Merge pull request #3514 from deepfire/chntpw

chntpw:  new expression
This commit is contained in:
Michael Raskin 2014-08-23 12:47:17 +04:00
commit c80f325109
4 changed files with 82 additions and 0 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;
};
}

View File

@ -608,6 +608,8 @@ let
consul = callPackage ../servers/consul { }; consul = callPackage ../servers/consul { };
consul_ui = callPackage ../servers/consul/ui.nix { }; consul_ui = callPackage ../servers/consul/ui.nix { };
chntpw = callPackage ../tools/security/chntpw { };
coprthr = callPackage ../development/libraries/coprthr { coprthr = callPackage ../development/libraries/coprthr {
flex = flex_2_5_35; flex = flex_2_5_35;
}; };