packages: chntpw/chntpw.spec, chntpw/chntpw-080526-correct-test-for-failing...

glen glen at pld-linux.org
Wed Aug 18 16:03:00 CEST 2010


Author: glen                         Date: Wed Aug 18 14:03:00 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add patches from fedora
- 100627 release is actually version 0.99.6 

---- Files affected:
packages/chntpw:
   chntpw.spec (1.14 -> 1.15) , chntpw-080526-correct-test-for-failing-open-syscall.patch (NONE -> 1.1)  (NEW), chntpw-080526-detect-failure-to-write-key.patch (NONE -> 1.1)  (NEW), chntpw-080526-reged-no-deref-null.patch (NONE -> 1.1)  (NEW), chntpw-README.Dist (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/chntpw/chntpw.spec
diff -u packages/chntpw/chntpw.spec:1.14 packages/chntpw/chntpw.spec:1.15
--- packages/chntpw/chntpw.spec:1.14	Mon Jul  5 21:52:14 2010
+++ packages/chntpw/chntpw.spec	Wed Aug 18 16:02:52 2010
@@ -1,15 +1,24 @@
 # $Revision$, $Date$
+%define		reldate	100627
 Summary:	NT SAM password recovery utility
 Summary(pl.UTF-8):	Narzędzie do odtwarzania haseł NT SAM
 Name:		chntpw
-Version:	100627
+# Version is taken from HISTORY.txt
+Version:	0.99.6
 Release:	1
-License:	GPL
+Epoch:		1
+License:	GPL (ntchpw), LGPL (ntreg)
 Group:		Applications/System
-Source0:	http://pogostick.net/~pnh/ntpasswd/%{name}-source-%{version}.zip
+Source0:	http://pogostick.net/~pnh/ntpasswd/%{name}-source-%{reldate}.zip
 # Source0-md5:	8b046c2073f27eed728e18635ba72dd4
 Patch0:		%{name}-debian.patch
 URL:		http://pogostick.net/~pnh/ntpasswd/
+BuildRequires:	rpmbuild(macros) >= 1.553
+Source2:	%{name}-README.Dist
+# Patches from Jim Meyering to improve robustness of the code.
+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
 BuildRequires:	openssl-devel >= 0.9.7d
 BuildRequires:	unzip
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -37,29 +46,44 @@
 strony domowej.
 
 %prep
-%setup -q
+%setup -q -n %{name}-%{reldate}
 %patch0 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+
+cp -p %{SOURCE2} README.Dist
+
+%undos WinReg.txt
+
+ver=$(awk '/%{reldate}/{print $3}' HISTORY.txt)
+if [ "$ver" != %{version} ]; then
+	: plz correct version to $ver
+	exit 1
+fi
 
 %build
 %{__make} chntpw cpnt reged \
 	CC="%{__cc}" \
-	CFLAGS="%{rpmcflags}"
+	CFLAGS="%{rpmcflags} -DUSEOPENSSL -Wall"
 
 %install
 rm -rf $RPM_BUILD_ROOT
-
-install -d $RPM_BUILD_ROOT%{_bindir}
-install {chntpw,cpnt,reged} $RPM_BUILD_ROOT%{_bindir}
-install -D chntpw.8 $RPM_BUILD_ROOT%{_mandir}/man8/chntpw.8
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man8}
+install -p chntpw cpnt reged $RPM_BUILD_ROOT%{_bindir}
+cp -a chntpw.8 $RPM_BUILD_ROOT%{_mandir}/man8/chntpw.8
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc *.txt
-%attr(755,root,root) %{_bindir}/*
-%{_mandir}/man8/*
+%doc README.txt regedit.txt WinReg.txt HISTORY.txt
+%doc README.Dist
+%attr(755,root,root) %{_bindir}/chntpw
+%attr(755,root,root) %{_bindir}/cpnt
+%attr(755,root,root) %{_bindir}/reged
+%{_mandir}/man8/chntpw.8*
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -67,6 +91,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.15  2010/08/18 14:02:52  glen
+- add patches from fedora
+- 100627 release is actually version 0.99.6
+
 Revision 1.14  2010/07/05 19:52:14  areq
 - 100627
 

================================================================
Index: packages/chntpw/chntpw-080526-correct-test-for-failing-open-syscall.patch
diff -u /dev/null packages/chntpw/chntpw-080526-correct-test-for-failing-open-syscall.patch:1.1
--- /dev/null	Wed Aug 18 16:03:00 2010
+++ packages/chntpw/chntpw-080526-correct-test-for-failing-open-syscall.patch	Wed Aug 18 16:02:52 2010
@@ -0,0 +1,75 @@
+From jim at meyering.net  Mon Jul 20 20:05:55 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:05:55 +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:05:47 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+	by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 2C1134E4EB
+	for <rjones at redhat.com>; Mon, 20 Jul 2009 15:05:47 -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 a7N9dvNRkYQB for <rjones at redhat.com>;
+	Mon, 20 Jul 2009 15:05:47 -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 034384E4D6
+	for <rjones at mail.corp.redhat.com>; Mon, 20 Jul 2009 15:05:46 -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 n6KJ5kIt032703
+	for <rjones at int-mx2.corp.redhat.com>; Mon, 20 Jul 2009 15:05:46 -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 n6KJ5jf3021050
+	for <rjones at redhat.com>; Mon, 20 Jul 2009 15:05:45 -0400
+Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
+	id D674638154; Mon, 20 Jul 2009 21:05:44 +0200 (CEST)
+From: Jim Meyering <jim at meyering.net>
+To: "Richard W. M. Jones" <rjones at redhat.com>
+Subject: chntpw [PATCH] correct test for failing "open" syscall
+Date: Mon, 20 Jul 2009 21:05:44 +0200
+Message-ID: <878wij899z.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: 1103
+Lines: 33
+
+This one is weird.
+It must be code that is never exercised,
+since the existing code is totally bogus.
+The condition, !open(...), will almost always be true.
+(sole exception is when starting a program with stdin
+initially closed)
+
+>From bc4cddb06cf13c189fbdc93e6962cad072779097 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering at redhat.com>
+Date: Mon, 20 Jul 2009 14:59:19 -0400
+Subject: [PATCH] correct test for failing "open" syscall
+
+* ntreg.c (writeHive): Test open() < 0, not !open().
+---
+ ntreg.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/ntreg.c b/ntreg.c
+index be6b680..21cd3e3 100644
+--- a/ntreg.c
++++ b/ntreg.c
+@@ -2765,7 +2765,7 @@ int writeHive(struct hive *hdesc)
+   if ( !(hdesc->state & HMODE_DIRTY)) return(0);
+
+   if ( !(hdesc->state & HMODE_OPEN)) { /* File has been closed */
+-    if (!(hdesc->filedesc = open(hdesc->filename,O_RDWR))) {
++    if ((hdesc->filedesc = open(hdesc->filename,O_RDWR)) < 0) {
+       fprintf(stderr,"writeHive: open(%s) failed: %s, FILE NOT WRITTEN!\n",hdesc->filename,strerror(errno));
+       return(1);
+     }
+-- 
+1.6.2.5
+

================================================================
Index: packages/chntpw/chntpw-080526-detect-failure-to-write-key.patch
diff -u /dev/null packages/chntpw/chntpw-080526-detect-failure-to-write-key.patch:1.1
--- /dev/null	Wed Aug 18 16:03:00 2010
+++ packages/chntpw/chntpw-080526-detect-failure-to-write-key.patch	Wed Aug 18 16:02:52 2010
@@ -0,0 +1,77 @@
+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);
+
+-    fclose(file);
++    if (ferror (file)) {
++	printf("failed to write file '%s'\n", filename);
++	fclose (file);
++	return;
++    }
++    if (fclose(file))
++      printf("failed to write file '%s': %s\n", filename,
++	     strerror(errno));
+ }
+
+
+--
+1.6.2.5
+

