[packages/chntpw] Rel 3

arekm arekm at pld-linux.org
Wed May 20 21:03:55 CEST 2026


commit ee91c183fb2c56a728fa91ec8e278fde8a9ec681
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed May 20 21:03:39 2026 +0200

    Rel 3

 chntpw-080526-detect-failure-to-write-key.patch | 67 ++-----------------------
 chntpw-080526-reged-no-deref-null.patch         | 61 ++--------------------
 chntpw-incompatible-pointer-types.patch         | 23 +++++++++
 chntpw.spec                                     |  6 ++-
 4 files changed, 35 insertions(+), 122 deletions(-)
---
diff --git a/chntpw.spec b/chntpw.spec
index 2714ea7..f114030 100644
--- a/chntpw.spec
+++ b/chntpw.spec
@@ -4,7 +4,7 @@ Summary(pl.UTF-8):	Narzędzie do odtwarzania haseł NT SAM
 Name:		chntpw
 # Version is taken from HISTORY.txt
 Version:	1.00
-Release:	2
+Release:	3
 Epoch:		1
 License:	GPL v2 (ntchpw), LGPL (ntreg)
 Group:		Applications/System
@@ -17,6 +17,7 @@ Patch1:		%{name}-debian.patch
 Patch5:		%{name}-080526-correct-test-for-failing-open-syscall.patch
 Patch6:		%{name}-080526-detect-failure-to-write-key.patch
 Patch7:		%{name}-080526-reged-no-deref-null.patch
+Patch8:		%{name}-incompatible-pointer-types.patch
 URL:		http://pogostick.net/~pnh/ntpasswd/
 BuildRequires:	openssl-devel >= 0.9.7d
 BuildRequires:	rpmbuild(macros) >= 1.553
@@ -52,6 +53,7 @@ strony domowej.
 %patch -P5 -p1
 %patch -P6 -p1
 %patch -P7 -p1
+%patch -P8 -p1
 
 cp -p %{SOURCE2} README.Dist
 
@@ -66,7 +68,7 @@ fi
 %build
 %{__make} chntpw cpnt reged \
 	CC="%{__cc}" \
-	OPTFLAGS="%{rpmcflags}"
+	OPTFLAGS="%{rpmcflags} %{rpmcppflags}"
 
 %install
 rm -rf $RPM_BUILD_ROOT
diff --git a/chntpw-080526-detect-failure-to-write-key.patch b/chntpw-080526-detect-failure-to-write-key.patch
index ea17219..2995983 100644
--- a/chntpw-080526-detect-failure-to-write-key.patch
+++ b/chntpw-080526-detect-failure-to-write-key.patch
@@ -1,64 +1,8 @@
-From jim at meyering.net  Mon Jul 20 20:12:31 2009
-Return-Path: jim at meyering.net
-X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on amd.home.annexia.org
-X-Spam-Level: 
-X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,
-	UNPARSEABLE_RELAY autolearn=ham version=3.2.5
-Received: from mail.corp.redhat.com [10.5.5.51]
-	by amd.home.annexia.org with IMAP (fetchmail-6.3.8)
-	for <rjones at localhost> (single-drop); Mon, 20 Jul 2009 20:12:31 +0100 (BST)
-Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
- zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
- mail06.corp.redhat.com with LMTP; Mon, 20 Jul 2009 15:12:17 -0400 (EDT)
-Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 3C1A04E4EC
-	for <rjones at redhat.com>; Mon, 20 Jul 2009 15:12:17 -0400 (EDT)
-Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id a+PpYwgPRjqW for <rjones at redhat.com>;
-	Mon, 20 Jul 2009 15:12:17 -0400 (EDT)
-Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26])
-	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 130A44E4D6
-	for <rjones at mail.corp.redhat.com>; Mon, 20 Jul 2009 15:12:17 -0400 (EDT)
-Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199])
-	by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6KJCGMZ001977
-	for <rjones at int-mx2.corp.redhat.com>; Mon, 20 Jul 2009 15:12:16 -0400
-Received: from mx.meyering.net (sebastian-int.corp.redhat.com [172.16.52.221])
-	by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6KJCF82022169
-	for <rjones at redhat.com>; Mon, 20 Jul 2009 15:12:15 -0400
-Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
-	id 36C5D38154; Mon, 20 Jul 2009 21:12:15 +0200 (CEST)
-From: Jim Meyering <jim at meyering.net>
-To: "Richard W. M. Jones" <rjones at redhat.com>
-Subject: chntpw [PATCH] detect/diagnose failure to write key
-Date: Mon, 20 Jul 2009 21:12:15 +0200
-Message-ID: <873a8r88z4.fsf at meyering.net>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26
-Status: RO
-Content-Length: 938
-Lines: 34
-
-Hi Rich, here's another.
-
->From 057c832cf924cabf887e59d1c1f2127cd4619572 Mon Sep 17 00:00:00 2001
-From: Jim Meyering <meyering at redhat.com>
-Date: Mon, 20 Jul 2009 15:09:26 -0400
-Subject: [PATCH] detect/diagnose failure to write key
-
-* ntreg.c (export_key): Detect stream write failure.
----
- ntreg.c |    9 ++++++++-
- 1 files changed, 8 insertions(+), 1 deletions(-)
-
-diff --git a/ntreg.c b/ntreg.c
-index 21cd3e3..cdb6503 100644
 --- a/ntreg.c
 +++ b/ntreg.c
