pwgen-2.06/0000755003667600366760000000000010643030201011732 5ustar tytsotytsopwgen-2.06/pw_rand.c0000644003667600366760000000364110643030133013540 0ustar tytsotytso/* * pw_rand.c --- generate completely random (and hard to remember) * passwords * * Copyright (C) 2001,2002 by Theodore Ts'o * * This file may be distributed under the terms of the GNU Public * License. */ #include #include #include #include "pwgen.h" const char *pw_digits = "0123456789"; const char *pw_uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const char *pw_lowers = "abcdefghijklmnopqrstuvwxyz"; const char *pw_symbols = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; const char *pw_ambiguous = "B8G6I1l0OQDS5Z2"; const char *pw_vowels = "01aeiouyAEIOUY"; void pw_rand(char *buf, int size, int pw_flags) { char ch, *chars, *wchars; int i, len, feature_flags; len = 0; if (pw_flags & PW_DIGITS) { len += strlen(pw_digits); } if (pw_flags & PW_UPPERS) { len += strlen(pw_uppers); } len += strlen(pw_lowers); if (pw_flags & PW_SYMBOLS) { len += strlen(pw_symbols); } chars = malloc(len+1); if (!chars) { fprintf(stderr, "Couldn't malloc pw_rand buffer.\n"); exit(1); } wchars = chars; if (pw_flags & PW_DIGITS) { strcpy(wchars, pw_digits); wchars += strlen(pw_digits); } if (pw_flags & PW_UPPERS) { strcpy(wchars, pw_uppers); wchars += strlen(pw_uppers); } strcpy(wchars, pw_lowers); wchars += strlen(pw_lowers); if (pw_flags & PW_SYMBOLS) { strcpy(wchars, pw_symbols); } try_again: len = strlen(chars); feature_flags = pw_flags; i = 0; while (i < size) { ch = chars[pw_number(len)]; if ((pw_flags & PW_AMBIGUOUS) && strchr(pw_ambiguous,ch)) continue; if ((pw_flags & PW_NO_VOWELS) && strchr(pw_vowels, ch)) continue; buf[i++] = ch; if (strchr(pw_digits, ch)) feature_flags &= ~PW_DIGITS; if (strchr(pw_uppers, ch)) feature_flags &= ~PW_UPPERS; if (strchr(pw_symbols, ch)) feature_flags &= ~PW_SYMBOLS; } if (feature_flags & (PW_UPPERS | PW_DIGITS | PW_SYMBOLS)) goto try_again; buf[size] = 0; free(chars); return; } pwgen-2.06/configure0000755003667600366760000012763510643030133013663 0ustar tytsotytso#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=pwgen.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:529: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:559: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:610: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 653 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:689: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:717: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:779: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:834: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$MV" in /*) ac_cv_path_MV="$MV" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_MV="$MV" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_MV="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_MV" && ac_cv_path_MV="mv" ;; esac fi MV="$ac_cv_path_MV" if test -n "$MV"; then echo "$ac_t""$MV" 1>&6 else echo "$ac_t""no" 1>&6 fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:870: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$RM" in /*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_RM="$RM" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_RM="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_RM" && ac_cv_path_RM="rm" ;; esac fi RM="$ac_cv_path_RM" if test -n "$RM"; then echo "$ac_t""$RM" 1>&6 else echo "$ac_t""no" 1>&6 fi # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:906: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SED'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$SED" in /*) ac_cv_path_SED="$SED" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_SED="$SED" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_SED="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_SED" && ac_cv_path_SED="sed" ;; esac fi SED="$ac_cv_path_SED" if test -n "$SED"; then echo "$ac_t""$SED" 1>&6 else echo "$ac_t""no" 1>&6 fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:942: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$PERL" in /*) ac_cv_path_PERL="$PERL" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_PERL="$PERL" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_PERL="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="perl" ;; esac fi PERL="$ac_cv_path_PERL" if test -n "$PERL"; then echo "$ac_t""$PERL" 1>&6 else echo "$ac_t""no" 1>&6 fi for ac_func in drand48 getopt_long do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:978: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:1031: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1052: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1086: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 for ac_hdr in getopt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1114: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. cat > conftest.defs <<\EOF s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g s%\[%\\&%g s%\]%\\&%g s%\$%$$%g EOF DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` rm -f conftest.defs # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@MV@%$MV%g s%@RM@%$RM%g s%@SED@%$SED%g s%@PERL@%$PERL%g s%@CPP@%$CPP%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 pwgen-2.06/sha1.c0000644003667600366760000002315110643030133012740 0ustar tytsotytso/* * FIPS-180-1 compliant SHA-1 implementation * * Copyright (C) 2001-2003 Christophe Devine * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "sha1.h" void sha1_process(sha1_context *ctx, uint8 data[64]); #define GET_UINT32(n,b,i) \ { \ (n) = ( (uint32) (b)[(i) ] << 24 ) \ | ( (uint32) (b)[(i) + 1] << 16 ) \ | ( (uint32) (b)[(i) + 2] << 8 ) \ | ( (uint32) (b)[(i) + 3] ); \ } #define PUT_UINT32(n,b,i) \ { \ (b)[(i) ] = (uint8) ( (n) >> 24 ); \ (b)[(i) + 1] = (uint8) ( (n) >> 16 ); \ (b)[(i) + 2] = (uint8) ( (n) >> 8 ); \ (b)[(i) + 3] = (uint8) ( (n) ); \ } void sha1_starts(ctx) sha1_context *ctx; { ctx->total[0] = 0; ctx->total[1] = 0; ctx->state[0] = 0x67452301; ctx->state[1] = 0xEFCDAB89; ctx->state[2] = 0x98BADCFE; ctx->state[3] = 0x10325476; ctx->state[4] = 0xC3D2E1F0; } void sha1_process(ctx, data) sha1_context *ctx; uint8 data[64]; { uint32 temp, W[16], A, B, C, D, E; GET_UINT32( W[0], data, 0 ); GET_UINT32( W[1], data, 4 ); GET_UINT32( W[2], data, 8 ); GET_UINT32( W[3], data, 12 ); GET_UINT32( W[4], data, 16 ); GET_UINT32( W[5], data, 20 ); GET_UINT32( W[6], data, 24 ); GET_UINT32( W[7], data, 28 ); GET_UINT32( W[8], data, 32 ); GET_UINT32( W[9], data, 36 ); GET_UINT32( W[10], data, 40 ); GET_UINT32( W[11], data, 44 ); GET_UINT32( W[12], data, 48 ); GET_UINT32( W[13], data, 52 ); GET_UINT32( W[14], data, 56 ); GET_UINT32( W[15], data, 60 ); #define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) #define R(t) \ ( \ temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ ( W[t & 0x0F] = S(temp,1) ) \ ) #define P(a,b,c,d,e,x) \ { \ e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \ } A = ctx->state[0]; B = ctx->state[1]; C = ctx->state[2]; D = ctx->state[3]; E = ctx->state[4]; #define F(x,y,z) (z ^ (x & (y ^ z))) #define K 0x5A827999 P( A, B, C, D, E, W[0] ); P( E, A, B, C, D, W[1] ); P( D, E, A, B, C, W[2] ); P( C, D, E, A, B, W[3] ); P( B, C, D, E, A, W[4] ); P( A, B, C, D, E, W[5] ); P( E, A, B, C, D, W[6] ); P( D, E, A, B, C, W[7] ); P( C, D, E, A, B, W[8] ); P( B, C, D, E, A, W[9] ); P( A, B, C, D, E, W[10] ); P( E, A, B, C, D, W[11] ); P( D, E, A, B, C, W[12] ); P( C, D, E, A, B, W[13] ); P( B, C, D, E, A, W[14] ); P( A, B, C, D, E, W[15] ); P( E, A, B, C, D, R(16) ); P( D, E, A, B, C, R(17) ); P( C, D, E, A, B, R(18) ); P( B, C, D, E, A, R(19) ); #undef K #undef F #define F(x,y,z) (x ^ y ^ z) #define K 0x6ED9EBA1 P( A, B, C, D, E, R(20) ); P( E, A, B, C, D, R(21) ); P( D, E, A, B, C, R(22) ); P( C, D, E, A, B, R(23) ); P( B, C, D, E, A, R(24) ); P( A, B, C, D, E, R(25) ); P( E, A, B, C, D, R(26) ); P( D, E, A, B, C, R(27) ); P( C, D, E, A, B, R(28) ); P( B, C, D, E, A, R(29) ); P( A, B, C, D, E, R(30) ); P( E, A, B, C, D, R(31) ); P( D, E, A, B, C, R(32) ); P( C, D, E, A, B, R(33) ); P( B, C, D, E, A, R(34) ); P( A, B, C, D, E, R(35) ); P( E, A, B, C, D, R(36) ); P( D, E, A, B, C, R(37) ); P( C, D, E, A, B, R(38) ); P( B, C, D, E, A, R(39) ); #undef K #undef F #define F(x,y,z) ((x & y) | (z & (x | y))) #define K 0x8F1BBCDC P( A, B, C, D, E, R(40) ); P( E, A, B, C, D, R(41) ); P( D, E, A, B, C, R(42) ); P( C, D, E, A, B, R(43) ); P( B, C, D, E, A, R(44) ); P( A, B, C, D, E, R(45) ); P( E, A, B, C, D, R(46) ); P( D, E, A, B, C, R(47) ); P( C, D, E, A, B, R(48) ); P( B, C, D, E, A, R(49) ); P( A, B, C, D, E, R(50) ); P( E, A, B, C, D, R(51) ); P( D, E, A, B, C, R(52) ); P( C, D, E, A, B, R(53) ); P( B, C, D, E, A, R(54) ); P( A, B, C, D, E, R(55) ); P( E, A, B, C, D, R(56) ); P( D, E, A, B, C, R(57) ); P( C, D, E, A, B, R(58) ); P( B, C, D, E, A, R(59) ); #undef K #undef F #define F(x,y,z) (x ^ y ^ z) #define K 0xCA62C1D6 P( A, B, C, D, E, R(60) ); P( E, A, B, C, D, R(61) ); P( D, E, A, B, C, R(62) ); P( C, D, E, A, B, R(63) ); P( B, C, D, E, A, R(64) ); P( A, B, C, D, E, R(65) ); P( E, A, B, C, D, R(66) ); P( D, E, A, B, C, R(67) ); P( C, D, E, A, B, R(68) ); P( B, C, D, E, A, R(69) ); P( A, B, C, D, E, R(70) ); P( E, A, B, C, D, R(71) ); P( D, E, A, B, C, R(72) ); P( C, D, E, A, B, R(73) ); P( B, C, D, E, A, R(74) ); P( A, B, C, D, E, R(75) ); P( E, A, B, C, D, R(76) ); P( D, E, A, B, C, R(77) ); P( C, D, E, A, B, R(78) ); P( B, C, D, E, A, R(79) ); #undef K #undef F ctx->state[0] += A; ctx->state[1] += B; ctx->state[2] += C; ctx->state[3] += D; ctx->state[4] += E; } void sha1_update(ctx, input, length ) sha1_context *ctx; uint8 *input; uint32 length; { uint32 left, fill; if( ! length ) return; left = ctx->total[0] & 0x3F; fill = 64 - left; ctx->total[0] += length; ctx->total[0] &= 0xFFFFFFFF; if( ctx->total[0] < length ) ctx->total[1]++; if( left && length >= fill ) { memcpy( (void *) (ctx->buffer + left), (void *) input, fill ); sha1_process( ctx, ctx->buffer ); length -= fill; input += fill; left = 0; } while( length >= 64 ) { sha1_process( ctx, input ); length -= 64; input += 64; } if( length ) { memcpy( (void *) (ctx->buffer + left), (void *) input, length ); } } static uint8 sha1_padding[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; void sha1_finish( ctx, digest ) sha1_context *ctx; uint8 digest[20]; { uint32 last, padn; uint32 high, low; uint8 msglen[8]; high = ( ctx->total[0] >> 29 ) | ( ctx->total[1] << 3 ); low = ( ctx->total[0] << 3 ); PUT_UINT32( high, msglen, 0 ); PUT_UINT32( low, msglen, 4 ); last = ctx->total[0] & 0x3F; padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); sha1_update( ctx, sha1_padding, padn ); sha1_update( ctx, msglen, 8 ); PUT_UINT32( ctx->state[0], digest, 0 ); PUT_UINT32( ctx->state[1], digest, 4 ); PUT_UINT32( ctx->state[2], digest, 8 ); PUT_UINT32( ctx->state[3], digest, 12 ); PUT_UINT32( ctx->state[4], digest, 16 ); } #ifdef TEST #include #include /* * those are the standard FIPS-180-1 test vectors */ static char *msg[] = { "abc", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", NULL }; static char *val[] = { "a9993e364706816aba3e25717850c26c9cd0d89d", "84983e441c3bd26ebaae4aa1f95129e5e54670f1", "34aa973cd4c4daa4f61eeb2bdbad27316534016f" }; int main( argc, argv ) int argc; char **argv; { FILE *f; int i, j; char output[41]; sha1_context ctx; unsigned char buf[1000]; unsigned char sha1sum[20]; if( argc < 2 ) { printf( "\n SHA-1 Validation Tests:\n\n" ); for( i = 0; i < 3; i++ ) { printf( " Test %d ", i + 1 ); sha1_starts( &ctx ); if( i < 2 ) { sha1_update( &ctx, (uint8 *) msg[i], strlen( msg[i] ) ); } else { memset( buf, 'a', 1000 ); for( j = 0; j < 1000; j++ ) { sha1_update( &ctx, (uint8 *) buf, 1000 ); } } sha1_finish( &ctx, sha1sum ); for( j = 0; j < 20; j++ ) { sprintf( output + j * 2, "%02x", sha1sum[j] ); } if( memcmp( output, val[i], 40 ) ) { printf( "failed!\n" ); return( 1 ); } printf( "passed.\n" ); } printf( "\n" ); } else { if( ! ( f = fopen( argv[1], "rb" ) ) ) { perror( "fopen" ); return( 1 ); } sha1_starts( &ctx ); while( ( i = fread( buf, 1, sizeof( buf ), f ) ) > 0 ) { sha1_update( &ctx, buf, i ); } sha1_finish( &ctx, sha1sum ); for( j = 0; j < 20; j++ ) { printf( "%02x", sha1sum[j] ); } printf( " %s\n", argv[1] ); } return( 0 ); } #endif pwgen-2.06/wordwrap.pl0000755003667600366760000000123410643030133014143 0ustar tytsotytso#!/usr/bin/perl # # wordwrap.pl --- does word wrap # while (<>) { if (/^#/) { # don't word wrap comments print; next; } next if (/^$/); # skip blank lines $linelen = 0; split; while (defined($word = shift @_)) { $word =~ s#\$\(srcdir\)/\.\./version.h#\$\(top_srcdir\)/version.h#; $word =~ s#\$\(srcdir\)/.\.\/\.\./version.h#\$\(top_srcdir\)/version.h#; $word =~ s#\$\(srcdir\)/.\.\/et/com_err.h#\$\(top_srcdir\)/lib/et/com_err.h#; if ($linelen > 0) { printf(" "); } $len = length($word) + 1; $linelen += $len; if ($linelen > 78) { printf("\\\n "); $linelen = 1+$len; } printf("%s", $word); } printf("\n"); } pwgen-2.06/pw_phonemes.c0000644003667600366760000000734710643030133014441 0ustar tytsotytso/* * pw_phonemes.c --- generate secure passwords using phoneme rules * * Copyright (C) 2001,2002 by Theodore Ts'o * * This file may be distributed under the terms of the GNU Public * License. */ #include #include #include "pwgen.h" struct pw_element elements[] = { { "a", VOWEL }, { "ae", VOWEL | DIPTHONG }, { "ah", VOWEL | DIPTHONG }, { "ai", VOWEL | DIPTHONG }, { "b", CONSONANT }, { "c", CONSONANT }, { "ch", CONSONANT | DIPTHONG }, { "d", CONSONANT }, { "e", VOWEL }, { "ee", VOWEL | DIPTHONG }, { "ei", VOWEL | DIPTHONG }, { "f", CONSONANT }, { "g", CONSONANT }, { "gh", CONSONANT | DIPTHONG | NOT_FIRST }, { "h", CONSONANT }, { "i", VOWEL }, { "ie", VOWEL | DIPTHONG }, { "j", CONSONANT }, { "k", CONSONANT }, { "l", CONSONANT }, { "m", CONSONANT }, { "n", CONSONANT }, { "ng", CONSONANT | DIPTHONG | NOT_FIRST }, { "o", VOWEL }, { "oh", VOWEL | DIPTHONG }, { "oo", VOWEL | DIPTHONG}, { "p", CONSONANT }, { "ph", CONSONANT | DIPTHONG }, { "qu", CONSONANT | DIPTHONG}, { "r", CONSONANT }, { "s", CONSONANT }, { "sh", CONSONANT | DIPTHONG}, { "t", CONSONANT }, { "th", CONSONANT | DIPTHONG}, { "u", VOWEL }, { "v", CONSONANT }, { "w", CONSONANT }, { "x", CONSONANT }, { "y", CONSONANT }, { "z", CONSONANT } }; #define NUM_ELEMENTS (sizeof(elements) / sizeof (struct pw_element)) void pw_phonemes(char *buf, int size, int pw_flags) { int c, i, len, flags, feature_flags; int prev, should_be, first; const char *str; char ch, *cp; try_again: feature_flags = pw_flags; c = 0; prev = 0; should_be = 0; first = 1; should_be = pw_number(2) ? VOWEL : CONSONANT; while (c < size) { i = pw_number(NUM_ELEMENTS); str = elements[i].str; len = strlen(str); flags = elements[i].flags; /* Filter on the basic type of the next element */ if ((flags & should_be) == 0) continue; /* Handle the NOT_FIRST flag */ if (first && (flags & NOT_FIRST)) continue; /* Don't allow VOWEL followed a Vowel/Dipthong pair */ if ((prev & VOWEL) && (flags & VOWEL) && (flags & DIPTHONG)) continue; /* Don't allow us to overflow the buffer */ if (len > size-c) continue; /* Handle the AMBIGUOUS flag */ if (pw_flags & PW_AMBIGUOUS) { cp = strpbrk(str, pw_ambiguous); if (cp) continue; } /* * OK, we found an element which matches our criteria, * let's do it! */ strcpy(buf+c, str); /* Handle PW_UPPERS */ if (pw_flags & PW_UPPERS) { if ((first || flags & CONSONANT) && (pw_number(10) < 2)) { buf[c] = toupper(buf[c]); feature_flags &= ~PW_UPPERS; } } c += len; /* Time to stop? */ if (c >= size) break; /* * Handle PW_DIGITS */ if (pw_flags & PW_DIGITS) { if (!first && (pw_number(10) < 3)) { do { ch = pw_number(10)+'0'; } while ((pw_flags & PW_AMBIGUOUS) && strchr(pw_ambiguous, ch)); buf[c++] = ch; buf[c] = 0; feature_flags &= ~PW_DIGITS; first = 1; prev = 0; should_be = pw_number(2) ? VOWEL : CONSONANT; continue; } } /* Handle PW_SYMBOLS */ if (pw_flags & PW_SYMBOLS) { if (!first && (pw_number(10) < 2)) { do { ch = pw_symbols[ pw_number(strlen(pw_symbols))]; } while ((pw_flags & PW_AMBIGUOUS) && strchr(pw_ambiguous, ch)); buf[c++] = ch; buf[c] = 0; feature_flags &= ~PW_SYMBOLS; } } /* * OK, figure out what the next element should be */ if (should_be == CONSONANT) { should_be = VOWEL; } else { /* should_be == VOWEL */ if ((prev & VOWEL) || (flags & DIPTHONG) || (pw_number(10) > 3)) should_be = CONSONANT; else should_be = VOWEL; } prev = flags; first = 0; } if (feature_flags & (PW_UPPERS | PW_DIGITS | PW_SYMBOLS)) goto try_again; } pwgen-2.06/.gitignore0000644003667600366760000000010310643030133013720 0ustar tytsotytsoMakefile config.cache config.log config.status configure pwgen *.o pwgen-2.06/sha1.h0000644003667600366760000000064710643030133012752 0ustar tytsotytso#ifndef _SHA1_H #define _SHA1_H #ifndef uint8 #define uint8 unsigned char #endif #ifndef uint32 #define uint32 unsigned long int #endif typedef struct { uint32 total[2]; uint32 state[5]; uint8 buffer[64]; } sha1_context; void sha1_starts( sha1_context *ctx ); void sha1_update( sha1_context *ctx, uint8 *input, uint32 length ); void sha1_finish( sha1_context *ctx, uint8 digest[20] ); #endif /* sha1.h */ pwgen-2.06/debian/0000755003667600366760000000000010643030133013160 5ustar tytsotytsopwgen-2.06/debian/rules0000755003667600366760000000251310643030133014241 0ustar tytsotytso#!/usr/bin/make -f # Made with the aid of debmake, by Christoph Lameter, # based on the sample debian/rules file for GNU hello by Ian Jackson. package=pwgen build: build-stamp build-stamp: dh_testdir ./configure --prefix=/usr --mandir=/usr/share/man $(MAKE) CFLAGS="-O2 -g -Wall" touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp if test -f Makefile ; then $(MAKE) distclean ; fi -rm -f `find . -name "*~"` pwgen *.o dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs $(MAKE) install DESTDIR=`pwd`/debian/pwgen dh_install -ppwgen-udeb pwgen /usr/bin binary-indep: build install dh_testdir dh_testroot # There are no architecture-independent files to be uploaded # generated by this package. If there were any they would be # made here. binary-arch: build install dh_testdir dh_testroot # dh_installdebconf dh_installdocs dh_installexamples dh_installmenu # dh_installemacsen # dh_installpam # dh_installinit # dh_installcron dh_installman # dh_installinfo # dh_undocumented dh_installchangelogs ChangeLog dh_link dh_strip dh_compress dh_fixperms # You may want to make some executables suid here. # dh_makeshlibs dh_installdeb # dh_perl dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: binary binary-arch binary-indep clean pwgen-2.06/debian/copyright0000644003667600366760000000040610643030133015113 0ustar tytsotytsoThis package was debianized by Vincent Renardias on Tue, 19 Jun 2001 10:59:51 +0200. It was downloaded from http://sourceforge.net/projects/pwgen/ Copyright: GPL v2 A version of it is available in the file /usr/share/common-licenses/GPL pwgen-2.06/debian/changelog0000644003667600366760000002141110643030133015031 0ustar tytsotytsopwgen (2.06-1) unstable; urgency=low * New upstream version * Fix pwgen -Bs so that this option combination works correctly (Closes: #368010) * Fix the pwgen -Bc option combination (Closes: #355153) * Fix typo in pwgen man page (Closes: #376147) * Make the -s option imply the -nc options (Closes: #427969) * Add -v option to generate passwords without vowels (Closes: #387461) -- Theodore Y. Ts'o Wed, 4 Jul 2007 19:19:26 -0400 pwgen (2.05-1) unstable; urgency=low * Add a udeb for debian-installer. Thanks to Martin Michlmayr for the patch. (Closes: #271115) * Fix bug which would cause pwgen to loop forever if the password length is 1. * Fix spelling errors in the man page. (Closes: #323538) -- Theodore Y. Ts'o Sun, 15 Jan 2006 23:16:59 -0500 pwgen (2.04-1) unstable; urgency=low * New upstream version. * Adopt maintainership of pwgen. (Closes: #282076) * Fix minor bug in man page. (Closes: #311461) * Convert from debmake to debhelper * Add the --sha1 option so that pwgen uses the SHA1 hash to generate (not so) random passwords. * Add --symbols option which adds special symbols to the password. (Closes: #154561) * Add short options for --no-capitalize and --no-numerals and make those options work when --secure is specified. * Add --ambiguous option which avoids characters that can be confused by the user. (Closes: #51307) * Fix bug where --no-capitalized and --no-numerals were ignored for short passwords. (Closes: #276307) * In the pwgen man page, explain that human-memorable passwords are subject to off-line brute force attacks. (Closes: #276976) * Allow one or more capital letters and digits in human-friendly passwords (Closes: #182595) -- Theodore Y. Ts'o Wed, 15 Jun 2005 00:39:10 -0400 pwgen (2.03-1) unstable; urgency=high * New upstream release (Thanks Ted for the quick release! :-) (Closes: #170312, #176688). * Bugs fixed in previous release (Closes: #166959, #167485) -- Vincent Renardias Thu, 16 Jan 2003 11:07:14 +0100 pwgen (2.02-2) unstable; urgency=low * Apply small fix from Matthew J Backes (Closes: #176082). -- Vincent Renardias Mon, 13 Jan 2003 16:09:17 +0100 pwgen (2.02-1) unstable; urgency=low * new upstream release; fixes the following bugs (Thanks Ted!): - If the number of characters is less than 5, force the use of the fully random generator, since the quality of phonetic generator is really bad if the lengths are small --- and if the length is less than or equal to 2, pwgen will loop forever (Closes: #117137). - Fix e-mail address in man page (Closes: #150579). - #include the appropriate header files to avoid -Wall warnings (Closes: #126774). - Fix floating point exception errors if the password is longer than terminal width (Closes: #113571). - Return an exit value of 0 when pwgen on success (Closes: #118181, #102063). -- Vincent Renardias Tue, 16 Jul 2002 11:32:40 +0200 pwgen (2.01-3) unstable; urgency=low * Package is not native anymore (Closes: #44169). * pwgen now accept to generate passwords longer than 16 chars (Closes: #54957). * pwgen now really honors the password length (Closes: #70580). * The /usr/doc symlink is created (Closes: #102452). -- Vincent Renardias Thu, 6 Dec 2001 17:38:58 +0100 pwgen (2.01-2) unstable; urgency=low * Fix copyright file (Closes: #104207). The very purpose of having the /usr/share/licences directory is precisely to avoid to duplicate the GPL text in every package. This is explicitely allowed by the Debian policy unless it changed recently. -- Vincent Renardias Tue, 10 Jul 2001 20:46:25 +0200 pwgen (2.01-1) unstable; urgency=low * Now using new GPL'd code from Ted T'so. -- Vincent Renardias Thu, 21 Jun 2001 11:57:22 +0200 pwgen (1-17) unstable; urgency=low * Brandon has put is code under the BSD licence. Closes: #39130. * Remove extra junk files in source archive (yo, *~). * Ack NMU fixed bugs (Closes: 80763, #89985). * Really add /usr/doc/pwgen (NOT sntop!) link (Closes: #90335). -- Vincent Renardias Wed, 13 Jun 2001 11:34:10 +0200 pwgen (1-16) unstable; urgency=low * Fixed debian/rules manpages moved from /usr/man to /usr/share/man closes: #80763 docs in /usr/doc moved to /usr/share/doc closes: #89985 * lintian clean -- Fredrik Steen Sat, 17 Mar 2001 13:23:11 +0100 pwgen (1-15) unstable; urgency=low * Fix debian/rules; closes: #54001: can not build from source. -- Vincent Renardias Tue, 4 Jan 2000 14:53:58 +0100 pwgen (1-14) unstable; urgency=low * Fix bug #38630. -- Vincent Renardias Wed, 2 Jun 1999 14:55:04 +0200 pwgen (1-13) unstable; urgency=low * install pwgen in mode 755, not 555. -- Vincent Renardias Mon, 25 Jan 1999 05:51:20 +0100 pwgen (1-12) unstable; urgency=low * Plenty of good stuff contributed by Jim Lynch : * added -h and --help to the list of supported options. == pwgen (1-11.4) unstable; urgency=low * Cleaned up options parser. Now: - all options exclude repetition of themselves - -acn excludes -s - -s excludes -acn - -h in a future release. Note: this finshes fixes of Bug#25525. == pwgen (1-11.3) unstable; urgency=low * Made the function header for pwgen() be ANSI-compatible * Note: I just discovered that 1-11.1 fixes Bug#25525, and the parser will be fixed in .4, when I tighten up the parser. == pwgen (1-11.2) unstable; urgency=low * Modified manpage to combine the descriptions for short options with their equivalent long options. == pwgen (1-11.1) unstable; urgency=low * Added command-line arg handling (-a, -c, -n, -s) which implement the old preprocessor definitions ALTPHON, CAPITALIZE, NUMERALS and an unhooked secure password generator, respectively. Define ALLBYOPTS in the preprocessor to activate. When defined, ALTPHON, CAPITALIZE and NUMERALS have no effect. When not defined, is practically identical to version 1-11. The default for 1-11.1 will have ALLBYOPTS defined. Now, one copy of the pwgen binary will suffice when 16 would have been needed before to provide the same functionality. Also, the long options --alt-phonics, --capitalize, --numerals and --secure are identical aliases to -a, -c, -n and -s, respectively. * updated man page pwgen.1 to reflect all new functionality. * updated Makefile so it defines ALLBYOPTS and no longer defines ALTPHON, CAPITALIZE and NUMERALS when compiling pwgen (and spwgen; this has no effect, the secure option in pwgen is identical to the implementation in spwgen. So, I have arranged for the Makefile to not build or install spwgen.) -- Vincent Renardias Fri, 24 Apr 1998 19:37:50 +0200 pwgen (1-11) unstable; urgency=low * Corrected usage string (Bug #21612). -- Vincent Renardias Fri, 24 Apr 1998 19:37:50 +0200 pwgen (1-10) unstable; urgency=low * Corrected typo. in manpage (Bug #15027). -- Vincent Renardias Thu, 18 Dec 1997 05:08:06 +0100 pwgen (1-9) unstable; urgency=low * Added a 'spwgen' command to get more 'secure' passwords. Fixes bug #13162. -- Vincent Renardias Mon, 10 Nov 1997 06:14:12 +0100 pwgen (1-8) unstable; urgency=low * Documented bug #10192 so that it becomes a feature. _(; -- Vincent Renardias Wed, 28 May 1997 21:06:38 +0200 pwgen (1-7) unstable; urgency=low * Rebuilt with libc6. -- Vincent Renardias Thu, 1 May 1997 21:45:05 +0200 pwgen (1-6) unstable; urgency=low * Changed architecture from control file (i386 => any). -- Vincent Renardias Sat, 19 Apr 1997 10:42:34 +0200 pwgen (1-5) unstable; urgency=low * Modified usage info (Fixes bug #8227). -- Vincent Renardias Mon, 24 Mar 1997 23:33:11 +0100 pwgen (1-4) unstable; urgency=low * Modified RNG initialisation (Fixes Bug #6508). -- Vincent Renardias Sat, 11 Jan 1997 22:58:24 +0100 pwgen (1-3) unstable; urgency=low * Maintainer changed * Tuned Makefile -- Vincent Renardias Sat, 19 Oct 1996 04:32:26 +0200 pwgen (1-2) unstable; urgency=low * Binary not stripped * More documentation regarding the origin of the package -- Christoph Lameter Thu, 26 Sep 1996 14:51:46 +0800 pwgen (1-1) unstable; urgency=low * Initial Release -- Christoph Lameter Fri, 20 Sep 1996 14:51:46 +0800 Local variables: mode: debian-changelog End: pwgen-2.06/debian/control0000644003667600366760000000205210643030133014562 0ustar tytsotytsoSource: pwgen Section: admin Priority: optional Build-Depends: debhelper (>= 4) Maintainer: Theodore Y. Ts'o Standards-Version: 3.7.2.2 Package: pwgen Architecture: any Depends: ${shlibs:Depends} Description: Automatic Password generation pwgen generates random, meaningless but pronounceable passwords. These passwords contain either only lowercase letters, or upper and lower case mixed, or digits thrown in. Uppercase letters and digits are placed in a way that eases remembering their position when memorizing only the word. Package: pwgen-udeb Architecture: any Depends: ${shlibs:Depends} Section: debian-installer XC-Package-Type: udeb Description: Automatic Password generation pwgen generates random, meaningless but pronounceable passwords. These passwords contain either only lowercase letters, or upper and lower case mixed, or digits thrown in. Uppercase letters and digits are placed in a way that eases remembering their position when memorizing only the word. . pwgen-udeb is a minimal package used by debian-installer. pwgen-2.06/debian/control~0000644003667600366760000000205210643030133014760 0ustar tytsotytsoSource: pwgen Section: admin Priority: optional Build-Depends: debhelper (>= 4) Maintainer: Theodore Y. Ts'o Standards-Version: 3.6.1.1 Package: pwgen Architecture: any Depends: ${shlibs:Depends} Description: Automatic Password generation pwgen generates random, meaningless but pronounceable passwords. These passwords contain either only lowercase letters, or upper and lower case mixed, or digits thrown in. Uppercase letters and digits are placed in a way that eases remembering their position when memorizing only the word. Package: pwgen-udeb Architecture: any Depends: ${shlibs:Depends} Section: debian-installer XC-Package-Type: udeb Description: Automatic Password generation pwgen generates random, meaningless but pronounceable passwords. These passwords contain either only lowercase letters, or upper and lower case mixed, or digits thrown in. Uppercase letters and digits are placed in a way that eases remembering their position when memorizing only the word. . pwgen-udeb is a minimal package used by debian-installer. pwgen-2.06/debian/pwgen-udeb.dirs0000644003667600366760000000001010643030133016067 0ustar tytsotytsousr/bin pwgen-2.06/debian/rules~0000755003667600366760000000245310643030133014442 0ustar tytsotytso#!/usr/bin/make -f # Made with the aid of debmake, by Christoph Lameter, # based on the sample debian/rules file for GNU hello by Ian Jackson. package=pwgen build: build-stamp build-stamp: dh_testdir ./configure --prefix=/usr --mandir=/usr/share/man $(MAKE) CFLAGS="-O2 -g -Wall" touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp $(MAKE) distclean -rm -f `find . -name "*~"` pwgen *.o dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs $(MAKE) install DESTDIR=`pwd`/debian/pwgen dh_install -ppwgen-udeb pwgen /usr/bin binary-indep: build install dh_testdir dh_testroot # There are no architecture-independent files to be uploaded # generated by this package. If there were any they would be # made here. binary-arch: build install dh_testdir dh_testroot # dh_installdebconf dh_installdocs dh_installexamples dh_installmenu # dh_installemacsen # dh_installpam # dh_installinit # dh_installcron dh_installman # dh_installinfo # dh_undocumented dh_installchangelogs ChangeLog dh_link dh_strip dh_compress dh_fixperms # You may want to make some executables suid here. # dh_makeshlibs dh_installdeb # dh_perl dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: binary binary-arch binary-indep clean pwgen-2.06/debian/compat0000644003667600366760000000000210643030133014356 0ustar tytsotytso4 pwgen-2.06/debian/dirs0000644003667600366760000000002110643030133014035 0ustar tytsotytsousr/bin usr/sbin pwgen-2.06/randnum.c0000644003667600366760000000363110643030133013551 0ustar tytsotytso/* * randnum.c -- generate (good) randum numbers. * * Copyright (C) 2001,2002 by Theodore Ts'o * * This file may be distributed under the terms of the GNU Public * License. */ #include #include #include #include #include #include #include #include "pwgen.h" #ifdef HAVE_DRAND48 extern double drand48(void); #endif static int get_random_fd(void); /* Borrowed/adapted from e2fsprogs's UUID generation code */ static int get_random_fd() { struct timeval tv; static int fd = -2; int i; if (fd == -2) { gettimeofday(&tv, 0); fd = open("/dev/urandom", O_RDONLY); if (fd == -1) fd = open("/dev/random", O_RDONLY | O_NONBLOCK); #ifdef HAVE_DRAND48 srand48((tv.tv_sec<<9) ^ (getpgrp()<<15) ^ (getpid()) ^ (tv.tv_usec>>11)); #else srandom((getpid() << 16) ^ (getpgrp() << 8) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); #endif } /* Crank the random number generator a few times */ gettimeofday(&tv, 0); for (i = (tv.tv_sec ^ tv.tv_usec) & 0x1F; i > 0; i--) #ifdef HAVE_DRAND48 drand48(); #else random(); #endif return fd; } /* * Generate a random number n, where 0 <= n < max_num, using * /dev/urandom if possible. */ int pw_random_number(max_num) int max_num; { int i, fd = get_random_fd(); int lose_counter = 0, nbytes=4; unsigned int rand_num; char *cp = (char *) &rand_num; if (fd >= 0) { while (nbytes > 0) { i = read(fd, cp, nbytes); if ((i < 0) && ((errno == EINTR) || (errno == EAGAIN))) continue; if (i <= 0) { if (lose_counter++ == 8) break; continue; } nbytes -= i; cp += i; lose_counter = 0; } } if (nbytes == 0) return (rand_num % max_num); /* OK, we weren't able to use /dev/random, fall back to rand/rand48 */ #ifdef HAVE_DRAND48 return ((int) ((drand48() * max_num))); #else return ((int) (random() / ((float) RAND_MAX) * max_num)); #endif } pwgen-2.06/ChangeLog0000644003667600366760000000754210643030133013520 0ustar tytsotytso2006-01-15 Theodore Ts'o * Release of pwgen 2.05 * pwgen.1: Fix spelling mistakes in the man page (Addresses Debian Bug: #323538) * pwgen.c (main): Fix bug which would cause pwgen to loop forever if the password length specified is 1. 2005-06-15 Theodore Ts'o * pw_phonemes.c (pw_phonemes): Allow one or more capital letters and one or more digits in the generated passwords. (Addresses Debian Bug: #182595) 2005-06-14 Theodore Ts'o * pwgen.1: Explain that human-memorable passwords are vulnerable to off-line brute force attacks. (Addresses Debian Bug: #276976) * pwgen.c, pwgen.h, pw_rand.c, pwgen.1: Make -A and -0 aliases to --no-capitalize and --no-numerals, and make those options work when --secure is specified. * pwgen.c, pwgen.h, pw_rand.c, pw_phonemes.c, pwgen.c: Add support for the --symbols/-y option, which adds special characters to the generated password. (Addresses Debian Bug: #154561) * pwgen.c: Add -H, --sha1 option, to allow computing reproducible passwords, given a known file, and a known seed. (ie: pwgen -H ~/my_favourite.mp3#olivier@guerrier.com gives me a list of possibles passwords for my pop3 account, and I can ask this list again and again). Feature suggested and implemented by Olivier Guerrier . 2005-06-13 Theodore Ts'o * Fix obvious spelling typo in pwgen.1. (Addresses Debian Bug #311461) 2003-01-15 Theodore Ts'o * Release of pwgen 2.03 * randnum.c: Fix #ifdef to use HAVE_DRAND48 instead of just RAND48. This caused random() to be called without first initializing the right random number generator. This apparently caused pwgen to core dump under AIX, which seems surprising. * pw_rand.c (pw_rand): Use a list of acceptable characters instead of a list of unacceptable characters. This is slightly faster, and the code is cleaner and easier to understand. * randnum.c (get_random_fd): Use random() instead of rand() since we initialize the random number generator using srandom() if /dev/urandom and drand48() are not present. * Makefile.in (pwgen): Use LDFLAGS when linking pwgen. * pw_phonemes.c (pw_phonemes): Fix bug in how we call pw_random_number() so that we generate passwords that start with vowels, and insert numbers from 0-9, not just 0-8. (Oops!) Addresses Debian bug #176688. 2002-07-16 Theodore Ts'o * Makefile.in (install): Create the directory using $mandir, and not $(prefix)/man. * pw_phonemes.c: Add missing #include of string.h 2002-07-15 Theodore Ts'o * Release of pwgen 2.02 * pwgen.c (main): If the number of characters is less than 5, force the use of the fully random generator, since the quality of phonetic generator is really bad if the lengths are small --- and if the length is less than or equal to 2, pwgen will loop forever. (Addresses Debian bug #117137) * pw_rand.c: Add most punctuation characters to the "bad characters list", so that the random passwords are much more usable. * pwgen.1: Fix e-mail address in man page. (Addresses Debian bug #150579) * Makefile.in (WALL_OPTS): Add gcc options to do lots of nit-picky checking. * pwgen.c, pw_phonemes.c, pw_rand.c, pwgen.c, pwgen.h, randnum.c: Add const declarations and other code cleanups for avoidining -Wall warnings. * pwgen.c, pw_rand.c: #include the appropriate header files to avoid -Wall warnings. (Addresses Debian bug #126774). * pwgen.c (main): Fix floating point exception errors if the password is longer than terminal width. Addresses Debian bug #113571. * pwgen.c (main): Return an exit value of 0 when pwgen on success. (Addresses Debian bugs #118181 and #102063). 2001-06-19 Theodore Tso * Release of pwgen 2.01 * pwgen.c (usage): Add help/usage message pwgen-2.06/pwgen.10000644003667600366760000001156410643030133013147 0ustar tytsotytso.TH PWGEN 1 "January 2006" "pwgen version 2.05" .SH NAME pwgen \- generate pronounceable passwords .SH SYNOPSIS .B pwgen [ .I OPTION ] [ .I pw_length ] [ .I num_pw ] .SH DESCRIPTION The .B pwgen program generates passwords which are designed to be easily memorized by humans, while being as secure as possible. Human-memorable passwords are never going to be as secure as completely completely random passwords. In particular, passwords generated by .B pwgen without the .B \-s option should not be used in places where the password could be attacked via an off-line brute-force attack. On the other hand, completely randomly generated passwords have a tendency to be written down, and are subject to being compromised in that fashion. .PP The .B pwgen program is designed to be used both interactively, and in shell scripts. Hence, its default behavior differs depending on whether the standard output is a tty device or a pipe to another program. Used interactively, .B pwgen will display a screenful of passwords, allowing the user to pick a single password, and then quickly erase the screen. This prevents someone from being able to "shoulder surf" the user's chosen password. .PP When standard output (stdout) is not a tty, .B pwgen will only generate one password, as this tends to be much more convenient for shell scripts, and in order to be compatible with previous versions of this program. .PP In addition, for backwards compatibility reasons, when stdout is not a tty and secure password generation mode has not been requested, .B pwgen will generate less secure passwords, as if the .B \-0A options had been passed to it on the command line. This can be overriden using the .B \-nc options. In the future, the behavior when stdout is a tty may change, so shell scripts using .B pwgen should explicitly specify the .B \-nc or .B \-0A options. The latter is not recommended for security reasons, since such passwords are far too easy to guess. .B .SH OPTIONS .TP .B \-0, \--no-numerals Don't include numbers in the generated passwords. .TP .B \-1 Print the generated passwords one per line. .TP .B \-A, \--no-capitalize Don't bother to include any capital letters in the generated passwords. .TP .B \-a, --alt-phonics This option doesn't do anything special; it is present only for backwards compatibility. .TP .B \-B, --ambiguous Don't use characters that could be confused by the user when printed, such as 'l' and '1', or '0' or 'O'. This reduces the number of possible passwords significantly, and as such reduces the quality of the passwords. It may be useful for users who have bad vision, but in general use of this option is not recommended. .TP .B \-c, --capitalize Include at least one capital letter in the password. This is the default if the standard output is a tty device. .TP .B \-C Print the generated passwords in columns. This is the default if the standard output is a tty device. .TP .B \-N, --num-passwords=\fInum Generate .I num passwords. This defaults to a screenful if passwords are printed by columns, and one password. .TP .B \-n, --numerals Include at least one number in the password. This is the default if the standard output is a tty device. .TP .B \-H, --sha1=\fI/path/to/file[#seed] Will use the sha1's hash of given file and the optional seed to create password. It will allow you to compute the same password later, if you remember the file, seed, and pwgen's options used. ie: pwgen -H ~/your_favorite.mp3#your@email.com gives a list of possibles passwords for your pop3 account, and you can ask this list again and again. .IP .B WARNING: The passwords generated using this option are not very random. If you use this option, make sure the attacker can not obtain a copy of the file. Also, note that the name of the file may be easily available from the ~/.history or ~/.bash_history file. .TP .B \-h, --help Print a help message. .TP .B \-s, --secure Generate completely random, hard-to-memorize passwords. These should only be used for machine passwords, since otherwise it's almost guaranteed that users will simply write the password on a piece of paper taped to the monitor... .TP .B \-v, --no-vowels Generate random passwords that do not contain vowels or numbers that might be mistaken for vowels. It provides less secure passwords to allow system administrators to not have to worry with random passwords accidentally contain offensive substrings. .TP .B \-y, --symbols Include at least one special character in the password. .SH AUTHOR This version of .B pwgen was written by Theodore Ts'o . It is modelled after a program originally written by Brandon S. Allbery, and then later extensively modified by Olaf Titz, Jim Lynch, and others. It was rewritten from scratch by Theodore Ts'o because the original program was somewhat of a hack, and thus hard to maintain, and because the licensing status of the program was unclear. .SH SEE ALSO .BR passwd (1) pwgen-2.06/sha1num.c0000644003667600366760000000312210643030133013454 0ustar tytsotytso/* * sha1num.c --- generate sha1 hash based, pseudo random numbers * * Copyright (C) 2005 by Olivier Guerrier * * This file may be distributed under the terms of the GNU Public * License. */ #include #include #include #include "pwgen.h" #include "sha1.h" sha1_context sha1_ctx; char *sha1_seed; const char *sha1_magic="pwgen"; unsigned char sha1sum[20]; int sha1sum_idx=20; void pw_sha1_init(char *sha1) { int i = 0; char *seed; FILE *f; unsigned char buf[1024]; if ((seed = strchr(sha1,'#'))) { *(seed++) = 0; sha1_seed = malloc(strlen(seed)+1); if (!sha1_seed) { fprintf(stderr, "Couldn't malloc sha1_seed buffer.\n"); exit(1); } strcpy(sha1_seed, seed); } else { sha1_seed = malloc(strlen(sha1_magic)+1); if (!sha1_seed) { fprintf(stderr, "Couldn't malloc sha1_seed buffer.\n"); exit(1); } strcpy(sha1_seed, sha1_magic); } if( ! ( f = fopen( sha1, "rb" ) ) ) { fprintf(stderr, "Couldn't open file: %s.\n", sha1); exit(1); } sha1_starts( &sha1_ctx ); while( ( i = fread( buf, 1, sizeof( buf ), f ) ) > 0 ) { sha1_update( &sha1_ctx, buf, i ); } return; } int pw_sha1_number(int max_num) { int val; sha1_context ctx; if (sha1sum_idx>19) { sha1sum_idx = 0; sha1_update(&sha1_ctx, (unsigned char *) sha1_seed, strlen(sha1_seed)); ctx = sha1_ctx; sha1_finish(&ctx, sha1sum ); } val = (int) (sha1sum[sha1sum_idx++] / ((float) 256) * max_num); return (val); } pwgen-2.06/pwgen.c0000644003667600366760000001165110643030133013226 0ustar tytsotytso/* * pwgen.c --- generate secure passwords * * Copyright (C) 2001,2002 by Theodore Ts'o * * This file may be distributed under the terms of the GNU Public * License. */ #include #include #include #include #include #ifdef HAVE_GETOPT_H #include #endif #include "pwgen.h" /* Globals variables */ int (*pw_number)(int max_num); /* Program parameters set via getopt */ int pw_length = 8; int num_pw = -1; int pwgen_flags = 0; int do_columns = 0; #ifdef HAVE_GETOPT_LONG struct option pwgen_options[] = { { "alt-phonics", no_argument, 0, 'a' }, { "capitalize", no_argument, 0, 'c' }, { "numerals", no_argument, 0, 'n'}, { "symbols", no_argument, 0, 'y'}, { "num-passwords", required_argument, 0, 'N'}, { "secure", no_argument, 0, 's' }, { "help", no_argument, 0, 'h'}, { "no-numerals", no_argument, 0, '0' }, { "no-capitalize", no_argument, 0, 'A' }, { "sha1", required_argument, 0, 'H' }, { "ambiguous", no_argument, 0, 'B' }, { "no-vowels", no_argument, 0, 'v' }, { 0, 0, 0, 0} }; #endif const char *pw_options = "01AaBCcnN:shH:vy"; static void usage(void) { fputs("Usage: pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]\n\n", stderr); fputs("Options supported by pwgen:\n", stderr); fputs(" -c or --capitalize\n", stderr); fputs("\tInclude at least one capital letter in the password\n", stderr); fputs(" -A or --no-capitalize\n", stderr); fputs("\tDon't include capital letters in the password\n", stderr); fputs(" -n or --numerals\n", stderr); fputs("\tInclude at least one number in the password\n", stderr); fputs(" -0 or --no-numerals\n", stderr); fputs("\tDon't include numbers in the password\n", stderr); fputs(" -y or --symbols\n", stderr); fputs("\tInclude at least one special symbol in the password\n", stderr); fputs(" -s or --secure\n", stderr); fputs("\tGenerate completely random passwords\n", stderr); fputs(" -B or --ambiguous\n", stderr); fputs("\tDon't include ambiguous characters in the password\n", stderr); fputs(" -h or --help\n", stderr); fputs("\tPrint a help message\n", stderr); fputs(" -H or --sha1=path/to/file[#seed]\n", stderr); fputs("\tUse sha1 hash of given file as a (not so) random generator\n", stderr); fputs(" -C\n\tPrint the generated passwords in columns\n", stderr); fputs(" -1\n\tDon't print the generated passwords in columns\n", stderr); fputs(" -v or --no-vowels\n", stderr); fputs("\tDo not use any vowels so as to avoid accidental nasty words\n", stderr); exit(1); } int main(int argc, char **argv) { int term_width = 80; int c, i; int num_cols = -1; char *buf, *tmp; void (*pwgen)(char *inbuf, int size, int pw_flags); pwgen = pw_phonemes; pw_number = pw_random_number; if (isatty(1)) { do_columns = 1; pwgen_flags |= PW_DIGITS | PW_UPPERS; } while (1) { #ifdef HAVE_GETOPT_LONG c = getopt_long(argc, argv, pw_options, pwgen_options, 0); #else c = getopt(argc, argv, pw_options); #endif if (c == -1) break; switch (c) { case '0': pwgen_flags &= ~PW_DIGITS; break; case 'A': pwgen_flags &= ~PW_UPPERS; break; case 'a': break; case 'B': pwgen_flags |= PW_AMBIGUOUS; break; case 'c': pwgen_flags |= PW_UPPERS; break; case 'n': pwgen_flags |= PW_DIGITS; break; case 'N': num_pw = strtol(optarg, &tmp, 0); if (*tmp) { fprintf(stderr, "Invalid number of passwords: %s\n", optarg); exit(1); } break; case 's': pwgen = pw_rand; pwgen_flags = PW_DIGITS | PW_UPPERS; break; case 'C': do_columns = 1; break; case '1': do_columns = 0; break; case 'H': pw_sha1_init(optarg); pw_number = pw_sha1_number; break; case 'y': pwgen_flags |= PW_SYMBOLS; break; case 'v': pwgen = pw_rand; pwgen_flags |= PW_NO_VOWELS | PW_DIGITS | PW_UPPERS; break; case 'h': case '?': usage(); break; } } if (optind < argc) { pw_length = strtol(argv[optind], &tmp, 0); if (pw_length < 5) pwgen = pw_rand; if (pw_length <= 2) pwgen_flags &= ~PW_UPPERS; if (pw_length <= 1) pwgen_flags &= ~PW_DIGITS; if (*tmp) { fprintf(stderr, "Invalid password length: %s\n", argv[optind]); exit(1); } optind++; } if (optind < argc) { num_pw = strtol(argv[optind], &tmp, 0); if (*tmp) { fprintf(stderr, "Invalid number of passwords: %s\n", argv[optind]); exit(1); } } if (do_columns) { num_cols = term_width / (pw_length+1); if (num_cols == 0) num_cols = 1; } if (num_pw < 0) num_pw = do_columns ? num_cols * 20 : 1; buf = malloc(pw_length+1); if (!buf) { fprintf(stderr, "Couldn't malloc password buffer.\n"); exit(1); } for (i=0; i < num_pw; i++) { pwgen(buf, pw_length, pwgen_flags); if (!do_columns || ((i % num_cols) == (num_cols-1))) printf("%s\n", buf); else printf("%s ", buf); } if ((num_cols > 1) && ((i % num_cols) != 0)) fputc('\n', stdout); free(buf); return 0; } pwgen-2.06/configure.in0000644003667600366760000000037410643030133014253 0ustar tytsotytsoAC_INIT(pwgen.c) AC_PREREQ(2.12) AC_PROG_CC AC_PROG_INSTALL AC_PATH_PROG(MV, mv, mv) AC_PATH_PROG(RM, rm, rm) AC_PATH_PROG(SED, sed, sed) AC_PATH_PROG(PERL, perl, perl) AC_CHECK_FUNCS(drand48 getopt_long) AC_CHECK_HEADERS(getopt.h) AC_OUTPUT(Makefile) pwgen-2.06/depfix.sed0000644003667600366760000000060310643030133013711 0ustar tytsotytso# # Insert the header..... # 1i\ # +++ Dependency line eater +++\ # \ # Makefile dependencies follow. This must be the last section in\ # the Makefile.in file\ # # # Remove line continuations.... # :FIRST y/ / / s/^ *// /\\$/{ N y/ / / s/\\\n */ / bFIRST } s/ */ /g s;/usr/include/[^ ]* *;;g s;/usr/lib/[^ ]* *;;g s;/mit/cygnus[^ ]* *;;g # # Now insert a trailing newline... # $a\ pwgen-2.06/install-sh0000755003667600366760000001124410643030133013744 0ustar tytsotytso#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" tranformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 pwgen-2.06/.cvsignore0000644003667600366760000000011510643030133013733 0ustar tytsotytsoconfig.status pwgen configure config.log config.cache .depend build Makefile pwgen-2.06/Makefile.in0000644003667600366760000000711710643030133014011 0ustar tytsotytsoPWGEN_VERSION=2.05 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ top_builddir = . my_dir = . prefix = @prefix@ mandir = @mandir@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ WALL_OPTS = -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes \ -Wshadow -Wwrite-strings -Wpointer-arith -Wcast-qual -Wcast-align \ -pedantic CC = @CC@ DEFS = @DEFS@ CFLAGS = @CFLAGS@ $(WALL_OPTS) CPPFLAGS = @CPPFLAGS@ ALL_CFLAGS = $(CPPFLAGS) $(DEFS) $(USE_WFLAGS) $(CFLAGS) $(XTRA_CFLAGS) LDFLAGS = @LDFLAGS@ RM = @RM@ MV = @MV@ SED = @SED@ PERL = @PERL@ TAR = tar all:: pwgen .c.o: $(CC) -c $(ALL_CFLAGS) $< -o $@ OBJS= pwgen.o pw_phonemes.o pw_rand.o randnum.o sha1.o sha1num.o SRCS= pwgen.c pw_phonemes.c pw_rand.c randnum.c sha1.c sha1num.c pwgen: $(OBJS) $(CC) $(LDFLAGS) -o pwgen $(OBJS) install: pwgen pwgen.1 mkdir -p $(DESTDIR)$(prefix)/bin $(DESTDIR)$(mandir)/man1 $(INSTALL_PROGRAM) pwgen $(DESTDIR)$(prefix)/bin/pwgen $(INSTALL_DATA) $(srcdir)/pwgen.1 $(DESTDIR)$(mandir)/man1/pwgen.1 clean: $(RM) -f $(OBJS) pwgen *~ distclean: clean $(RM) -rf config.status config.log config.cache Makefile \ $(srcdir)/Makefile.in.old $(srcdir)/.exclude-file \ $(srcdir)/autom4te.cache # # Build source tar ball... # SRCROOT = pwgen-$(PWGEN_VERSION) $(srcdir)/.exclude-file: a=$(SRCROOT); \ (cd $(srcdir)/.. && find src \( -name \*~ -o -name \*.orig \ -o -name CVS -o -name \*.rej \ -o -name TAGS -o -name \*.old -o -name \*.gmo \ -o -name changed-files -o -name .#\* \) \ -print) | sed -e "s/src/$$a/" > $(srcdir)/.exclude-file echo "$(SRCROOT)/build" >> $(srcdir)/.exclude-file echo "$(SRCROOT)/rpm.log" >> $(srcdir)/.exclude-file echo "$(SRCROOT)/TODO" >> $(srcdir)/.exclude-file echo "$(SRCROOT)/.exclude-file" >> $(srcdir)/.exclude-file >> $(srcdir)/.exclude-file source_tar_file: $(srcdir)/.exclude-file cd $(srcdir)/.. && a=$(SRCROOT); rm -f $$a ; ln -sf src $$a ; \ $(TAR) -c -h -v -f - \ -X $$a/.exclude-file $$a | \ gzip -9 > pwgen-$(PWGEN_VERSION).tar.gz rm -f $(srcdir)/.exclude-file # # Autoconf magic... # $(top_builddir)/config.status: $(top_srcdir)/configure cd $(top_builddir); ./config.status --recheck Makefile: $(srcdir)/Makefile.in $(DEP_MAKEFILE) $(top_builddir)/config.status cd $(top_builddir); CONFIG_FILES=$(my_dir)/Makefile ./config.status $(top_srcdir)/configure: $(top_srcdir)/configure.in cd $(top_srcdir) && autoconf # # Make depend magic... # .depend: Makefile $(SRCS) $(top_srcdir)/depfix.sed $(top_srcdir)/wordwrap.pl if test -n "$(SRCS)" ; then \ $(CC) -M $(ALL_CFLAGS) $(SRCS) | \ $(SED) -f $(top_srcdir)/depfix.sed \ -e 's; $(srcdir)/; $$(srcdir)/;g' \ -e 's; $(top_srcdir)/; $$(top_srcdir)/;g' \ -e 's; $(top_builddir)/; $$(top_builddir)/;g' \ -e 's; \./; ;g' \ -e '/^ *\\$$/d' | \ $(PERL) $(top_srcdir)/wordwrap.pl > .depend; \ else :; fi depend:: .depend if test -n "$(SRCS)" ; then \ sed -e '/^# +++ Dependency line eater +++/,$$d' \ < $(srcdir)/Makefile.in | cat - .depend \ > $(srcdir)/Makefile.in.new; \ if cmp -s $(srcdir)/Makefile.in $(srcdir)/Makefile.in.new ; then \ $(RM) $(srcdir)/Makefile.in.new ; \ else \ $(MV) $(srcdir)/Makefile.in $(srcdir)/Makefile.in.old; \ $(MV) $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in; \ fi ; else :; fi # +++ Dependency line eater +++ # # Makefile dependencies follow. This must be the last section in # the Makefile.in file # pwgen.o: pwgen.c pwgen.h pw_phonemes.o: pw_phonemes.c pwgen.h pw_rand.o: pw_rand.c pwgen.h randnum.o: randnum.c pwgen.h sha1.o: sha1.c sha1.h sha1num.o: sha1num.c sha1.h pwgen.h pwgen-2.06/pwgen.h0000644003667600366760000000213710643030133013232 0ustar tytsotytso/* * pwgen.h --- header file for password generator * * Copyright (C) 2001,2002 by Theodore Ts'o * * This file may be distributed under the terms of the GNU Public * License. */ struct pw_element { const char *str; int flags; }; /* * Flags for the pw_element */ #define CONSONANT 0x0001 #define VOWEL 0x0002 #define DIPTHONG 0x0004 #define NOT_FIRST 0x0008 /* * Flags for the pwgen function */ #define PW_DIGITS 0x0001 /* At least one digit */ #define PW_UPPERS 0x0002 /* At least one upper letter */ #define PW_SYMBOLS 0x0004 #define PW_AMBIGUOUS 0x0008 #define PW_NO_VOWELS 0x0010 /* pointer to choose between random or sha1 pseudo random number generator */ extern int (*pw_number)(int max_num); extern const char *pw_symbols; extern const char *pw_ambiguous; /* Function prototypes */ /* pw_phonemes.c */ extern void pw_phonemes(char *buf, int size, int pw_flags); /* pw_rand.c */ extern void pw_rand(char *buf, int size, int pw_flags); /* randnum.c */ extern int pw_random_number(int max_num); /* sha1num.c */ extern void pw_sha1_init(char *sha1); extern int pw_sha1_number(int max_num);