7ae832c
--- c50a/src/util/Makefile.chris	1996-12-16 09:27:35.000000000 +0100
2ab2759
+++ c50a/src/util/Makefile	2007-05-10 13:46:45.000000000 +0200
7ae832c
@@ -17,7 +17,7 @@
7ae832c
 EXE=    $(XDIR)/dawg \
7ae832c
 	$(XDIR)/dictfilt \
7ae832c
 	$(XDIR)/kickdict \
7ae832c
-	$(XDIR)/cracker
7ae832c
+	$(XDIR)/stdlib-cracker
7ae832c
 
7ae832c
 #------------------------------------------------------------------
7ae832c
 
7ae832c
@@ -69,7 +69,7 @@
7ae832c
 #------------------------------------------------------------------
7ae832c
 
7ae832c
 # don't you just love dependency graphs?
7ae832c
-$(XDIR)/dictfilt: dictfilt.c $(XLIB) $(XDIR)/cracker
7ae832c
+$(XDIR)/dictfilt: dictfilt.c $(XLIB) $(XDIR)/stdlib-cracker
7ae832c
 	$(CC) $(CFLAGS) -o $(XDIR)/dictfilt dictfilt.c elcid.o $(XLIB)
7ae832c
 
7ae832c
 #------------------------------------------------------------------
7ae832c
--- c50a/src/util/cracker.c.chris	1996-12-16 16:20:03.000000000 +0100
2ab2759
+++ c50a/src/util/cracker.c	2007-05-10 13:46:45.000000000 +0200
7ae832c
@@ -11,6 +11,7 @@
7ae832c
 
7ae832c
 #include "libcrack.h"
7ae832c
 #include "elcid.h"
7ae832c
+#include <stdarg.h>
7ae832c
 
7ae832c
 #define CRACK_MEMSMALL          0x0001
7ae832c
 #define CRACK_DISKSMALL         0x0002
7ae832c
@@ -97,18 +98,23 @@
7ae832c
 
7ae832c
 /* ------------------------------------------------------------------ */
7ae832c
 
7ae832c
+#ifdef __GNUC__
7ae832c
 void