-@@ -2735,7 +2735,14 @@ void export_key(struct hive *hdesc, int nkofs, char *name, char *filename, char
-         fprintf(file, "Windows Registry Editor Version 5.00\r\n\r\n");
-     export_subkey(hdesc, nkofs, name, prefix, file);
+@@ -3492,7 +3492,14 @@
+
+     fprintf(file,"\r\n"); /* Must end file with an empty line, windows does that */
 
 -    fclose(file);
 +    if (ferror (file)) {
@@ -71,7 +15,4 @@ index 21cd3e3..cdb6503 100644
 +	     strerror(errno));
  }
 
-
---
-1.6.2.5
-
+ /* ================================================================ */
diff --git a/chntpw-080526-reged-no-deref-null.patch b/chntpw-080526-reged-no-deref-null.patch
index 9bd681e..3c83d48 100644
--- a/chntpw-080526-reged-no-deref-null.patch
+++ b/chntpw-080526-reged-no-deref-null.patch
@@ -1,62 +1,10 @@
-From jim at meyering.net  Wed Jul 22 13:41:58 2009
-Return-Path: jim at meyering.net
-X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on amd.home.annexia.org
-X-Spam-Level: 
-X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,
-	UNPARSEABLE_RELAY autolearn=ham version=3.2.5
-Received: from mail.corp.redhat.com [10.5.5.51]
-	by amd.home.annexia.org with IMAP (fetchmail-6.3.8)
-	for <rjones at localhost> (single-drop); Wed, 22 Jul 2009 13:41:58 +0100 (BST)
-Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO
- zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by
- mail06.corp.redhat.com with LMTP; Wed, 22 Jul 2009 08:41:25 -0400 (EDT)
-Received: from localhost (localhost.localdomain [127.0.0.1])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 52E8193C42
-	for <rjones at redhat.com>; Wed, 22 Jul 2009 08:41:25 -0400 (EDT)
-Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1])
-	by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
-	with ESMTP id i+F0NOkWPqt0 for <rjones at redhat.com>;
-	Wed, 22 Jul 2009 08:41:25 -0400 (EDT)
-Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26])
-	by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 29C8193C01
-	for <rjones at mail.corp.redhat.com>; Wed, 22 Jul 2009 08:41:25 -0400 (EDT)
-Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199])
-	by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6MCfOiN011483
-	for <rjones at int-mx2.corp.redhat.com>; Wed, 22 Jul 2009 08:41:24 -0400
-Received: from mx.meyering.net (sebastian-int.corp.redhat.com [172.16.52.221])
-	by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6MCfNP5023290
-	for <rjones at redhat.com>; Wed, 22 Jul 2009 08:41:23 -0400
-Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
-	id 38377558B9; Wed, 22 Jul 2009 14:41:23 +0200 (CEST)
-From: Jim Meyering <jim at meyering.net>
-To: "Richard W. M. Jones" <rjones at redhat.com>
-Subject: [PATCH] "reged -e" should not dereference NULL
-Date: Wed, 22 Jul 2009 14:41:23 +0200
-Message-ID: <87y6qg51qk.fsf at meyering.net>
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26
-Status: RO
-Content-Length: 871
-Lines: 27
+Patch from Jim Meyering: "reged -e" should not dereference NULL.
+Diagnose a missing hive file name with -e.
 
-
->From d9203daf8e29290ca82b2433722e9e56cd0ab73f Mon Sep 17 00:00:00 2001
-From: Jim Meyering <meyering at redhat.com>
-Date: Wed, 22 Jul 2009 14:25:14 +0200
-Subject: [PATCH] "reged -e" should not dereference NULL
-
-* reged.c (main): Diagnose a missing hive file name with -e.
----
- reged.c |   30 +++++++++++++++++-------------
- 1 files changed, 17 insertions(+), 13 deletions(-)
-
-diff --git a/reged.c b/reged.c
-index cf395bc..f99f94e 100644
 --- a/reged.c
 +++ b/reged.c
-@@ -99,6 +99,11 @@ int main(int argc, char **argv)
-   }
+@@ -167,6 +167,11 @@ int main(int argc, char **argv)
+
    if (edit) {  /* Call editor. Rest of arguments are considered hives to load */
      hivename = argv[optind+no_hives];
 +    if (!hivename) {
@@ -67,4 +15,3 @@ index cf395bc..f99f94e 100644
      do {
        if (!(hive[no_hives] = openHive(hivename,
  				      HMODE_RW|mode))) {
-
diff --git a/chntpw-incompatible-pointer-types.patch b/chntpw-incompatible-pointer-types.patch
new file mode 100644
index 0000000..9a1239a
--- /dev/null
+++ b/chntpw-incompatible-pointer-types.patch
@@ -0,0 +1,23 @@
+Fix passing int* where hexdump() expects char* (struct keyval.data is int).
+Errors out with -Werror=incompatible-pointer-types on modern GCC.
+
+--- a/libsam.c
++++ b/libsam.c
+@@ -511,7 +511,7 @@ int sam_put_grp_members_sid(struct hive *hdesc, int grp, struct sid_array *sarra
+
+      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 @@ int sam_put_grp_members_sid(struct hive *hdesc, int grp, struct sid_array *sarra
+     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);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/chntpw.git/commitdiff/ee91c183fb2c56a728fa91ec8e278fde8a9ec681



More information about the pld-cvs-commit mailing list