diff --git a/chntpw-140201-fix-bogus-errno-use.patch b/chntpw-140201-fix-bogus-errno-use.patch new file mode 100644 index 0000000..ff7c846 --- /dev/null +++ b/chntpw-140201-fix-bogus-errno-use.patch @@ -0,0 +1,34 @@ +diff -u chntpw-140201.orig/ntreg.c chntpw-140201/ntreg.c +--- chntpw-140201.orig/ntreg.c 2019-06-22 13:09:59.583717369 -0700 ++++ chntpw-140201/ntreg.c 2019-06-22 13:16:26.714726148 -0700 +@@ -4241,10 +4241,13 @@ + do { /* On some platforms read may not block, and read in chunks. handle that */ + r = read(hdesc->filedesc, hdesc->buffer + rt, hdesc->size - rt); + rt += r; +- } while ( !errno && (rt < hdesc->size) ); ++ } while ( r > 0 && (rt < hdesc->size) ); + +- if (errno) { +- perror("openHive(): read error: "); ++ if (r <= 0) { ++ if (r < 0) ++ perror("openHive(): read error"); ++ else ++ fprintf(stderr, "openHive(): read error: unexpected EOF\n"); + closeHive(hdesc); + return(NULL); + } +@@ -4255,10 +4258,10 @@ + return(NULL); + } + +- if (r < sizeof (*hdesc)) { ++ if (rt < sizeof (*hdesc)) { + fprintf(stderr, +- "file is too small; got %d bytes while expecting %d or more\n", +- r, sizeof (*hdesc)); ++ "file is too small; got %d bytes while expecting %zu or more\n", ++ rt, sizeof (*hdesc)); + closeHive(hdesc); + return(NULL); + } diff --git a/chntpw-140201-hexdump-pointer-type.patch b/chntpw-140201-hexdump-pointer-type.patch new file mode 100644 index 0000000..a8924bc --- /dev/null +++ b/chntpw-140201-hexdump-pointer-type.patch @@ -0,0 +1,21 @@ +diff -urN chntpw-140201.orig/libsam.c chntpw-140201/libsam.c +--- chntpw-140201.orig/libsam.c 2014-02-01 08:54:37.000000000 -0800 ++++ chntpw-140201/libsam.c 2024-08-03 15:31:41.817601486 -0700 +@@ -511,7 +511,7 @@ + + if (gverbose) printf("put_grp_members_sid: ajusted: mofs = %x, mlen = %x (%d)\n", mofs + 0x34 ,mlen,mlen); + +- if (gverbose) hexdump(&c->data, 0, c->len, 1); ++ if (gverbose) hexdump((char*)&c->data, 0, c->len, 1); + + /* Get total size of new SID data */ + +@@ -539,7 +539,7 @@ + cd->members_len = sidlen; /* Update member count in C struct */ + cd->grp_members = i; + +- if (gverbose) hexdump(&c->data, 0, c->len, 1); ++ if (gverbose) hexdump((char*)&c->data, 0, c->len, 1); + + if (!put_buf2val(hdesc, c, 0, g, 0, TPF_VK_EXACT)) { + fprintf(stderr,"put_grp_members_sid: could not write back group info in value %s\n",g); diff --git a/chntpw.spec b/chntpw.spec index a80129d..120ca06 100644 --- a/chntpw.spec +++ b/chntpw.spec @@ -1,10 +1,10 @@ Name: chntpw # Version is taken from HISTORY.txt Version: 1.00 -Release: 0.140201%{?dist} +Release: 20.140201%{?dist} Summary: Change passwords in Windows SAM files -Group: Applications/Engineering -License: GPLv2 +# Automatically converted from old format: GPLv2 - review is highly recommended. +License: GPL-2.0-only URL: http://pogostick.net/~pnh/ntpasswd/ Source0: http://pogostick.net/~pnh/ntpasswd/chntpw-source-140201.zip Source2: chntpw-README.Dist @@ -14,7 +14,9 @@ Source11: reged.8 Source12: sampasswd.8 Source13: samusrgrp.8 +BuildRequires: gcc BuildRequires: libgcrypt-devel +BuildRequires: make # Patches sent upstream on 2009-06-08. Patch1: chntpw-140201-get_abs_path.patch @@ -28,6 +30,12 @@ Patch5: chntpw-080526-correct-test-for-failing-open-syscall.patch Patch6: chntpw-110511-detect-failure-to-write-key.patch Patch7: chntpw-110511-reged-no-deref-null.patch +# Patch derived from Oleg Samarin (RHBZ#1645886) +Patch8: chntpw-140201-fix-bogus-errno-use.patch + +# Cast around new GCC error for mismatched pointer arguments +Patch9: chntpw-140201-hexdump-pointer-type.patch + %description This is a utility to (re)set the password of any user that has a valid @@ -47,12 +55,14 @@ sed -e 's/\r$//' WinReg.txt > WinReg.txt.eol touch -c -r WinReg.txt WinReg.txt.eol mv WinReg.txt.eol WinReg.txt -%patch1 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 +%patch -P1 -p1 +%patch -P3 -p1 +%patch -P4 -p1 +%patch -P5 -p1 +%patch -P6 -p1 +%patch -P7 -p1 +%patch -P8 -p1 +%patch -P9 -p1 %build @@ -71,7 +81,6 @@ cp -p %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \ %files -%defattr(-,root,root,-) %doc GPL.txt LGPL.txt README.txt regedit.txt WinReg.txt HISTORY.txt %doc README.Dist %{_bindir}/chntpw @@ -83,6 +92,67 @@ cp -p %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \ %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 1.00-20.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Thu Jan 16 2025 Fedora Release Engineering - 1.00-19.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Sat Aug 03 2024 Conrad Meyer - 1.00-18.140201 +- Add fix for rhbz# 2300591. + +* Mon Jul 29 2024 Miroslav Suchý - 1.00-17.140201 +- convert license to SPDX + +* Wed Jul 17 2024 Fedora Release Engineering - 1.00-16.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Tue Jan 23 2024 Fedora Release Engineering - 1.00-15.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 1.00-14.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jul 19 2023 Fedora Release Engineering - 1.00-13.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Jan 18 2023 Fedora Release Engineering - 1.00-12.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Jul 20 2022 Fedora Release Engineering - 1.00-11.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Wed Jan 19 2022 Fedora Release Engineering - 1.00-10.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Jul 21 2021 Fedora Release Engineering - 1.00-9.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jan 26 2021 Fedora Release Engineering - 1.00-8.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering - 1.00-7.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jan 28 2020 Fedora Release Engineering - 1.00-6.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Jul 24 2019 Fedora Release Engineering - 1.00-5.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Jun 22 2019 Conrad Meyer - 1.00-4.140201 +- Add fix for rhbz# 1645886. Thanks Oleg Samarin. + +* Thu Jan 31 2019 Fedora Release Engineering - 1.00-3.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jul 19 2018 Conrad Meyer - 1.00-2.140201 +- Add missing GCC BR after removal from buildroot +- Unfuck version number bumped incorrectly by RE + +* Thu Jul 12 2018 Fedora Release Engineering - 1.00-1.140201 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Mon Jul 02 2018 Conrad Meyer - 1.00-0.140201 - Update to latest upstream, 1.00 / 140201 - Rebase patches as needed