summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/security/chntpw
diff options
context:
space:
mode:
authorKosyrev Serge <_deepfire@feelingofgreen.ru>2014-08-04 13:03:49 +0400
committerKosyrev Serge <_deepfire@feelingofgreen.ru>2014-08-15 03:19:58 +0400
commit9eea38285bfa28a70a6996c45c84e7c4aceb0bac (patch)
tree9926872a0da8a4eade5e03a6b467abe1b4fe5c88 /pkgs/tools/security/chntpw
parent7f9eba573d3ee93cb8c871d3f3a92c39c31a245f (diff)
chntpw: new expression
Diffstat (limited to 'pkgs/tools/security/chntpw')
-rw-r--r--pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch25
-rw-r--r--pkgs/tools/security/chntpw/01-chntpw-install-target.patch26
-rw-r--r--pkgs/tools/security/chntpw/default.nix29
3 files changed, 80 insertions, 0 deletions
diff --git a/pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch b/pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch
new file mode 100644
index 000000000000..9c379adb7dfb
--- /dev/null
+++ b/pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch
@@ -0,0 +1,25 @@
+diff -urN chntpw-140201.orig/Makefile chntpw-140201/Makefile
+--- chntpw-140201.orig/Makefile 2014-02-01 20:54:37.000000000 +0400
++++ chntpw-140201/Makefile 2014-08-03 20:26:56.497161881 +0400
+@@ -12,14 +12,13 @@
+
+ CC=gcc
+
+-# Force 32 bit
+-CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall -m32
+-OSSLLIB=$(OSSLPATH)/lib
+-
+-# 64 bit if default for compiler setup
+-#CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall
+-#OSSLLIB=$(OSSLPATH)/lib64
+-
++ifeq '$(shell gcc -dumpmachine)' 'x86_64-unknown-linux-gnu'
++ CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall
++ OSSLLIB=$(OSSLPATH)/lib64
++else ifeq '$(shell gcc -dumpmachine)' 'i686-unknown-linux-gnu'
++ CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall -m32
++ OSSLLIB=$(OSSLPATH)/lib
++endif
+
+ # This is to link with whatever we have, SSL crypto lib we put in static
+ #LIBS=-L$(OSSLLIB) $(OSSLLIB)/libcrypto.a
diff --git a/pkgs/tools/security/chntpw/01-chntpw-install-target.patch b/pkgs/tools/security/chntpw/01-chntpw-install-target.patch
new file mode 100644
index 000000000000..d3163a026f91
--- /dev/null
+++ b/pkgs/tools/security/chntpw/01-chntpw-install-target.patch
@@ -0,0 +1,26 @@
+diff -urN chntpw-140201.orig/Makefile chntpw-140201/Makefile
+--- chntpw-140201.orig/Makefile 2014-08-03 20:26:56.497161881 +0400
++++ chntpw-140201/Makefile 2014-08-04 12:57:16.563818342 +0400
+@@ -10,6 +10,8 @@
+ OSSLPATH=/usr
+ OSSLINC=$(OSSLPATH)/include
+
++PREFIX ?= /usr
++
+ CC=gcc
+
+ ifeq '$(shell gcc -dumpmachine)' 'x86_64-unknown-linux-gnu'
+@@ -24,8 +26,12 @@
+ #LIBS=-L$(OSSLLIB) $(OSSLLIB)/libcrypto.a
+ LIBS=-L$(OSSLLIB)
+
++BINARIES := chntpw chntpw.static cpnt reged reged.static samusrgrp samusrgrp.static sampasswd sampasswd.static
+
+-all: chntpw chntpw.static cpnt reged reged.static samusrgrp samusrgrp.static sampasswd sampasswd.static
++all: $(BINARIES)
++install: $(BINARIES)
++ mkdir -p $(PREFIX)/bin
++ cp $^ $(PREFIX)/bin
+
+ chntpw: chntpw.o ntreg.o edlib.o libsam.o
+ $(CC) $(CFLAGS) -o chntpw chntpw.o ntreg.o edlib.o libsam.o $(LIBS)
diff --git a/pkgs/tools/security/chntpw/default.nix b/pkgs/tools/security/chntpw/default.nix
new file mode 100644
index 000000000000..a1aab355a3c3
--- /dev/null
+++ b/pkgs/tools/security/chntpw/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+ name = "chntpw-${version}";
+
+ version = "140201";
+
+ src = fetchurl {
+ url = "http://pogostick.net/~pnh/ntpasswd/chntpw-source-${version}.zip";
+ sha256 = "1k1cxsj0221dpsqi5yibq2hr7n8xywnicl8yyaicn91y8h2hkqln";
+ };
+
+ buildInputs = [ unzip ];
+
+ patches = [
+ ./00-chntpw-build-arch-autodetect.patch
+ ./01-chntpw-install-target.patch
+ ];
+
+ installPhase = ''
+ make install PREFIX=$out
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = http://pogostick.net/~pnh/ntpasswd/;
+ description = "An utility to reset the password of any user that has a valid local account on a Windows system";
+ license = licenses.gpl2;
+ };
+}