aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Klaus <philipp.klaus@gmail.com>2011-06-21 17:12:21 +0200
committerPhilipp Klaus <philipp.klaus@gmail.com>2011-06-21 17:12:21 +0200
commita067bd488fb1ad0ce4818c6601031554397c1d80 (patch)
tree7abf7fae76c0e77e17abaa83a2ca01030824661b
parent468a1f0c5bd165b6d0647b184885eb2040d7ddf4 (diff)
downloadpwgen-a067bd488fb1ad0ce4818c6601031554397c1d80.zip
automatic commit for pwgen-2.03
-rw-r--r--ChangeLog32
-rw-r--r--Makefile.in6
-rw-r--r--config.cache28
-rw-r--r--config.log23
-rwxr-xr-xconfig.status164
-rw-r--r--pw_phonemes.c7
-rw-r--r--pw_rand.c14
-rw-r--r--randnum.c4
8 files changed, 261 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d44a3a..ae9d333 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2003-01-15 Theodore Ts'o <tytso@mit.edu>
+
+ * Release of pwgen 2.03
+
+ * randnum.c: Fix #ifdef to use HAVE_DRAND48 instead of just
+ RAND48. This caused random() to be callled 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 <tytso@mit.edu>
+
+ * 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 <tytso@mit.edu>
* Release of pwgen 2.02
diff --git a/Makefile.in b/Makefile.in
index 2ed04ed..b4efd3c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-PWGEN_VERSION=2.02
+PWGEN_VERSION=2.03
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -37,10 +37,10 @@ SRCS= pwgen.c pw_phonemes.c pw_rand.c randnum.c
pwgen: $(OBJS)
- $(CC) -o pwgen $(OBJS)
+ $(CC) $(LDFLAGS) -o pwgen $(OBJS)
install: pwgen pwgen.1
- mkdir -p $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)/man/man1
+ 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
diff --git a/config.cache b/config.cache
new file mode 100644
index 0000000..1cc6c37
--- /dev/null
+++ b/config.cache
@@ -0,0 +1,28 @@
+# 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.
+#
+ac_cv_func_drand48=${ac_cv_func_drand48=yes}
+ac_cv_func_getopt_long=${ac_cv_func_getopt_long=yes}
+ac_cv_header_getopt_h=${ac_cv_header_getopt_h=yes}
+ac_cv_path_MV=${ac_cv_path_MV=/bin/mv}
+ac_cv_path_PERL=${ac_cv_path_PERL=/usr/bin/perl}
+ac_cv_path_RM=${ac_cv_path_RM=/bin/rm}
+ac_cv_path_SED=${ac_cv_path_SED=/bin/sed}
+ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
+ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
+ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
+ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
+ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
+ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
+ac_cv_prog_gcc=${ac_cv_prog_gcc=yes}
diff --git a/config.log b/config.log
new file mode 100644
index 0000000..bab758f
--- /dev/null
+++ b/config.log
@@ -0,0 +1,23 @@
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+configure:529: checking for gcc
+configure:642: checking whether the C compiler (gcc ) works
+configure:658: gcc -o conftest conftest.c 1>&5
+configure:684: checking whether the C compiler (gcc ) is a cross-compiler
+configure:689: checking whether we are using GNU C
+configure:698: gcc -E conftest.c
+configure:717: checking whether gcc accepts -g
+configure:779: checking for a BSD compatible install
+configure:834: checking for mv
+configure:870: checking for rm
+configure:906: checking for sed
+configure:942: checking for perl
+configure:978: checking for drand48
+configure:1006: gcc -o conftest -g -O2 conftest.c 1>&5
+configure:978: checking for getopt_long
+configure:1006: gcc -o conftest -g -O2 conftest.c 1>&5
+configure:1031: checking how to run the C preprocessor
+configure:1052: gcc -E conftest.c >/dev/null 2>conftest.out
+configure:1114: checking for getopt.h
+configure:1124: gcc -E conftest.c >/dev/null 2>conftest.out
diff --git a/config.status b/config.status
new file mode 100755
index 0000000..90577a8
--- /dev/null
+++ b/config.status
@@ -0,0 +1,164 @@
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host think.thunk.org:
+#
+# ./configure
+#
+# 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} ./configure --no-create --no-recursion"
+ exec ${CONFIG_SHELL-/bin/sh} ./configure --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=.
+ac_given_INSTALL="/usr/bin/install -c"
+
+trap 'rm -fr Makefile conftest*; exit 1' 1 2 15
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
+/^[ ]*VPATH[ ]*=[^:]*$/d
+
+s%@SHELL@%/bin/sh%g
+s%@CFLAGS@%-g -O2%g
+s%@CPPFLAGS@%%g
+s%@CXXFLAGS@%%g
+s%@FFLAGS@%%g
+s%@DEFS@% -DHAVE_DRAND48=1 -DHAVE_GETOPT_LONG=1 -DHAVE_GETOPT_H=1 %g
+s%@LDFLAGS@%%g
+s%@LIBS@%%g
+s%@exec_prefix@%${prefix}%g
+s%@prefix@%/usr/local%g
+s%@program_transform_name@%s,x,x,%g
+s%@bindir@%${exec_prefix}/bin%g
+s%@sbindir@%${exec_prefix}/sbin%g
+s%@libexecdir@%${exec_prefix}/libexec%g
+s%@datadir@%${prefix}/share%g
+s%@sysconfdir@%${prefix}/etc%g
+s%@sharedstatedir@%${prefix}/com%g
+s%@localstatedir@%${prefix}/var%g
+s%@libdir@%${exec_prefix}/lib%g
+s%@includedir@%${prefix}/include%g
+s%@oldincludedir@%/usr/include%g
+s%@infodir@%${prefix}/info%g
+s%@mandir@%${prefix}/man%g
+s%@CC@%gcc%g
+s%@INSTALL_PROGRAM@%${INSTALL}%g
+s%@INSTALL_SCRIPT@%${INSTALL_PROGRAM}%g
+s%@INSTALL_DATA@%${INSTALL} -m 644%g
+s%@MV@%/bin/mv%g
+s%@RM@%/bin/rm%g
+s%@SED@%/bin/sed%g
+s%@PERL@%/usr/bin/perl%g
+s%@CPP@%gcc -E%g
+
+CEOF
+
+# 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
+
+CONFIG_FILES=${CONFIG_FILES-"Makefile"}
+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*
+
+
+
+exit 0
diff --git a/pw_phonemes.c b/pw_phonemes.c
index 1eaa311..cb14ff5 100644
--- a/pw_phonemes.c
+++ b/pw_phonemes.c
@@ -8,6 +8,7 @@
*/
#include <ctype.h>
+#include <string.h>
#include "pwgen.h"
struct pw_element elements[] = {
@@ -68,7 +69,7 @@ try_again:
should_be = 0;
first = 1;
- should_be = pw_random_number(1) ? VOWEL : CONSONANT;
+ should_be = pw_random_number(2) ? VOWEL : CONSONANT;
while (c < size) {
i = pw_random_number(NUM_ELEMENTS);
@@ -114,13 +115,13 @@ try_again:
*/
if (feature_flags & PW_ONE_NUMBER) {
if (!first && (pw_random_number(10) < 3)) {
- buf[c++] = pw_random_number(9)+'0';
+ buf[c++] = pw_random_number(10)+'0';
buf[c] = 0;
feature_flags &= ~PW_ONE_NUMBER;
first = 1;
prev = 0;
- should_be = pw_random_number(1) ?
+ should_be = pw_random_number(2) ?
VOWEL : CONSONANT;
continue;
}
diff --git a/pw_rand.c b/pw_rand.c
index e49ff76..5c9cd4f 100644
--- a/pw_rand.c
+++ b/pw_rand.c
@@ -11,20 +11,16 @@
#include <string.h>
#include "pwgen.h"
-#define FIRST_CHAR '!'
-#define LAST_CHAR '~'
-
-static char bad_chars[] = "'\\\"!@#$%^&*()+=_-{}[]<>`~?:;,/.|";
+#define PW_CHARS "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
void pw_rand(char *buf, int size, int pw_flags)
{
- char ch;
- int i = 0;
+ char ch, *chars = PW_CHARS;
+ int i = 0, len;
+ len = strlen(chars);
while (i < size) {
- ch = pw_random_number(LAST_CHAR - FIRST_CHAR) + FIRST_CHAR;
- if (strchr(bad_chars, ch))
- continue;
+ ch = chars[pw_random_number(len)];
buf[i++] = ch;
}
buf[size] = 0;
diff --git a/randnum.c b/randnum.c
index 6afa191..8d88e2d 100644
--- a/randnum.c
+++ b/randnum.c
@@ -47,7 +47,7 @@ static int get_random_fd(void)
#ifdef HAVE_DRAND48
drand48();
#else
- rand();
+ random();
#endif
return fd;
}
@@ -84,7 +84,7 @@ int pw_random_number(int max_num)
/* OK, we weren't able to use /dev/random, fall back to rand/rand48 */
-#ifdef RAND48
+#ifdef HAVE_DRAND48
return ((int) ((drand48() * max_num)));
#else
return ((int) (random() / ((float) RAND_MAX) * max_num));