diff -ur --new-file chntpw-source-000607.orig/Makefile chntpw-source-000607/Makefile --- chntpw-source-000607.orig/Makefile Sat Apr 1 22:16:44 2000 +++ chntpw-source-000607/Makefile Thu Aug 31 03:02:58 2000 @@ -2,19 +2,23 @@ # Makefile for the Offline NT Password Editor # # -# Change here to point to the needed MD4 & DES libraries & .h files +# Change here to point to the needed OpenSSL libraries & .h files # See INSTALL for more info. # -DESPATH=../libdes -MDPATH=.. +OSSLPATH=/mnt/ducamp/openssl-SNAP +OSSLLIB=$(OSSLPATH)/lib +OSSLINC=$(OSSLPATH)/include CC=gcc -CFLAGS= -g -I. -I$(DESPATH) -I$(MDPATH) +CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall -LIBS=$(DESPATH)/libdes.a $(MDPATH)/md4/md4c.o +LIBS=-L$(OSSLLIB) -lcrypto chntpw: chntpw.o ntreg.o - $(CC) $(CFLAGS) -o chntpw chntpw.o ntreg.o -DDP=$(DESPATH) -DMP=$(MDPATH) $(LIBS) + $(CC) $(CFLAGS) -o chntpw chntpw.o ntreg.o $(LIBS) .c.o: $(CC) -c $(CFLAGS) $< + +clean: + rm -f *.o chntpw *~ diff -ur --new-file chntpw-source-000607.orig/chntpw.c chntpw-source-000607/chntpw.c --- chntpw-source-000607.orig/chntpw.c Wed Jun 7 20:25:33 2000 +++ chntpw-source-000607/chntpw.c Thu Aug 31 03:12:59 2000 @@ -41,9 +41,18 @@ /* #include */ /* These are from the DESlib & MD packages, see Makefile & README */ +#ifndef USEOPENSSL #include #include #include +#else +#include +#include +#define uchar u_char +#define MD4Init MD4_Init +#define MD4Update MD4_Update +#define MD4Final MD4_Final +#endif #include "proto.h" @@ -178,8 +187,8 @@ { uchar x1[] = {0x4B,0x47,0x53,0x21,0x40,0x23,0x24,0x25}; - char magic[] = {0x24, 0, 0x44 }; - int pl,ridofs,vend; + /* char magic[] = {0x24, 0, 0x44 }; */ + int pl /* ,ridofs,vend */ ; char *vp; static char username[128],fullname[128]; char comment[128],homedir[128],md4[32],lanman[32]; @@ -470,20 +479,20 @@ #define MCMD_EDIT 10 struct cmds maincmds[] = { - "cd" , MCMD_CD, - "ls" , MCMD_LS, - "dir", MCMD_LS, - "q" , MCMD_QUIT, - "cat", MCMD_CAT, - "type",MCMD_CAT, - "st" , MCMD_STRUCT, - "pw" , MCMD_PASSWD, - "passwd", MCMD_PASSWD, - "debug", MCMD_DEBUG, - "hive", MCMD_HIVE, - "ed", MCMD_EDIT, - "?", MCMD_HELP, - "", 0 + { "cd" , MCMD_CD } , + { "ls" , MCMD_LS } , + { "dir", MCMD_LS } , + { "q" , MCMD_QUIT } , + { "cat", MCMD_CAT } , + { "type",MCMD_CAT } , + { "st" , MCMD_STRUCT } , + { "pw" , MCMD_PASSWD } , + { "passwd", MCMD_PASSWD } , + { "debug", MCMD_DEBUG } , + { "hive", MCMD_HIVE } , + { "ed", MCMD_EDIT } , + { "?", MCMD_HELP } , + { "", 0 } }; /* Edit value: Invoke whatever is needed to edit it @@ -597,8 +606,8 @@ */ int parsecmd(char **s, struct cmds *cmd) { - char temp[10]; - int i,l = 0; + /* char temp[10]; */ + int /* i, */ l = 0; while ((*s)[l] && ((*s)[l] != ' ')) { l++; @@ -622,7 +631,7 @@ struct hive *hdesc; int cdofs, newofs; struct nk_key *cdkey; - char inbuf[100],whatbuf[100],*bp; + char inbuf[100], /* whatbuf[100], */ *bp; char path[1000]; int l, vkofs, nh; int usehive = 0; @@ -743,7 +752,7 @@ { char s[200]; struct keyval *v; - int nkofs,vkofs; + int nkofs /* ,vkofs */ ; int rid; int count = 0, countri = 0; struct ex_data ex; @@ -792,7 +801,7 @@ { char s[200]; struct vk_key *vkkey; - int vkofs; + /* int vkofs; */ int rid; struct keyval *v; @@ -865,12 +874,12 @@ }; #endif - void *fdata; + /* void *fdata; */ struct samkeyf *ff = NULL; struct secpoldata *sf = NULL; - struct lsadata *ld = NULL; - int len,i,secboot, samfmode, secmode, ldmode; - struct keyval *samf, *secpol, *lsad; + /* struct lsadata *ld = NULL; */ + int /* len, */ i,secboot, samfmode, secmode /* , ldmode */ ; + struct keyval *samf, *secpol /* , *lsad */ ; char *syskeytypes[4] = { "off", "key-in-registry", "enter-passphrase", "key-on-floppy" }; char yn[5]; @@ -1022,9 +1031,9 @@ int main(int argc, char **argv) { - int vofs; + /* int vofs; */ int dodebug = 0, list = 1, inter = 0,edit = 0,il,d = 0, dd = 0; - extern int opterr,optind; + extern int /* opterr, */ optind; extern char* optarg; char *filename,c; char *who = "Administrator"; diff -ur --new-file chntpw-source-000607.orig/ntreg.c chntpw-source-000607/ntreg.c --- chntpw-source-000607.orig/ntreg.c Wed Jun 7 20:25:50 2000 +++ chntpw-source-000607/ntreg.c Thu Aug 31 03:16:24 2000 @@ -423,7 +423,7 @@ void parse_sk(struct hive *hdesc, int vofs, int blen) { struct sk_key *key; - int i; + /* int i; */ printf("== sk at offset %0x\n",vofs); @@ -659,7 +659,7 @@ */ int ex_next_v(struct hive *hdesc, int nkofs, int *count, struct vex_data *sptr) { - struct nk_key *key, *newnkkey; + struct nk_key *key /* , *newnkkey */ ; int vkofs,vlistofs; int *vlistkey; struct vk_key *vkkey; @@ -729,7 +729,7 @@ int get_abs_path(struct hive *hdesc, int nkofs, char *path, int maxlen) { - int newnkofs; + /* int newnkofs; */ struct nk_key *key; char tmp[ABSPATHLEN+1]; @@ -1151,7 +1151,7 @@ int fmode,r,vofs; struct stat sbuf; unsigned long pofs; - off_t l; + /* off_t l; */ char *c; struct hbin_page *p; struct regf_header *hdr; diff -ur --new-file chntpw-source-000607.orig/ntreg.h chntpw-source-000607/ntreg.h --- chntpw-source-000607.orig/ntreg.h Wed Jun 7 20:25:55 2000 +++ chntpw-source-000607/ntreg.h Thu Aug 31 03:21:51 2000 @@ -316,3 +316,5 @@ void closeHive(struct hive *hdesc); int writeHive(struct hive *hdesc); struct hive *openHive(char *filename, int mode); + +void nk_ls(struct hive *hdesc, char *path, int vofs, int type);