7ae832c
-Logger(key, fmt, a, b, c, d, e, f)
7ae832c
-char key;
7ae832c
-char *fmt;
7ae832c
-char *a, *b, *c, *d, *e, *f;
7ae832c
+Logger(char key, const char *fmt, ...)
7ae832c
+    __attribute__ ((format (printf, 2, 3)));
7ae832c
+#endif
7ae832c
+void
7ae832c
+Logger(char key, const char *fmt, ...)
7ae832c
 {
7ae832c
     long t;
7ae832c
+    va_list ap;
7ae832c
 
7ae832c
     time(&t);
7ae832c
 
7ae832c
     fprintf(stdout, "%c:%ld:", key, t);
7ae832c
-    fprintf(stdout, fmt, a, b, c, d, e, f);
7ae832c
+    va_start(ap, fmt);
7ae832c
+    vprintf(fmt, ap);
7ae832c
+    va_end(ap);
7ae832c
 
7ae832c
     fflush(stdout);
7ae832c
     fflush(stderr);		/* and why not ? */
7ae832c
--- c50a/Crack.chris	1996-12-21 02:09:41.000000000 +0100
2ab2759
+++ c50a/Crack	2007-05-10 13:52:31.000000000 +0200
7ae832c
@@ -1,4 +1,4 @@
7ae832c
-#!/bin/sh
7ae832c
+#!/bin/bash
7ae832c
 ###
7ae832c
 # This program was written by and is copyright Alec Muffett 1991,
7ae832c
 # 1992, 1993, 1994, 1995, and 1996, and is provided as part of the
7ae832c
@@ -12,85 +12,11 @@
7ae832c
 # User-configurable junk for Crack
7ae832c
 ###
7ae832c
 
7ae832c
-# nice, generic path (RedHat Linux, Solaris1, Solaris2)
7ae832c
-CRACK_PATH=/usr/local/bin:/usr/ccs/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/ucb:/usr/etc:$PATH
7ae832c
-
7ae832c
-# compiler options for crack 5.0
7ae832c
-#
7ae832c
-# -DUSE_BZERO        /* add this to C5FLAGS if you don't have memset() */
7ae832c
-# -DUSE_MALLOC_H
7ae832c
-# -DUSE_PWD_H
7ae832c
-# -DUSE_SIGNAL_H
7ae832c
-# -DUSE_STDLIB_H
7ae832c
-# -DUSE_STRINGS_H
7ae832c
-# -DUSE_STRING_H
7ae832c
-# -DUSE_SYS_TYPES_H
7ae832c
-# -DUSE_UNISTD_H
7ae832c
-# -DMAXWORDLEN=      /* ignore if you don't read the code */
7ae832c
-# -DNUMWORDS=        /* ignore if you don't read the code */
7ae832c
-# -DSTRINGSIZE=      /* ignore if you don't read the code */
7ae832c
-
7ae832c
-# this set tested on:
7ae832c
-# - solaris 2.5
7ae832c
-# - redhat linux 4.0
7ae832c
-# - digital unix v4.0
7ae832c
-
7ae832c
-C5FLAGS="-DUSE_STRING_H -DUSE_STDLIB_H -DUSE_SIGNAL_H -DUSE_SYS_TYPES_H -DUSE_UNISTD_H -DUSE_PWD_H"
7ae832c
-
7ae832c
-#
7ae832c
-# now pick your compiler
7ae832c
-#
7ae832c
-
7ae832c
-# vanilla unix cc
7ae832c
-CC=cc
7ae832c
-CFLAGS="-g -O $C5FLAGS"
7ae832c
-#LIBS=-lcrypt # uncomment only if necessary to use stdlib crypt(), eg: NetBSD MD5
7ae832c
-
7ae832c
-# gcc 2.7.2
7ae832c
-#CC=gcc
7ae832c
-#CFLAGS="-g -O2 -Wall $C5FLAGS"
7ae832c
-#LIBS=-lcrypt # uncomment only if necessary to use stdlib crypt(), eg: NetBSD MD5
7ae832c
-
7ae832c
-# digital unix v4.0, CFLAGS for ev4/ev5 chipsets (pick one)
7ae832c
-#CC=cc
7ae832c
-#CFLAGS="-O4 -fast -tune ev4 $C5FLAGS"
7ae832c
-#CFLAGS="-O4 -fast -tune ev5 $C5FLAGS"
7ae832c
-#LIBS=
7ae832c
-
7ae832c
-# Uncomment the next two lines if a) you are running Crack in
7ae832c
-# networking mode, and b) your environment's operating system will not
7ae832c
-# necessarily run binaries compiled on other revs of the same
7ae832c
-# operating system which have the same architecture and the same
7ae832c
-# *MAJOR* revision number.
7ae832c
-#
7ae832c
-# eg: if you have Foonix 2.0 boxes as well as Foonix 2.1 boxes; in
7ae832c
-# this example, the major revision number is "2".  If the Foonix 2.1
7ae832c
-# O/S will not run Foonix 2.0 binaries for some reason, or vice-versa,
7ae832c
-# then uncomment these lines.
7ae832c
-
7ae832c
-#STRICT_OSREV=yes
7ae832c
-#export STRICT_OSREV
7ae832c
-
7ae832c
-# Uncomment and/or modify on HP/UX or similar where the UCB "rsh"
7ae832c
-# command has been renamed.  See scripts/crack-rsh also
7ae832c
-#CRACK_RSH=remsh
7ae832c
-#CRACK_RCP=rcp
7ae832c
-
7ae832c
-###########################################################
7ae832c
-###########################################################
7ae832c
-#################### THAT'S ALL, FOLKS ####################
7ae832c
-#### NOW GO CONFIGURE YOUR CRYPT ALGORITHM, EG: LIBDES ####
7ae832c
-###########################################################
7ae832c
-###########################################################
7ae832c
-
7ae832c
 ###
7ae832c
 # security
7ae832c
 ###
7ae832c
 
7ae832c
 umask 077
7ae832c
-export CRACK_PATH                       # So it can be picked up later
7ae832c
-PATH=$CRACK_PATH                        # For temporary use...
7ae832c
-export PATH
7ae832c
 
7ae832c
 ###
7ae832c
 # Defaults
7ae832c
@@ -108,12 +34,9 @@
7ae832c
 # home base
7ae832c
 ###
7ae832c
 
7ae832c
-CRACK_HOME=`echo $0 | sed -e 's/Crack$//'`
7ae832c
+old_wd=`pwd`
7ae832c
 
7ae832c
-if [ "$CRACK_HOME" = "" ]
7ae832c
-then
7ae832c
-	CRACK_HOME=.
7ae832c
-fi
7ae832c
+CRACK_HOME=${CRACK_HOME:-"/var/lib/crack"}
7ae832c
 
7ae832c
 if cd $CRACK_HOME
7ae832c
 then
7ae832c
@@ -126,25 +49,6 @@
7ae832c
 export CRACK_HOME
7ae832c
 
7ae832c
 ###
7ae832c
-# sanity check
7ae832c
-###
7ae832c
-
7ae832c
-if [ ! -f "$CRACK_HOME/Crack" ]
7ae832c
-then
7ae832c
-	echo "Fatal Error: $CRACK_HOME: something weird going down" 1>&2
7ae832c
-	exit 1
7ae832c
-fi
7ae832c
-
7ae832c
-###
7ae832c
-# Hierarchy
7ae832c
-###
7ae832c
-
7ae832c
-for dir in run run/bin
7ae832c
-do
7ae832c
-	test -d $dir || mkdir $dir || exit 1
7ae832c
-done
7ae832c
-
7ae832c
-###
7ae832c
 # Flagwaving
7ae832c
 ###
7ae832c
 
7ae832c
@@ -158,8 +62,6 @@
7ae832c
 # Parse Arguments
7ae832c
 ###
7ae832c
 
7ae832c
-argbackup1="$*"
7ae832c
-
7ae832c
 while [ "x$1" != "x" ]
7ae832c
 do
7ae832c
 	case $1 in
7ae832c
@@ -275,50 +177,24 @@
7ae832c
 	exit 1
7ae832c
 fi
7ae832c
 
7ae832c
-###
7ae832c
-# Sanity test bindir - written in gruntscript for clarity.
7ae832c
-###
7ae832c
-
7ae832c
-bdname=`scripts/binstamp 2>/dev/null`
7ae832c
-
7ae832c
-if [ "x$bdname" = "x" ]
7ae832c
-then
7ae832c
-	echo "Crack: error: cannot continue as binstamp returned empty string" 1>&2
7ae832c
-	exit 0
7ae832c
-fi
7ae832c
-
7ae832c
-echo "Stamp: $bdname"
7ae832c
 echo ""
7ae832c
 
7ae832c
 
7ae832c
 if [ "x$1" != "x" ]
7ae832c
 then
7ae832c
-	if [ "$1" = "-fmt" ]            # use generic name
7ae832c
-	then
7ae832c
-		bindir=run/bin/$bdname
7ae832c
-	elif [ -d run/bin/$1 ]          # have been here before
7ae832c
-	then
7ae832c
-		bindir=run/bin/$1
7ae832c
-		shift
7ae832c
-	elif [ ! -f $1 ]                # use specified name
7ae832c
-	then
7ae832c
-		bindir=run/bin/$1
7ae832c
-		shift
7ae832c
-	else                            # use generic name
7ae832c
-		bindir=run/bin/$bdname
7ae832c
-	fi
7ae832c
+	bindir=bin
7ae832c
 else                                    # supporting "-makeonly"
7ae832c
 	if [ "$makeonlyflag" != "" ]
7ae832c
 	then
7ae832c
-		bindir=run/bin/$bdname
7ae832c
+		bindir=bin
7ae832c
 
7ae832c
 	elif [ "$makedictflag" != "" ]
7ae832c
 	then
7ae832c
-		bindir=run/bin/$bdname
7ae832c
+		bindir=bin
7ae832c
 
7ae832c
 	elif [ "$remoteflag" != "" ]
7ae832c
 	then
7ae832c
-		bindir=run/bin/$bdname
7ae832c
+		bindir=bin
7ae832c
 	else
7ae832c
 		echo $usage 1>&2
7ae832c
 		exit 1
7ae832c
@@ -333,21 +209,6 @@
7ae832c
 export PATH
7ae832c
 
7ae832c
 ###
7ae832c
-# Make the binaries
7ae832c
-###
7ae832c
-
7ae832c
-echo "Crack: making utilities in $bindir"
7ae832c
-
7ae832c
-if [ ! -d $bindir ] # small redundancy, big benefit
7ae832c
-then
7ae832c
-	mkdir $bindir || exit 1
7ae832c
-fi
7ae832c
-
7ae832c
-make clean || exit 1
7ae832c
-
7ae832c
-make ARGS="\"XDIR=../../$bindir\" \"XCFLAGS=$CFLAGS\" \"XCC=$CC\" \"XLIBS=$LIBS\"" utils || exit 1
7ae832c
-
7ae832c
-###
7ae832c
 # Make Only ?
7ae832c
 ###
7ae832c
 
7ae832c
@@ -439,7 +300,6 @@
7ae832c
 	fbmerge
7ae832c
 
7ae832c
 	echo "Crack: Merging password files..."
7ae832c
-	argbackup2="$*"
7ae832c
 
7ae832c
 	(
7ae832c
 		cat run/F-merged        # first the feedback
2ab2759
@@ -451,16 +311,22 @@
7ae832c
 				shift || exit 1
7ae832c
 				deffmt=$1
7ae832c
 
7ae832c
-			elif [ "$deffmt" = "spf" ]
7ae832c
-			then
7ae832c
-				cat $1 1>&3 # skip the sort
7ae832c
 			else
7ae832c
-				${deffmt}2spf $1
7ae832c
+			  theFile=$1
7ae832c
+			  if [ ! -r $theFile ]; then
7ae832c
+			    theFile="$old_wd/$theFile"
7ae832c
+			  fi
7ae832c
+			  if [ "$deffmt" = "spf" ]
7ae832c
+			  then
7ae832c
+			  	  cat $theFile 1>&3 # skip the sort
7ae832c
+			  else
7ae832c
+			  	  ${deffmt}2spf $theFile
7ae832c
+			  fi
7ae832c
 			fi
7ae832c
 
7ae832c
 			shift
2ab2759
 		done |
2ab2759
-		crack-sort -t: +1
2ab2759
+		crack-sort -t: -k 2
2ab2759
 	) 3>&1 |
2ab2759
 	fbfilt $crackfb $crackmf > $crackin # remove feedback-guessable users
2ab2759
 
7ae832c
--- c50a/Reporter.chris	1996-12-13 20:13:55.000000000 +0100
2ab2759
+++ c50a/Reporter	2007-05-10 13:46:45.000000000 +0200
7ae832c
@@ -1,4 +1,4 @@
7ae832c
-#!/bin/sh
7ae832c
+#!/bin/bash
7ae832c
 ###
7ae832c
 # This program was written by and is copyright Alec Muffett 1991,
7ae832c
 # 1992, 1993, 1994, 1995, and 1996, and is provided as part of the
7ae832c
@@ -10,6 +10,9 @@
7ae832c
 # document which accompanies distributions of Crack v5.0 and upwards.
7ae832c
 ###
7ae832c
 
7ae832c
+CRACK_HOME=${CRACK_HOME:-"/var/lib/crack"}
7ae832c
+cd $CRACK_HOME
7ae832c
+
7ae832c
 tfile=run/T$$
7ae832c
 date=`date`
7ae832c