aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-11-20 13:54:12 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2018-11-20 13:54:12 +0000
commit2e4139498d33005f4d9c56db360024b11ae5a42e (patch)
treeff91b913ad87e3ddc69fd705f31a708ae612c9fe
parentc2ac0e6df64d71833dfffe422df8113d291a8e13 (diff)
community/chntpw: remove openssl dep, add patches from fedora
OpenSSL is not used at all so remove the dependency and misleading build option. The patches from Fedora seems to be needed so we add those.
-rw-r--r--community/chntpw/APKBUILD25
-rw-r--r--community/chntpw/chntpw-080526-correct-test-for-failing-open-syscall.patch75
-rw-r--r--community/chntpw/chntpw-110511-detect-failure-to-write-key.patch19
-rw-r--r--community/chntpw/chntpw-110511-reged-no-deref-null.patch15
-rw-r--r--community/chntpw/chntpw-110511-robustness.patch39
-rw-r--r--community/chntpw/chntpw-140201-get_abs_path.patch10
6 files changed, 174 insertions, 9 deletions
diff --git a/community/chntpw/APKBUILD b/community/chntpw/APKBUILD
index ccc782e1957..dfb11a891b7 100644
--- a/community/chntpw/APKBUILD
+++ b/community/chntpw/APKBUILD
@@ -2,20 +2,26 @@
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=chntpw
pkgver=140201
-pkgrel=2
+pkgrel=3
pkgdesc="Change passwords in Windows SAM files"
url="http://pogostick.net/~pnh/ntpasswd/"
arch="all"
options="!check"
license="GPL-2.0"
-makedepends="openssl-dev"
+makedepends=""
source="http://pogostick.net/~pnh/ntpasswd/$pkgname-source-$pkgver.zip
- stdint.patch"
+ stdint.patch
+ chntpw-080526-correct-test-for-failing-open-syscall.patch
+ chntpw-110511-detect-failure-to-write-key.patch
+ chntpw-110511-reged-no-deref-null.patch
+ chntpw-110511-robustness.patch
+ chntpw-140201-get_abs_path.patch
+ "
builddir="$srcdir/$pkgname-$pkgver"
build() {
cd "$builddir"
- make CC="${CC:-gcc}" CFLAGS="$CFLAGS -DUSEOPENSSL" LIBS="-lcrypto" \
+ make CC="${CC:-gcc}" CFLAGS="$CFLAGS" \
chntpw cpnt reged
}
@@ -25,9 +31,10 @@ package() {
install chntpw cpnt reged "$pkgdir"/usr/bin/
}
-md5sums="d60bc657206b07ad84d926649d6417dc chntpw-source-140201.zip
-7219b4f860212e85de39ba1937e2c296 stdint.patch"
-sha256sums="96e20905443e24cba2f21e51162df71dd993a1c02bfa12b1be2d0801a4ee2ccc chntpw-source-140201.zip
-9d392cdf598d4a9e9ddd3ae1b538ed1d8bd63fb27e23d4e4c9b13110b808a723 stdint.patch"
sha512sums="a26d747f6e077d1bb3e9b8077781f8c37dd978e07b7426495862f15c9004572b706c34736fc4d1ed8856b1a43335d726b4d87c688f7f9a11fd6cc3a74d71a7fa chntpw-source-140201.zip
-3ed747119d125b3e4dc8dbb2a697d411ef2f4403ec84c60177d8e35389bc695bb0c65f7aa4314ca320ffceec87e60e2a0c81d52544b90463fe23aa7d4a50df67 stdint.patch"
+3ed747119d125b3e4dc8dbb2a697d411ef2f4403ec84c60177d8e35389bc695bb0c65f7aa4314ca320ffceec87e60e2a0c81d52544b90463fe23aa7d4a50df67 stdint.patch
+1332407858eb20e0f1304472bc458789ef78638059137b91ff0b7bac9619740e8a608aace0330ace363853b5c02642fdbbc66bc47dac19f6807dae57cdaca4ca chntpw-080526-correct-test-for-failing-open-syscall.patch
+a570451f52943a2ccdced349c5fe4e82e1a338dd6d0067ddaf18dc328b2c3ee3976d08827eee866b4654ccbda93ad95dcbabaddd0b6487a1e4112b66fc63bde1 chntpw-110511-detect-failure-to-write-key.patch
+c61ea69ea1f039e470f501fddd1d3674ee7427e9084361a1aba03402d302a07efd1a2630e16f479bd3cef13b17e85c14cbfff53cb33bccb470465276b1b7ac22 chntpw-110511-reged-no-deref-null.patch
+bcc314545272b5be04612e435a2f9dd13cbf065cfbd80aed2ed57147ee9e73b2478cd18e95cbaa7ad3b5dfcf4788a3026b5ddd767f89ea9c80ba7a2efc7ea8c4 chntpw-110511-robustness.patch
+1bb5939d2cfd3718b9e630998b250c3c37d50d5769463f4f8456ede9fa4521e1bf9d9f05986883df36418d91bef591b34a81cd36bfacca053160e4d95c03cb4b chntpw-140201-get_abs_path.patch"
diff --git a/community/chntpw/chntpw-080526-correct-test-for-failing-open-syscall.patch b/community/chntpw/chntpw-080526-correct-test-for-failing-open-syscall.patch
new file mode 100644
index 00000000000..3c68146b094
--- /dev/null
+++ b/community/chntpw/chntpw-080526-correct-test-for-failing-open-syscall.patch
@@ -0,0 +1,75 @@
+From jim@meyering.net Mon Jul 20 20:05:55 2009
+Return-Path: jim@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@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@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@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@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@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@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@meyering.net>
+To: "Richard W. M. Jones" <rjones@redhat.com>
+Subject: chntpw [PATCH] correct test for failing "open" syscall
+Date: Mon, 20 Jul 2009 21:05:44 +0200
+Message-ID: <878wij899z.fsf@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@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
+
diff --git a/community/chntpw/chntpw-110511-detect-failure-to-write-key.patch b/community/chntpw/chntpw-110511-detect-failure-to-write-key.patch
new file mode 100644
index 00000000000..818639d83a0
--- /dev/null
+++ b/community/chntpw/chntpw-110511-detect-failure-to-write-key.patch
@@ -0,0 +1,19 @@
+diff -ur chntpw-110511.orig/ntreg.c chntpw-110511/ntreg.c
+--- chntpw-110511.orig/ntreg.c 2011-05-11 12:33:56.000000000 -0700
++++ chntpw-110511/ntreg.c 2011-11-01 13:45:02.550421729 -0700
+@@ -3389,7 +3389,14 @@
+
+ fprintf(file,"\r\n"); /* Must end file with an empty line, windows does that */
+
+- 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));
+ }
+
+ /* ================================================================ */
diff --git a/community/chntpw/chntpw-110511-reged-no-deref-null.patch b/community/chntpw/chntpw-110511-reged-no-deref-null.patch
new file mode 100644
index 00000000000..0193cd49370
--- /dev/null
+++ b/community/chntpw/chntpw-110511-reged-no-deref-null.patch
@@ -0,0 +1,15 @@
+diff -ur chntpw-110511.orig/reged.c chntpw-110511/reged.c
+--- chntpw-110511.orig/reged.c 2011-05-11 12:33:56.000000000 -0700
++++ chntpw-110511/reged.c 2011-11-01 13:46:55.569625286 -0700
+@@ -167,6 +167,11 @@
+
+ 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))) {
diff --git a/community/chntpw/chntpw-110511-robustness.patch b/community/chntpw/chntpw-110511-robustness.patch
new file mode 100644
index 00000000000..ea2363f3435
--- /dev/null
+++ b/community/chntpw/chntpw-110511-robustness.patch
@@ -0,0 +1,39 @@
+--- chntpw-110511.orig/ntreg.c 2011-05-11 12:33:56.000000000 -0700
++++ chntpw-110511/ntreg.c 2011-12-18 17:09:06.290818997 -0800
+@@ -190,14 +190,18 @@
+
+ int fmyinput(char *prmpt, char *ibuf, int maxlen)
+ {
+-
++ int len;
+ printf("%s",prmpt);
+
+ fgets(ibuf,maxlen+1,stdin);
++ len = strlen(ibuf);
+
+- ibuf[strlen(ibuf)-1] = 0;
++ if (len) {
++ ibuf[len-1] = 0;
++ --len;
++ }
+
+- return(strlen(ibuf));
++ return len;
+ }
+
+ /* Print len number of hexbytes */
+@@ -4119,6 +4123,14 @@
+ closeHive(hdesc);
+ return(NULL);
+ }
++
++ if (r < sizeof (*hdesc)) {
++ fprintf(stderr,
++ "file is too small; got %d bytes while expecting %d or more\n",
++ r, sizeof (*hdesc));
++ closeHive(hdesc);
++ return(NULL);
++ }
+
+ /* Now run through file, tallying all pages */
+ /* NOTE/KLUDGE: Assume first page starts at offset 0x1000 */
diff --git a/community/chntpw/chntpw-140201-get_abs_path.patch b/community/chntpw/chntpw-140201-get_abs_path.patch
new file mode 100644
index 00000000000..c9f1a3decca
--- /dev/null
+++ b/community/chntpw/chntpw-140201-get_abs_path.patch
@@ -0,0 +1,10 @@
+--- chntpw-140201/ntreg.c.orig 2014-02-01 08:54:37.000000000 -0800
++++ chntpw-140201/ntreg.c 2018-07-02 16:10:39.625152640 -0700
+@@ -1511,6 +1511,7 @@
+ }
+
+ strncpy(tmp,path,ABSPATHLEN-1);
++ tmp[ABSPATHLEN-1] = '\0';
+
+ if (key->type & 0x20)
+ keyname = mem_str(key->keyname, key->len_name);