From 9eea38285bfa28a70a6996c45c84e7c4aceb0bac Mon Sep 17 00:00:00 2001 From: Kosyrev Serge <_deepfire@feelingofgreen.ru> Date: Mon, 4 Aug 2014 13:03:49 +0400 Subject: chntpw: new expression --- .../chntpw/00-chntpw-build-arch-autodetect.patch | 25 +++++++++++++++++++ .../security/chntpw/01-chntpw-install-target.patch | 26 +++++++++++++++++++ pkgs/tools/security/chntpw/default.nix | 29 ++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch create mode 100644 pkgs/tools/security/chntpw/01-chntpw-install-target.patch create mode 100644 pkgs/tools/security/chntpw/default.nix (limited to 'pkgs/tools/security/chntpw') 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; + }; +} -- cgit v1.2.3