Hello community, here is the log from the commit of package pwgen for openSUSE:Factory checked in at 2017-11-08 15:11:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pwgen (Old) and /work/SRC/openSUSE:Factory/.pwgen.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pwgen" Wed Nov 8 15:11:54 2017 rev:22 rq:539827 version:2.08 Changes: -------- --- /work/SRC/openSUSE:Factory/pwgen/pwgen.changes 2015-08-01 11:34:42.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.pwgen.new/pwgen.changes 2017-11-08 15:15:59.373222247 +0100 @@ -1,0 +2,17 @@ +Wed Nov 8 04:07:13 UTC 2017 - [email protected] + +- updated to version 2.08 + * Suppress trailing space after the last password + * Make pwgen -s more "secure" for 1 and 2 character passwords + * Fix option parsing of "pwgen --no-capitalize --no-vowels" + * Add new option --remove-chars which removes chars from the set of + characters used to generate passwords + * Add cross-compilation to debian/rules + * Update control and copyright files to point at pwgen at github for + the home directory and primary git repository +- Drop 1 hunk that was fixed upsteam in pwgen-2.06-fdleaks.patch + * merged in df7d8419ee44088eeeb9df92074914a659e90b15 +- Cleanup spec file with spec-cleaner +- Use macros more extensively in spec file + +------------------------------------------------------------------- Old: ---- pwgen-2.07.tar.gz pwgen-2.07.tar.gz.asc New: ---- pwgen-2.08.tar.gz pwgen-2.08.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pwgen.spec ++++++ --- /var/tmp/diff_new_pack.w4euwk/_old 2017-11-08 15:15:59.917202392 +0100 +++ /var/tmp/diff_new_pack.w4euwk/_new 2017-11-08 15:15:59.921202246 +0100 @@ -1,7 +1,7 @@ # # spec file for package pwgen # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,19 +17,18 @@ Name: pwgen -Version: 2.07 +Version: 2.08 Release: 0 Summary: Password generator License: GPL-2.0+ Group: Productivity/Security Url: http://sourceforge.net/projects/pwgen/ -Source0: http://downloads.sourceforge.net/project/pwgen/pwgen/%{version}/pwgen-%{version}.tar.gz -Source1: http://downloads.sourceforge.net/project/pwgen/pwgen/%{version}/pwgen-%{version}.tar.gz.asc +Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.gz +Source1: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.gz.asc Source2: %{name}.keyring Patch0: pwgen-2.06-fdleaks.patch BuildRequires: autoconf BuildRequires: automake -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description pwgen generates random, meaningless but pronounceable and thus easy to @@ -46,13 +45,10 @@ make %{?_smp_mflags} %install -mkdir -p %{buildroot}%{_bindir} -mkdir -p %{buildroot}%{_mandir}/man1 -make DESTDIR=%{buildroot} install %{?_smp_mflags} +%make_install %files -%defattr(-,root,root) -%{_mandir}/man1/* -%{_bindir}/pwgen +%{_mandir}/man1/%{name}.1%{ext_man} +%{_bindir}/%{name} %changelog ++++++ pwgen-2.06-fdleaks.patch ++++++ --- /var/tmp/diff_new_pack.w4euwk/_old 2017-11-08 15:15:59.953201077 +0100 +++ /var/tmp/diff_new_pack.w4euwk/_new 2017-11-08 15:15:59.957200931 +0100 @@ -1,17 +1,5 @@ Index: sha1num.c =================================================================== ---- sha1num.c.orig 2007-07-05 01:42:19.000000000 +0200 -+++ sha1num.c 2009-10-02 04:17:46.000000000 +0200 -@@ -53,6 +53,7 @@ void pw_sha1_init(char *sha1) - while( ( i = fread( buf, 1, sizeof( buf ), f ) ) > 0 ) { - sha1_update( &sha1_ctx, buf, i ); - } -+ fclose(f); - - return; - } -Index: sha1.c -=================================================================== --- sha1.c.orig 2007-07-05 01:42:19.000000000 +0200 +++ sha1.c 2009-10-02 02:33:01.000000000 +0200 @@ -383,6 +383,8 @@ int main( argc, argv ) ++++++ pwgen-2.07.tar.gz -> pwgen-2.08.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/.gitignore new/pwgen-2.08/.gitignore --- old/pwgen-2.07/.gitignore 2007-07-05 01:14:26.000000000 +0200 +++ new/pwgen-2.08/.gitignore 2017-08-07 06:36:54.000000000 +0200 @@ -4,4 +4,6 @@ config.status configure pwgen +build +autom4te.cache *.o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/Makefile.in new/pwgen-2.08/Makefile.in --- old/pwgen-2.07/Makefile.in 2014-10-28 04:41:47.000000000 +0100 +++ new/pwgen-2.08/Makefile.in 2017-08-07 06:52:36.000000000 +0200 @@ -1,4 +1,4 @@ -PWGEN_VERSION=2.07 +PWGEN_VERSION=2.08 srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -32,9 +32,19 @@ .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 +OBJS= pwgen.o \ + pw_phonemes.o \ + pw_rand.o \ + randnum.o \ + sha1.o \ + sha1num.o + +SRCS= $(srcdir)/pwgen.c \ + $(srcdir)/pw_phonemes.c \ + $(srcdir)/pw_rand.c \ + $(srcdir)/randnum.c \ + $(srcdir)/sha1.c \ + $(srcdir)/sha1num.c pwgen: $(OBJS) @@ -66,6 +76,7 @@ -o -name TAGS -o -name \*.old -o -name \*.gmo \ -o -name config.log -o -name config.cache \ -o -name config.status -o -name Makefile \ + -o -name build -o -name autom4te.cache \ -o -name changed-files -o -name .#\* \) \ -print) | sed -e "s/^./$$a/" > $(srcdir)/.exclude-file echo "$(SRCROOT)/.exclude-file" >> $(srcdir)/.exclude-file @@ -87,7 +98,7 @@ 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 +$(top_srcdir)/configure: $(top_srcdir)/configure.ac cd $(top_srcdir) && autoconf # @@ -123,9 +134,9 @@ # 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.o: $(srcdir)/pwgen.c $(srcdir)/pwgen.h +pw_phonemes.o: $(srcdir)/pw_phonemes.c $(srcdir)/pwgen.h +pw_rand.o: $(srcdir)/pw_rand.c $(srcdir)/pwgen.h +randnum.o: $(srcdir)/randnum.c $(srcdir)/pwgen.h +sha1.o: $(srcdir)/sha1.c $(srcdir)/sha1.h +sha1num.o: $(srcdir)/sha1num.c $(srcdir)/pwgen.h $(srcdir)/sha1.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/configure new/pwgen-2.08/configure --- old/pwgen-2.07/configure 2014-10-28 04:39:41.000000000 +0100 +++ new/pwgen-2.08/configure 2017-08-07 06:56:30.000000000 +0200 @@ -657,6 +657,7 @@ docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -727,6 +728,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -979,6 +981,15 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1116,7 +1127,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1269,6 +1280,7 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/configure.ac new/pwgen-2.08/configure.ac --- old/pwgen-2.07/configure.ac 1970-01-01 01:00:00.000000000 +0100 +++ new/pwgen-2.08/configure.ac 2017-08-07 06:36:54.000000000 +0200 @@ -0,0 +1,11 @@ +AC_INIT(pwgen.c) +AC_PREREQ(2.50) +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(getopt_long) +AC_CHECK_HEADERS(getopt.h) +AC_OUTPUT(Makefile) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/configure.in new/pwgen-2.08/configure.in --- old/pwgen-2.07/configure.in 2014-10-28 04:39:37.000000000 +0100 +++ new/pwgen-2.08/configure.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ -AC_INIT(pwgen.c) -AC_PREREQ(2.50) -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(getopt_long) -AC_CHECK_HEADERS(getopt.h) -AC_OUTPUT(Makefile) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/debian/changelog new/pwgen-2.08/debian/changelog --- old/pwgen-2.07/debian/changelog 2014-10-28 04:31:07.000000000 +0100 +++ new/pwgen-2.08/debian/changelog 2017-08-07 06:53:46.000000000 +0200 @@ -1,3 +1,29 @@ +pwgen (2.08-1) unstable; urgency=medium + + * New upstream version + * Suppress trailing space after the last password (Closes: #794635) + * Make pwgen -s more "secure" for 1 and 2 character passwords + (Closes: #666725) + * Fix option parsing of "pwgen --no-capitalize --no-vowels" (Closes: #791908) + * Add new option --remove-chars which removes chars from the set of + characters used to generate passwords (Closes: #836334) + * Add cross-compilation to debian/rules (Closes: #695148) + * Update control and copyright files to point at pwgen at github for + the home directory and primary git repository + (Closes: #454500, #855495, #846517) + * Update Debian policy compliance to 4.0.0 + + -- Theodore Y. Ts'o <[email protected]> Mon, 07 Aug 2017 00:51:45 -0400 + +pwgen (2.07-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Add multiarch metadata (Closes: #693964) + * Fix manpage typo (Closes: #579178) + * Stop -s from overwriting other flags (Closes: #436912) + + -- Wookey <[email protected]> Thu, 22 Oct 2015 22:14:04 +0100 + pwgen (2.07-1) unstable; urgency=high * New upstream version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/debian/compat new/pwgen-2.08/debian/compat --- old/pwgen-2.07/debian/compat 2014-10-28 04:11:30.000000000 +0100 +++ new/pwgen-2.08/debian/compat 2017-08-07 06:36:54.000000000 +0200 @@ -1 +1 @@ -8 +10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/debian/control new/pwgen-2.08/debian/control --- old/pwgen-2.07/debian/control 2014-10-28 04:11:30.000000000 +0100 +++ new/pwgen-2.08/debian/control 2017-08-07 06:36:54.000000000 +0200 @@ -1,12 +1,16 @@ Source: pwgen Section: admin Priority: optional -Build-Depends: debhelper (>= 8) +Build-Depends: debhelper (>= 10) Maintainer: Theodore Y. Ts'o <[email protected]> -Standards-Version: 3.9.6.0 +Standards-Version: 4.0.0 +Homepage: https://github.com/tytso/pwgen +Vcs-Browser: https://github.com/tytso/pwgen +Vcs-Git: https://github.com/tytso/pwgen.git Package: pwgen Architecture: any +Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends} Description: Automatic Password generation pwgen generates random, meaningless but pronounceable passwords. @@ -17,6 +21,7 @@ Package: pwgen-udeb Architecture: any +Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends} Section: debian-installer XC-Package-Type: udeb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/debian/copyright new/pwgen-2.08/debian/copyright --- old/pwgen-2.07/debian/copyright 2014-10-28 04:12:04.000000000 +0100 +++ new/pwgen-2.08/debian/copyright 2017-08-07 06:36:54.000000000 +0200 @@ -1,7 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: pwgen Upstream-Contact: [email protected] -Source: http://sourceforge.net/projects/pwgen/files/pwgen/ +Source: https://github.com/tytso/pwgen Files: * Copyright: 2001, 2002, 2005, 2006, 2014 Theodore Ts'o <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/debian/rules new/pwgen-2.08/debian/rules --- old/pwgen-2.07/debian/rules 2014-10-28 04:35:28.000000000 +0100 +++ new/pwgen-2.08/debian/rules 2017-08-07 06:36:54.000000000 +0200 @@ -2,6 +2,8 @@ # Made with the aid of debmake, by Christoph Lameter, # based on the sample debian/rules file for GNU hello by Ian Jackson. +DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) @@ -15,7 +17,8 @@ build-stamp: dh_testdir - ./configure --prefix=/usr --mandir=/usr/share/man + ./configure --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \ + --prefix=/usr --mandir=/usr/share/man $(MAKE) CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" touch build-stamp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/pw_phonemes.c new/pwgen-2.08/pw_phonemes.c --- old/pwgen-2.07/pw_phonemes.c 2014-10-28 02:45:54.000000000 +0100 +++ new/pwgen-2.08/pw_phonemes.c 2017-08-07 06:36:54.000000000 +0200 @@ -56,7 +56,7 @@ #define NUM_ELEMENTS (sizeof(elements) / sizeof (struct pw_element)) -void pw_phonemes(char *buf, int size, int pw_flags) +void pw_phonemes(char *buf, int size, int pw_flags, char *remove) { int c, i, len, flags, feature_flags; int prev, should_be, first; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/pw_rand.c new/pwgen-2.08/pw_rand.c --- old/pwgen-2.07/pw_rand.c 2007-07-05 01:14:26.000000000 +0200 +++ new/pwgen-2.08/pw_rand.c 2017-08-07 06:36:54.000000000 +0200 @@ -20,7 +20,32 @@ const char *pw_ambiguous = "B8G6I1l0OQDS5Z2"; const char *pw_vowels = "01aeiouyAEIOUY"; -void pw_rand(char *buf, int size, int pw_flags) +static void remove_chars(char *buf, const char *remove) +{ + const char *cp; + + if (!remove) + return; + for (cp = remove; *cp; cp++) { + char *r = strchr(buf, *cp); + + if (r == NULL) + continue; + memmove(r, r+1, strlen(r)); + } +} + +static int find_chars(char *buf, const char *set) +{ + const char *cp; + + for (cp = set; *cp; cp++) + if (strchr(buf, *cp)) + return 1; + return 0; +} + +void pw_rand(char *buf, int size, int pw_flags, char *remove) { char ch, *chars, *wchars; int i, len, feature_flags; @@ -55,9 +80,40 @@ if (pw_flags & PW_SYMBOLS) { strcpy(wchars, pw_symbols); } -try_again: + if (remove) { + if (pw_flags & PW_AMBIGUOUS) + remove_chars(chars, pw_ambiguous); + if (pw_flags & PW_NO_VOWELS) + remove_chars(chars, pw_vowels); + remove_chars(chars, remove); + if ((pw_flags & PW_DIGITS) && + !find_chars(chars, pw_digits)) { + fprintf(stderr, + "Error: No digits left in the valid set\n"); + exit(1); + } + if ((pw_flags & PW_UPPERS) && + !find_chars(chars, pw_uppers)) { + fprintf(stderr, + "Error: No upper case letters left in " + "the valid set\n"); + exit(1); + } + if ((pw_flags & PW_SYMBOLS) && + !find_chars(chars, pw_symbols)) { + fprintf(stderr, + "Error: No symbols left in the valid set\n"); + exit(1); + } + if (chars[0] == '\0') { + fprintf(stderr, + "Error: No characters left in the valid set\n"); + exit(1); + } + } len = strlen(chars); - feature_flags = pw_flags; +try_again: + feature_flags = (size > 2) ? pw_flags : 0; i = 0; while (i < size) { ch = chars[pw_number(len)]; @@ -66,11 +122,14 @@ if ((pw_flags & PW_NO_VOWELS) && strchr(pw_vowels, ch)) continue; buf[i++] = ch; - if (strchr(pw_digits, ch)) + if ((feature_flags & PW_DIGITS) && + strchr(pw_digits, ch)) feature_flags &= ~PW_DIGITS; - if (strchr(pw_uppers, ch)) + if ((feature_flags & PW_UPPERS) && + strchr(pw_uppers, ch)) feature_flags &= ~PW_UPPERS; - if (strchr(pw_symbols, ch)) + if ((feature_flags & PW_SYMBOLS) && + strchr(pw_symbols, ch)) feature_flags &= ~PW_SYMBOLS; } if (feature_flags & (PW_UPPERS | PW_DIGITS | PW_SYMBOLS)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/pwgen.1 new/pwgen-2.08/pwgen.1 --- old/pwgen-2.07/pwgen.1 2014-10-28 02:00:39.000000000 +0100 +++ new/pwgen-2.08/pwgen.1 2017-08-07 06:53:04.000000000 +0200 @@ -1,4 +1,4 @@ -.TH PWGEN 1 "January 2006" "pwgen version 2.05" +.TH PWGEN 1 "August 2017" "pwgen version 2.08" .SH NAME pwgen \- generate pronounceable passwords .SH SYNOPSIS @@ -78,7 +78,7 @@ Generate .I num passwords. This defaults to a screenful if passwords are -printed by columns, and one password. +printed by columns, and one password otherwise. .TP .B \-n, --numerals Include at least one number in the password. This is the default @@ -101,6 +101,11 @@ .B \-h, --help Print a help message. .TP +.B \-r \fIchars\fR, \fB--remove-chars=\fIchars +Don't use the specified characters in password. This option will +disable the phomeme-based generator and uses the random password +generator. +.TP .B \-s, --secure Generate completely random, hard-to-memorize passwords. These should only be used for machine passwords, since otherwise it's almost diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/pwgen.c new/pwgen-2.08/pwgen.c --- old/pwgen-2.07/pwgen.c 2014-10-28 02:00:39.000000000 +0100 +++ new/pwgen-2.08/pwgen.c 2017-08-07 06:36:54.000000000 +0200 @@ -35,6 +35,7 @@ { "numerals", no_argument, 0, 'n'}, { "symbols", no_argument, 0, 'y'}, { "num-passwords", required_argument, 0, 'N'}, + { "remove-chars", required_argument, 0, 'r' }, { "secure", no_argument, 0, 's' }, { "help", no_argument, 0, 'h'}, { "no-numerals", no_argument, 0, '0' }, @@ -46,7 +47,7 @@ }; #endif -const char *pw_options = "01AaBCcnN:shH:vy"; +const char *pw_options = "01AaBCcnN:sr:hH:vy"; static void usage(void) { @@ -66,6 +67,9 @@ fputs(" -y or --symbols\n", stderr); fputs("\tInclude at least one special symbol in the password\n", stderr); + fputs(" -r <chars> or --remove-chars=<chars>\n", stderr); + fputs("\tRemove characters from the set of characters to " + "generate passwords\n", stderr); fputs(" -s or --secure\n", stderr); fputs("\tGenerate completely random passwords\n", stderr); fputs(" -B or --ambiguous\n", stderr); @@ -92,7 +96,8 @@ int c, i; int num_cols = -1; char *buf, *tmp; - void (*pwgen)(char *inbuf, int size, int pw_flags); + char *remove=NULL; + void (*pwgen)(char *inbuf, int size, int pw_flags, char *remove); pwgen = pw_phonemes; pw_number = pw_random_number; @@ -137,7 +142,6 @@ break; case 's': pwgen = pw_rand; - pwgen_flags = PW_DIGITS | PW_UPPERS; break; case 'C': do_columns = 1; @@ -154,7 +158,11 @@ break; case 'v': pwgen = pw_rand; - pwgen_flags |= PW_NO_VOWELS | PW_DIGITS | PW_UPPERS; + pwgen_flags |= PW_NO_VOWELS; + break; + case 'r': + remove = strdup(optarg); + pwgen = pw_rand; break; case 'h': case '?': @@ -166,10 +174,12 @@ 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 (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]); @@ -201,14 +211,13 @@ exit(1); } for (i=0; i < num_pw; i++) { - pwgen(buf, pw_length, pwgen_flags); - if (!do_columns || ((i % num_cols) == (num_cols-1))) + pwgen(buf, pw_length, pwgen_flags, remove); + if (!do_columns || ((i % num_cols) == (num_cols-1)) || + (i == (num_pw - 1))) printf("%s\n", buf); else printf("%s ", buf); } - if ((num_cols > 1) && ((i % num_cols) != 0)) - fputc('\n', stdout); free(buf); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/pwgen.h new/pwgen-2.08/pwgen.h --- old/pwgen-2.07/pwgen.h 2007-07-05 01:14:26.000000000 +0200 +++ new/pwgen-2.08/pwgen.h 2017-08-07 06:36:54.000000000 +0200 @@ -38,10 +38,10 @@ /* Function prototypes */ /* pw_phonemes.c */ -extern void pw_phonemes(char *buf, int size, int pw_flags); +extern void pw_phonemes(char *buf, int size, int pw_flags, char *remove); /* pw_rand.c */ -extern void pw_rand(char *buf, int size, int pw_flags); +extern void pw_rand(char *buf, int size, int pw_flags, char *remove); /* randnum.c */ extern int pw_random_number(int max_num); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/randnum.c new/pwgen-2.08/randnum.c --- old/pwgen-2.07/randnum.c 2014-10-28 02:55:43.000000000 +0100 +++ new/pwgen-2.08/randnum.c 2017-08-07 06:36:54.000000000 +0200 @@ -46,13 +46,12 @@ int pw_random_number(max_num) int max_num; { - int i, fd = get_random_fd(); - int lose_counter = 0, nbytes; unsigned int rand_num; + int i, fd = get_random_fd(); + int lose_counter = 0, nbytes = sizeof(rand_num); char *cp = (char *) &rand_num; if (fd >= 0) { - nbytes = sizeof(rand_num); while (nbytes > 0) { i = read(fd, cp, nbytes); if ((i < 0) && diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/sha1num.c new/pwgen-2.08/sha1num.c --- old/pwgen-2.07/sha1num.c 2007-07-04 23:39:35.000000000 +0200 +++ new/pwgen-2.08/sha1num.c 2017-08-07 06:36:29.000000000 +0200 @@ -54,6 +54,8 @@ sha1_update( &sha1_ctx, buf, i ); } + fclose(f); + return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pwgen-2.07/wordwrap.pl new/pwgen-2.08/wordwrap.pl --- old/pwgen-2.07/wordwrap.pl 2007-07-04 23:39:35.000000000 +0200 +++ new/pwgen-2.08/wordwrap.pl 2017-08-07 06:36:54.000000000 +0200 @@ -9,8 +9,8 @@ } next if (/^$/); # skip blank lines $linelen = 0; - split; - while (defined($word = shift @_)) { + @words = split; + while (defined($word = shift @words)) { $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#;