================================================================
Index: packages/chntpw/chntpw-080526-reged-no-deref-null.patch
diff -u /dev/null packages/chntpw/chntpw-080526-reged-no-deref-null.patch:1.1
--- /dev/null	Wed Aug 18 16:03:00 2010
+++ packages/chntpw/chntpw-080526-reged-no-deref-null.patch	Wed Aug 18 16:02:52 2010
@@ -0,0 +1,70 @@
+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
+
+
+>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)
+   }
+   if (edit) {  /* Call editor. Rest of arguments are considered hives to load */
+     hivename = argv[optind+no_hives];
++    if (!hivename) {
++      fprintf(stderr,"with -e you must specify at least one hive file name\n");
++      usage();
++      exit(1);
++    }
+     do {
+       if (!(hive[no_hives] = openHive(hivename,
+ 				      HMODE_RW|mode))) {
+

================================================================
Index: packages/chntpw/chntpw-README.Dist
diff -u /dev/null packages/chntpw/chntpw-README.Dist:1.1
--- /dev/null	Wed Aug 18 16:03:00 2010
+++ packages/chntpw/chntpw-README.Dist	Wed Aug 18 16:02:52 2010
@@ -0,0 +1,4 @@
+cpnt is depricated now (I think) because of ntfs-3g. Furthermore
+reged is probably less useful than regedit.exe under WINE, but
+as both of these might be useful for someone trying to run some
+old script it's probably worthwhile to include them both.
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/chntpw/chntpw.spec?r1=1.14&r2=1.15&f=u



More information about the pld-cvs-commit mailing list