Add mkntpwd, a utility to create Samba password hashes

PR:		ports/156478
Submitted by:	Jyun-Yan You <jyyou at cs.nctu.edu.tw>
This commit is contained in:
Ganael LAPLANCHE 2011-05-18 11:44:14 +00:00
parent f817446e0f
commit 67c12c27b5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=274262
7 changed files with 136 additions and 0 deletions

View File

@ -489,6 +489,7 @@
SUBDIR += mixer
SUBDIR += mkfile
SUBDIR += mkfwimage
SUBDIR += mkntpwd
SUBDIR += mksunbootcd
SUBDIR += mktool
SUBDIR += mmore

27
sysutils/mkntpwd/Makefile Normal file
View File

@ -0,0 +1,27 @@
# New ports collection makefile for: mkntpwd
# Date created: 2011-04-18
# Whom: Jyun-Yan You <jyyou@cs.nctu.edu.tw>
#
# $FreeBSD$
#
PORTNAME= mkntpwd
PORTVERSION= 1.0
CATEGORIES= sysutils net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ldaputils/Contrib/mkntpwd
DISTNAME= ${PORTNAME}
MAINTAINER= pcTA@cs.nctu.edu.tw
COMMENT= A utility to create Samba password hashes
NO_WRKSUBDIR= yes
PLIST_FILES= bin/mkntpwd
LICENSE= GPLv2 BSD
LICENSE_COMB= multi
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/mkntpwd ${PREFIX}/bin
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (mkntpwd.tar.gz) = 29a6769ee30e8cf2dda46fbf6b2d772d1d03e3b2760c501325f35098de25e4a2
SIZE (mkntpwd.tar.gz) = 21810

View File

@ -0,0 +1,51 @@
--- Makefile.orig 1998-05-11 16:47:09.000000000 +0200
+++ Makefile 2011-05-16 18:15:48.391100964 +0200
@@ -2,15 +2,15 @@
# C compiler
#CC=cc
-CC=gcc
+CC?=gcc
# Uncomment the following to add symbols to the code for debugging
-DEBUG=-g -Wall -D_DEBUG
+#DEBUG=-g -Wall -D_DEBUG
#DEBUG=-D_DEBUG
# Optimization for the compiler
#OPTIMIZE=
-OPTIMIZE=-O2
+#OPTIMIZE=-O2
# Choose your architecture
# note that if you are on a big-endian machine like SUN's
@@ -18,9 +18,9 @@
# the correct order yet. You're on your own right now.
#
# FreeBSD
-ARCH=-DMPU8086
-STATIC=
-XLIBS=
+#ARCH=-DMPU8086
+#STATIC=
+#XLIBS=
#
# SUNOS
#ARCH=-DBIGENDIAN
@@ -47,12 +47,12 @@
#OPTIMIZE=
#XLIBS=
-CFLAGS= $(DEBUG) $(OPTIMIZE) $(ARCH) $(VISUAL) $(PERMUTE) $(STATIC)
+#CFLAGS= $(DEBUG) $(OPTIMIZE) $(ARCH) $(VISUAL) $(PERMUTE) $(STATIC)
-OBJS = getopt.o md4.o mkntpwd.o smbdes.o
+OBJS = md4.o mkntpwd.o smbdes.o
-lc: $(OBJS)
- $(CC) $(CFLAGS) $(XLIBS) -o mkntpwd $(OBJS)
+all: $(OBJS)
+ $(CC) $(CFLAGS) -o mkntpwd $(OBJS)
clean:
rm -f core *.o mkntpwd

View File

@ -0,0 +1,11 @@
--- md4.c.orig 2011-05-16 18:18:54.288522284 +0200
+++ md4.c 2011-05-16 18:19:21.930002696 +0200
@@ -25,6 +25,8 @@
It assumes that a int is at least 32 bits long
*/
+#include <string.h>
+
typedef unsigned int uint32;
static uint32 A, B, C, D;

View File

@ -0,0 +1,41 @@
--- mkntpwd.c.orig 1998-05-12 11:16:07.000000000 +0200
+++ mkntpwd.c 2011-05-17 07:14:19.278025383 +0200
@@ -24,6 +24,8 @@
* SUCH DAMAGE.
*/
+#include <unistd.h>
+
#include "mkntpwd.h"
void str_to_key(unsigned char *,unsigned char *);
@@ -34,7 +36,7 @@
void E_P16(unsigned char *p14,unsigned char *p16);
-void main(int argc, char **argv) {
+int main(int argc, char **argv) {
extern char *optarg;
int c;
@@ -131,7 +133,7 @@
if (printlan >0) {
memset(hashout,'\0',17);
- E_P16((uchar *)lanpwd,hashout);
+ E_P16((uchar *)lanpwd,(uchar *)hashout);
printlanhash(hashout);
}
@@ -164,9 +166,9 @@
}
memset(p16,'\0',17);
- mdfour(p16,hold, uni_len);
+ mdfour(p16,(uchar *)hold, uni_len);
- printlanhash(p16);
+ printlanhash((char *)p16);
free(p16);
free(hold);

View File

@ -0,0 +1,3 @@
A utility to create Samba password hashes
WWW: http://sourceforge.net/projects/ldaputils/