diff options
author | Andreas Henriksson <andreas@fatal.se> | 2019-12-05 13:29:31 +0100 |
---|---|---|
committer | Andreas Henriksson <andreas@fatal.se> | 2019-12-05 13:29:31 +0100 |
commit | 69d932140c70455a282b6e7115d9caf0cc56d6ff (patch) | |
tree | eda18bc82cc58e5d193e608f00543b2b5b537d49 /libmisc | |
parent | b28d45d2bd2462414b9dbbe38e6c7f3d5f7b462b (diff) | |
download | shadow-69d932140c70455a282b6e7115d9caf0cc56d6ff.tar.gz |
New upstream version 4.8upstream/4.8
Diffstat (limited to 'libmisc')
-rw-r--r-- | libmisc/Makefile.am | 2 | ||||
-rw-r--r-- | libmisc/Makefile.in | 336 | ||||
-rw-r--r-- | libmisc/chkname.c | 7 | ||||
-rw-r--r-- | libmisc/find_new_gid.c | 2 | ||||
-rw-r--r-- | libmisc/find_new_uid.c | 2 | ||||
-rw-r--r-- | libmisc/getdate.c | 408 | ||||
-rw-r--r-- | libmisc/obscure.c | 3 | ||||
-rw-r--r-- | libmisc/prefix_flag.c | 18 | ||||
-rw-r--r-- | libmisc/salt.c | 123 |
9 files changed, 604 insertions, 297 deletions
diff --git a/libmisc/Makefile.am b/libmisc/Makefile.am index 9aed980f..7f43161f 100644 --- a/libmisc/Makefile.am +++ b/libmisc/Makefile.am @@ -1,7 +1,7 @@ EXTRA_DIST = .indent.pro xgetXXbyYY.c -AM_CPPFLAGS = -I$(top_srcdir)/lib +AM_CPPFLAGS = -I$(top_srcdir)/lib $(ECONF_CPPFLAGS) noinst_LIBRARIES = libmisc.a diff --git a/libmisc/Makefile.in b/libmisc/Makefile.in index b6a57ed3..b591961f 100644 --- a/libmisc/Makefile.in +++ b/libmisc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -160,7 +160,39 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/addgrps.Po ./$(DEPDIR)/age.Po \ + ./$(DEPDIR)/audit_help.Po ./$(DEPDIR)/basename.Po \ + ./$(DEPDIR)/btrfs.Po ./$(DEPDIR)/chkname.Po \ + ./$(DEPDIR)/chowndir.Po ./$(DEPDIR)/chowntty.Po \ + ./$(DEPDIR)/cleanup.Po ./$(DEPDIR)/cleanup_group.Po \ + ./$(DEPDIR)/cleanup_user.Po ./$(DEPDIR)/console.Po \ + ./$(DEPDIR)/copydir.Po ./$(DEPDIR)/entry.Po ./$(DEPDIR)/env.Po \ + ./$(DEPDIR)/failure.Po ./$(DEPDIR)/find_new_gid.Po \ + ./$(DEPDIR)/find_new_sub_gids.Po \ + ./$(DEPDIR)/find_new_sub_uids.Po ./$(DEPDIR)/find_new_uid.Po \ + ./$(DEPDIR)/getdate.Po ./$(DEPDIR)/getgr_nam_gid.Po \ + ./$(DEPDIR)/getrange.Po ./$(DEPDIR)/gettime.Po \ + ./$(DEPDIR)/hushed.Po ./$(DEPDIR)/idmapping.Po \ + ./$(DEPDIR)/isexpired.Po ./$(DEPDIR)/limits.Po \ + ./$(DEPDIR)/list.Po ./$(DEPDIR)/log.Po \ + ./$(DEPDIR)/loginprompt.Po ./$(DEPDIR)/mail.Po \ + ./$(DEPDIR)/motd.Po ./$(DEPDIR)/myname.Po \ + ./$(DEPDIR)/obscure.Po ./$(DEPDIR)/pam_pass.Po \ + ./$(DEPDIR)/pam_pass_non_interactive.Po \ + ./$(DEPDIR)/prefix_flag.Po ./$(DEPDIR)/pwd2spwd.Po \ + ./$(DEPDIR)/pwd_init.Po ./$(DEPDIR)/pwdcheck.Po \ + ./$(DEPDIR)/remove_tree.Po ./$(DEPDIR)/rlogin.Po \ + ./$(DEPDIR)/root_flag.Po ./$(DEPDIR)/salt.Po \ + ./$(DEPDIR)/setugid.Po ./$(DEPDIR)/setupenv.Po \ + ./$(DEPDIR)/shell.Po ./$(DEPDIR)/strtoday.Po \ + ./$(DEPDIR)/sub.Po ./$(DEPDIR)/sulog.Po ./$(DEPDIR)/ttytype.Po \ + ./$(DEPDIR)/tz.Po ./$(DEPDIR)/ulimit.Po \ + ./$(DEPDIR)/user_busy.Po ./$(DEPDIR)/utmp.Po \ + ./$(DEPDIR)/valid.Po ./$(DEPDIR)/xgetgrgid.Po \ + ./$(DEPDIR)/xgetgrnam.Po ./$(DEPDIR)/xgetpwnam.Po \ + ./$(DEPDIR)/xgetpwuid.Po ./$(DEPDIR)/xgetspnam.Po \ + ./$(DEPDIR)/xmalloc.Po ./$(DEPDIR)/yesno.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -246,6 +278,7 @@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +ECONF_CPPFLAGS = @ECONF_CPPFLAGS@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ @@ -268,6 +301,7 @@ LIBATTR = @LIBATTR@ LIBAUDIT = @LIBAUDIT@ LIBCRACK = @LIBCRACK@ LIBCRYPT = @LIBCRYPT@ +LIBECONF = @LIBECONF@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMD = @LIBMD@ @@ -313,6 +347,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ +VENDORDIR = @VENDORDIR@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ @@ -377,7 +412,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = .indent.pro xgetXXbyYY.c -AM_CPPFLAGS = -I$(top_srcdir)/lib +AM_CPPFLAGS = -I$(top_srcdir)/lib $(ECONF_CPPFLAGS) noinst_LIBRARIES = libmisc.a libmisc_a_SOURCES = addgrps.c age.c audit_help.c basename.c chkname.c \ chkname.h chowndir.c chowntty.c cleanup.c cleanup_group.c \ @@ -413,8 +448,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -440,70 +475,76 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addgrps.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/age.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audit_help.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btrfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkname.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chowndir.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chowntty.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup_group.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup_user.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/console.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copydir.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entry.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failure.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_gid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_sub_gids.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_sub_uids.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_uid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdate.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getgr_nam_gid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getrange.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettime.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hushed.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idmapping.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isexpired.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loginprompt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motd.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/myname.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obscure.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam_pass.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam_pass_non_interactive.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prefix_flag.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwd2spwd.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwd_init.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwdcheck.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remove_tree.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rlogin.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root_flag.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/salt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setugid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setupenv.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shell.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoday.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sulog.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttytype.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tz.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ulimit.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user_busy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utmp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/valid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetgrgid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetgrnam.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetpwnam.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetpwuid.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetspnam.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yesno.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addgrps.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/age.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audit_help.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btrfs.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkname.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chowndir.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chowntty.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup_group.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup_user.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/console.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copydir.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entry.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failure.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_gid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_sub_gids.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_sub_uids.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_uid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdate.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getgr_nam_gid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getrange.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettime.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hushed.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idmapping.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isexpired.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loginprompt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/myname.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obscure.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam_pass.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam_pass_non_interactive.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prefix_flag.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwd2spwd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwd_init.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwdcheck.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remove_tree.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rlogin.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root_flag.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/salt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setugid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setupenv.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shell.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoday.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sulog.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttytype.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tz.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ulimit.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user_busy.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utmp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/valid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetgrgid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetgrnam.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetpwnam.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetpwuid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetspnam.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yesno.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -587,7 +628,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -658,7 +702,70 @@ clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/addgrps.Po + -rm -f ./$(DEPDIR)/age.Po + -rm -f ./$(DEPDIR)/audit_help.Po + -rm -f ./$(DEPDIR)/basename.Po + -rm -f ./$(DEPDIR)/btrfs.Po + -rm -f ./$(DEPDIR)/chkname.Po + -rm -f ./$(DEPDIR)/chowndir.Po + -rm -f ./$(DEPDIR)/chowntty.Po + -rm -f ./$(DEPDIR)/cleanup.Po + -rm -f ./$(DEPDIR)/cleanup_group.Po + -rm -f ./$(DEPDIR)/cleanup_user.Po + -rm -f ./$(DEPDIR)/console.Po + -rm -f ./$(DEPDIR)/copydir.Po + -rm -f ./$(DEPDIR)/entry.Po + -rm -f ./$(DEPDIR)/env.Po + -rm -f ./$(DEPDIR)/failure.Po + -rm -f ./$(DEPDIR)/find_new_gid.Po + -rm -f ./$(DEPDIR)/find_new_sub_gids.Po + -rm -f ./$(DEPDIR)/find_new_sub_uids.Po + -rm -f ./$(DEPDIR)/find_new_uid.Po + -rm -f ./$(DEPDIR)/getdate.Po + -rm -f ./$(DEPDIR)/getgr_nam_gid.Po + -rm -f ./$(DEPDIR)/getrange.Po + -rm -f ./$(DEPDIR)/gettime.Po + -rm -f ./$(DEPDIR)/hushed.Po + -rm -f ./$(DEPDIR)/idmapping.Po + -rm -f ./$(DEPDIR)/isexpired.Po + -rm -f ./$(DEPDIR)/limits.Po + -rm -f ./$(DEPDIR)/list.Po + -rm -f ./$(DEPDIR)/log.Po + -rm -f ./$(DEPDIR)/loginprompt.Po + -rm -f ./$(DEPDIR)/mail.Po + -rm -f ./$(DEPDIR)/motd.Po + -rm -f ./$(DEPDIR)/myname.Po + -rm -f ./$(DEPDIR)/obscure.Po + -rm -f ./$(DEPDIR)/pam_pass.Po + -rm -f ./$(DEPDIR)/pam_pass_non_interactive.Po + -rm -f ./$(DEPDIR)/prefix_flag.Po + -rm -f ./$(DEPDIR)/pwd2spwd.Po + -rm -f ./$(DEPDIR)/pwd_init.Po + -rm -f ./$(DEPDIR)/pwdcheck.Po + -rm -f ./$(DEPDIR)/remove_tree.Po + -rm -f ./$(DEPDIR)/rlogin.Po + -rm -f ./$(DEPDIR)/root_flag.Po + -rm -f ./$(DEPDIR)/salt.Po + -rm -f ./$(DEPDIR)/setugid.Po + -rm -f ./$(DEPDIR)/setupenv.Po + -rm -f ./$(DEPDIR)/shell.Po + -rm -f ./$(DEPDIR)/strtoday.Po + -rm -f ./$(DEPDIR)/sub.Po + -rm -f ./$(DEPDIR)/sulog.Po + -rm -f ./$(DEPDIR)/ttytype.Po + -rm -f ./$(DEPDIR)/tz.Po + -rm -f ./$(DEPDIR)/ulimit.Po + -rm -f ./$(DEPDIR)/user_busy.Po + -rm -f ./$(DEPDIR)/utmp.Po + -rm -f ./$(DEPDIR)/valid.Po + -rm -f ./$(DEPDIR)/xgetgrgid.Po + -rm -f ./$(DEPDIR)/xgetgrnam.Po + -rm -f ./$(DEPDIR)/xgetpwnam.Po + -rm -f ./$(DEPDIR)/xgetpwuid.Po + -rm -f ./$(DEPDIR)/xgetspnam.Po + -rm -f ./$(DEPDIR)/xmalloc.Po + -rm -f ./$(DEPDIR)/yesno.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -704,7 +811,70 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/addgrps.Po + -rm -f ./$(DEPDIR)/age.Po + -rm -f ./$(DEPDIR)/audit_help.Po + -rm -f ./$(DEPDIR)/basename.Po + -rm -f ./$(DEPDIR)/btrfs.Po + -rm -f ./$(DEPDIR)/chkname.Po + -rm -f ./$(DEPDIR)/chowndir.Po + -rm -f ./$(DEPDIR)/chowntty.Po + -rm -f ./$(DEPDIR)/cleanup.Po + -rm -f ./$(DEPDIR)/cleanup_group.Po + -rm -f ./$(DEPDIR)/cleanup_user.Po + -rm -f ./$(DEPDIR)/console.Po + -rm -f ./$(DEPDIR)/copydir.Po + -rm -f ./$(DEPDIR)/entry.Po + -rm -f ./$(DEPDIR)/env.Po + -rm -f ./$(DEPDIR)/failure.Po + -rm -f ./$(DEPDIR)/find_new_gid.Po + -rm -f ./$(DEPDIR)/find_new_sub_gids.Po + -rm -f ./$(DEPDIR)/find_new_sub_uids.Po + -rm -f ./$(DEPDIR)/find_new_uid.Po + -rm -f ./$(DEPDIR)/getdate.Po + -rm -f ./$(DEPDIR)/getgr_nam_gid.Po + -rm -f ./$(DEPDIR)/getrange.Po + -rm -f ./$(DEPDIR)/gettime.Po + -rm -f ./$(DEPDIR)/hushed.Po + -rm -f ./$(DEPDIR)/idmapping.Po + -rm -f ./$(DEPDIR)/isexpired.Po + -rm -f ./$(DEPDIR)/limits.Po + -rm -f ./$(DEPDIR)/list.Po + -rm -f ./$(DEPDIR)/log.Po + -rm -f ./$(DEPDIR)/loginprompt.Po + -rm -f ./$(DEPDIR)/mail.Po + -rm -f ./$(DEPDIR)/motd.Po + -rm -f ./$(DEPDIR)/myname.Po + -rm -f ./$(DEPDIR)/obscure.Po + -rm -f ./$(DEPDIR)/pam_pass.Po + -rm -f ./$(DEPDIR)/pam_pass_non_interactive.Po + -rm -f ./$(DEPDIR)/prefix_flag.Po + -rm -f ./$(DEPDIR)/pwd2spwd.Po + -rm -f ./$(DEPDIR)/pwd_init.Po + -rm -f ./$(DEPDIR)/pwdcheck.Po + -rm -f ./$(DEPDIR)/remove_tree.Po + -rm -f ./$(DEPDIR)/rlogin.Po + -rm -f ./$(DEPDIR)/root_flag.Po + -rm -f ./$(DEPDIR)/salt.Po + -rm -f ./$(DEPDIR)/setugid.Po + -rm -f ./$(DEPDIR)/setupenv.Po + -rm -f ./$(DEPDIR)/shell.Po + -rm -f ./$(DEPDIR)/strtoday.Po + -rm -f ./$(DEPDIR)/sub.Po + -rm -f ./$(DEPDIR)/sulog.Po + -rm -f ./$(DEPDIR)/ttytype.Po + -rm -f ./$(DEPDIR)/tz.Po + -rm -f ./$(DEPDIR)/ulimit.Po + -rm -f ./$(DEPDIR)/user_busy.Po + -rm -f ./$(DEPDIR)/utmp.Po + -rm -f ./$(DEPDIR)/valid.Po + -rm -f ./$(DEPDIR)/xgetgrgid.Po + -rm -f ./$(DEPDIR)/xgetgrnam.Po + -rm -f ./$(DEPDIR)/xgetpwnam.Po + -rm -f ./$(DEPDIR)/xgetpwuid.Po + -rm -f ./$(DEPDIR)/xgetspnam.Po + -rm -f ./$(DEPDIR)/xmalloc.Po + -rm -f ./$(DEPDIR)/yesno.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -725,16 +895,16 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff --git a/libmisc/chkname.c b/libmisc/chkname.c index 64f5580c..bdd1e72a 100644 --- a/libmisc/chkname.c +++ b/libmisc/chkname.c @@ -46,11 +46,18 @@ #include "defines.h" #include "chkname.h" +int allow_bad_names = false; + static bool is_valid_name (const char *name) { + if (allow_bad_names) { + return true; + } + /* * User/group names must match [a-z_][a-z0-9_-]*[$] */ + if (('\0' == *name) || !((('a' <= *name) && ('z' >= *name)) || ('_' == *name))) { return false; diff --git a/libmisc/find_new_gid.c b/libmisc/find_new_gid.c index d8764087..f93b4a37 100644 --- a/libmisc/find_new_gid.c +++ b/libmisc/find_new_gid.c @@ -167,7 +167,7 @@ int find_new_gid (bool sys_group, bool *used_gids; const struct group *grp; gid_t gid_min, gid_max, preferred_min; - gid_t group_id, id; + gid_t id; gid_t lowest_found, highest_found; int result; int nospam = 0; diff --git a/libmisc/find_new_uid.c b/libmisc/find_new_uid.c index d01f79b1..743cf0a5 100644 --- a/libmisc/find_new_uid.c +++ b/libmisc/find_new_uid.c @@ -167,7 +167,7 @@ int find_new_uid(bool sys_user, bool *used_uids; const struct passwd *pwd; uid_t uid_min, uid_max, preferred_min; - uid_t user_id, id; + uid_t id; uid_t lowest_found, highest_found; int result; int nospam = 0; diff --git a/libmisc/getdate.c b/libmisc/getdate.c index 390f9efd..b36188f6 100644 --- a/libmisc/getdate.c +++ b/libmisc/getdate.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.4.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Inc. 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 @@ -40,11 +41,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.4" +#define YYBISON_VERSION "3.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -61,8 +65,8 @@ -/* Copy the first part of user declarations. */ -#line 1 "getdate.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 1 "getdate.y" /* ** Originally written by Steven M. Bellovin <smb@research.att.com> while @@ -233,13 +237,17 @@ static int yyRelSeconds; static int yyRelYear; -#line 237 "getdate.c" /* yacc.c:339 */ +#line 241 "getdate.c" # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif @@ -303,17 +311,16 @@ extern int yydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { -#line 172 "getdate.y" /* yacc.c:355 */ +#line 172 "getdate.y" int Number; enum _MERIDIAN Meridian; -#line 315 "getdate.c" /* yacc.c:355 */ -}; +#line 322 "getdate.c" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -326,9 +333,7 @@ int yyparse (void); -/* Copy the second part of user declarations. */ -#line 332 "getdate.c" /* yacc.c:358 */ #ifdef short # undef short @@ -349,13 +354,13 @@ typedef signed char yytype_int8; #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef unsigned short yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef short yytype_int16; #endif #ifndef YYSIZE_T @@ -367,7 +372,7 @@ typedef short int yytype_int16; # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif @@ -403,15 +408,6 @@ typedef short int yytype_int16; # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -419,7 +415,7 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ @@ -439,6 +435,8 @@ typedef short int yytype_int16; #endif +#define YY_ASSERT(E) ((void) (0 && (E))) + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -581,16 +579,16 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 61 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 273 +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ + as returned by yylex. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -782,22 +780,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -837,37 +835,37 @@ do { \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -901,7 +899,7 @@ do { \ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + unsigned long yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", @@ -912,7 +910,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); } @@ -1016,7 +1014,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -1034,7 +1035,7 @@ yytnamerr (char *yyres, const char *yystr) if (! yyres) return yystrlen (yystr); - return yystpcpy (yyres, yystr) - yyres; + return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -1112,10 +1113,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -1127,6 +1128,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1138,9 +1140,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1266,23 +1269,33 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yynewstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + *yyssp = (yytype_int16) yystate; if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into @@ -1298,14 +1311,10 @@ yyparse (void) &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1321,35 +1330,33 @@ yyparse (void) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1407,7 +1414,6 @@ yybackup: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END - goto yynewstate; @@ -1422,7 +1428,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1442,70 +1448,70 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 4: -#line 192 "getdate.y" /* yacc.c:1646 */ + case 4: +#line 192 "getdate.y" { yyHaveTime++; } -#line 1451 "getdate.c" /* yacc.c:1646 */ +#line 1457 "getdate.c" break; case 5: -#line 195 "getdate.y" /* yacc.c:1646 */ +#line 195 "getdate.y" { yyHaveZone++; } -#line 1459 "getdate.c" /* yacc.c:1646 */ +#line 1465 "getdate.c" break; case 6: -#line 198 "getdate.y" /* yacc.c:1646 */ +#line 198 "getdate.y" { yyHaveDate++; } -#line 1467 "getdate.c" /* yacc.c:1646 */ +#line 1473 "getdate.c" break; case 7: -#line 201 "getdate.y" /* yacc.c:1646 */ +#line 201 "getdate.y" { yyHaveDay++; } -#line 1475 "getdate.c" /* yacc.c:1646 */ +#line 1481 "getdate.c" break; case 8: -#line 204 "getdate.y" /* yacc.c:1646 */ +#line 204 "getdate.y" { yyHaveRel++; } -#line 1483 "getdate.c" /* yacc.c:1646 */ +#line 1489 "getdate.c" break; case 10: -#line 210 "getdate.y" /* yacc.c:1646 */ +#line 210 "getdate.y" { yyHour = (yyvsp[-1].Number); yyMinutes = 0; yySeconds = 0; yyMeridian = (yyvsp[0].Meridian); } -#line 1494 "getdate.c" /* yacc.c:1646 */ +#line 1500 "getdate.c" break; case 11: -#line 216 "getdate.y" /* yacc.c:1646 */ +#line 216 "getdate.y" { yyHour = (yyvsp[-3].Number); yyMinutes = (yyvsp[-1].Number); yySeconds = 0; yyMeridian = (yyvsp[0].Meridian); } -#line 1505 "getdate.c" /* yacc.c:1646 */ +#line 1511 "getdate.c" break; case 12: -#line 222 "getdate.y" /* yacc.c:1646 */ +#line 222 "getdate.y" { yyHour = (yyvsp[-3].Number); yyMinutes = (yyvsp[-1].Number); @@ -1515,22 +1521,22 @@ yyreduce: ? -(yyvsp[0].Number) % 100 + (-(yyvsp[0].Number) / 100) * 60 : - ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60)); } -#line 1519 "getdate.c" /* yacc.c:1646 */ +#line 1525 "getdate.c" break; case 13: -#line 231 "getdate.y" /* yacc.c:1646 */ +#line 231 "getdate.y" { yyHour = (yyvsp[-5].Number); yyMinutes = (yyvsp[-3].Number); yySeconds = (yyvsp[-1].Number); yyMeridian = (yyvsp[0].Meridian); } -#line 1530 "getdate.c" /* yacc.c:1646 */ +#line 1536 "getdate.c" break; case 14: -#line 237 "getdate.y" /* yacc.c:1646 */ +#line 237 "getdate.y" { yyHour = (yyvsp[-5].Number); yyMinutes = (yyvsp[-3].Number); @@ -1541,71 +1547,71 @@ yyreduce: ? -(yyvsp[0].Number) % 100 + (-(yyvsp[0].Number) / 100) * 60 : - ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60)); } -#line 1545 "getdate.c" /* yacc.c:1646 */ +#line 1551 "getdate.c" break; case 15: -#line 249 "getdate.y" /* yacc.c:1646 */ +#line 249 "getdate.y" { yyTimezone = (yyvsp[0].Number); } -#line 1553 "getdate.c" /* yacc.c:1646 */ +#line 1559 "getdate.c" break; case 16: -#line 252 "getdate.y" /* yacc.c:1646 */ +#line 252 "getdate.y" { yyTimezone = (yyvsp[0].Number) - 60; } -#line 1561 "getdate.c" /* yacc.c:1646 */ +#line 1567 "getdate.c" break; case 17: -#line 256 "getdate.y" /* yacc.c:1646 */ +#line 256 "getdate.y" { yyTimezone = (yyvsp[-1].Number) - 60; } -#line 1569 "getdate.c" /* yacc.c:1646 */ +#line 1575 "getdate.c" break; case 18: -#line 261 "getdate.y" /* yacc.c:1646 */ +#line 261 "getdate.y" { yyDayOrdinal = 1; yyDayNumber = (yyvsp[0].Number); } -#line 1578 "getdate.c" /* yacc.c:1646 */ +#line 1584 "getdate.c" break; case 19: -#line 265 "getdate.y" /* yacc.c:1646 */ +#line 265 "getdate.y" { yyDayOrdinal = 1; yyDayNumber = (yyvsp[-1].Number); } -#line 1587 "getdate.c" /* yacc.c:1646 */ +#line 1593 "getdate.c" break; case 20: -#line 269 "getdate.y" /* yacc.c:1646 */ +#line 269 "getdate.y" { yyDayOrdinal = (yyvsp[-1].Number); yyDayNumber = (yyvsp[0].Number); } -#line 1596 "getdate.c" /* yacc.c:1646 */ +#line 1602 "getdate.c" break; case 21: -#line 275 "getdate.y" /* yacc.c:1646 */ +#line 275 "getdate.y" { yyMonth = (yyvsp[-2].Number); yyDay = (yyvsp[0].Number); } -#line 1605 "getdate.c" /* yacc.c:1646 */ +#line 1611 "getdate.c" break; case 22: -#line 279 "getdate.y" /* yacc.c:1646 */ +#line 279 "getdate.y" { /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY. The goal in recognizing YYYY/MM/DD is solely to support legacy @@ -1624,71 +1630,71 @@ yyreduce: yyYear = (yyvsp[0].Number); } } -#line 1628 "getdate.c" /* yacc.c:1646 */ +#line 1634 "getdate.c" break; case 23: -#line 297 "getdate.y" /* yacc.c:1646 */ +#line 297 "getdate.y" { /* ISO 8601 format. yyyy-mm-dd. */ yyYear = (yyvsp[-2].Number); yyMonth = -(yyvsp[-1].Number); yyDay = -(yyvsp[0].Number); } -#line 1639 "getdate.c" /* yacc.c:1646 */ +#line 1645 "getdate.c" break; case 24: -#line 303 "getdate.y" /* yacc.c:1646 */ +#line 303 "getdate.y" { /* e.g. 17-JUN-1992. */ yyDay = (yyvsp[-2].Number); yyMonth = (yyvsp[-1].Number); yyYear = -(yyvsp[0].Number); } -#line 1650 "getdate.c" /* yacc.c:1646 */ +#line 1656 "getdate.c" break; case 25: -#line 309 "getdate.y" /* yacc.c:1646 */ +#line 309 "getdate.y" { yyMonth = (yyvsp[-1].Number); yyDay = (yyvsp[0].Number); } -#line 1659 "getdate.c" /* yacc.c:1646 */ +#line 1665 "getdate.c" break; case 26: -#line 313 "getdate.y" /* yacc.c:1646 */ +#line 313 "getdate.y" { yyMonth = (yyvsp[-3].Number); yyDay = (yyvsp[-2].Number); yyYear = (yyvsp[0].Number); } -#line 1669 "getdate.c" /* yacc.c:1646 */ +#line 1675 "getdate.c" break; case 27: -#line 318 "getdate.y" /* yacc.c:1646 */ +#line 318 "getdate.y" { yyMonth = (yyvsp[0].Number); yyDay = (yyvsp[-1].Number); } -#line 1678 "getdate.c" /* yacc.c:1646 */ +#line 1684 "getdate.c" break; case 28: -#line 322 "getdate.y" /* yacc.c:1646 */ +#line 322 "getdate.y" { yyMonth = (yyvsp[-1].Number); yyDay = (yyvsp[-2].Number); yyYear = (yyvsp[0].Number); } -#line 1688 "getdate.c" /* yacc.c:1646 */ +#line 1694 "getdate.c" break; case 29: -#line 329 "getdate.y" /* yacc.c:1646 */ +#line 329 "getdate.y" { yyRelSeconds = -yyRelSeconds; yyRelMinutes = -yyRelMinutes; @@ -1697,155 +1703,155 @@ yyreduce: yyRelMonth = -yyRelMonth; yyRelYear = -yyRelYear; } -#line 1701 "getdate.c" /* yacc.c:1646 */ +#line 1707 "getdate.c" break; case 31: -#line 340 "getdate.y" /* yacc.c:1646 */ +#line 340 "getdate.y" { yyRelYear += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1709 "getdate.c" /* yacc.c:1646 */ +#line 1715 "getdate.c" break; case 32: -#line 343 "getdate.y" /* yacc.c:1646 */ +#line 343 "getdate.y" { yyRelYear += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1717 "getdate.c" /* yacc.c:1646 */ +#line 1723 "getdate.c" break; case 33: -#line 346 "getdate.y" /* yacc.c:1646 */ +#line 346 "getdate.y" { yyRelYear++; } -#line 1725 "getdate.c" /* yacc.c:1646 */ +#line 1731 "getdate.c" break; case 34: -#line 349 "getdate.y" /* yacc.c:1646 */ +#line 349 "getdate.y" { yyRelMonth += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1733 "getdate.c" /* yacc.c:1646 */ +#line 1739 "getdate.c" break; case 35: -#line 352 "getdate.y" /* yacc.c:1646 */ +#line 352 "getdate.y" { yyRelMonth += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1741 "getdate.c" /* yacc.c:1646 */ +#line 1747 "getdate.c" break; case 36: -#line 355 "getdate.y" /* yacc.c:1646 */ +#line 355 "getdate.y" { yyRelMonth++; } -#line 1749 "getdate.c" /* yacc.c:1646 */ +#line 1755 "getdate.c" break; case 37: -#line 358 "getdate.y" /* yacc.c:1646 */ +#line 358 "getdate.y" { yyRelDay += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1757 "getdate.c" /* yacc.c:1646 */ +#line 1763 "getdate.c" break; case 38: -#line 361 "getdate.y" /* yacc.c:1646 */ +#line 361 "getdate.y" { yyRelDay += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1765 "getdate.c" /* yacc.c:1646 */ +#line 1771 "getdate.c" break; case 39: -#line 364 "getdate.y" /* yacc.c:1646 */ +#line 364 "getdate.y" { yyRelDay++; } -#line 1773 "getdate.c" /* yacc.c:1646 */ +#line 1779 "getdate.c" break; case 40: -#line 367 "getdate.y" /* yacc.c:1646 */ +#line 367 "getdate.y" { yyRelHour += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1781 "getdate.c" /* yacc.c:1646 */ +#line 1787 "getdate.c" break; case 41: -#line 370 "getdate.y" /* yacc.c:1646 */ +#line 370 "getdate.y" { yyRelHour += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1789 "getdate.c" /* yacc.c:1646 */ +#line 1795 "getdate.c" break; case 42: -#line 373 "getdate.y" /* yacc.c:1646 */ +#line 373 "getdate.y" { yyRelHour++; } -#line 1797 "getdate.c" /* yacc.c:1646 */ +#line 1803 "getdate.c" break; case 43: -#line 376 "getdate.y" /* yacc.c:1646 */ +#line 376 "getdate.y" { yyRelMinutes += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1805 "getdate.c" /* yacc.c:1646 */ +#line 1811 "getdate.c" break; case 44: -#line 379 "getdate.y" /* yacc.c:1646 */ +#line 379 "getdate.y" { yyRelMinutes += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1813 "getdate.c" /* yacc.c:1646 */ +#line 1819 "getdate.c" break; case 45: -#line 382 "getdate.y" /* yacc.c:1646 */ +#line 382 "getdate.y" { yyRelMinutes++; } -#line 1821 "getdate.c" /* yacc.c:1646 */ +#line 1827 "getdate.c" break; case 46: -#line 385 "getdate.y" /* yacc.c:1646 */ +#line 385 "getdate.y" { yyRelSeconds += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1829 "getdate.c" /* yacc.c:1646 */ +#line 1835 "getdate.c" break; case 47: -#line 388 "getdate.y" /* yacc.c:1646 */ +#line 388 "getdate.y" { yyRelSeconds += (yyvsp[-1].Number) * (yyvsp[0].Number); } -#line 1837 "getdate.c" /* yacc.c:1646 */ +#line 1843 "getdate.c" break; case 48: -#line 391 "getdate.y" /* yacc.c:1646 */ +#line 391 "getdate.y" { yyRelSeconds++; } -#line 1845 "getdate.c" /* yacc.c:1646 */ +#line 1851 "getdate.c" break; case 49: -#line 397 "getdate.y" /* yacc.c:1646 */ +#line 397 "getdate.y" { if ((yyHaveTime != 0) && (yyHaveDate != 0) && (yyHaveRel == 0)) yyYear = (yyvsp[0].Number); @@ -1876,27 +1882,28 @@ yyreduce: } } } -#line 1880 "getdate.c" /* yacc.c:1646 */ +#line 1886 "getdate.c" break; case 50: -#line 430 "getdate.y" /* yacc.c:1646 */ +#line 430 "getdate.y" { (yyval.Meridian) = MER24; } -#line 1888 "getdate.c" /* yacc.c:1646 */ +#line 1894 "getdate.c" break; case 51: -#line 434 "getdate.y" /* yacc.c:1646 */ +#line 434 "getdate.y" { (yyval.Meridian) = (yyvsp[0].Meridian); } -#line 1896 "getdate.c" /* yacc.c:1646 */ +#line 1902 "getdate.c" break; -#line 1900 "getdate.c" /* yacc.c:1646 */ +#line 1906 "getdate.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1921,14 +1928,13 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -2011,12 +2017,10 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2078,6 +2082,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2085,6 +2090,7 @@ yyabortlab: yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -2095,6 +2101,10 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -2124,7 +2134,7 @@ yyreturn: #endif return yyresult; } -#line 439 "getdate.y" /* yacc.c:1906 */ +#line 439 "getdate.y" /* Month and day table. */ diff --git a/libmisc/obscure.c b/libmisc/obscure.c index a0751237..15da7603 100644 --- a/libmisc/obscure.c +++ b/libmisc/obscure.c @@ -269,6 +269,9 @@ static /*@observer@*//*@null@*/const char *obscure_msg ( || (strcmp (result, "SHA256") == 0) || (strcmp (result, "SHA512") == 0) #endif +#ifdef USE_BCRYPT + || (strcmp (result, "BCRYPT") == 0) +#endif ) { return NULL; } diff --git a/libmisc/prefix_flag.c b/libmisc/prefix_flag.c index cd1eec47..4fe6d195 100644 --- a/libmisc/prefix_flag.c +++ b/libmisc/prefix_flag.c @@ -96,7 +96,7 @@ extern const char* process_prefix_flag (const char* short_opt, int argc, char ** } } - + if (prefix != NULL) { if ( prefix[0] == '\0' || !strcmp(prefix, "/")) @@ -113,7 +113,7 @@ extern const char* process_prefix_flag (const char* short_opt, int argc, char ** group_db_file = xmalloc(len); snprintf(group_db_file, len, "%s/%s", prefix, GROUP_FILE); gr_setdbname(group_db_file); - + #ifdef SHADOWGRP len = strlen(prefix) + strlen(SGROUP_FILE) + 2; sgroup_db_file = xmalloc(len); @@ -128,7 +128,7 @@ extern const char* process_prefix_flag (const char* short_opt, int argc, char ** spw_db_file = xmalloc(len); snprintf(spw_db_file, len, "%s/%s", prefix, SHADOW_FILE); spw_setdbname(spw_db_file); - + #ifdef ENABLE_SUBIDS len = strlen(prefix) + strlen("/etc/subuid") + 2; suid_db_file = xmalloc(len); @@ -141,11 +141,15 @@ extern const char* process_prefix_flag (const char* short_opt, int argc, char ** sub_gid_setdbname(sgid_db_file); #endif +#ifdef USE_ECONF + setdef_config_file(prefix); +#else len = strlen(prefix) + strlen("/etc/login.defs") + 2; def_conf_file = xmalloc(len); snprintf(def_conf_file, len, "%s/%s", prefix, "/etc/login.defs"); setdef_config_file(def_conf_file); - } +#endif + } if (prefix == NULL) return ""; @@ -169,7 +173,7 @@ extern struct group *prefix_getgrnam(const char *name) fclose(fg); return grp; } - + return getgrnam(name); } @@ -262,7 +266,7 @@ extern void prefix_setpwent() } if (fp_pwent) fclose (fp_pwent); - + fp_pwent = fopen(passwd_db_file, "rt"); if(!fp_pwent) return; @@ -293,7 +297,7 @@ extern void prefix_setgrent() } if (fp_grent) fclose (fp_grent); - + fp_grent = fopen(group_db_file, "rt"); if(!fp_grent) return; diff --git a/libmisc/salt.c b/libmisc/salt.c index c72447ea..e1a7ac80 100644 --- a/libmisc/salt.c +++ b/libmisc/salt.c @@ -22,10 +22,16 @@ /* local function prototypes */ static void seedRNG (void); static /*@observer@*/const char *gensalt (size_t salt_size); -#ifdef USE_SHA_CRYPT +#if defined(USE_SHA_CRYPT) || defined(USE_BCRYPT) static long shadow_random (long min, long max); +#endif /* USE_SHA_CRYPT || USE_BCRYPT */ +#ifdef USE_SHA_CRYPT static /*@observer@*/const char *SHA_salt_rounds (/*@null@*/int *prefered_rounds); #endif /* USE_SHA_CRYPT */ +#ifdef USE_BCRYPT +static /*@observer@*/const char *gensalt_bcrypt (void); +static /*@observer@*/const char *BCRYPT_salt_rounds (/*@null@*/int *prefered_rounds); +#endif /* USE_BCRYPT */ #ifndef HAVE_L64A static /*@observer@*/char *l64a(long value) @@ -79,8 +85,16 @@ static void seedRNG (void) * Add the salt prefix. */ #define MAGNUM(array,ch) (array)[0]=(array)[2]='$',(array)[1]=(ch),(array)[3]='\0' +#ifdef USE_BCRYPT +/* + * Using the Prefix $2a$ to enable an anti-collision safety measure in musl libc. + * Negatively affects a subset of passwords containing the '\xff' character, + * which is not valid UTF-8 (so "unlikely to cause much annoyance"). + */ +#define BCRYPTMAGNUM(array) (array)[0]=(array)[3]='$',(array)[1]='2',(array)[2]='a',(array)[4]='\0' +#endif /* USE_BCRYPT */ -#ifdef USE_SHA_CRYPT +#if defined(USE_SHA_CRYPT) || defined(USE_BCRYPT) /* It is not clear what is the maximum value of random(). * We assume 2^31-1.*/ #define RANDOM_MAX 0x7FFFFFFF @@ -105,14 +119,15 @@ static long shadow_random (long min, long max) } return ret; } +#endif /* USE_SHA_CRYPT || USE_BCRYPT */ +#ifdef USE_SHA_CRYPT /* Default number of rounds if not explicitly specified. */ #define ROUNDS_DEFAULT 5000 /* Minimum number of rounds. */ #define ROUNDS_MIN 1000 /* Maximum number of rounds. */ #define ROUNDS_MAX 999999999 - /* * Return a salt prefix specifying the rounds number for the SHA crypt methods. */ @@ -165,6 +180,89 @@ static /*@observer@*/const char *SHA_salt_rounds (/*@null@*/int *prefered_rounds } #endif /* USE_SHA_CRYPT */ +#ifdef USE_BCRYPT +/* Default number of rounds if not explicitly specified. */ +#define B_ROUNDS_DEFAULT 13 +/* Minimum number of rounds. */ +#define B_ROUNDS_MIN 4 +/* Maximum number of rounds. */ +#define B_ROUNDS_MAX 31 +/* + * Return a salt prefix specifying the rounds number for the BCRYPT method. + */ +static /*@observer@*/const char *BCRYPT_salt_rounds (/*@null@*/int *prefered_rounds) +{ + static char rounds_prefix[4]; /* Max size: 31$ */ + long rounds; + + if (NULL == prefered_rounds) { + long min_rounds = getdef_long ("BCRYPT_MIN_ROUNDS", -1); + long max_rounds = getdef_long ("BCRYPT_MAX_ROUNDS", -1); + + if (((-1 == min_rounds) && (-1 == max_rounds)) || (0 == *prefered_rounds)) { + rounds = B_ROUNDS_DEFAULT; + } + else { + if (-1 == min_rounds) { + min_rounds = max_rounds; + } + + if (-1 == max_rounds) { + max_rounds = min_rounds; + } + + if (min_rounds > max_rounds) { + max_rounds = min_rounds; + } + + rounds = shadow_random (min_rounds, max_rounds); + } + } else { + rounds = *prefered_rounds; + } + + /* + * Sanity checks. + * Use 19 as an upper bound for now, + * because musl doesn't allow rounds >= 20. + */ + if (rounds < B_ROUNDS_MIN) { + rounds = B_ROUNDS_MIN; + } + + if (rounds > 19) { + /* rounds = B_ROUNDS_MAX; */ + rounds = 19; + } + + (void) snprintf (rounds_prefix, sizeof rounds_prefix, + "%2.2ld$", rounds); + + return rounds_prefix; +} + +#define BCRYPT_SALT_SIZE 22 +/* + * Generate a 22 character salt string for bcrypt. + */ +static /*@observer@*/const char *gensalt_bcrypt (void) +{ + static char salt[32]; + + salt[0] = '\0'; + + seedRNG (); + strcat (salt, l64a (random())); + do { + strcat (salt, l64a (random())); + } while (strlen (salt) < BCRYPT_SALT_SIZE); + + salt[BCRYPT_SALT_SIZE] = '\0'; + + return salt; +} +#endif /* USE_BCRYPT */ + /* * Generate salt of size salt_size. */ @@ -230,6 +328,11 @@ static /*@observer@*/const char *gensalt (size_t salt_size) if (0 == strcmp (method, "MD5")) { MAGNUM(result, '1'); +#ifdef USE_BCRYPT + } else if (0 == strcmp (method, "BCRYPT")) { + BCRYPTMAGNUM(result); + strcat(result, BCRYPT_salt_rounds((int *)arg)); +#endif /* USE_BCRYPT */ #ifdef USE_SHA_CRYPT } else if (0 == strcmp (method, "SHA256")) { MAGNUM(result, '5'); @@ -252,8 +355,18 @@ static /*@observer@*/const char *gensalt (size_t salt_size) * Concatenate a pseudo random salt. */ assert (sizeof (result) > strlen (result) + salt_len); - strncat (result, gensalt (salt_len), - sizeof (result) - strlen (result) - 1); +#ifdef USE_BCRYPT + if (0 == strcmp (method, "BCRYPT")) { + strncat (result, gensalt_bcrypt (), + sizeof (result) - strlen (result) - 1); + return result; + } else { +#endif /* USE_BCRYPT */ + strncat (result, gensalt (salt_len), + sizeof (result) - strlen (result) - 1); +#ifdef USE_BCRYPT + } +#endif /* USE_BCRYPT */ return result; } |