From 0c04b92a9afe5e09a20307d8a5ec98d97ed00f47 Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 21 Jan 2022 23:41:15 +0100 Subject: New upstream version 4.11.1+dfsg1 --- libmisc/Makefile.am | 3 +- libmisc/Makefile.in | 388 +++++++++++++------ libmisc/addgrps.c | 35 +- libmisc/age.c | 33 +- libmisc/audit_help.c | 36 +- libmisc/basename.c | 31 +- libmisc/chkname.c | 33 +- libmisc/chkname.h | 33 +- libmisc/chowndir.c | 33 +- libmisc/chowntty.c | 35 +- libmisc/cleanup.c | 27 +- libmisc/cleanup_group.c | 52 +-- libmisc/cleanup_user.c | 44 +-- libmisc/console.c | 35 +- libmisc/copydir.c | 47 +-- libmisc/date_to_str.c | 46 +++ libmisc/entry.c | 33 +- libmisc/env.c | 36 +- libmisc/failure.c | 58 +-- libmisc/failure.h | 33 +- libmisc/find_new_gid.c | 70 ++-- libmisc/find_new_sub_gids.c | 37 +- libmisc/find_new_sub_uids.c | 37 +- libmisc/find_new_uid.c | 70 ++-- libmisc/getdate.c | 766 +++++++++++++++++++++---------------- libmisc/getdate.h | 31 +- libmisc/getdate.y | 2 +- libmisc/getgr_nam_gid.c | 33 +- libmisc/getrange.c | 27 +- libmisc/gettime.c | 29 +- libmisc/hushed.c | 37 +- libmisc/idmapping.c | 70 ++-- libmisc/idmapping.h | 27 +- libmisc/isexpired.c | 33 +- libmisc/limits.c | 40 +- libmisc/list.c | 31 +- libmisc/log.c | 35 +- libmisc/loginprompt.c | 35 +- libmisc/mail.c | 33 +- libmisc/motd.c | 35 +- libmisc/myname.c | 31 +- libmisc/obscure.c | 33 +- libmisc/pam_pass.c | 33 +- libmisc/pam_pass_non_interactive.c | 46 +-- libmisc/prefix_flag.c | 91 ++--- libmisc/pwd2spwd.c | 33 +- libmisc/pwd_init.c | 33 +- libmisc/pwdcheck.c | 32 +- libmisc/remove_tree.c | 33 +- libmisc/rlogin.c | 33 +- libmisc/root_flag.c | 58 +-- libmisc/salt.c | 35 +- libmisc/setugid.c | 33 +- libmisc/setupenv.c | 36 +- libmisc/shell.c | 33 +- libmisc/strtoday.c | 33 +- libmisc/sub.c | 31 +- libmisc/sulog.c | 33 +- libmisc/ttytype.c | 33 +- libmisc/tz.c | 35 +- libmisc/ulimit.c | 33 +- libmisc/user_busy.c | 46 +-- libmisc/utmp.c | 33 +- libmisc/valid.c | 33 +- libmisc/xgetXXbyYY.c | 34 +- libmisc/xgetgrgid.c | 27 +- libmisc/xgetgrnam.c | 27 +- libmisc/xgetpwnam.c | 27 +- libmisc/xgetpwuid.c | 27 +- libmisc/xgetspnam.c | 27 +- libmisc/xmalloc.c | 38 +- libmisc/yesno.c | 29 +- 72 files changed, 1254 insertions(+), 2434 deletions(-) create mode 100644 libmisc/date_to_str.c (limited to 'libmisc') diff --git a/libmisc/Makefile.am b/libmisc/Makefile.am index 9766a7ec..3d319cd8 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 $(ECONF_CPPFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir) $(ECONF_CPPFLAGS) noinst_LTLIBRARIES = libmisc.la @@ -19,6 +19,7 @@ libmisc_la_SOURCES = \ cleanup_user.c \ console.c \ copydir.c \ + date_to_str.c \ entry.c \ env.c \ failure.c \ diff --git a/libmisc/Makefile.in b/libmisc/Makefile.in index e957ddee..71c68707 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, @@ -110,22 +110,23 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) libmisc_la_LIBADD = am__libmisc_la_SOURCES_DIST = addgrps.c age.c audit_help.c basename.c \ chkname.c chkname.h chowndir.c chowntty.c cleanup.c \ - cleanup_group.c cleanup_user.c console.c copydir.c entry.c \ - env.c failure.c failure.h find_new_gid.c find_new_uid.c \ - find_new_sub_gids.c find_new_sub_uids.c getdate.h getdate.y \ - getgr_nam_gid.c getrange.c gettime.c hushed.c idmapping.h \ - idmapping.c isexpired.c limits.c list.c log.c loginprompt.c \ - mail.c motd.c myname.c obscure.c pam_pass.c \ - pam_pass_non_interactive.c prefix_flag.c pwd2spwd.c pwdcheck.c \ - pwd_init.c remove_tree.c rlogin.c root_flag.c salt.c setugid.c \ - setupenv.c shell.c strtoday.c sub.c sulog.c ttytype.c tz.c \ - ulimit.c user_busy.c utmp.c valid.c xgetpwnam.c xgetpwuid.c \ - xgetgrnam.c xgetgrgid.c xgetspnam.c xmalloc.c yesno.c btrfs.c + cleanup_group.c cleanup_user.c console.c copydir.c \ + date_to_str.c entry.c env.c failure.c failure.h find_new_gid.c \ + find_new_uid.c find_new_sub_gids.c find_new_sub_uids.c \ + getdate.h getdate.y getgr_nam_gid.c getrange.c gettime.c \ + hushed.c idmapping.h idmapping.c isexpired.c limits.c list.c \ + log.c loginprompt.c mail.c motd.c myname.c obscure.c \ + pam_pass.c pam_pass_non_interactive.c prefix_flag.c pwd2spwd.c \ + pwdcheck.c pwd_init.c remove_tree.c rlogin.c root_flag.c \ + salt.c setugid.c setupenv.c shell.c strtoday.c sub.c sulog.c \ + ttytype.c tz.c ulimit.c user_busy.c utmp.c valid.c xgetpwnam.c \ + xgetpwuid.c xgetgrnam.c xgetgrgid.c xgetspnam.c xmalloc.c \ + yesno.c btrfs.c @WITH_BTRFS_TRUE@am__objects_1 = btrfs.lo am_libmisc_la_OBJECTS = addgrps.lo age.lo audit_help.lo basename.lo \ chkname.lo chowndir.lo chowntty.lo cleanup.lo cleanup_group.lo \ - cleanup_user.lo console.lo copydir.lo entry.lo env.lo \ - failure.lo find_new_gid.lo find_new_uid.lo \ + cleanup_user.lo console.lo copydir.lo date_to_str.lo entry.lo \ + env.lo failure.lo find_new_gid.lo find_new_uid.lo \ find_new_sub_gids.lo find_new_sub_uids.lo getdate.lo \ getgr_nam_gid.lo getrange.lo gettime.lo hushed.lo idmapping.lo \ isexpired.lo limits.lo list.lo log.lo loginprompt.lo mail.lo \ @@ -155,7 +156,41 @@ 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.Plo ./$(DEPDIR)/age.Plo \ + ./$(DEPDIR)/audit_help.Plo ./$(DEPDIR)/basename.Plo \ + ./$(DEPDIR)/btrfs.Plo ./$(DEPDIR)/chkname.Plo \ + ./$(DEPDIR)/chowndir.Plo ./$(DEPDIR)/chowntty.Plo \ + ./$(DEPDIR)/cleanup.Plo ./$(DEPDIR)/cleanup_group.Plo \ + ./$(DEPDIR)/cleanup_user.Plo ./$(DEPDIR)/console.Plo \ + ./$(DEPDIR)/copydir.Plo ./$(DEPDIR)/date_to_str.Plo \ + ./$(DEPDIR)/entry.Plo ./$(DEPDIR)/env.Plo \ + ./$(DEPDIR)/failure.Plo ./$(DEPDIR)/find_new_gid.Plo \ + ./$(DEPDIR)/find_new_sub_gids.Plo \ + ./$(DEPDIR)/find_new_sub_uids.Plo ./$(DEPDIR)/find_new_uid.Plo \ + ./$(DEPDIR)/getdate.Plo ./$(DEPDIR)/getgr_nam_gid.Plo \ + ./$(DEPDIR)/getrange.Plo ./$(DEPDIR)/gettime.Plo \ + ./$(DEPDIR)/hushed.Plo ./$(DEPDIR)/idmapping.Plo \ + ./$(DEPDIR)/isexpired.Plo ./$(DEPDIR)/limits.Plo \ + ./$(DEPDIR)/list.Plo ./$(DEPDIR)/log.Plo \ + ./$(DEPDIR)/loginprompt.Plo ./$(DEPDIR)/mail.Plo \ + ./$(DEPDIR)/motd.Plo ./$(DEPDIR)/myname.Plo \ + ./$(DEPDIR)/obscure.Plo ./$(DEPDIR)/pam_pass.Plo \ + ./$(DEPDIR)/pam_pass_non_interactive.Plo \ + ./$(DEPDIR)/prefix_flag.Plo ./$(DEPDIR)/pwd2spwd.Plo \ + ./$(DEPDIR)/pwd_init.Plo ./$(DEPDIR)/pwdcheck.Plo \ + ./$(DEPDIR)/remove_tree.Plo ./$(DEPDIR)/rlogin.Plo \ + ./$(DEPDIR)/root_flag.Plo ./$(DEPDIR)/salt.Plo \ + ./$(DEPDIR)/setugid.Plo ./$(DEPDIR)/setupenv.Plo \ + ./$(DEPDIR)/shell.Plo ./$(DEPDIR)/strtoday.Plo \ + ./$(DEPDIR)/sub.Plo ./$(DEPDIR)/sulog.Plo \ + ./$(DEPDIR)/ttytype.Plo ./$(DEPDIR)/tz.Plo \ + ./$(DEPDIR)/ulimit.Plo ./$(DEPDIR)/user_busy.Plo \ + ./$(DEPDIR)/utmp.Plo ./$(DEPDIR)/valid.Plo \ + ./$(DEPDIR)/xgetgrgid.Plo ./$(DEPDIR)/xgetgrnam.Plo \ + ./$(DEPDIR)/xgetpwnam.Plo ./$(DEPDIR)/xgetpwuid.Plo \ + ./$(DEPDIR)/xgetspnam.Plo ./$(DEPDIR)/xmalloc.Plo \ + ./$(DEPDIR)/yesno.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -374,21 +409,22 @@ 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 $(ECONF_CPPFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir) $(ECONF_CPPFLAGS) noinst_LTLIBRARIES = libmisc.la libmisc_la_SOURCES = addgrps.c age.c audit_help.c basename.c chkname.c \ chkname.h chowndir.c chowntty.c cleanup.c cleanup_group.c \ - cleanup_user.c console.c copydir.c entry.c env.c failure.c \ - failure.h find_new_gid.c find_new_uid.c find_new_sub_gids.c \ - find_new_sub_uids.c getdate.h getdate.y getgr_nam_gid.c \ - getrange.c gettime.c hushed.c idmapping.h idmapping.c \ - isexpired.c limits.c list.c log.c loginprompt.c mail.c motd.c \ - myname.c obscure.c pam_pass.c pam_pass_non_interactive.c \ - prefix_flag.c pwd2spwd.c pwdcheck.c pwd_init.c remove_tree.c \ - rlogin.c root_flag.c salt.c setugid.c setupenv.c shell.c \ - strtoday.c sub.c sulog.c ttytype.c tz.c ulimit.c user_busy.c \ - utmp.c valid.c xgetpwnam.c xgetpwuid.c xgetgrnam.c xgetgrgid.c \ - xgetspnam.c xmalloc.c yesno.c $(am__append_1) + cleanup_user.c console.c copydir.c date_to_str.c entry.c env.c \ + failure.c failure.h find_new_gid.c find_new_uid.c \ + find_new_sub_gids.c find_new_sub_uids.c getdate.h getdate.y \ + getgr_nam_gid.c getrange.c gettime.c hushed.c idmapping.h \ + idmapping.c isexpired.c limits.c list.c log.c loginprompt.c \ + mail.c motd.c myname.c obscure.c pam_pass.c \ + pam_pass_non_interactive.c prefix_flag.c pwd2spwd.c pwdcheck.c \ + pwd_init.c remove_tree.c rlogin.c root_flag.c salt.c setugid.c \ + setupenv.c shell.c strtoday.c sub.c sulog.c ttytype.c tz.c \ + ulimit.c user_busy.c utmp.c valid.c xgetpwnam.c xgetpwuid.c \ + xgetgrnam.c xgetgrgid.c xgetspnam.c xmalloc.c yesno.c \ + $(am__append_1) all: all-am .SUFFIXES: @@ -410,8 +446,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) @@ -443,70 +479,77 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addgrps.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/age.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audit_help.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btrfs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkname.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chowndir.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chowntty.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup_group.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup_user.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/console.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copydir.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entry.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_gid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_sub_gids.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_sub_uids.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_uid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getgr_nam_gid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getrange.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettime.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hushed.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idmapping.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isexpired.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loginprompt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/myname.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obscure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam_pass.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam_pass_non_interactive.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prefix_flag.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwd2spwd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwd_init.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwdcheck.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remove_tree.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rlogin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root_flag.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/salt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setugid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setupenv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shell.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoday.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sulog.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttytype.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tz.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ulimit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user_busy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utmp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/valid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetgrgid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetgrnam.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetpwnam.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetpwuid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetspnam.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yesno.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addgrps.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/age.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audit_help.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btrfs.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkname.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chowndir.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chowntty.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup_group.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cleanup_user.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/console.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copydir.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/date_to_str.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entry.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failure.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_gid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_sub_gids.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_sub_uids.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find_new_uid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdate.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getgr_nam_gid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getrange.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettime.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hushed.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idmapping.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isexpired.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loginprompt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mail.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/myname.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obscure.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam_pass.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam_pass_non_interactive.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prefix_flag.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwd2spwd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwd_init.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwdcheck.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remove_tree.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rlogin.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root_flag.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/salt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setugid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setupenv.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shell.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoday.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sub.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sulog.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttytype.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tz.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ulimit.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user_busy.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utmp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/valid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetgrgid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetgrnam.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetpwnam.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetpwuid.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgetspnam.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yesno.Plo@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 $@ $< @@ -590,7 +633,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)'; \ @@ -661,7 +707,71 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/addgrps.Plo + -rm -f ./$(DEPDIR)/age.Plo + -rm -f ./$(DEPDIR)/audit_help.Plo + -rm -f ./$(DEPDIR)/basename.Plo + -rm -f ./$(DEPDIR)/btrfs.Plo + -rm -f ./$(DEPDIR)/chkname.Plo + -rm -f ./$(DEPDIR)/chowndir.Plo + -rm -f ./$(DEPDIR)/chowntty.Plo + -rm -f ./$(DEPDIR)/cleanup.Plo + -rm -f ./$(DEPDIR)/cleanup_group.Plo + -rm -f ./$(DEPDIR)/cleanup_user.Plo + -rm -f ./$(DEPDIR)/console.Plo + -rm -f ./$(DEPDIR)/copydir.Plo + -rm -f ./$(DEPDIR)/date_to_str.Plo + -rm -f ./$(DEPDIR)/entry.Plo + -rm -f ./$(DEPDIR)/env.Plo + -rm -f ./$(DEPDIR)/failure.Plo + -rm -f ./$(DEPDIR)/find_new_gid.Plo + -rm -f ./$(DEPDIR)/find_new_sub_gids.Plo + -rm -f ./$(DEPDIR)/find_new_sub_uids.Plo + -rm -f ./$(DEPDIR)/find_new_uid.Plo + -rm -f ./$(DEPDIR)/getdate.Plo + -rm -f ./$(DEPDIR)/getgr_nam_gid.Plo + -rm -f ./$(DEPDIR)/getrange.Plo + -rm -f ./$(DEPDIR)/gettime.Plo + -rm -f ./$(DEPDIR)/hushed.Plo + -rm -f ./$(DEPDIR)/idmapping.Plo + -rm -f ./$(DEPDIR)/isexpired.Plo + -rm -f ./$(DEPDIR)/limits.Plo + -rm -f ./$(DEPDIR)/list.Plo + -rm -f ./$(DEPDIR)/log.Plo + -rm -f ./$(DEPDIR)/loginprompt.Plo + -rm -f ./$(DEPDIR)/mail.Plo + -rm -f ./$(DEPDIR)/motd.Plo + -rm -f ./$(DEPDIR)/myname.Plo + -rm -f ./$(DEPDIR)/obscure.Plo + -rm -f ./$(DEPDIR)/pam_pass.Plo + -rm -f ./$(DEPDIR)/pam_pass_non_interactive.Plo + -rm -f ./$(DEPDIR)/prefix_flag.Plo + -rm -f ./$(DEPDIR)/pwd2spwd.Plo + -rm -f ./$(DEPDIR)/pwd_init.Plo + -rm -f ./$(DEPDIR)/pwdcheck.Plo + -rm -f ./$(DEPDIR)/remove_tree.Plo + -rm -f ./$(DEPDIR)/rlogin.Plo + -rm -f ./$(DEPDIR)/root_flag.Plo + -rm -f ./$(DEPDIR)/salt.Plo + -rm -f ./$(DEPDIR)/setugid.Plo + -rm -f ./$(DEPDIR)/setupenv.Plo + -rm -f ./$(DEPDIR)/shell.Plo + -rm -f ./$(DEPDIR)/strtoday.Plo + -rm -f ./$(DEPDIR)/sub.Plo + -rm -f ./$(DEPDIR)/sulog.Plo + -rm -f ./$(DEPDIR)/ttytype.Plo + -rm -f ./$(DEPDIR)/tz.Plo + -rm -f ./$(DEPDIR)/ulimit.Plo + -rm -f ./$(DEPDIR)/user_busy.Plo + -rm -f ./$(DEPDIR)/utmp.Plo + -rm -f ./$(DEPDIR)/valid.Plo + -rm -f ./$(DEPDIR)/xgetgrgid.Plo + -rm -f ./$(DEPDIR)/xgetgrnam.Plo + -rm -f ./$(DEPDIR)/xgetpwnam.Plo + -rm -f ./$(DEPDIR)/xgetpwuid.Plo + -rm -f ./$(DEPDIR)/xgetspnam.Plo + -rm -f ./$(DEPDIR)/xmalloc.Plo + -rm -f ./$(DEPDIR)/yesno.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -707,7 +817,71 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/addgrps.Plo + -rm -f ./$(DEPDIR)/age.Plo + -rm -f ./$(DEPDIR)/audit_help.Plo + -rm -f ./$(DEPDIR)/basename.Plo + -rm -f ./$(DEPDIR)/btrfs.Plo + -rm -f ./$(DEPDIR)/chkname.Plo + -rm -f ./$(DEPDIR)/chowndir.Plo + -rm -f ./$(DEPDIR)/chowntty.Plo + -rm -f ./$(DEPDIR)/cleanup.Plo + -rm -f ./$(DEPDIR)/cleanup_group.Plo + -rm -f ./$(DEPDIR)/cleanup_user.Plo + -rm -f ./$(DEPDIR)/console.Plo + -rm -f ./$(DEPDIR)/copydir.Plo + -rm -f ./$(DEPDIR)/date_to_str.Plo + -rm -f ./$(DEPDIR)/entry.Plo + -rm -f ./$(DEPDIR)/env.Plo + -rm -f ./$(DEPDIR)/failure.Plo + -rm -f ./$(DEPDIR)/find_new_gid.Plo + -rm -f ./$(DEPDIR)/find_new_sub_gids.Plo + -rm -f ./$(DEPDIR)/find_new_sub_uids.Plo + -rm -f ./$(DEPDIR)/find_new_uid.Plo + -rm -f ./$(DEPDIR)/getdate.Plo + -rm -f ./$(DEPDIR)/getgr_nam_gid.Plo + -rm -f ./$(DEPDIR)/getrange.Plo + -rm -f ./$(DEPDIR)/gettime.Plo + -rm -f ./$(DEPDIR)/hushed.Plo + -rm -f ./$(DEPDIR)/idmapping.Plo + -rm -f ./$(DEPDIR)/isexpired.Plo + -rm -f ./$(DEPDIR)/limits.Plo + -rm -f ./$(DEPDIR)/list.Plo + -rm -f ./$(DEPDIR)/log.Plo + -rm -f ./$(DEPDIR)/loginprompt.Plo + -rm -f ./$(DEPDIR)/mail.Plo + -rm -f ./$(DEPDIR)/motd.Plo + -rm -f ./$(DEPDIR)/myname.Plo + -rm -f ./$(DEPDIR)/obscure.Plo + -rm -f ./$(DEPDIR)/pam_pass.Plo + -rm -f ./$(DEPDIR)/pam_pass_non_interactive.Plo + -rm -f ./$(DEPDIR)/prefix_flag.Plo + -rm -f ./$(DEPDIR)/pwd2spwd.Plo + -rm -f ./$(DEPDIR)/pwd_init.Plo + -rm -f ./$(DEPDIR)/pwdcheck.Plo + -rm -f ./$(DEPDIR)/remove_tree.Plo + -rm -f ./$(DEPDIR)/rlogin.Plo + -rm -f ./$(DEPDIR)/root_flag.Plo + -rm -f ./$(DEPDIR)/salt.Plo + -rm -f ./$(DEPDIR)/setugid.Plo + -rm -f ./$(DEPDIR)/setupenv.Plo + -rm -f ./$(DEPDIR)/shell.Plo + -rm -f ./$(DEPDIR)/strtoday.Plo + -rm -f ./$(DEPDIR)/sub.Plo + -rm -f ./$(DEPDIR)/sulog.Plo + -rm -f ./$(DEPDIR)/ttytype.Plo + -rm -f ./$(DEPDIR)/tz.Plo + -rm -f ./$(DEPDIR)/ulimit.Plo + -rm -f ./$(DEPDIR)/user_busy.Plo + -rm -f ./$(DEPDIR)/utmp.Plo + -rm -f ./$(DEPDIR)/valid.Plo + -rm -f ./$(DEPDIR)/xgetgrgid.Plo + -rm -f ./$(DEPDIR)/xgetgrnam.Plo + -rm -f ./$(DEPDIR)/xgetpwnam.Plo + -rm -f ./$(DEPDIR)/xgetpwuid.Plo + -rm -f ./$(DEPDIR)/xgetspnam.Plo + -rm -f ./$(DEPDIR)/xmalloc.Plo + -rm -f ./$(DEPDIR)/yesno.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -728,16 +902,16 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES 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-noinstLTLIBRARIES \ + 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/addgrps.c b/libmisc/addgrps.c index 76c172a5..845d383b 100644 --- a/libmisc/addgrps.c +++ b/libmisc/addgrps.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2001 - 2006, Tomasz Kłoczko - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2001 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -40,6 +17,7 @@ #include #include #include +#include "shadowlog.h" #ident "$Id$" @@ -58,6 +36,7 @@ int add_groups (const char *list) char *token; char buf[1024]; int ret; + FILE *shadow_logfd = log_get_logfd(); if (strlen (list) >= sizeof (buf)) { errno = EINVAL; diff --git a/libmisc/age.c b/libmisc/age.c index 12e6036e..d10f71b9 100644 --- a/libmisc/age.c +++ b/libmisc/age.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2001 - 2006, Tomasz Kłoczko - * Copyright (c) 2008 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2001 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/audit_help.c b/libmisc/audit_help.c index b4e5f10e..e6c2006b 100644 --- a/libmisc/audit_help.c +++ b/libmisc/audit_help.c @@ -1,32 +1,9 @@ /* - * Copyright (c) 2005 , Red Hat, Inc. - * Copyright (c) 2005 , Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2005 , Red Hat, Inc. + * SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* @@ -45,6 +22,7 @@ #include #include #include "prototypes.h" +#include "shadowlog.h" int audit_fd; void audit_help_open (void) @@ -59,7 +37,7 @@ void audit_help_open (void) return; } (void) fputs (_("Cannot open audit interface - aborting.\n"), - shadow_logfd); + log_get_logfd()); exit (EXIT_FAILURE); } } @@ -68,7 +46,7 @@ void audit_help_open (void) * This function will log a message to the audit system using a predefined * message format. Parameter usage is as follows: * - * type - type of message: AUDIT_USER_CHAUTHTOK for changing any account + * type - type of message: AUDIT_USER_CHAUTHTOK for changing any account * attributes. * pgname - program's name * op - operation. "adding user", "changing finger info", "deleting group" diff --git a/libmisc/basename.c b/libmisc/basename.c index 1525169c..fe916532 100644 --- a/libmisc/basename.c +++ b/libmisc/basename.c @@ -1,32 +1,9 @@ /* - * Copyright (c) 1990 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1997, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * All rights reserved. + * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/chkname.c b/libmisc/chkname.c index bdd1e72a..cb002a14 100644 --- a/libmisc/chkname.c +++ b/libmisc/chkname.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1990 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2001 - 2005, Tomasz Kłoczko - * Copyright (c) 2005 - 2008, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2005 - 2008, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/chkname.h b/libmisc/chkname.h index 06e0dee8..07713473 100644 --- a/libmisc/chkname.h +++ b/libmisc/chkname.h @@ -1,33 +1,10 @@ /* - * Copyright (c) 1990 - 1994, Julianne Frances Haugh - * Copyright (c) 1997 - 2000, Marek Michałkiewicz - * Copyright (c) 2005 , Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1997 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* $Id$ */ diff --git a/libmisc/chowndir.c b/libmisc/chowndir.c index c4c504a5..3a62d545 100644 --- a/libmisc/chowndir.c +++ b/libmisc/chowndir.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1992 - 1993, Julianne Frances Haugh - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2010 - , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1992 - 1993, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2010 - , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/chowntty.c b/libmisc/chowntty.c index a42ab622..8043d8ca 100644 --- a/libmisc/chowntty.c +++ b/libmisc/chowntty.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 2001, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2001, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -43,6 +20,7 @@ #include "defines.h" #include #include "getdef.h" +#include "shadowlog.h" /* * chown_tty() sets the login tty to be owned by the new user ID @@ -75,6 +53,7 @@ void chown_tty (const struct passwd *info) if ( (fchown (STDIN_FILENO, info->pw_uid, gid) != 0) || (fchmod (STDIN_FILENO, (mode_t)getdef_num ("TTYPERM", 0600)) != 0)) { int err = errno; + FILE *shadow_logfd = log_get_logfd(); fprintf (shadow_logfd, _("Unable to change owner or mode of tty stdin: %s"), diff --git a/libmisc/cleanup.c b/libmisc/cleanup.c index bd83a230..c16f1bcd 100644 --- a/libmisc/cleanup.c +++ b/libmisc/cleanup.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2008 - 2011, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2008 - 2011, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/cleanup_group.c b/libmisc/cleanup_group.c index a1233eac..df3ebfdb 100644 --- a/libmisc/cleanup_group.c +++ b/libmisc/cleanup_group.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -36,6 +13,7 @@ #include "groupio.h" #include "sgroupio.h" #include "prototypes.h" +#include "shadowlog.h" /* * cleanup_report_add_group - Report failure to add a group to the system @@ -48,7 +26,7 @@ void cleanup_report_add_group (void *group_name) SYSLOG ((LOG_ERR, "failed to add group %s", name)); #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_GROUP, Prog, + audit_logger (AUDIT_ADD_GROUP, log_get_progname(), "", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -66,7 +44,7 @@ void cleanup_report_del_group (void *group_name) SYSLOG ((LOG_ERR, "failed to remove group %s", name)); #ifdef WITH_AUDIT - audit_logger (AUDIT_DEL_GROUP, Prog, + audit_logger (AUDIT_DEL_GROUP, log_get_progname(), "", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -83,7 +61,7 @@ void cleanup_report_mod_group (void *cleanup_info) gr_dbname (), info->action)); #ifdef WITH_AUDIT - audit_logger (AUDIT_USER_ACCT, Prog, + audit_logger (AUDIT_USER_ACCT, log_get_progname(), info->audit_msg, info->name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -101,7 +79,7 @@ void cleanup_report_mod_gshadow (void *cleanup_info) sgr_dbname (), info->action)); #ifdef WITH_AUDIT - audit_logger (AUDIT_USER_ACCT, Prog, + audit_logger (AUDIT_USER_ACCT, log_get_progname(), info->audit_msg, info->name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -121,7 +99,7 @@ void cleanup_report_add_group_group (void *group_name) SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ())); #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_GROUP, Prog, + audit_logger (AUDIT_ADD_GROUP, log_get_progname(), "adding group to /etc/group", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -141,7 +119,7 @@ void cleanup_report_add_group_gshadow (void *group_name) SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ())); #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_GROUP, Prog, + audit_logger (AUDIT_ADD_GROUP, log_get_progname(), "adding group to /etc/gshadow", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -164,7 +142,7 @@ void cleanup_report_del_group_group (void *group_name) "failed to remove group %s from %s", name, gr_dbname ())); #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_GROUP, Prog, + audit_logger (AUDIT_ADD_GROUP, log_get_progname(), "removing group from /etc/group", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -187,7 +165,7 @@ void cleanup_report_del_group_gshadow (void *group_name) "failed to remove group %s from %s", name, sgr_dbname ())); #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_GROUP, Prog, + audit_logger (AUDIT_ADD_GROUP, log_get_progname(), "removing group from /etc/gshadow", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -203,9 +181,9 @@ void cleanup_report_del_group_gshadow (void *group_name) void cleanup_unlock_group (unused void *arg) { if (gr_unlock () == 0) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: failed to unlock %s\n"), - Prog, gr_dbname ()); + log_get_progname(), gr_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); #ifdef WITH_AUDIT audit_logger_message ("unlocking group file", @@ -223,9 +201,9 @@ void cleanup_unlock_group (unused void *arg) void cleanup_unlock_gshadow (unused void *arg) { if (sgr_unlock () == 0) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: failed to unlock %s\n"), - Prog, sgr_dbname ()); + log_get_progname(), sgr_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); #ifdef WITH_AUDIT audit_logger_message ("unlocking gshadow file", diff --git a/libmisc/cleanup_user.c b/libmisc/cleanup_user.c index 7422846a..26675c65 100644 --- a/libmisc/cleanup_user.c +++ b/libmisc/cleanup_user.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -36,6 +13,7 @@ #include "pwio.h" #include "shadowio.h" #include "prototypes.h" +#include "shadowlog.h" /* * cleanup_report_add_user - Report failure to add an user to the system @@ -48,7 +26,7 @@ void cleanup_report_add_user (void *user_name) SYSLOG ((LOG_ERR, "failed to add user %s", name)); #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_USER, Prog, + audit_logger (AUDIT_ADD_USER, log_get_progname(), "", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -65,7 +43,7 @@ void cleanup_report_mod_passwd (void *cleanup_info) pw_dbname (), info->action)); #ifdef WITH_AUDIT - audit_logger (AUDIT_USER_ACCT, Prog, + audit_logger (AUDIT_USER_ACCT, log_get_progname(), info->audit_msg, info->name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -85,7 +63,7 @@ void cleanup_report_add_user_passwd (void *user_name) SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, pw_dbname ())); #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_USER, Prog, + audit_logger (AUDIT_ADD_USER, log_get_progname(), "adding user to /etc/passwd", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -105,7 +83,7 @@ void cleanup_report_add_user_shadow (void *user_name) SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, spw_dbname ())); #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_USER, Prog, + audit_logger (AUDIT_ADD_USER, log_get_progname(), "adding user to /etc/shadow", name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); @@ -120,9 +98,9 @@ void cleanup_report_add_user_shadow (void *user_name) void cleanup_unlock_passwd (unused void *arg) { if (pw_unlock () == 0) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: failed to unlock %s\n"), - Prog, pw_dbname ()); + log_get_progname(), pw_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); #ifdef WITH_AUDIT audit_logger_message ("unlocking passwd file", @@ -139,9 +117,9 @@ void cleanup_unlock_passwd (unused void *arg) void cleanup_unlock_shadow (unused void *arg) { if (spw_unlock () == 0) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: failed to unlock %s\n"), - Prog, spw_dbname ()); + log_get_progname(), spw_dbname ()); SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); #ifdef WITH_AUDIT audit_logger_message ("unlocking shadow file", diff --git a/libmisc/console.c b/libmisc/console.c index cb74c2f9..4720e3e1 100644 --- a/libmisc/console.c +++ b/libmisc/console.c @@ -1,34 +1,11 @@ /* - * Copyright (c) 1991 , Julianne Frances Haugh - * Copyright (c) 1991 , Chip Rosenthal - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1991 , Julianne Frances Haugh + * SPDX-FileCopyrightText: 1991 , Chip Rosenthal + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/copydir.c b/libmisc/copydir.c index 015e1b68..90ba2fcd 100644 --- a/libmisc/copydir.c +++ b/libmisc/copydir.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 2001, Marek Michałkiewicz - * Copyright (c) 2003 - 2006, Tomasz Kłoczko - * Copyright (c) 2007 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2001, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -55,6 +32,7 @@ #ifdef WITH_ATTR #include #endif /* WITH_ATTR */ +#include "shadowlog.h" static /*@null@*/const char *src_orig; @@ -116,8 +94,9 @@ static int fchown_if_needed (int fdst, const struct stat *statp, static void error_acl (struct error_context *ctx, const char *fmt, ...) { va_list ap; + FILE *shadow_logfd = log_get_logfd(); - /* ignore the case when destination does not support ACLs + /* ignore the case when destination does not support ACLs * or extended attributes */ if (ENOTSUP == errno) { errno = 0; @@ -125,7 +104,7 @@ static void error_acl (struct error_context *ctx, const char *fmt, ...) } va_start (ap, fmt); - (void) fprintf (shadow_logfd, _("%s: "), Prog); + (void) fprintf (shadow_logfd, _("%s: "), log_get_progname()); if (vfprintf (shadow_logfd, fmt, ap) != 0) { (void) fputs (_(": "), shadow_logfd); } @@ -248,9 +227,9 @@ int copy_tree (const char *src_root, const char *dst_root, } if (!S_ISDIR (sb.st_mode)) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), "%s: %s is not a directory", - Prog, src_root); + log_get_progname(), src_root); return -1; } @@ -739,7 +718,7 @@ static int copy_file (const char *src, const char *dst, char buf[1024]; ssize_t cnt; - ifd = open (src, O_RDONLY); + ifd = open (src, O_RDONLY|O_NOFOLLOW); if (ifd < 0) { return -1; } @@ -749,7 +728,7 @@ static int copy_file (const char *src, const char *dst, return -1; } #endif /* WITH_SELINUX */ - ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, statp->st_mode & 07777); + ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, statp->st_mode & 07777); if ( (ofd < 0) || (fchown_if_needed (ofd, statp, old_uid, new_uid, old_gid, new_gid) != 0) diff --git a/libmisc/date_to_str.c b/libmisc/date_to_str.c new file mode 100644 index 00000000..07e99f1a --- /dev/null +++ b/libmisc/date_to_str.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021, Alejandro Colomar + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the copyright holders or contributors may not be used to + * endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#ident "$Id$" + +#include "prototypes.h" + +void date_to_str (size_t size, char buf[size], long date) +{ + time_t t; + + t = date; + if (date < 0) + (void) strncpy (buf, "never", size); + else + (void) strftime (buf, size, "%Y-%m-%d", gmtime (&t)); + buf[size - 1] = '\0'; +} diff --git a/libmisc/entry.c b/libmisc/entry.c index f195fdf6..87f57545 100644 --- a/libmisc/entry.c +++ b/libmisc/entry.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2008, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2008, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/env.c b/libmisc/env.c index 47a55584..4eba0a33 100644 --- a/libmisc/env.c +++ b/libmisc/env.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1992, Julianne Frances Haugh - * Copyright (c) 1996 - 1999, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1992, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -40,6 +17,7 @@ #include #include "prototypes.h" #include "defines.h" +#include "shadowlog.h" /* * NEWENVP_STEP must be a power of two. This is the number * of (char *) pointers to allocate at a time, to avoid using @@ -171,7 +149,7 @@ void addenv (const char *string, /*@null@*/const char *value) } newenvp = __newenvp; } else { - (void) fputs (_("Environment overflow\n"), shadow_logfd); + (void) fputs (_("Environment overflow\n"), log_get_logfd()); newenvc--; free (newenvp[newenvc]); } diff --git a/libmisc/failure.c b/libmisc/failure.c index a1f3ec79..1aab299c 100644 --- a/libmisc/failure.c +++ b/libmisc/failure.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2002 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2002 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -232,13 +209,8 @@ int failcheck (uid_t uid, struct faillog *fl, bool failed) void failprint (const struct faillog *fail) { struct tm *tp; - -#if HAVE_STRFTIME char lasttimeb[256]; char *lasttime = lasttimeb; -#else - char *lasttime; -#endif time_t NOW; if (0 == fail->fail_cnt) { @@ -248,31 +220,11 @@ void failprint (const struct faillog *fail) tp = localtime (&(fail->fail_time)); (void) time (&NOW); -#if HAVE_STRFTIME /* * Print all information we have. */ (void) strftime (lasttimeb, sizeof lasttimeb, "%c", tp); -#else - - /* - * Do the same thing, but don't use strftime since it - * probably doesn't exist on this system - */ - lasttime = asctime (tp); - lasttime[24] = '\0'; - if ((NOW - fail->fail_time) < YEAR) { - lasttime[19] = '\0'; - } - if ((NOW - fail->fail_time) < DAY) { - lasttime = lasttime + 11; - } - - if (' ' == *lasttime) { - lasttime++; - } -#endif /*@-formatconst@*/ (void) printf (ngettext ("%d failure since last login.\n" "Last was %s on %s.\n", diff --git a/libmisc/failure.h b/libmisc/failure.h index 38a4d72f..2ac30d7f 100644 --- a/libmisc/failure.h +++ b/libmisc/failure.h @@ -1,33 +1,10 @@ /* - * Copyright (c) 1990 - 1994, Julianne Frances Haugh - * Copyright (c) 1997 - 2000, Marek Michałkiewicz - * Copyright (c) 2005 , Tomasz Kłoczko - * Copyright (c) 2008 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1997 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* $Id$ */ diff --git a/libmisc/find_new_gid.c b/libmisc/find_new_gid.c index d9a0b33f..1bddc12f 100644 --- a/libmisc/find_new_gid.c +++ b/libmisc/find_new_gid.c @@ -1,32 +1,9 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 2008 - 2011, Nicolas François - * Copyright (c) 2014, Red Hat, Inc. - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 2008 - 2011, Nicolas François + * SPDX-FileCopyrightText: 2014, Red Hat, Inc. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -38,6 +15,7 @@ #include "prototypes.h" #include "groupio.h" #include "getdef.h" +#include "shadowlog.h" /* * get_ranges - Get the minimum and maximum ID ranges for the search @@ -74,10 +52,10 @@ static int get_ranges (bool sys_group, gid_t *min_id, gid_t *max_id, /* Check that the ranges make sense */ if (*max_id < *min_id) { - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: Invalid configuration: SYS_GID_MIN (%lu), " "GID_MIN (%lu), SYS_GID_MAX (%lu)\n"), - Prog, (unsigned long) *min_id, + log_get_progname(), (unsigned long) *min_id, getdef_ulong ("GID_MIN", 1000UL), (unsigned long) *max_id); return EINVAL; @@ -97,10 +75,10 @@ static int get_ranges (bool sys_group, gid_t *min_id, gid_t *max_id, /* Check that the ranges make sense */ if (*max_id < *min_id) { - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: Invalid configuration: GID_MIN (%lu), " "GID_MAX (%lu)\n"), - Prog, (unsigned long) *min_id, + log_get_progname(), (unsigned long) *min_id, (unsigned long) *max_id); return EINVAL; } @@ -157,7 +135,7 @@ static int check_gid (const gid_t gid, * [GID_MIN:GID_MAX] range. * This ID should be higher than all the used GID, but if not possible, * the lowest unused ID in the range will be returned. - * + * * Return 0 on success, -1 if no unused GIDs are available. */ int find_new_gid (bool sys_group, @@ -213,10 +191,10 @@ int find_new_gid (bool sys_group, * more likely to want to stop and address the * issue. */ - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Encountered error attempting to use " "preferred GID: %s\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); return -1; } } @@ -243,9 +221,9 @@ int find_new_gid (bool sys_group, /* Create an array to hold all of the discovered GIDs */ used_gids = malloc (sizeof (bool) * (gid_max +1)); if (NULL == used_gids) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: failed to allocate memory: %s\n"), - Prog, strerror (errno)); + log_get_progname(), strerror (errno)); return -1; } memset (used_gids, false, sizeof (bool) * (gid_max + 1)); @@ -323,10 +301,10 @@ int find_new_gid (bool sys_group, * */ if (!nospam) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique system GID (%s). " "Suppressing additional messages.\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); SYSLOG ((LOG_ERR, "Error checking available GIDs: %s", strerror (result))); @@ -366,10 +344,10 @@ int find_new_gid (bool sys_group, * */ if (!nospam) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique system GID (%s). " "Suppressing additional messages.\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); SYSLOG ((LOG_ERR, "Error checking available GIDs: %s", strerror (result))); @@ -426,10 +404,10 @@ int find_new_gid (bool sys_group, * */ if (!nospam) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique GID (%s). " "Suppressing additional messages.\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); SYSLOG ((LOG_ERR, "Error checking available GIDs: %s", strerror (result))); @@ -469,10 +447,10 @@ int find_new_gid (bool sys_group, * */ if (!nospam) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique GID (%s). " "Suppressing additional messages.\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); SYSLOG ((LOG_ERR, "Error checking available GIDs: %s", strerror (result))); @@ -488,9 +466,9 @@ int find_new_gid (bool sys_group, } /* The code reached here and found no available IDs in the range */ - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique GID (no more available GIDs)\n"), - Prog); + log_get_progname()); SYSLOG ((LOG_WARN, "no more available GIDs on the system")); free (used_gids); return -1; diff --git a/libmisc/find_new_sub_gids.c b/libmisc/find_new_sub_gids.c index 6d33dec6..bbd4570b 100644 --- a/libmisc/find_new_sub_gids.c +++ b/libmisc/find_new_sub_gids.c @@ -1,29 +1,7 @@ /* - * Copyright (c) 2012 Eric Biederman + * SPDX-FileCopyrightText: 2012 Eric Biederman * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -37,13 +15,14 @@ #include "prototypes.h" #include "subordinateio.h" #include "getdef.h" +#include "shadowlog.h" /* * find_new_sub_gids - Find a new unused range of GIDs. * * If successful, find_new_sub_gids provides a range of unused * user IDs in the [SUB_GID_MIN:SUB_GID_MAX] range. - * + * * Return 0 on success, -1 if no unused GIDs are available. */ int find_new_sub_gids (gid_t *range_start, unsigned long *range_count) @@ -60,18 +39,18 @@ int find_new_sub_gids (gid_t *range_start, unsigned long *range_count) count = getdef_ulong ("SUB_GID_COUNT", 65536); if (min > max || count >= max || (min + count - 1) > max) { - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: Invalid configuration: SUB_GID_MIN (%lu)," " SUB_GID_MAX (%lu), SUB_GID_COUNT (%lu)\n"), - Prog, min, max, count); + log_get_progname(), min, max, count); return -1; } start = sub_gid_find_free_range(min, max, count); if (start == (gid_t)-1) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique subordinate GID range\n"), - Prog); + log_get_progname()); SYSLOG ((LOG_WARN, "no more available subordinate GIDs on the system")); return -1; } diff --git a/libmisc/find_new_sub_uids.c b/libmisc/find_new_sub_uids.c index be3a0df8..a86b311a 100644 --- a/libmisc/find_new_sub_uids.c +++ b/libmisc/find_new_sub_uids.c @@ -1,29 +1,7 @@ /* - * Copyright (c) 2012 Eric Biederman + * SPDX-FileCopyrightText: 2012 Eric Biederman * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -37,13 +15,14 @@ #include "prototypes.h" #include "subordinateio.h" #include "getdef.h" +#include "shadowlog.h" /* * find_new_sub_uids - Find a new unused range of UIDs. * * If successful, find_new_sub_uids provides a range of unused * user IDs in the [SUB_UID_MIN:SUB_UID_MAX] range. - * + * * Return 0 on success, -1 if no unused UIDs are available. */ int find_new_sub_uids (uid_t *range_start, unsigned long *range_count) @@ -60,18 +39,18 @@ int find_new_sub_uids (uid_t *range_start, unsigned long *range_count) count = getdef_ulong ("SUB_UID_COUNT", 65536); if (min > max || count >= max || (min + count - 1) > max) { - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: Invalid configuration: SUB_UID_MIN (%lu)," " SUB_UID_MAX (%lu), SUB_UID_COUNT (%lu)\n"), - Prog, min, max, count); + log_get_progname(), min, max, count); return -1; } start = sub_uid_find_free_range(min, max, count); if (start == (uid_t)-1) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique subordinate UID range\n"), - Prog); + log_get_progname()); SYSLOG ((LOG_WARN, "no more available subordinate UIDs on the system")); return -1; } diff --git a/libmisc/find_new_uid.c b/libmisc/find_new_uid.c index 30dc2ed6..41b6c1d1 100644 --- a/libmisc/find_new_uid.c +++ b/libmisc/find_new_uid.c @@ -1,32 +1,9 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 2008 - 2011, Nicolas François - * Copyright (c) 2014, Red Hat, Inc. - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 2008 - 2011, Nicolas François + * SPDX-FileCopyrightText: 2014, Red Hat, Inc. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -38,6 +15,7 @@ #include "prototypes.h" #include "pwio.h" #include "getdef.h" +#include "shadowlog.h" /* * get_ranges - Get the minimum and maximum ID ranges for the search @@ -74,10 +52,10 @@ static int get_ranges (bool sys_user, uid_t *min_id, uid_t *max_id, /* Check that the ranges make sense */ if (*max_id < *min_id) { - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: Invalid configuration: SYS_UID_MIN (%lu), " "UID_MIN (%lu), SYS_UID_MAX (%lu)\n"), - Prog, (unsigned long) *min_id, + log_get_progname(), (unsigned long) *min_id, getdef_ulong ("UID_MIN", 1000UL), (unsigned long) *max_id); return EINVAL; @@ -97,10 +75,10 @@ static int get_ranges (bool sys_user, uid_t *min_id, uid_t *max_id, /* Check that the ranges make sense */ if (*max_id < *min_id) { - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: Invalid configuration: UID_MIN (%lu), " "UID_MAX (%lu)\n"), - Prog, (unsigned long) *min_id, + log_get_progname(), (unsigned long) *min_id, (unsigned long) *max_id); return EINVAL; } @@ -157,7 +135,7 @@ static int check_uid(const uid_t uid, * [UID_MIN:UID_MAX] range. * This ID should be higher than all the used UID, but if not possible, * the lowest unused ID in the range will be returned. - * + * * Return 0 on success, -1 if no unused UIDs are available. */ int find_new_uid(bool sys_user, @@ -213,10 +191,10 @@ int find_new_uid(bool sys_user, * more likely to want to stop and address the * issue. */ - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Encountered error attempting to use " "preferred UID: %s\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); return -1; } } @@ -243,9 +221,9 @@ int find_new_uid(bool sys_user, /* Create an array to hold all of the discovered UIDs */ used_uids = malloc (sizeof (bool) * (uid_max +1)); if (NULL == used_uids) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: failed to allocate memory: %s\n"), - Prog, strerror (errno)); + log_get_progname(), strerror (errno)); return -1; } memset (used_uids, false, sizeof (bool) * (uid_max + 1)); @@ -323,10 +301,10 @@ int find_new_uid(bool sys_user, * */ if (!nospam) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique system UID (%s). " "Suppressing additional messages.\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); SYSLOG ((LOG_ERR, "Error checking available UIDs: %s", strerror (result))); @@ -366,10 +344,10 @@ int find_new_uid(bool sys_user, * */ if (!nospam) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique system UID (%s). " "Suppressing additional messages.\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); SYSLOG((LOG_ERR, "Error checking available UIDs: %s", strerror (result))); @@ -426,10 +404,10 @@ int find_new_uid(bool sys_user, * */ if (!nospam) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique UID (%s). " "Suppressing additional messages.\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); SYSLOG ((LOG_ERR, "Error checking available UIDs: %s", strerror (result))); @@ -469,10 +447,10 @@ int find_new_uid(bool sys_user, * */ if (!nospam) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique UID (%s). " "Suppressing additional messages.\n"), - Prog, strerror (result)); + log_get_progname(), strerror (result)); SYSLOG ((LOG_ERR, "Error checking available UIDs: %s", strerror (result))); @@ -488,9 +466,9 @@ int find_new_uid(bool sys_user, } /* The code reached here and found no available IDs in the range */ - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: Can't get unique UID (no more available UIDs)\n"), - Prog); + log_get_progname()); SYSLOG ((LOG_WARN, "no more available UIDs on the system")); free (used_uids); return -1; diff --git a/libmisc/getdate.c b/libmisc/getdate.c index 390f9efd..af6424e7 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.5.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-2020 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.5.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 while @@ -126,7 +130,7 @@ /* Some old versions of bison generate parsers that use bcopy. That loses on systems that don't provide the function, so we have to redefine it here. */ -#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy) +#if !defined (HAVE_BCOPY) && !defined (bcopy) # define bcopy(from, to, len) memcpy ((to), (from), (len)) #endif @@ -233,13 +237,26 @@ static int yyRelSeconds; static int yyRelYear; -#line 237 "getdate.c" /* yacc.c:339 */ +#line 241 "getdate.c" +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # 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 +320,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 331 "getdate.c" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -326,36 +342,81 @@ int yyparse (void); -/* Copy the second part of user declarations. */ -#line 332 "getdate.c" /* yacc.c:358 */ #ifdef short # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; +#else +typedef short yytype_int16; +#endif + +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_uint8; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; #else -typedef short int yytype_int16; +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -363,15 +424,27 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_int8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -385,30 +458,19 @@ typedef short int yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define YY_ATTRIBUTE(Spec) /* empty */ +# define YY_ATTRIBUTE_PURE # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - #ifndef YY_ATTRIBUTE_UNUSED -# 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) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif @@ -419,13 +481,13 @@ 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") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -438,6 +500,20 @@ typedef short int yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE @@ -514,17 +590,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -537,11 +613,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -553,12 +629,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -581,17 +657,18 @@ 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) + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -625,7 +702,7 @@ static const yytype_uint8 yytranslate[] = #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_int16 yyrline[] = { 0, 188, 188, 189, 192, 195, 198, 201, 204, 207, 210, 216, 222, 231, 237, 249, 252, 256, 261, 265, @@ -652,7 +729,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 58, @@ -660,14 +737,14 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -20 +#define YYPACT_NINF (-20) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-20))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -1 +#define YYTABLE_NINF (-1) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -686,7 +763,7 @@ static const yytype_int8 yypact[] = /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ -static const yytype_uint8 yydefact[] = +static const yytype_int8 yydefact[] = { 2, 0, 1, 18, 39, 16, 42, 45, 0, 36, 48, 0, 49, 33, 15, 3, 4, 5, 7, 6, @@ -714,7 +791,7 @@ static const yytype_int8 yydefgoto[] = /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_uint8 yytable[] = +static const yytype_int8 yytable[] = { 2, 23, 52, 24, 3, 4, 5, 59, 6, 46, 47, 7, 8, 9, 10, 11, 12, 13, 14, 31, @@ -724,7 +801,7 @@ static const yytype_uint8 yytable[] = 60 }; -static const yytype_uint8 yycheck[] = +static const yytype_int8 yycheck[] = { 0, 20, 10, 16, 4, 5, 6, 15, 8, 15, 16, 11, 12, 13, 14, 15, 16, 17, 18, 4, @@ -736,7 +813,7 @@ static const yytype_uint8 yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_int8 yystos[] = { 0, 23, 0, 4, 5, 6, 8, 11, 12, 13, 14, 15, 16, 17, 18, 24, 25, 26, 27, 28, @@ -748,7 +825,7 @@ static const yytype_uint8 yystos[] = }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const yytype_int8 yyr1[] = { 0, 22, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 27, 27, @@ -759,7 +836,7 @@ static const yytype_uint8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const yytype_int8 yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, 2, 4, 4, 6, 6, 1, 1, 2, 1, 2, @@ -782,22 +859,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 +914,39 @@ 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 + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| 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, ")"); } /*------------------------------------------------------------------. @@ -876,7 +955,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -899,20 +978,20 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + yystos[+yyssp[yyi + 1 - yynrhs]], + &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); } @@ -956,13 +1035,13 @@ int yydebug; # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -998,12 +1077,12 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) @@ -1016,7 +1095,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; @@ -1031,10 +1113,10 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; } # endif @@ -1047,19 +1129,19 @@ yytnamerr (char *yyres, const char *yystr) *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ + /* Actual size of YYARG. */ int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then @@ -1086,7 +1168,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, */ if (yytoken != YYEMPTY) { - int yyn = yypact[*yyssp]; + int yyn = yypact[+*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { @@ -1111,11 +1195,12 @@ 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)) + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -1127,6 +1212,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")); @@ -1137,10 +1223,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1166,8 +1255,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } else { - yyp++; - yyformat++; + ++yyp; + ++yyformat; } } return 0; @@ -1210,7 +1299,7 @@ int yynerrs; int yyparse (void) { - int yystate; + yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1222,16 +1311,16 @@ yyparse (void) to reallocate them elsewhere. */ /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYSIZE_T yystacksize; + YYPTRDIFF_T yystacksize; int yyn; int yyresult; @@ -1245,7 +1334,7 @@ yyparse (void) /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1266,46 +1355,54 @@ 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; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END 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; + YYPTRDIFF_T yysize = 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 memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*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; @@ -1314,42 +1411,43 @@ yyparse (void) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) 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)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END 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. */ @@ -1399,15 +1497,13 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1422,7 +1518,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1442,71 +1538,71 @@ 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 1547 "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 1555 "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 1563 "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 1571 "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 1579 "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 1590 "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 1601 "getdate.c" break; case 12: -#line 222 "getdate.y" /* yacc.c:1646 */ - { +#line 222 "getdate.y" + { yyHour = (yyvsp[-3].Number); yyMinutes = (yyvsp[-1].Number); yyMeridian = MER24; @@ -1515,23 +1611,23 @@ 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 1615 "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 1626 "getdate.c" break; case 14: -#line 237 "getdate.y" /* yacc.c:1646 */ - { +#line 237 "getdate.y" + { yyHour = (yyvsp[-5].Number); yyMinutes = (yyvsp[-3].Number); yySeconds = (yyvsp[-1].Number); @@ -1541,72 +1637,72 @@ 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 1641 "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 1649 "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 1657 "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 1665 "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 1674 "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 1683 "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 1692 "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 1701 "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 machine-generated dates like those in an RCS log listing. If @@ -1624,72 +1720,72 @@ yyreduce: yyYear = (yyvsp[0].Number); } } -#line 1628 "getdate.c" /* yacc.c:1646 */ +#line 1724 "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 1735 "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 1746 "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 1755 "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 1765 "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 1774 "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 1784 "getdate.c" break; case 29: -#line 329 "getdate.y" /* yacc.c:1646 */ - { +#line 329 "getdate.y" + { yyRelSeconds = -yyRelSeconds; yyRelMinutes = -yyRelMinutes; yyRelHour = -yyRelHour; @@ -1697,156 +1793,156 @@ yyreduce: yyRelMonth = -yyRelMonth; yyRelYear = -yyRelYear; } -#line 1701 "getdate.c" /* yacc.c:1646 */ +#line 1797 "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 1805 "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 1813 "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 1821 "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 1829 "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 1837 "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 1845 "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 1853 "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 1861 "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 1869 "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 1877 "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 1885 "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 1893 "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 1901 "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 1909 "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 1917 "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 1925 "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 1933 "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 1941 "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); else @@ -1876,27 +1972,28 @@ yyreduce: } } } -#line 1880 "getdate.c" /* yacc.c:1646 */ +#line 1976 "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 1984 "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 1992 "getdate.c" break; -#line 1900 "getdate.c" /* yacc.c:1646 */ +#line 1996 "getdate.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1921,14 +2018,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; @@ -1960,7 +2056,7 @@ yyerrlab: { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; @@ -2011,12 +2107,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 +2172,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2085,6 +2180,7 @@ yyabortlab: yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -2095,6 +2191,10 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -2111,7 +2211,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[+*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2124,7 +2224,7 @@ yyreturn: #endif return yyresult; } -#line 439 "getdate.y" /* yacc.c:1906 */ +#line 439 "getdate.y" /* Month and day table. */ diff --git a/libmisc/getdate.h b/libmisc/getdate.h index d1bb176d..eae56f64 100644 --- a/libmisc/getdate.h +++ b/libmisc/getdate.h @@ -1,32 +1,9 @@ /* - * Copyright (c) 1990 - 1994, Julianne Frances Haugh - * Copyright (c) 1997 - 2000, Marek Michałkiewicz - * Copyright (c) 2005 , Tomasz Kłoczko - * All rights reserved. + * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1997 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #ifndef _GETDATE_H_ diff --git a/libmisc/getdate.y b/libmisc/getdate.y index 5a8bde2e..7afa995b 100644 --- a/libmisc/getdate.y +++ b/libmisc/getdate.y @@ -61,7 +61,7 @@ /* Some old versions of bison generate parsers that use bcopy. That loses on systems that don't provide the function, so we have to redefine it here. */ -#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy) +#if !defined (HAVE_BCOPY) && !defined (bcopy) # define bcopy(from, to, len) memcpy ((to), (from), (len)) #endif diff --git a/libmisc/getgr_nam_gid.c b/libmisc/getgr_nam_gid.c index 027280a5..5294f509 100644 --- a/libmisc/getgr_nam_gid.c +++ b/libmisc/getgr_nam_gid.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2000 - 2006, Tomasz Kłoczko - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2000 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/getrange.c b/libmisc/getrange.c index 9b5e6117..d620c126 100644 --- a/libmisc/getrange.c +++ b/libmisc/getrange.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/gettime.c b/libmisc/gettime.c index e882300c..b2884022 100644 --- a/libmisc/gettime.c +++ b/libmisc/gettime.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2017, Chris Lamb - * All rights reserved. + * SPDX-FileCopyrightText: 2017, Chris Lamb * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -36,6 +13,7 @@ #include #include "defines.h" #include "prototypes.h" +#include "shadowlog.h" /* * gettime() returns the time as the number of seconds since the Epoch @@ -50,6 +28,7 @@ char *source_date_epoch; time_t fallback; unsigned long long epoch; + FILE *shadow_logfd = log_get_logfd(); fallback = time (NULL); source_date_epoch = shadow_getenv ("SOURCE_DATE_EPOCH"); diff --git a/libmisc/hushed.c b/libmisc/hushed.c index b71b99ce..84b2f550 100644 --- a/libmisc/hushed.c +++ b/libmisc/hushed.c @@ -1,34 +1,11 @@ /* - * Copyright (c) 1991 - 1993, Julianne Frances Haugh - * Copyright (c) 1991 - 1993, Chip Rosenthal - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1993, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1991 - 1993, Chip Rosenthal + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -90,7 +67,7 @@ bool hushed (const char *username) return false; } for (found = false; !found && (fgets (buf, (int) sizeof buf, fp) == buf);) { - buf[strlen (buf) - 1] = '\0'; + buf[strcspn (buf, "\n")] = '\0'; found = (strcmp (buf, pw->pw_shell) == 0) || (strcmp (buf, pw->pw_name) == 0); } diff --git a/libmisc/idmapping.c b/libmisc/idmapping.c index 3324f671..8b64a26a 100644 --- a/libmisc/idmapping.c +++ b/libmisc/idmapping.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2013 Eric Biederman - * All rights reserved. + * SPDX-FileCopyrightText: 2013 Eric Biederman * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -40,6 +17,7 @@ #include #include #endif +#include "shadowlog.h" struct map_range *get_map_ranges(int ranges, int argc, char **argv) { @@ -47,28 +25,28 @@ struct map_range *get_map_ranges(int ranges, int argc, char **argv) int idx, argidx; if (ranges < 0 || argc < 0) { - fprintf(shadow_logfd, "%s: error calculating number of arguments\n", Prog); + fprintf(log_get_logfd(), "%s: error calculating number of arguments\n", log_get_progname()); return NULL; } if (ranges != ((argc + 2) / 3)) { - fprintf(shadow_logfd, "%s: ranges: %u is wrong for argc: %d\n", Prog, ranges, argc); + fprintf(log_get_logfd(), "%s: ranges: %u is wrong for argc: %d\n", log_get_progname(), ranges, argc); return NULL; } if ((ranges * 3) > argc) { - fprintf(shadow_logfd, "ranges: %u argc: %d\n", + fprintf(log_get_logfd(), "ranges: %u argc: %d\n", ranges, argc); - fprintf(shadow_logfd, + fprintf(log_get_logfd(), _( "%s: Not enough arguments to form %u mappings\n"), - Prog, ranges); + log_get_progname(), ranges); return NULL; } mappings = calloc(ranges, sizeof(*mappings)); if (!mappings) { - fprintf(shadow_logfd, _( "%s: Memory allocation failure\n"), - Prog); + fprintf(log_get_logfd(), _( "%s: Memory allocation failure\n"), + log_get_progname()); exit(EXIT_FAILURE); } @@ -88,24 +66,24 @@ struct map_range *get_map_ranges(int ranges, int argc, char **argv) return NULL; } if (ULONG_MAX - mapping->upper <= mapping->count || ULONG_MAX - mapping->lower <= mapping->count) { - fprintf(shadow_logfd, _( "%s: subuid overflow detected.\n"), Prog); + fprintf(log_get_logfd(), _( "%s: subuid overflow detected.\n"), log_get_progname()); exit(EXIT_FAILURE); } if (mapping->upper > UINT_MAX || mapping->lower > UINT_MAX || mapping->count > UINT_MAX) { - fprintf(shadow_logfd, _( "%s: subuid overflow detected.\n"), Prog); + fprintf(log_get_logfd(), _( "%s: subuid overflow detected.\n"), log_get_progname()); exit(EXIT_FAILURE); } if (mapping->lower + mapping->count > UINT_MAX || mapping->upper + mapping->count > UINT_MAX) { - fprintf(shadow_logfd, _( "%s: subuid overflow detected.\n"), Prog); + fprintf(log_get_logfd(), _( "%s: subuid overflow detected.\n"), log_get_progname()); exit(EXIT_FAILURE); } if (mapping->lower + mapping->count < mapping->lower || mapping->upper + mapping->count < mapping->upper) { /* this one really shouldn't be possible given previous checks */ - fprintf(shadow_logfd, _( "%s: subuid overflow detected.\n"), Prog); + fprintf(log_get_logfd(), _( "%s: subuid overflow detected.\n"), log_get_progname()); exit(EXIT_FAILURE); } } @@ -176,19 +154,19 @@ void write_mapping(int proc_dir_fd, int ranges, struct map_range *mappings, } else if (strcmp(map_file, "gid_map") == 0) { cap = CAP_SETGID; } else { - fprintf(shadow_logfd, _("%s: Invalid map file %s specified\n"), Prog, map_file); + fprintf(log_get_logfd(), _("%s: Invalid map file %s specified\n"), log_get_progname(), map_file); exit(EXIT_FAILURE); } /* Align setuid- and fscaps-based new{g,u}idmap behavior. */ if (geteuid() == 0 && geteuid() != ruid) { if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) { - fprintf(shadow_logfd, _("%s: Could not prctl(PR_SET_KEEPCAPS)\n"), Prog); + fprintf(log_get_logfd(), _("%s: Could not prctl(PR_SET_KEEPCAPS)\n"), log_get_progname()); exit(EXIT_FAILURE); } if (seteuid(ruid) < 0) { - fprintf(shadow_logfd, _("%s: Could not seteuid to %d\n"), Prog, ruid); + fprintf(log_get_logfd(), _("%s: Could not seteuid to %d\n"), log_get_progname(), ruid); exit(EXIT_FAILURE); } } @@ -204,12 +182,12 @@ void write_mapping(int proc_dir_fd, int ranges, struct map_range *mappings, data[0].effective |= CAP_TO_MASK(CAP_SETFCAP); data[0].permitted = data[0].effective; if (capset(&hdr, data) < 0) { - fprintf(shadow_logfd, _("%s: Could not set caps\n"), Prog); + fprintf(log_get_logfd(), _("%s: Could not set caps\n"), log_get_progname()); exit(EXIT_FAILURE); } #endif - bufsize = ranges * ((ULONG_DIGITS + 1) * 3); + bufsize = ranges * ((ULONG_DIGITS + 1) * 3); pos = buf = xmalloc(bufsize); /* Build the mapping command */ @@ -222,7 +200,7 @@ void write_mapping(int proc_dir_fd, int ranges, struct map_range *mappings, mapping->lower, mapping->count); if ((written <= 0) || (written >= (bufsize - (pos - buf)))) { - fprintf(shadow_logfd, _("%s: snprintf failed!\n"), Prog); + fprintf(log_get_logfd(), _("%s: snprintf failed!\n"), log_get_progname()); exit(EXIT_FAILURE); } pos += written; @@ -231,13 +209,13 @@ void write_mapping(int proc_dir_fd, int ranges, struct map_range *mappings, /* Write the mapping to the mapping file */ fd = openat(proc_dir_fd, map_file, O_WRONLY); if (fd < 0) { - fprintf(shadow_logfd, _("%s: open of %s failed: %s\n"), - Prog, map_file, strerror(errno)); + fprintf(log_get_logfd(), _("%s: open of %s failed: %s\n"), + log_get_progname(), map_file, strerror(errno)); exit(EXIT_FAILURE); } if (write(fd, buf, pos - buf) != (pos - buf)) { - fprintf(shadow_logfd, _("%s: write to %s failed: %s\n"), - Prog, map_file, strerror(errno)); + fprintf(log_get_logfd(), _("%s: write to %s failed: %s\n"), + log_get_progname(), map_file, strerror(errno)); exit(EXIT_FAILURE); } close(fd); diff --git a/libmisc/idmapping.h b/libmisc/idmapping.h index 1a8efe68..e3527606 100644 --- a/libmisc/idmapping.h +++ b/libmisc/idmapping.h @@ -1,30 +1,7 @@ /* - * Copyright (c) 2013 Eric Biederman - * All rights reserved. + * SPDX-FileCopyrightText: 2013 Eric Biederman * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #ifndef _IDMAPPING_H_ diff --git a/libmisc/isexpired.c b/libmisc/isexpired.c index 8e8a645f..ff203967 100644 --- a/libmisc/isexpired.c +++ b/libmisc/isexpired.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1997, Marek Michałkiewicz - * Copyright (c) 2001 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/limits.c b/libmisc/limits.c index 31f738da..fea85fe5 100644 --- a/libmisc/limits.c +++ b/libmisc/limits.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1999, Marek Michałkiewicz - * Copyright (c) 2003 - 2006, Tomasz Kłoczko - * Copyright (c) 2007 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* @@ -50,6 +27,7 @@ #include "defines.h" #include #include "getdef.h" +#include "shadowlog.h" #ifdef HAVE_SYS_RESOURCE_H #include #define LIMITS @@ -202,7 +180,7 @@ static int check_logins (const char *name, const char *maxlogins) return 0; } -/* Function setup_user_limits - checks/set limits for the curent login +/* Function setup_user_limits - checks/set limits for the current login * Original idea from Joel Katz's lshell. Ported to shadow-login * by Cristian Gafton - gafton@sorosis.ro * @@ -404,7 +382,7 @@ static bool user_in_group (const char *uname, const char *gname) { struct group *groupdata; - if (uname == NULL || gname == NULL){ + if (uname == NULL || gname == NULL) { return false; } @@ -548,7 +526,7 @@ void setup_limits (const struct passwd *info) #ifdef LIMITS if (info->pw_uid != 0) { if ((setup_user_limits (info->pw_name) & LOGIN_ERROR_LOGIN) != 0) { - (void) fputs (_("Too many logins.\n"), shadow_logfd); + (void) fputs (_("Too many logins.\n"), log_get_logfd()); (void) sleep (2); /* XXX: Should be FAIL_DELAY */ exit (EXIT_FAILURE); } diff --git a/libmisc/list.c b/libmisc/list.c index 8837fa12..9d7ec77b 100644 --- a/libmisc/list.c +++ b/libmisc/list.c @@ -1,32 +1,9 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1997, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/log.c b/libmisc/log.c index 68a9d7e2..a220be0d 100644 --- a/libmisc/log.c +++ b/libmisc/log.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -42,7 +19,7 @@ #include #include "prototypes.h" -/* +/* * dolastlog - create lastlog entry * * A "last login" entry is created for the user being logged in. The diff --git a/libmisc/loginprompt.c b/libmisc/loginprompt.c index b008e2a2..35856463 100644 --- a/libmisc/loginprompt.c +++ b/libmisc/loginprompt.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1993, Julianne Frances Haugh - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2011, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1993, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2011, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -103,7 +80,7 @@ void login_prompt (const char *prompt, char *name, int namesize) (void) fflush (stdout); } - /* + /* * Read the user's response. The trailing newline will be * removed. */ diff --git a/libmisc/mail.c b/libmisc/mail.c index 1c53c310..647f879c 100644 --- a/libmisc/mail.c +++ b/libmisc/mail.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1991, Julianne Frances Haugh - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1991, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/motd.c b/libmisc/motd.c index 6ba7e128..23e27f24 100644 --- a/libmisc/motd.c +++ b/libmisc/motd.c @@ -1,35 +1,12 @@ /* - * Copyright (c) 1989 - 1991, Julianne Frances Haugh - * Copyright (c) 1996 - 1997, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2010 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1991, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2010 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ - + #include #ident "$Id$" diff --git a/libmisc/myname.c b/libmisc/myname.c index e1b7f702..1b026179 100644 --- a/libmisc/myname.c +++ b/libmisc/myname.c @@ -1,32 +1,9 @@ /* - * Copyright (c) 1996 - 1997, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/obscure.c b/libmisc/obscure.c index dc69f768..3daaa958 100644 --- a/libmisc/obscure.c +++ b/libmisc/obscure.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1999, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/pam_pass.c b/libmisc/pam_pass.c index 58a3d3f6..166a42ef 100644 --- a/libmisc/pam_pass.c +++ b/libmisc/pam_pass.c @@ -1,32 +1,9 @@ /* - * Copyright (c) 1997 - 1999, Marek Michałkiewicz - * Copyright (c) 2001 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1997 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -46,11 +23,13 @@ #include "defines.h" #include "pam_defs.h" #include "prototypes.h" +#include "shadowlog.h" void do_pam_passwd (const char *user, bool silent, bool change_expired) { pam_handle_t *pamh = NULL; int flags = 0, ret; + FILE *shadow_logfd = log_get_logfd(); if (silent) flags |= PAM_SILENT; diff --git a/libmisc/pam_pass_non_interactive.c b/libmisc/pam_pass_non_interactive.c index 3c95c88c..d031284a 100644 --- a/libmisc/pam_pass_non_interactive.c +++ b/libmisc/pam_pass_non_interactive.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2009 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2009 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -38,6 +15,7 @@ #include #include #include "prototypes.h" +#include "shadowlog.h" /*@null@*/ /*@only@*/static const char *non_interactive_password = NULL; static int ni_conv (int num_msg, @@ -76,9 +54,9 @@ static int ni_conv (int num_msg, switch (msg[count]->msg_style) { case PAM_PROMPT_ECHO_ON: - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: PAM modules requesting echoing are not supported.\n"), - Prog); + log_get_progname()); goto failed_conversation; case PAM_PROMPT_ECHO_OFF: responses[count].resp = strdup (non_interactive_password); @@ -88,7 +66,7 @@ static int ni_conv (int num_msg, break; case PAM_ERROR_MSG: if ( (NULL == msg[count]->msg) - || (fprintf (shadow_logfd, "%s\n", msg[count]->msg) <0)) { + || (fprintf (log_get_logfd(), "%s\n", msg[count]->msg) <0)) { goto failed_conversation; } responses[count].resp = NULL; @@ -101,9 +79,9 @@ static int ni_conv (int num_msg, responses[count].resp = NULL; break; default: - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: conversation type %d not supported.\n"), - Prog, msg[count]->msg_style); + log_get_progname(), msg[count]->msg_style); goto failed_conversation; } } @@ -143,19 +121,19 @@ int do_pam_passwd_non_interactive (const char *pam_service, ret = pam_start (pam_service, username, &non_interactive_pam_conv, &pamh); if (ret != PAM_SUCCESS) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: (user %s) pam_start failure %d\n"), - Prog, username, ret); + log_get_progname(), username, ret); return 1; } non_interactive_password = password; ret = pam_chauthtok (pamh, 0); if (ret != PAM_SUCCESS) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: (user %s) pam_chauthtok() failed, error:\n" "%s\n"), - Prog, username, pam_strerror (pamh, ret)); + log_get_progname(), username, pam_strerror (pamh, ret)); } (void) pam_end (pamh, PAM_SUCCESS); diff --git a/libmisc/prefix_flag.c b/libmisc/prefix_flag.c index 2e455c40..d4dfbc20 100644 --- a/libmisc/prefix_flag.c +++ b/libmisc/prefix_flag.c @@ -1,31 +1,8 @@ /* - * Copyright (c) 2011 , Julian Pidancet - * Copyright (c) 2011 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2011 , Julian Pidancet + * SPDX-FileCopyrightText: 2011 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -48,6 +25,7 @@ #include "subordinateio.h" #endif /* ENABLE_SUBIDS */ #include "getdef.h" +#include "shadowlog.h" static char *passwd_db_file = NULL; static char *spw_db_file = NULL; @@ -83,18 +61,18 @@ extern const char* process_prefix_flag (const char* short_opt, int argc, char ** && (val = argv[i] + 9)) || (strcmp (argv[i], short_opt) == 0)) { if (NULL != prefix) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: multiple --prefix options\n"), - Prog); + log_get_progname()); exit (E_BAD_ARG); } if (val) { prefix = val; } else if (i + 1 == argc) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: option '%s' requires an argument\n"), - Prog, argv[i]); + log_get_progname(), argv[i]); exit (E_BAD_ARG); } else { prefix = argv[++ i]; @@ -110,9 +88,9 @@ extern const char* process_prefix_flag (const char* short_opt, int argc, char ** /* should we prevent symbolic link from being used as a prefix? */ if ( prefix[0] != '/') { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: prefix must be an absolute path\n"), - Prog); + log_get_progname()); exit (E_BAD_ARG); } size_t len; @@ -176,10 +154,10 @@ extern struct group *prefix_getgrnam(const char *name) struct group * grp = NULL; fg = fopen(group_db_file, "rt"); - if(!fg) + if (!fg) return NULL; - while((grp = fgetgrent(fg)) != NULL) { - if(!strcmp(name, grp->gr_name)) + while ((grp = fgetgrent(fg)) != NULL) { + if (!strcmp(name, grp->gr_name)) break; } fclose(fg); @@ -196,10 +174,10 @@ extern struct group *prefix_getgrgid(gid_t gid) struct group * grp = NULL; fg = fopen(group_db_file, "rt"); - if(!fg) + if (!fg) return NULL; - while((grp = fgetgrent(fg)) != NULL) { - if(gid == grp->gr_gid) + while ((grp = fgetgrent(fg)) != NULL) { + if (gid == grp->gr_gid) break; } fclose(fg); @@ -216,10 +194,10 @@ extern struct passwd *prefix_getpwuid(uid_t uid) struct passwd *pwd = NULL; fg = fopen(passwd_db_file, "rt"); - if(!fg) + if (!fg) return NULL; - while((pwd = fgetpwent(fg)) != NULL) { - if(uid == pwd->pw_uid) + while ((pwd = fgetpwent(fg)) != NULL) { + if (uid == pwd->pw_uid) break; } fclose(fg); @@ -236,10 +214,10 @@ extern struct passwd *prefix_getpwnam(const char* name) struct passwd *pwd = NULL; fg = fopen(passwd_db_file, "rt"); - if(!fg) + if (!fg) return NULL; - while((pwd = fgetpwent(fg)) != NULL) { - if(!strcmp(name, pwd->pw_name)) + while ((pwd = fgetpwent(fg)) != NULL) { + if (!strcmp(name, pwd->pw_name)) break; } fclose(fg); @@ -256,10 +234,10 @@ extern struct spwd *prefix_getspnam(const char* name) struct spwd *sp = NULL; fg = fopen(spw_db_file, "rt"); - if(!fg) + if (!fg) return NULL; - while((sp = fgetspent(fg)) != NULL) { - if(!strcmp(name, sp->sp_namp)) + while ((sp = fgetspent(fg)) != NULL) { + if (!strcmp(name, sp->sp_namp)) break; } fclose(fg); @@ -272,7 +250,7 @@ extern struct spwd *prefix_getspnam(const char* name) extern void prefix_setpwent() { - if(!passwd_db_file) { + if (!passwd_db_file) { setpwent(); return; } @@ -280,19 +258,22 @@ extern void prefix_setpwent() fclose (fp_pwent); fp_pwent = fopen(passwd_db_file, "rt"); - if(!fp_pwent) + if (!fp_pwent) return; } extern struct passwd* prefix_getpwent() { - if(!passwd_db_file) { + if (!passwd_db_file) { return getpwent(); } + if (!fp_pwent) { + return NULL; + } return fgetpwent(fp_pwent); } extern void prefix_endpwent() { - if(!passwd_db_file) { + if (!passwd_db_file) { endpwent(); return; } @@ -303,7 +284,7 @@ extern void prefix_endpwent() extern void prefix_setgrent() { - if(!group_db_file) { + if (!group_db_file) { setgrent(); return; } @@ -311,19 +292,19 @@ extern void prefix_setgrent() fclose (fp_grent); fp_grent = fopen(group_db_file, "rt"); - if(!fp_grent) + if (!fp_grent) return; } extern struct group* prefix_getgrent() { - if(!group_db_file) { + if (!group_db_file) { return getgrent(); } return fgetgrent(fp_grent); } extern void prefix_endgrent() { - if(!group_db_file) { + if (!group_db_file) { endgrent(); return; } diff --git a/libmisc/pwd2spwd.c b/libmisc/pwd2spwd.c index 6799dd50..139a0240 100644 --- a/libmisc/pwd2spwd.c +++ b/libmisc/pwd2spwd.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1997, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/pwd_init.c b/libmisc/pwd_init.c index 774ba9b1..63c71e28 100644 --- a/libmisc/pwd_init.c +++ b/libmisc/pwd_init.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1990 - 1994, Julianne Frances Haugh - * Copyright (c) 1997 , Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1997 , Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/pwdcheck.c b/libmisc/pwdcheck.c index bc6b66f8..15fc3a33 100644 --- a/libmisc/pwdcheck.c +++ b/libmisc/pwdcheck.c @@ -1,31 +1,8 @@ /* - * Copyright (c) 2000 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2008, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2000 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2008, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -39,6 +16,7 @@ #include "prototypes.h" #include "defines.h" #include "pwauth.h" +#include "shadowlog.h" void passwd_check (const char *user, const char *passwd, unused const char *progname) { @@ -51,7 +29,7 @@ void passwd_check (const char *user, const char *passwd, unused const char *prog if (pw_auth (passwd, user, PW_LOGIN, (char *) 0) != 0) { SYSLOG ((LOG_WARN, "incorrect password for `%s'", user)); (void) sleep (1); - fprintf (shadow_logfd, _("Incorrect password for %s.\n"), user); + fprintf (log_get_logfd(), _("Incorrect password for %s.\n"), user); exit (EXIT_FAILURE); } } diff --git a/libmisc/remove_tree.c b/libmisc/remove_tree.c index b2794ab4..c3aa8131 100644 --- a/libmisc/remove_tree.c +++ b/libmisc/remove_tree.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 2001, Marek Michałkiewicz - * Copyright (c) 2003 - 2006, Tomasz Kłoczko - * Copyright (c) 2007 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2001, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/rlogin.c b/libmisc/rlogin.c index b19f5e8f..fa67dc34 100644 --- a/libmisc/rlogin.c +++ b/libmisc/rlogin.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1999, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2008, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2008, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/root_flag.c b/libmisc/root_flag.c index e9a97d44..530f32b9 100644 --- a/libmisc/root_flag.c +++ b/libmisc/root_flag.c @@ -1,31 +1,8 @@ /* - * Copyright (c) 2011 , Julian Pidancet - * Copyright (c) 2011 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2011 , Julian Pidancet + * SPDX-FileCopyrightText: 2011 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -38,6 +15,7 @@ #include "prototypes.h" /*@-exitarg@*/ #include "exitcodes.h" +#include "shadowlog.h" static void change_root (const char* newroot); @@ -65,18 +43,18 @@ extern void process_root_flag (const char* short_opt, int argc, char **argv) && (val = argv[i] + 7)) || (strcmp (argv[i], short_opt) == 0)) { if (NULL != newroot) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: multiple --root options\n"), - Prog); + log_get_progname()); exit (E_BAD_ARG); } if (val) { newroot = val; } else if (i + 1 == argc) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: option '%s' requires an argument\n"), - Prog, argv[i]); + log_get_progname(), argv[i]); exit (E_BAD_ARG); } else { newroot = argv[++ i]; @@ -94,36 +72,36 @@ static void change_root (const char* newroot) /* Drop privileges */ if ( (setregid (getgid (), getgid ()) != 0) || (setreuid (getuid (), getuid ()) != 0)) { - fprintf (shadow_logfd, _("%s: failed to drop privileges (%s)\n"), - Prog, strerror (errno)); + fprintf (log_get_logfd(), _("%s: failed to drop privileges (%s)\n"), + log_get_progname(), strerror (errno)); exit (EXIT_FAILURE); } if ('/' != newroot[0]) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: invalid chroot path '%s'\n"), - Prog, newroot); + log_get_progname(), newroot); exit (E_BAD_ARG); } if (access (newroot, F_OK) != 0) { - fprintf(shadow_logfd, + fprintf(log_get_logfd(), _("%s: cannot access chroot directory %s: %s\n"), - Prog, newroot, strerror (errno)); + log_get_progname(), newroot, strerror (errno)); exit (E_BAD_ARG); } if (chdir (newroot) != 0) { - fprintf(shadow_logfd, + fprintf(log_get_logfd(), _("%s: cannot chdir to chroot directory %s: %s\n"), - Prog, newroot, strerror (errno)); + log_get_progname(), newroot, strerror (errno)); exit (E_BAD_ARG); } if (chroot (newroot) != 0) { - fprintf(shadow_logfd, + fprintf(log_get_logfd(), _("%s: unable to chroot to directory %s: %s\n"), - Prog, newroot, strerror (errno)); + log_get_progname(), newroot, strerror (errno)); exit (E_BAD_ARG); } } diff --git a/libmisc/salt.c b/libmisc/salt.c index 91d528fd..f8ac5669 100644 --- a/libmisc/salt.c +++ b/libmisc/salt.c @@ -1,3 +1,10 @@ +/* + * SPDX-FileCopyrightText: Marek Michalkiewicz + * SPDX-FileCopyrightText: J.T. Conklin + * + * SPDX-License-Identifier: Unlicense + */ + /* * salt.c - generate a random salt string for crypt() * @@ -21,6 +28,7 @@ #include "prototypes.h" #include "defines.h" #include "getdef.h" +#include "shadowlog.h" #if (defined CRYPT_GENSALT_IMPLEMENTS_AUTO_ENTROPY && \ CRYPT_GENSALT_IMPLEMENTS_AUTO_ENTROPY) @@ -178,7 +186,7 @@ static long read_random_bytes (void) #endif fail: - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("Unable to obtain random bytes.\n")); exit (1); @@ -223,20 +231,21 @@ static /*@observer@*/const unsigned long SHA_get_salt_rounds (/*@null@*/int *pre if ((-1 == min_rounds) && (-1 == max_rounds)) { rounds = SHA_ROUNDS_DEFAULT; } + else { + if (-1 == min_rounds) { + min_rounds = max_rounds; + } - if (-1 == min_rounds) { - min_rounds = max_rounds; - } + if (-1 == max_rounds) { + max_rounds = min_rounds; + } - if (-1 == max_rounds) { - max_rounds = min_rounds; - } + if (min_rounds > max_rounds) { + max_rounds = min_rounds; + } - if (min_rounds > max_rounds) { - max_rounds = min_rounds; + rounds = (unsigned long) shadow_random (min_rounds, max_rounds); } - - rounds = (unsigned long) shadow_random (min_rounds, max_rounds); } else if (0 == *prefered_rounds) { rounds = SHA_ROUNDS_DEFAULT; } else { @@ -505,7 +514,7 @@ static /*@observer@*/const char *gensalt (size_t salt_size) SHA_salt_rounds_to_buf (result, rounds); #endif /* USE_SHA_CRYPT */ } else if (0 != strcmp (method, "DES")) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("Invalid ENCRYPT_METHOD value: '%s'.\n" "Defaulting to DES.\n"), method); @@ -531,7 +540,7 @@ static /*@observer@*/const char *gensalt (size_t salt_size) /* Should not happen, but... */ if (NULL == retval) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("Unable to generate a salt from setting " "\"%s\", check your settings in " "ENCRYPT_METHOD and the corresponding " diff --git a/libmisc/setugid.c b/libmisc/setugid.c index 9bb62af9..6dbe38ee 100644 --- a/libmisc/setugid.c +++ b/libmisc/setugid.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/setupenv.c b/libmisc/setupenv.c index 74b18723..5d7aefa2 100644 --- a/libmisc/setupenv.c +++ b/libmisc/setupenv.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2001 - 2006, Tomasz Kłoczko - * Copyright (c) 2007 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2001 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* @@ -47,6 +24,7 @@ #include "defines.h" #include #include "getdef.h" +#include "shadowlog.h" #ifndef USE_PAM static void @@ -219,7 +197,7 @@ void setup_env (struct passwd *info) static char temp_pw_dir[] = "/"; if (!getdef_bool ("DEFAULT_HOME") || chdir ("/") == -1) { - fprintf (shadow_logfd, _("Unable to cd to '%s'\n"), + fprintf (log_get_logfd(), _("Unable to cd to '%s'\n"), info->pw_dir); SYSLOG ((LOG_WARN, "unable to cd to `%s' for user `%s'\n", diff --git a/libmisc/shell.c b/libmisc/shell.c index 92bfc2bc..29724063 100644 --- a/libmisc/shell.c +++ b/libmisc/shell.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1991, Julianne Frances Haugh - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2003 - 2006, Tomasz Kłoczko - * Copyright (c) 2009 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1991, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2009 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/strtoday.c b/libmisc/strtoday.c index 860f06d4..7a60ea3d 100644 --- a/libmisc/strtoday.c +++ b/libmisc/strtoday.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1999, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #if !defined(__GLIBC__) diff --git a/libmisc/sub.c b/libmisc/sub.c index b0e32d11..d30c4c76 100644 --- a/libmisc/sub.c +++ b/libmisc/sub.c @@ -1,32 +1,9 @@ /* - * Copyright (c) 1989 - 1991, Julianne Frances Haugh - * Copyright (c) 1996 - 1999, Marek Michałkiewicz - * Copyright (c) 2003 - 2006, Tomasz Kłoczko - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1991, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/sulog.c b/libmisc/sulog.c index 4068acdf..3e956134 100644 --- a/libmisc/sulog.c +++ b/libmisc/sulog.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1992, Julianne Frances Haugh - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2001 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1992, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/ttytype.c b/libmisc/ttytype.c index 06e79444..f72d9573 100644 --- a/libmisc/ttytype.c +++ b/libmisc/ttytype.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1997, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/tz.c b/libmisc/tz.c index bcf4f7ff..16d92ade 100644 --- a/libmisc/tz.c +++ b/libmisc/tz.c @@ -1,34 +1,11 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 1991 - 1994, Chip Rosenthal - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1991 - 1994, Chip Rosenthal + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/ulimit.c b/libmisc/ulimit.c index 30255a5d..e331d46c 100644 --- a/libmisc/ulimit.c +++ b/libmisc/ulimit.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1990 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1997, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/user_busy.c b/libmisc/user_busy.c index 3deebfc3..c03feb29 100644 --- a/libmisc/user_busy.c +++ b/libmisc/user_busy.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1991 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 2000, Marek Michałkiewicz - * Copyright (c) 2000 - 2006, Tomasz Kłoczko - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2000 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include @@ -45,6 +22,7 @@ #ifdef ENABLE_SUBIDS #include "subordinateio.h" #endif /* ENABLE_SUBIDS */ +#include "shadowlog.h" #ifdef __linux__ static int check_status (const char *name, const char *sname, uid_t uid); @@ -96,9 +74,9 @@ static int user_busy_utmp (const char *name) continue; } - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: user %s is currently logged in\n"), - Prog, name); + log_get_progname(), name); return 1; } @@ -249,9 +227,9 @@ static int user_busy_processes (const char *name, uid_t uid) #ifdef ENABLE_SUBIDS sub_uid_close(); #endif - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: user %s is currently used by process %d\n"), - Prog, name, pid); + log_get_progname(), name, pid); return 1; } @@ -273,9 +251,9 @@ static int user_busy_processes (const char *name, uid_t uid) #ifdef ENABLE_SUBIDS sub_uid_close(); #endif - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: user %s is currently used by process %d\n"), - Prog, name, pid); + log_get_progname(), name, pid); return 1; } } diff --git a/libmisc/utmp.c b/libmisc/utmp.c index 5dcd419f..d2b65ac7 100644 --- a/libmisc/utmp.c +++ b/libmisc/utmp.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1999, Marek Michałkiewicz - * Copyright (c) 2001 - 2005, Tomasz Kłoczko - * Copyright (c) 2008 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/valid.c b/libmisc/valid.c index 4b85d67c..326635ff 100644 --- a/libmisc/valid.c +++ b/libmisc/valid.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1989 - 1993, Julianne Frances Haugh - * Copyright (c) 1996 - 1999, Marek Michałkiewicz - * Copyright (c) 2003 - 2005, Tomasz Kłoczko - * Copyright (c) 2007 - 2008, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1989 - 1993, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2007 - 2008, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include diff --git a/libmisc/xgetXXbyYY.c b/libmisc/xgetXXbyYY.c index 11f45fc4..db010224 100644 --- a/libmisc/xgetXXbyYY.c +++ b/libmisc/xgetXXbyYY.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* @@ -54,6 +31,7 @@ #include #include #include "prototypes.h" +#include "shadowlog.h" #define XFUNCTION_NAME XPREFIX (FUNCTION_NAME) #define XPREFIX(name) XPREFIX1 (name) @@ -74,7 +52,7 @@ result = malloc(sizeof(LOOKUP_TYPE)); if (NULL == result) { - fprintf (shadow_logfd, _("%s: out of memory\n"), + fprintf (log_get_logfd(), _("%s: out of memory\n"), "x" STRINGIZE(FUNCTION_NAME)); exit (13); } @@ -84,7 +62,7 @@ LOOKUP_TYPE *resbuf = NULL; buffer = (char *)realloc (buffer, length); if (NULL == buffer) { - fprintf (shadow_logfd, _("%s: out of memory\n"), + fprintf (log_get_logfd(), _("%s: out of memory\n"), "x" STRINGIZE(FUNCTION_NAME)); exit (13); } @@ -132,7 +110,7 @@ if (result) { result = DUP_FUNCTION(result); if (NULL == result) { - fprintf (shadow_logfd, _("%s: out of memory\n"), + fprintf (log_get_logfd(), _("%s: out of memory\n"), "x" STRINGIZE(FUNCTION_NAME)); exit (13); } diff --git a/libmisc/xgetgrgid.c b/libmisc/xgetgrgid.c index 2ef171d1..fe99929b 100644 --- a/libmisc/xgetgrgid.c +++ b/libmisc/xgetgrgid.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/xgetgrnam.c b/libmisc/xgetgrnam.c index a07d0c33..66d6f933 100644 --- a/libmisc/xgetgrnam.c +++ b/libmisc/xgetgrnam.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/xgetpwnam.c b/libmisc/xgetpwnam.c index db65abb7..74eb9721 100644 --- a/libmisc/xgetpwnam.c +++ b/libmisc/xgetpwnam.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/xgetpwuid.c b/libmisc/xgetpwuid.c index 89241344..23b2d0c3 100644 --- a/libmisc/xgetpwuid.c +++ b/libmisc/xgetpwuid.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2007 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2007 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/xgetspnam.c b/libmisc/xgetspnam.c index 287e97f2..148185f4 100644 --- a/libmisc/xgetspnam.c +++ b/libmisc/xgetspnam.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2008 - 2009, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2008 - 2009, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* diff --git a/libmisc/xmalloc.c b/libmisc/xmalloc.c index 6d686145..9329e674 100644 --- a/libmisc/xmalloc.c +++ b/libmisc/xmalloc.c @@ -1,33 +1,10 @@ /* - * Copyright (c) 1990 - 1994, Julianne Frances Haugh - * Copyright (c) 1996 - 1998, Marek Michałkiewicz - * Copyright (c) 2003 - 2006, Tomasz Kłoczko - * Copyright (c) 2008 , Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz + * SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko + * SPDX-FileCopyrightText: 2008 , Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* Replacements for malloc and strdup with error checking. Too trivial @@ -47,6 +24,7 @@ #include #include "defines.h" #include "prototypes.h" +#include "shadowlog.h" /*@maynotreturn@*/ /*@only@*//*@out@*//*@notnull@*/char *xmalloc (size_t size) { @@ -54,9 +32,9 @@ ptr = (char *) malloc (size); if (NULL == ptr) { - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: failed to allocate memory: %s\n"), - Prog, strerror (errno)); + log_get_progname(), strerror (errno)); exit (13); } return ptr; diff --git a/libmisc/yesno.c b/libmisc/yesno.c index a2eb9530..cfbe6ecc 100644 --- a/libmisc/yesno.c +++ b/libmisc/yesno.c @@ -1,31 +1,8 @@ /* - * Copyright (c) 1992 - 1994, Julianne Frances Haugh - * Copyright (c) 2007 - 2008, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 1992 - 1994, Julianne Frances Haugh + * SPDX-FileCopyrightText: 2007 - 2008, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ /* -- cgit v1.2.1