Compare commits
10 Commits
update-man
...
upstream/4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9c3448878 | ||
|
|
a475f464e0 | ||
|
|
65261e28f4 | ||
|
|
bd724b34e0 | ||
|
|
c2a3ebed18 | ||
|
|
f78a468368 | ||
|
|
9f68246a01 | ||
|
|
e8b8d7a84b | ||
|
|
0fda4df4f1 | ||
|
|
f7f4fd7c05 |
@@ -3,11 +3,20 @@ reports and various comments. This list may be incomplete, I received
|
||||
a lot of mail...
|
||||
|
||||
# Maintainers
|
||||
* Marek Michałkiewicz <marekm72@gmail.com> (1995-2000)
|
||||
* Tomasz Kłoczko <kloczek@pld.org.pl> (2000-2007)
|
||||
* Nicolas François <nicolas.francois@centraliens.net> (2007-2014)
|
||||
* Serge E. Hallyn <serge@hallyn.com> (2014-now)
|
||||
* Christian Brauner <christian@brauner.io> (2019-now)
|
||||
* Iker Pedrosa <ipedrosa@redhat.com> (2022-now)
|
||||
* Alejandro Colomar <alx@kernel.org> (2023-now) (4.14 stable)
|
||||
|
||||
To verify signatures on releases, use the following keys under keys/ :
|
||||
|
||||
* Serge Hallyn: keys/66D0387DB85D320F8408166DB175CFA98F192AF2.asc
|
||||
* Christian Brauner: keys/4880B8C9BD0E5106FC070F4F7B3C391EFEA93624.asc
|
||||
* Iker Pedrosa: keys/4E80EF49C7987B6DE2F81F5005079C6C3A653E57.asc
|
||||
* Alejandro Colomar: keys/A9348594CE31283A826FBDD8D57633D441E25BB5.asc
|
||||
|
||||
# Authors and contributors
|
||||
* Adam Rudnicki <adam@v-lo.krakow.pl>
|
||||
|
||||
14
ChangeLog
14
ChangeLog
@@ -9558,7 +9558,7 @@
|
||||
* NEWS: release date corrected.
|
||||
|
||||
* NEWS, src/su.c:
|
||||
fixed set enviroment too early when using PAM, so move it to !USE_PAM
|
||||
fixed set environment too early when using PAM, so move it to !USE_PAM
|
||||
(patch submitted by Mike Frysinger <vapier@gentoo.org>).
|
||||
|
||||
2006-07-30 Tomasz Kłoczko <kloczek@pld.org.pl>
|
||||
@@ -10245,7 +10245,7 @@
|
||||
* NEWS: cleanups.
|
||||
|
||||
* autogen.sh:
|
||||
by default in development enviroment use CFLAGS="-O2 -Wall".
|
||||
by default in development environment use CFLAGS="-O2 -Wall".
|
||||
|
||||
* src/chgpasswd.c (main): remove two unused variables (newgr and now).
|
||||
|
||||
@@ -11654,7 +11654,7 @@
|
||||
in OPTIONS section). Describe -a and -k options.
|
||||
|
||||
* NEWS, src/su.c:
|
||||
fixed twice copy enviroment which causes auth problems (bug was introduced in 4.0.12;
|
||||
fixed twice copy environment which causes auth problems (bug was introduced in 4.0.12;
|
||||
fix by Nicolas François <nicolas.francois@centraliens.net>).
|
||||
|
||||
* src/passwd.c, po/ja.po, po/ko.po, po/nb.po, po/nl.po, po/nn.po, po/pl.po, po/pt.po, po/pt_BR.po, po/ro.po, po/ru.po, po/sk.po, po/sq.po, po/sv.po, po/tl.po, po/tr.po, po/uk.po, po/vi.po, po/zh_CN.po, po/zh_TW.po, po/bs.po, po/ca.po, po/cs.po, po/da.po, po/de.po, po/el.po, po/es.po, po/eu.po, po/fi.po, po/fr.po, po/he.po, po/id.po, po/it.po:
|
||||
@@ -12584,7 +12584,7 @@
|
||||
http://bugs.debian.org/48002
|
||||
|
||||
* src/login.c, NEWS:
|
||||
fixed loggin of username on succesful login (was using the normal username,
|
||||
fixed loggin of username on successful login (was using the normal username,
|
||||
when it should have used pam_user) http://bugs.debian.org/47819
|
||||
|
||||
2005-06-02 Tomasz Kłoczko <kloczek@pld.org.pl>
|
||||
@@ -13029,7 +13029,7 @@
|
||||
* man/pl/usermod.8: finish sync with english version.
|
||||
|
||||
* man/hu/login.1, man/pl/login.1, NEWS, man/Attic/login.1, man/de/login.1:
|
||||
removed fragment about abilities pass enviroment variables in login prompt.
|
||||
removed fragment about abilities pass environment variables in login prompt.
|
||||
|
||||
* man/Attic/gpasswd.1, man/Attic/newgrp.1:
|
||||
fixes by Nicolas Nicolas François <nicolas.francois@centraliens.net> (not all
|
||||
@@ -13508,7 +13508,7 @@
|
||||
removed not used translations.
|
||||
|
||||
* NEWS, src/su.c:
|
||||
fix adding of pam_env env variables to enviroment (Martin Schlemmer <azarah@nosferatu.za.org>).
|
||||
fix adding of pam_env env variables to environment (Martin Schlemmer <azarah@nosferatu.za.org>).
|
||||
|
||||
* NEWS, configure.in:
|
||||
fixed filling MAIL_SPOOL_DIR and MAIL_SPOOL_FILE variables which was allways
|
||||
@@ -13605,7 +13605,7 @@
|
||||
|
||||
* NEWS, src/su.c:
|
||||
add pam_open_session() support. If builded without PAM support
|
||||
propagate $DISPLAY and $XAUTHORITY enviroment variables.
|
||||
propagate $DISPLAY and $XAUTHORITY environment variables.
|
||||
Based on http://www.gentoo.org/cgi-bin/viewcvs.cgi/sys-apps/shadow/files/shadow-4.0.4.1-su-pam_open_session.patch?rev=1.1
|
||||
|
||||
2004-10-23 Tomasz Kłoczko <kloczek@pld.org.pl>
|
||||
|
||||
20
Makefile.am
20
Makefile.am
@@ -1,15 +1,27 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
EXTRA_DIST = NEWS README TODO shadow.spec.in
|
||||
|
||||
SUBDIRS = libmisc lib
|
||||
SUBDIRS = lib
|
||||
|
||||
if ENABLE_SUBIDS
|
||||
SUBDIRS += libsubid
|
||||
endif
|
||||
|
||||
SUBDIRS += src po contrib doc etc
|
||||
SUBDIRS += src po contrib doc etc tests/unit
|
||||
|
||||
if ENABLE_REGENERATE_MAN
|
||||
SUBDIRS += man
|
||||
endif
|
||||
|
||||
CLEANFILES = man/8.out man/po/remove-potcdate.* man/*/login.defs.d man/*/*.mo
|
||||
|
||||
EXTRA_DIST = NEWS README tests/
|
||||
|
||||
dist-hook:
|
||||
chmod -R u+w $(distdir)/tests
|
||||
chmod u+w $(distdir)
|
||||
mv $(distdir)/tests/unit $(distdir)/realunittest
|
||||
mv $(distdir)/tests/tests $(distdir)/realtests
|
||||
rm -rf $(distdir)/tests
|
||||
mv $(distdir)/realtests $(distdir)/tests
|
||||
rm -rf $(distdir)/tests/unit $(distdir)/tests/Makefile*
|
||||
mv $(distdir)/realunittest $(distdir)/tests/unit
|
||||
|
||||
52
Makefile.in
52
Makefile.in
@@ -108,7 +108,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = man/po/Makefile shadow.spec
|
||||
CONFIG_CLEAN_FILES = man/po/Makefile
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
@@ -163,12 +163,11 @@ am__define_uniq_tagged_files = \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
DIST_SUBDIRS = libmisc lib libsubid src po contrib doc etc man
|
||||
DIST_SUBDIRS = lib libsubid src po contrib doc etc tests/unit man
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||
$(srcdir)/shadow.spec.in $(top_srcdir)/man/po/Makefile.in \
|
||||
ABOUT-NLS AUTHORS.md COPYING ChangeLog NEWS README TODO \
|
||||
compile config.guess config.rpath config.sub install-sh \
|
||||
ltmain.sh missing
|
||||
$(top_srcdir)/man/po/Makefile.in ABOUT-NLS AUTHORS.md COPYING \
|
||||
ChangeLog NEWS README compile config.guess config.rpath \
|
||||
config.sub install-sh ltmain.sh missing
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
@@ -224,6 +223,8 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CMOCKA_CFLAGS = @CMOCKA_CFLAGS@
|
||||
CMOCKA_LIBS = @CMOCKA_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
@@ -257,9 +258,15 @@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBACL = @LIBACL@
|
||||
LIBADD_DL = @LIBADD_DL@
|
||||
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
|
||||
LIBADD_DLOPEN = @LIBADD_DLOPEN@
|
||||
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
|
||||
LIBATTR = @LIBATTR@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBCRACK = @LIBCRACK@
|
||||
LIBBSD = @LIBBSD@
|
||||
LIBBSD_CFLAGS = @LIBBSD_CFLAGS@
|
||||
LIBBSD_LIBS = @LIBBSD_LIBS@
|
||||
LIBCRYPT = @LIBCRYPT@
|
||||
LIBECONF = @LIBECONF@
|
||||
LIBICONV = @LIBICONV@
|
||||
@@ -275,6 +282,7 @@ LIBSUBID_ABI = @LIBSUBID_ABI@
|
||||
LIBSUBID_ABI_MAJOR = @LIBSUBID_ABI_MAJOR@
|
||||
LIBSUBID_ABI_MICRO = @LIBSUBID_ABI_MICRO@
|
||||
LIBSUBID_ABI_MINOR = @LIBSUBID_ABI_MINOR@
|
||||
LIBSYSTEMD = @LIBSYSTEMD@
|
||||
LIBTCB = @LIBTCB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
@@ -283,6 +291,8 @@ LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_DLLOADERS = @LT_DLLOADERS@
|
||||
LT_DLPREOPEN = @LT_DLPREOPEN@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
@@ -305,6 +315,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
@@ -376,9 +389,10 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
EXTRA_DIST = NEWS README TODO shadow.spec.in
|
||||
SUBDIRS = libmisc lib $(am__append_1) src po contrib doc etc \
|
||||
SUBDIRS = lib $(am__append_1) src po contrib doc etc tests/unit \
|
||||
$(am__append_2)
|
||||
CLEANFILES = man/8.out man/po/remove-potcdate.* man/*/login.defs.d man/*/*.mo
|
||||
EXTRA_DIST = NEWS README tests/
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
@@ -433,8 +447,6 @@ distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
man/po/Makefile: $(top_builddir)/config.status $(top_srcdir)/man/po/Makefile.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
shadow.spec: $(top_builddir)/config.status $(srcdir)/shadow.spec.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
@@ -610,6 +622,9 @@ distdir-am: $(DISTFILES)
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
@@ -773,6 +788,7 @@ install-strip:
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
@@ -856,8 +872,8 @@ uninstall-am:
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
clean-libtool cscope cscopelist-am ctags ctags-am dist \
|
||||
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
|
||||
dist-xz dist-zip dist-zstd distcheck distclean \
|
||||
dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \
|
||||
dist-tarZ dist-xz dist-zip dist-zstd distcheck distclean \
|
||||
distclean-generic distclean-hdr distclean-libtool \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
@@ -873,6 +889,16 @@ uninstall-am:
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
dist-hook:
|
||||
chmod -R u+w $(distdir)/tests
|
||||
chmod u+w $(distdir)
|
||||
mv $(distdir)/tests/unit $(distdir)/realunittest
|
||||
mv $(distdir)/tests/tests $(distdir)/realtests
|
||||
rm -rf $(distdir)/tests
|
||||
mv $(distdir)/realtests $(distdir)/tests
|
||||
rm -rf $(distdir)/tests/unit $(distdir)/tests/Makefile*
|
||||
mv $(distdir)/realunittest $(distdir)/tests/unit
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
14
NEWS
14
NEWS
@@ -696,7 +696,7 @@ shadow-4.0.18 -> shadow-4.0.18.1 03-08-2006
|
||||
shadow-4.0.17 -> shadow-4.0.18 01-08-2006
|
||||
|
||||
*** general:
|
||||
- su: fixed set enviroment too early when using PAM, so move it to !USE_PAM
|
||||
- su: fixed set environment too early when using PAM, so move it to !USE_PAM
|
||||
(patch submitted by Mike Frysinger <vapier@gentoo.org>),
|
||||
- groupadd, groupmod, useradd, usermod: fixed UID/GID overflow (fixed
|
||||
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=198920)
|
||||
@@ -855,7 +855,7 @@ shadow-4.0.14 -> shadow-4.0.15 13-03-2006
|
||||
- su: move exit() outside libmisc/shell.c::shell() for handle shell() errors
|
||||
on higher level (now is better visable where some programs exit with 126
|
||||
and 127 exit codes); added new shell() parameter (char *const envp[])
|
||||
which allow fix preserving enviroment in su on using -p, (patch by
|
||||
which allow fix preserving environment in su on using -p, (patch by
|
||||
Alexander Gattin <xrgtn@yandex.ru>),
|
||||
- su: added handle -c,--command option for GNU su compliance (merge
|
||||
437_su_-c_option Debian patch),
|
||||
@@ -966,7 +966,7 @@ shadow-4.0.12 -> shadow-4.0.13 10-10-2005
|
||||
to example described in ident(1) man page (modern compilers like latest GCC
|
||||
removes not used functions by global optimization).
|
||||
So "ident /usr/bin/passwd" will show again some useable informations
|
||||
- su: fixed twice copy enviroment which causes auth problems
|
||||
- su: fixed twice copy environment which causes auth problems
|
||||
(bug was introduced in 4.0.12; fix by Nicolas François <nicolas.francois@centraliens.net>),
|
||||
- chage: differentiate the different failure causes by the exit value
|
||||
This will permit to adduser Debian script to detect if chage failed because the
|
||||
@@ -1133,7 +1133,7 @@ shadow-4.0.9 -> shadow-4.0.10 28-06-2005
|
||||
http://bugs.debian.org/53702
|
||||
- login: check for hushed login and pass PAM_SILENT if true,
|
||||
http://bugs.debian.org/48002
|
||||
- login: fixed username on succesful login (was using the normal username,
|
||||
- login: fixed username on successful login (was using the normal username,
|
||||
when it should have used pam_user) http://bugs.debian.org/47819
|
||||
- remove using SHADOWPWD #define so now shadow is always built with shadow
|
||||
password support,
|
||||
@@ -1212,7 +1212,7 @@ shadow-4.0.7 -> shadow-4.0.8 26-04-2005
|
||||
(without gshadow) doesn't permit to use newgrp,
|
||||
- newgrp(1): newgrp uses /bin/sh (not bash),
|
||||
- faillog(8): updated after rewritten faillog command for use getopt_long(),
|
||||
- login(1): removed fragment about abilities pass enviroment variables in login prompt,
|
||||
- login(1): removed fragment about abilities pass environment variables in login prompt,
|
||||
- gshadow(5): new file (by Nicolas Nicolas François <nicolas.francois@centraliens.net>),
|
||||
- usermod(8): fixed #302388 Debian bug: added separated -o option description,
|
||||
|
||||
@@ -1242,7 +1242,7 @@ shadow-4.0.6 -> shadow-4.0.7 26-01-2005
|
||||
|
||||
shadow-4.0.5 -> shadow-4.0.6 08-11-2004
|
||||
|
||||
- su: fixed adding of pam_env env variables to enviroment
|
||||
- su: fixed adding of pam_env env variables to environment
|
||||
(Martin Schlemmer <azarah@nosferatu.za.org>),
|
||||
- autoconf: fixed filling MAIL_SPOOL_DIR and MAIL_SPOOL_FILE variables
|
||||
which was always empty (Gregorio Guidi <g.guidi@sns.it>),
|
||||
@@ -1275,7 +1275,7 @@ shadow-4.0.4.1 -> shadow-4.0.5 27-10-2004
|
||||
including symlinks placed into /etc/skel/public_html for example.
|
||||
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=66819
|
||||
- su: add pam_open_session() support. If built without PAM support
|
||||
propagate $DISPLAY and $XAUTHORITY enviroment variables.
|
||||
propagate $DISPLAY and $XAUTHORITY environment variables.
|
||||
Based on http://www.gentoo.org/cgi-bin/viewcvs.cgi/sys-apps/shadow/files/shadow-4.0.4.1-su-pam_open_session.patch?rev=1.1
|
||||
- applied 036_pam_access_with_preauth.patch Debian patch submited by Bjorn
|
||||
Torkelsson <Bjorn.Torkelsson@hpc2n.umu.se>: add support for PAM account
|
||||
|
||||
11
README
11
README
@@ -17,6 +17,12 @@ are used for managing group accounts.
|
||||
* [Issue tracker](https://github.com/shadow-maint/shadow/issues)
|
||||
* [Releases](https://github.com/shadow-maint/shadow/releases)
|
||||
|
||||
## Code
|
||||
|
||||
The main development branch is at [https://github.com/shadow-maint/shadow.git](https://github.com/shadow-maint/shadow)
|
||||
|
||||
See [STABLE.md](https://github.com/shadow-maint/shadow/blob/master/STABLE.md) for a list of supported stable branches.
|
||||
|
||||
## Contacts
|
||||
There are several ways to contact us:
|
||||
* [the general discussion mailing list](
|
||||
@@ -31,6 +37,11 @@ There are several ways to contact us:
|
||||
https://alioth-lists-archive.debian.net/pipermail/pkg-shadow-commits/),
|
||||
only used for historical purposes
|
||||
|
||||
## Contributions
|
||||
|
||||
Contributions are welcome. Follow the
|
||||
[guidelines](doc/contributions/introduction.md) before posting any patches.
|
||||
|
||||
## Authors and maintainers
|
||||
Authors and maintainers are listed in [AUTHORS.md](
|
||||
https://github.com/shadow-maint/shadow/blob/master/AUTHORS.md).
|
||||
|
||||
127
TODO
127
TODO
@@ -1,127 +0,0 @@
|
||||
* Create a common usage function that'd take the array of
|
||||
long options and an array of descriptions and output that so things would
|
||||
be standardized across the utils.
|
||||
Usage strings should be normalized and split first.
|
||||
Investigate optparse.
|
||||
|
||||
|
||||
/etc/default/useradd
|
||||
* GROUP=1000 should accept a group name.
|
||||
|
||||
Check when RLOGIN is enabled if ruserok() exists
|
||||
|
||||
Move selinux_file_context out of libmisc/copydir.c
|
||||
|
||||
Review hardcoded root account?
|
||||
|
||||
review all call to strto
|
||||
|
||||
libmisc/cleanup_user.c
|
||||
cleanup needed (cleanup_report_add_user* not used)
|
||||
|
||||
|
||||
libxcrypt support
|
||||
* http://wiki.linuxfromscratch.org/patches/browser/trunk/shadow/shadow-4.0.18.1-owl_blowfish-1.patch
|
||||
|
||||
implement getlong, getulong.
|
||||
avoid atoi, atol, atoul, strtol, strtoul, ...
|
||||
|
||||
manpages: comment the RLOGIN parts
|
||||
|
||||
Replace build_list (in lib/gshadow.c) and list (in lib/sgetgrent.c) by
|
||||
comma_to_list()
|
||||
|
||||
Revert the modified files if all files could not be changed.
|
||||
* or warn and indicate which files were modified and which were not.
|
||||
* check the order the files are modified.
|
||||
|
||||
report nscd_flush_cache failures?
|
||||
call nscd from the programs or from lib (commonio?)
|
||||
|
||||
PAM: check if a non-interactive conversation function could be used to set
|
||||
the password in chpasswd and newusers
|
||||
|
||||
WITH_SELINUX
|
||||
- review all tools to check that the strategies are consistent
|
||||
|
||||
chage, chfn, chsh: same change needed as in passwd.
|
||||
- probably need moving check_selinux_access to a separate file.
|
||||
|
||||
testsuite
|
||||
- newgrp
|
||||
- test with unknown user's GID
|
||||
|
||||
newusers
|
||||
- add logging to SYSLOG & AUDIT
|
||||
- use CREATE_HOME
|
||||
- Add a -Z option (see useradd / usermod)
|
||||
|
||||
Document when/where option appeared, document whether an option is standard
|
||||
or not.
|
||||
|
||||
Check all the expiry semantics
|
||||
|
||||
ALL:
|
||||
- move base passwd/shadow/group/gshadow operation to module for allow write
|
||||
different backend modules for db, NIS, LDAP and others. Default backend it
|
||||
will be goot if will be chosen depending on /etc/nsswitch.conf and allow
|
||||
override this by -r <repository> options (where the <repository> can be
|
||||
file, db, nis nisplus, ldap .. like on /etc/nsswitch.conf in service column).
|
||||
passwd have old piece of code with handling -r option and it will be good
|
||||
finish this and propagate on other shadow tools for allow operate on other
|
||||
user databases by well known tools.
|
||||
- Protect against signals. Register do_cleanups in a signal handler.
|
||||
|
||||
- login.defs
|
||||
- generate depending on configuration
|
||||
|
||||
- useradd:
|
||||
- add handle create user mail spool in maildir format.
|
||||
- Add support for -k in -D mode
|
||||
- Add support for -K in -D mode
|
||||
- Add option to create or not the mail spool (and set the default in -D
|
||||
mode)
|
||||
- Change -l to reset the entry if an entry was already there
|
||||
- set the mask in mkdir?
|
||||
|
||||
- userdel:
|
||||
- add backup option for the removal of user resources,
|
||||
- user_busy: check that the user is not running any processes.
|
||||
- missing "deleting group" FAILED
|
||||
- home dir removed, but userdel may fail and may leave the user
|
||||
=> warning needed
|
||||
|
||||
- usermod
|
||||
- add an option equivalent to useradd's -l (only when uid is changed)
|
||||
- the mode of new home directories should be set according to the
|
||||
original mode. Does copy_tree does this?
|
||||
- user renamed, order is not kept in /etc/group (see
|
||||
47_usermod-l_no_shadow_file). This is a problem when the first user is
|
||||
considered as the admin.
|
||||
- see mail "user ID change" on April, 15
|
||||
+ fix call to chown (combination of -m and -u/-g)
|
||||
+ add tests
|
||||
|
||||
- passwd:
|
||||
- check combination of options (e.g. -u/-l)
|
||||
- when -u refuse to unlock because it would create an empty password, it
|
||||
should not display "Password changed."
|
||||
exit instead?
|
||||
|
||||
- newgrp: check the USE_PAM section.
|
||||
|
||||
- pwck
|
||||
- Add check to move passwd passwords to shadow if there is a shadow
|
||||
entry (with a password).
|
||||
- Add check to move passwd passwords to shadow if there is a shadow
|
||||
file.
|
||||
- Support an alternative /etc/tcb directory as second parameter.
|
||||
- add options -g / -G to specify alternative group / gshadow files
|
||||
|
||||
- su
|
||||
- add a login.defs configuration parameter to add variables to keep in
|
||||
the environment with "su -l" (TERM/TERMCOLOR/...)
|
||||
|
||||
- vipw
|
||||
- set ACLs and XATTRs on the temporary file (and backups?)
|
||||
- vipw + selinux -> use lib/selinux.c
|
||||
1254
aclocal.m4
vendored
1254
aclocal.m4
vendored
File diff suppressed because it is too large
Load Diff
253
config.h.in
253
config.h.in
@@ -4,6 +4,12 @@
|
||||
authenticate the callers */
|
||||
#undef ACCT_TOOLS_SETUID
|
||||
|
||||
/* Define to support lastlog. */
|
||||
#undef ENABLE_LASTLOG
|
||||
|
||||
/* Define to manage session support with logind. */
|
||||
#undef ENABLE_LOGIND
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
#undef ENABLE_NLS
|
||||
@@ -14,10 +20,6 @@
|
||||
/* Path for faillog file. */
|
||||
#undef FAILLOG_FILE
|
||||
|
||||
/* Define to the type of elements in the array set by `getgroups'. Usually
|
||||
this is either `int' or `gid_t'. */
|
||||
#undef GETGROUPS_T
|
||||
|
||||
/* max group name length */
|
||||
#undef GROUP_NAME_MAX_LENGTH
|
||||
|
||||
@@ -47,13 +49,14 @@
|
||||
the CoreFoundation framework. */
|
||||
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
|
||||
|
||||
/* Define to 1 if you have the <crypt.h> header file. */
|
||||
#undef HAVE_CRYPT_H
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_CYGWIN_CONV_PATH
|
||||
|
||||
/* Define to 1 if you have the declaration of `PAM_DATA_SILENT', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_PAM_DATA_SILENT
|
||||
@@ -70,26 +73,23 @@
|
||||
if you don't. */
|
||||
#undef HAVE_DECL_PAM_NEW_AUTHTOK_REQD
|
||||
|
||||
/* Define if you have the GNU dld library. */
|
||||
#undef HAVE_DLD
|
||||
|
||||
/* Define to 1 if you have the `dlerror' function. */
|
||||
#undef HAVE_DLERROR
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
/* Define if you have the _dyld_func_lookup function. */
|
||||
#undef HAVE_DYLD
|
||||
|
||||
/* Define to 1 if you have the `explicit_bzero' function. */
|
||||
#undef HAVE_EXPLICIT_BZERO
|
||||
|
||||
/* Define to 1 if you have the `fchmod' function. */
|
||||
#undef HAVE_FCHMOD
|
||||
|
||||
/* Define to 1 if you have the `fchown' function. */
|
||||
#undef HAVE_FCHOWN
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fsync' function. */
|
||||
#undef HAVE_FSYNC
|
||||
/* Defined to 1 if you have the declaration of 'fgetpwent_r' */
|
||||
#undef HAVE_FGETPWENT_R
|
||||
|
||||
/* Define to 1 if you have the `futimes' function. */
|
||||
#undef HAVE_FUTIMES
|
||||
@@ -97,18 +97,6 @@
|
||||
/* Define to 1 if you have the `getentropy' function. */
|
||||
#undef HAVE_GETENTROPY
|
||||
|
||||
/* Define to 1 if you have the `getgrgid_r' function. */
|
||||
#undef HAVE_GETGRGID_R
|
||||
|
||||
/* Define to 1 if you have the `getgrnam_r' function. */
|
||||
#undef HAVE_GETGRNAM_R
|
||||
|
||||
/* Define to 1 if you have the `getpwnam_r' function. */
|
||||
#undef HAVE_GETPWNAM_R
|
||||
|
||||
/* Define to 1 if you have the `getpwuid_r' function. */
|
||||
#undef HAVE_GETPWUID_R
|
||||
|
||||
/* Define to 1 if you have the `getrandom' function. */
|
||||
#undef HAVE_GETRANDOM
|
||||
|
||||
@@ -124,44 +112,23 @@
|
||||
/* Define to 1 if you have the `getusershell' function. */
|
||||
#undef HAVE_GETUSERSHELL
|
||||
|
||||
/* Define to 1 if you have the `getutent' function. */
|
||||
#undef HAVE_GETUTENT
|
||||
|
||||
/* Define to 1 if you have the <gshadow.h> header file. */
|
||||
#undef HAVE_GSHADOW_H
|
||||
|
||||
/* Define if you have the iconv() function and it works. */
|
||||
#undef HAVE_ICONV
|
||||
|
||||
/* Define to 1 if you have the `initgroups' function. */
|
||||
#undef HAVE_INITGROUPS
|
||||
|
||||
/* Define to 1 if you have the `innetgr' function. */
|
||||
#undef HAVE_INNETGR
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `l64a' function. */
|
||||
#undef HAVE_L64A
|
||||
|
||||
/* Define to 1 if you have the <lastlog.h> header file. */
|
||||
#undef HAVE_LASTLOG_H
|
||||
|
||||
/* Define to 1 if you have the `lckpwdf' function. */
|
||||
#undef HAVE_LCKPWDF
|
||||
|
||||
/* Defined if you have libcrack. */
|
||||
#undef HAVE_LIBCRACK
|
||||
/* Define if you have the libdl library or equivalent. */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Defined if you have the ts&szs cracklib. */
|
||||
#undef HAVE_LIBCRACK_HIST
|
||||
|
||||
/* Defined if it includes *Pw functions. */
|
||||
#undef HAVE_LIBCRACK_PW
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
/* Define if libdlloader will be built on this platform */
|
||||
#undef HAVE_LIBDLLOADER
|
||||
|
||||
/* Define to 1 if you have the <linux/btrfs_tree.h> header file. */
|
||||
#undef HAVE_LINUX_BTRFS_TREE_H
|
||||
@@ -172,27 +139,15 @@
|
||||
/* Define if struct lastlog has ll_host */
|
||||
#undef HAVE_LL_HOST
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if you have the `lutimes' function. */
|
||||
#undef HAVE_LUTIMES
|
||||
|
||||
/* Define to 1 if you have the `memset_s' function. */
|
||||
#undef HAVE_MEMSET_S
|
||||
/* Define to 1 if you have the `memset_explicit' function. */
|
||||
#undef HAVE_MEMSET_EXPLICIT
|
||||
|
||||
/* Define to 1 if you have the <minix/config.h> header file. */
|
||||
#undef HAVE_MINIX_CONFIG_H
|
||||
|
||||
/* Define to 1 if you have the `mkdir' function. */
|
||||
#undef HAVE_MKDIR
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define to 1 if you have the <paths.h> header file. */
|
||||
#undef HAVE_PATHS_H
|
||||
|
||||
/* Define to 1 if you have the `putgrent' function. */
|
||||
#undef HAVE_PUTGRENT
|
||||
|
||||
@@ -202,14 +157,11 @@
|
||||
/* Define to 1 if you have the `putspent' function. */
|
||||
#undef HAVE_PUTSPENT
|
||||
|
||||
/* Define to 1 if you have the `rename' function. */
|
||||
#undef HAVE_RENAME
|
||||
/* Define to 1 if you have the <readpassphrase.h> header file. */
|
||||
#undef HAVE_READPASSPHRASE_H
|
||||
|
||||
/* Define to 1 if you have the `rmdir' function. */
|
||||
#undef HAVE_RMDIR
|
||||
|
||||
/* Define to 1 if you have the <rpc/key_prot.h> header file. */
|
||||
#undef HAVE_RPC_KEY_PROT_H
|
||||
/* Define to 1 if you have the `rpmatch' function. */
|
||||
#undef HAVE_RPMATCH
|
||||
|
||||
/* Define to 1 if you have the <security/openpam.h> header file. */
|
||||
#undef HAVE_SECURITY_OPENPAM_H
|
||||
@@ -223,9 +175,6 @@
|
||||
/* Define to 1 if you have the <semanage/semanage.h> header file. */
|
||||
#undef HAVE_SEMANAGE_SEMANAGE_H
|
||||
|
||||
/* Define to 1 if you have the `setgroups' function. */
|
||||
#undef HAVE_SETGROUPS
|
||||
|
||||
/* Define to 1 if you have the `sgetgrent' function. */
|
||||
#undef HAVE_SGETGRENT
|
||||
|
||||
@@ -235,17 +184,8 @@
|
||||
/* Define to 1 if you have the `sgetspent' function. */
|
||||
#undef HAVE_SGETSPENT
|
||||
|
||||
/* Define to 1 if you have the <sgtty.h> header file. */
|
||||
#undef HAVE_SGTTY_H
|
||||
|
||||
/* Have working shadow group support in libc */
|
||||
#undef HAVE_SHADOWGRP
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if stdbool.h conforms to C99. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
/* Define if you have the shl_load function. */
|
||||
#undef HAVE_SHL_LOAD
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
@@ -256,14 +196,11 @@
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
/* Define to 1 if you have the `stpecpy' function. */
|
||||
#undef HAVE_STPECPY
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
/* Define to 1 if you have the `stpeprintf' function. */
|
||||
#undef HAVE_STPEPRINTF
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
@@ -271,21 +208,6 @@
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strstr' function. */
|
||||
#undef HAVE_STRSTR
|
||||
|
||||
/* Define to 1 if `st_atim' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_ATIM
|
||||
|
||||
/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_ATIMENSEC
|
||||
|
||||
/* Define to 1 if `st_mtim' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_MTIM
|
||||
|
||||
/* Define to 1 if `st_mtimensec' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_MTIMENSEC
|
||||
|
||||
/* Define to 1 if `ut_addr' is a member of `struct utmpx'. */
|
||||
#undef HAVE_STRUCT_UTMPX_UT_ADDR
|
||||
|
||||
@@ -307,84 +229,21 @@
|
||||
/* Define to 1 if `ut_xtime' is a member of `struct utmpx'. */
|
||||
#undef HAVE_STRUCT_UTMPX_UT_XTIME
|
||||
|
||||
/* Define to 1 if `ut_addr' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_ADDR
|
||||
|
||||
/* Define to 1 if `ut_addr_v6' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_ADDR_V6
|
||||
|
||||
/* Define to 1 if `ut_host' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_HOST
|
||||
|
||||
/* Define to 1 if `ut_id' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_ID
|
||||
|
||||
/* Define to 1 if `ut_name' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_NAME
|
||||
|
||||
/* Define to 1 if `ut_syslen' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_SYSLEN
|
||||
|
||||
/* Define to 1 if `ut_time' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_TIME
|
||||
|
||||
/* Define to 1 if `ut_tv' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_TV
|
||||
|
||||
/* Define to 1 if `ut_type' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_TYPE
|
||||
|
||||
/* Define to 1 if `ut_user' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_USER
|
||||
|
||||
/* Define to 1 if `ut_xtime' is a member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_XTIME
|
||||
|
||||
/* Define to 1 if you have the <syslog.h> header file. */
|
||||
#undef HAVE_SYSLOG_H
|
||||
|
||||
/* Define to 1 if you have the <sys/capability.h> header file. */
|
||||
#undef HAVE_SYS_CAPABILITY_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/random.h> header file. */
|
||||
#undef HAVE_SYS_RANDOM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#undef HAVE_SYS_RESOURCE_H
|
||||
|
||||
/* Define to 1 if you have the <sys/statfs.h> header file. */
|
||||
#undef HAVE_SYS_STATFS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <tcb.h> header file. */
|
||||
#undef HAVE_TCB_H
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
/* Define to 1 if you have the <termio.h> header file. */
|
||||
#undef HAVE_TERMIO_H
|
||||
|
||||
/* Define to 1 if you have the <ulimit.h> header file. */
|
||||
#undef HAVE_ULIMIT_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `updwtmp' function. */
|
||||
#undef HAVE_UPDWTMP
|
||||
|
||||
/* Define to 1 if you have the `updwtmpx' function. */
|
||||
#undef HAVE_UPDWTMPX
|
||||
|
||||
@@ -394,18 +253,12 @@
|
||||
/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
|
||||
#undef HAVE_UTIME_NULL
|
||||
|
||||
/* Define to 1 if you have the <utmpx.h> header file. */
|
||||
#undef HAVE_UTMPX_H
|
||||
|
||||
/* Define to 1 if you have the <utmp.h> header file. */
|
||||
#undef HAVE_UTMP_H
|
||||
/* Define to support vendor settings. */
|
||||
#undef HAVE_VENDORDIR
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define to 1 if the system has the type `_Bool'. */
|
||||
#undef HAVE__BOOL
|
||||
|
||||
/* Path for lastlog file. */
|
||||
#undef LASTLOG_FILE
|
||||
|
||||
@@ -442,12 +295,6 @@
|
||||
/* Path to passwd program. */
|
||||
#undef PASSWD_PROGRAM
|
||||
|
||||
/* Define if login should support the -r flag for rlogind. */
|
||||
#undef RLOGIN
|
||||
|
||||
/* Define to the ruserok() "success" return value (0 or 1). */
|
||||
#undef RUSEROK
|
||||
|
||||
/* Define to support the shadow group file. */
|
||||
#undef SHADOWGRP
|
||||
|
||||
@@ -477,9 +324,6 @@
|
||||
/* Define to support /etc/suauth su access control. */
|
||||
#undef SU_ACCESS
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Define to allow the bcrypt password encryption algorithm */
|
||||
#undef USE_BCRYPT
|
||||
|
||||
@@ -495,9 +339,6 @@
|
||||
/* Define to support flushing of sssd caches */
|
||||
#undef USE_SSSD
|
||||
|
||||
/* Define to use syslog(). */
|
||||
#undef USE_SYSLOG
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
@@ -586,12 +427,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Define if utmpx should be used */
|
||||
#undef USE_UTMPX
|
||||
|
||||
/* Define to allow the yescrypt password encryption algorithm */
|
||||
#undef USE_YESCRYPT
|
||||
|
||||
/* Directory for distribution provided configuration files */
|
||||
#undef VENDORDIR
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
@@ -607,6 +448,9 @@
|
||||
/* Build shadow with BtrFS support */
|
||||
#undef WITH_BTRFS
|
||||
|
||||
/* Build shadow without libbsd support */
|
||||
#undef WITH_LIBBSD
|
||||
|
||||
/* Build shadow with SELinux support */
|
||||
#undef WITH_SELINUX
|
||||
|
||||
@@ -622,14 +466,5 @@
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#undef _LARGE_FILES
|
||||
|
||||
/* Path for utmp file. */
|
||||
#undef _UTMP_FILE
|
||||
|
||||
/* Path for wtmp file. */
|
||||
#undef _WTMP_FILE
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef gid_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
||||
|
||||
243
configure.ac
243
configure.ac
@@ -1,12 +1,12 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ([2.69])
|
||||
m4_define([libsubid_abi_major], 4)
|
||||
m4_define([libsubid_abi_major], 5)
|
||||
m4_define([libsubid_abi_minor], 0)
|
||||
m4_define([libsubid_abi_micro], 0)
|
||||
m4_define([libsubid_abi], [libsubid_abi_major.libsubid_abi_minor.libsubid_abi_micro])
|
||||
AC_INIT([shadow], [4.13], [pkg-shadow-devel@lists.alioth.debian.org], [],
|
||||
AC_INIT([shadow], [4.17.4], [pkg-shadow-devel@lists.alioth.debian.org], [],
|
||||
[https://github.com/shadow-maint/shadow])
|
||||
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
|
||||
AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects tar-pax])
|
||||
AC_CONFIG_MACRO_DIRS([m4])
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@@ -32,47 +32,23 @@ AC_PROG_CC
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_YACC
|
||||
LT_INIT
|
||||
LT_LIB_DLLOAD
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDBOOL
|
||||
|
||||
AC_CHECK_HEADERS(crypt.h errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
|
||||
utmpx.h termios.h termio.h sgtty.h sys/ioctl.h syslog.h paths.h \
|
||||
utime.h ulimit.h sys/capability.h sys/random.h sys/resource.h \
|
||||
gshadow.h lastlog.h locale.h rpc/key_prot.h netdb.h acl/libacl.h \
|
||||
attr/libattr.h attr/error_context.h)
|
||||
|
||||
dnl shadow now uses the libc's shadow implementation
|
||||
AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
|
||||
|
||||
AC_CHECK_FUNCS(arc4random_buf l64a fchmod fchown fsync futimes \
|
||||
AC_CHECK_FUNCS(arc4random_buf futimes \
|
||||
getentropy getrandom getspnam getusershell \
|
||||
getutent initgroups lckpwdf lutimes \
|
||||
setgroups updwtmp updwtmpx innetgr getpwnam_r \
|
||||
getpwuid_r getgrnam_r getgrgid_r getspnam_r \
|
||||
memset_s explicit_bzero)
|
||||
lckpwdf lutimes \
|
||||
updwtmpx innetgr \
|
||||
getspnam_r \
|
||||
rpmatch \
|
||||
memset_explicit explicit_bzero stpecpy stpeprintf)
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_CHECK_MEMBERS([struct stat.st_atim])
|
||||
AC_CHECK_MEMBERS([struct stat.st_atimensec])
|
||||
AC_CHECK_MEMBERS([struct stat.st_mtim])
|
||||
AC_CHECK_MEMBERS([struct stat.st_mtimensec])
|
||||
AC_STRUCT_TM
|
||||
|
||||
AC_CHECK_MEMBERS([struct utmp.ut_type,
|
||||
struct utmp.ut_id,
|
||||
struct utmp.ut_name,
|
||||
struct utmp.ut_user,
|
||||
struct utmp.ut_host,
|
||||
struct utmp.ut_syslen,
|
||||
struct utmp.ut_addr,
|
||||
struct utmp.ut_addr_v6,
|
||||
struct utmp.ut_time,
|
||||
struct utmp.ut_xtime,
|
||||
struct utmp.ut_tv],,,[[#include <utmp.h>]])
|
||||
|
||||
AC_CHECK_MEMBERS([struct utmpx.ut_name,
|
||||
struct utmpx.ut_host,
|
||||
@@ -82,58 +58,16 @@ AC_CHECK_MEMBERS([struct utmpx.ut_name,
|
||||
struct utmpx.ut_time,
|
||||
struct utmpx.ut_xtime],,,[[#include <utmpx.h>]])
|
||||
|
||||
if test "$ac_cv_header_lastlog_h" = "yes"; then
|
||||
AC_CACHE_CHECK(for ll_host in struct lastlog,
|
||||
ac_cv_struct_lastlog_ll_host,
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
|
||||
[struct lastlog ll; char *cp = ll.ll_host;]
|
||||
)],
|
||||
[ac_cv_struct_lastlog_ll_host=yes],
|
||||
[ac_cv_struct_lastlog_ll_host=no]
|
||||
)
|
||||
)
|
||||
|
||||
if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
|
||||
AC_DEFINE(HAVE_LL_HOST, 1,
|
||||
[Define if struct lastlog has ll_host])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_TYPE_GETGROUPS
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
|
||||
AC_REPLACE_FUNCS(putgrent putpwent putspent)
|
||||
AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
|
||||
AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
|
||||
|
||||
AC_CHECK_FUNC(setpgrp)
|
||||
AC_CHECK_FUNC(secure_getenv, [AC_DEFINE(HAS_SECURE_GETENV,
|
||||
1,
|
||||
[Defined to 1 if you have the declaration of 'secure_getenv'])])
|
||||
|
||||
if test "$ac_cv_header_shadow_h" = "yes"; then
|
||||
AC_CACHE_CHECK(for working shadow group support,
|
||||
ac_cv_libc_shadowgrp,
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([
|
||||
#include <shadow.h>
|
||||
main()
|
||||
{
|
||||
struct sgrp *sg = sgetsgent("test:x::");
|
||||
/* NYS libc on Red Hat 3.0.3 has broken shadow group support */
|
||||
return !sg || !sg->sg_adm || !sg->sg_mem;
|
||||
}]
|
||||
)],
|
||||
[ac_cv_libc_shadowgrp=yes],
|
||||
[ac_cv_libc_shadowgrp=no],
|
||||
[ac_cv_libc_shadowgrp=no]
|
||||
)
|
||||
)
|
||||
|
||||
if test "$ac_cv_libc_shadowgrp" = "yes"; then
|
||||
AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([location of shared mail directory], shadow_cv_maildir,
|
||||
[for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
|
||||
if test -d $shadow_cv_maildir; then
|
||||
@@ -156,18 +90,6 @@ if test $shadow_cv_mailfile != none; then
|
||||
[Name of user's mail spool file if stored in user's home directory.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
|
||||
[for shadow_cv_utmpdir in /var/run /var/adm /usr/adm /etc none; do
|
||||
if test -f $shadow_cv_utmpdir/utmp; then
|
||||
break
|
||||
fi
|
||||
done])
|
||||
if test "$shadow_cv_utmpdir" = "none"; then
|
||||
AC_MSG_WARN(utmp file not found)
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
|
||||
[Path for utmp file.])
|
||||
|
||||
AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
|
||||
[for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
|
||||
if test -d $shadow_cv_logdir; then
|
||||
@@ -181,22 +103,9 @@ AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
|
||||
AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
|
||||
[Path for faillog file.])
|
||||
|
||||
AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
|
||||
[if test -f /usr/bin/passwd; then
|
||||
shadow_cv_passwd_dir=/usr/bin
|
||||
else
|
||||
shadow_cv_passwd_dir=/bin
|
||||
fi])
|
||||
AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
|
||||
AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$exec_prefix/bin/passwd",
|
||||
[Path to passwd program.])
|
||||
|
||||
dnl XXX - quick hack, should disappear before anyone notices :).
|
||||
AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
|
||||
if test "$ac_cv_func_ruserok" = "yes"; then
|
||||
AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
|
||||
AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(shadowgrp,
|
||||
[AS_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
|
||||
[case "${enableval}" in
|
||||
@@ -226,17 +135,6 @@ AC_ARG_ENABLE(account-tools-setuid,
|
||||
[enable_acct_tools_setuid="no"]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(utmpx,
|
||||
[AS_HELP_STRING([--enable-utmpx],
|
||||
[enable loggin in utmpx / wtmpx @<:@default=no@:>@])],
|
||||
[case "${enableval}" in
|
||||
yes) enable_utmpx="yes" ;;
|
||||
no) enable_utmpx="no" ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-utmpx) ;;
|
||||
esac],
|
||||
[enable_utmpx="no"]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(subordinate-ids,
|
||||
[AS_HELP_STRING([--enable-subordinate-ids],
|
||||
[support subordinate ids @<:@default=yes@:>@])],
|
||||
@@ -244,6 +142,20 @@ AC_ARG_ENABLE(subordinate-ids,
|
||||
[enable_subids="maybe"]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(lastlog,
|
||||
[AS_HELP_STRING([--enable-lastlog],
|
||||
[enable lastlog @<:@default=no@:>@])],
|
||||
[enable_lastlog="${enableval}"],
|
||||
[enable_lastlog="no"]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(logind,
|
||||
[AS_HELP_STRING([--enable-logind],
|
||||
[enable logind @<:@default=yes@:>@])],
|
||||
[enable_logind="${enableval}"],
|
||||
[enable_logind="yes"]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(audit,
|
||||
[AS_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
|
||||
[with_audit=$withval], [with_audit=maybe])
|
||||
@@ -268,9 +180,6 @@ AC_ARG_WITH(skey,
|
||||
AC_ARG_WITH(tcb,
|
||||
[AS_HELP_STRING([--with-tcb], [use tcb support (incomplete) @<:@default=yes if found@:>@])],
|
||||
[with_tcb=$withval], [with_tcb=maybe])
|
||||
AC_ARG_WITH(libcrack,
|
||||
[AS_HELP_STRING([--with-libcrack], [use libcrack @<:@default=no@:>@])],
|
||||
[with_libcrack=$withval], [with_libcrack=no])
|
||||
AC_ARG_WITH(sha-crypt,
|
||||
[AS_HELP_STRING([--with-sha-crypt], [allow the SHA256 and SHA512 password encryption algorithms @<:@default=yes@:>@])],
|
||||
[with_sha_crypt=$withval], [with_sha_crypt=yes])
|
||||
@@ -292,6 +201,9 @@ AC_ARG_WITH(group-name-max-length,
|
||||
AC_ARG_WITH(su,
|
||||
[AS_HELP_STRING([--with-su], [build and install su program and man page @<:@default=yes@:>@])],
|
||||
[with_su=$withval], [with_su=yes])
|
||||
AC_ARG_WITH(libbsd,
|
||||
[AS_HELP_STRING([--with-libbsd], [use libbsd support @<:@default=yes if found@:>@])],
|
||||
[with_libbsd=$withval], [with_libbsd=yes])
|
||||
|
||||
if test "$with_group_name_max_length" = "no" ; then
|
||||
with_group_name_max_length=0
|
||||
@@ -302,6 +214,7 @@ AC_DEFINE_UNQUOTED(GROUP_NAME_MAX_LENGTH, $with_group_name_max_length, [max grou
|
||||
AC_SUBST(GROUP_NAME_MAX_LENGTH)
|
||||
GROUP_NAME_MAX_LENGTH="$with_group_name_max_length"
|
||||
|
||||
|
||||
AM_CONDITIONAL(USE_SHA_CRYPT, test "x$with_sha_crypt" = "xyes")
|
||||
if test "$with_sha_crypt" = "yes"; then
|
||||
AC_DEFINE(USE_SHA_CRYPT, 1, [Define to allow the SHA256 and SHA512 password encryption algorithms])
|
||||
@@ -336,12 +249,16 @@ dnl Check for some functions in libc first, only if not found check for
|
||||
dnl other libraries. This should prevent linking libnsl if not really
|
||||
dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
|
||||
|
||||
AC_SEARCH_LIBS(inet_ntoa, inet)
|
||||
AC_SEARCH_LIBS(socket, socket)
|
||||
AC_SEARCH_LIBS(gethostbyname, nsl)
|
||||
|
||||
PKG_CHECK_MODULES([CMOCKA], [cmocka], [have_cmocka="yes"],
|
||||
[AC_MSG_WARN([libcmocka not found, cmocka tests will not be built])])
|
||||
AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes])
|
||||
|
||||
AC_CHECK_LIB([econf],[econf_readDirs],[LIBECONF="-leconf"],[LIBECONF=""])
|
||||
if test -n "$LIBECONF"; then
|
||||
AC_DEFINE_UNQUOTED([VENDORDIR], ["$enable_vendordir"],
|
||||
[Directory for distribution provided configuration files])
|
||||
ECONF_CPPFLAGS="-DUSE_ECONF=1"
|
||||
AC_ARG_ENABLE([vendordir],
|
||||
AS_HELP_STRING([--enable-vendordir=DIR], [Directory for distribution provided configuration files]),,[])
|
||||
@@ -349,6 +266,9 @@ fi
|
||||
AC_SUBST(ECONF_CPPFLAGS)
|
||||
AC_SUBST(LIBECONF)
|
||||
AC_SUBST([VENDORDIR], [$enable_vendordir])
|
||||
if test "x$enable_vendordir" != x; then
|
||||
AC_DEFINE(HAVE_VENDORDIR, 1, [Define to support vendor settings.])
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_VENDORDIR], [test "x$enable_vendordir" != x])
|
||||
|
||||
if test "$enable_shadowgrp" = "yes"; then
|
||||
@@ -393,6 +313,39 @@ if test "$enable_subids" != "no"; then
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_SUBIDS, test "x$enable_subids" != "xno")
|
||||
|
||||
if test "$enable_lastlog" = "yes" && test "$ac_cv_header_lastlog_h" = "yes"; then
|
||||
AC_CACHE_CHECK(for ll_host in struct lastlog,
|
||||
ac_cv_struct_lastlog_ll_host,
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
|
||||
[struct lastlog ll; char *cp = ll.ll_host;]
|
||||
)],
|
||||
[ac_cv_struct_lastlog_ll_host=yes],
|
||||
[ac_cv_struct_lastlog_ll_host=no]
|
||||
)
|
||||
)
|
||||
|
||||
if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
|
||||
AC_DEFINE(HAVE_LL_HOST, 1,
|
||||
[Define if struct lastlog has ll_host])
|
||||
AC_DEFINE(ENABLE_LASTLOG, 1, [Define to support lastlog.])
|
||||
enable_lastlog="yes"
|
||||
else
|
||||
AC_MSG_ERROR([Cannot enable support for lastlog on systems where the data structures aren't available])
|
||||
enable_subids="no"
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_LASTLOG, test "x$enable_lastlog" != "xno")
|
||||
|
||||
AC_SUBST(LIBSYSTEMD)
|
||||
if test "$enable_logind" = "yes"; then
|
||||
AC_CHECK_LIB(systemd, sd_session_get_remote_host,
|
||||
[enable_logind="yes"; [LIBSYSTEMD=-lsystemd];
|
||||
AC_DEFINE(ENABLE_LOGIND, 1,
|
||||
[Define to manage session support with logind.])],
|
||||
[enable_logind="no"])
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_LOGIND, test "x$enable_logind" != "xno")
|
||||
|
||||
AC_SUBST(LIBCRYPT)
|
||||
AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
|
||||
[AC_MSG_ERROR([crypt() not found])])
|
||||
@@ -401,6 +354,28 @@ AC_SUBST(LIYESCRYPT)
|
||||
AC_CHECK_LIB(crypt, crypt, [LIYESCRYPT=-lcrypt],
|
||||
[AC_MSG_ERROR([crypt() not found])])
|
||||
|
||||
AC_SUBST(LIBBSD)
|
||||
if test "$with_libbsd" != "no"; then
|
||||
AC_SEARCH_LIBS([readpassphrase], [bsd], [], [
|
||||
AC_MSG_ERROR([readpassphrase() is missing, either from libc or libbsd])
|
||||
])
|
||||
AS_IF([test "$ac_cv_search_readpassphrase" = "-lbsd"], [
|
||||
PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay])
|
||||
])
|
||||
dnl Make sure either the libc or libbsd provide the header.
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
|
||||
AC_CHECK_HEADERS([readpassphrase.h])
|
||||
AS_IF([test "$ac_cv_header_readpassphrase_h" != "yes"], [
|
||||
AC_MSG_ERROR([readpassphrase.h is missing])
|
||||
])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
AC_DEFINE(WITH_LIBBSD, 1, [Build shadow with libbsd support])
|
||||
else
|
||||
AC_DEFINE(WITH_LIBBSD, 0, [Build shadow without libbsd support])
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_LIBBSD, test x$with_libbsd = xyes)
|
||||
|
||||
AC_SUBST(LIBACL)
|
||||
if test "$with_acl" != "no"; then
|
||||
AC_CHECK_HEADERS(acl/libacl.h attr/error_context.h, [acl_header="yes"], [acl_header="no"])
|
||||
@@ -485,17 +460,6 @@ if test "$with_audit" != "no"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBCRACK)
|
||||
if test "$with_libcrack" = "yes"; then
|
||||
echo "checking cracklib flavour, don't be surprised by the results"
|
||||
AC_CHECK_LIB(crack, FascistCheck,
|
||||
[LIBCRACK=-lcrack AC_DEFINE(HAVE_LIBCRACK, 1, [Defined if you have libcrack.])])
|
||||
AC_CHECK_LIB(crack, FascistHistory,
|
||||
AC_DEFINE(HAVE_LIBCRACK_HIST, 1, [Defined if you have the ts&szs cracklib.]))
|
||||
AC_CHECK_LIB(crack, FascistHistoryPw,
|
||||
AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
|
||||
fi
|
||||
|
||||
if test "$with_btrfs" != "no"; then
|
||||
AC_CHECK_HEADERS([sys/statfs.h linux/magic.h linux/btrfs_tree.h], \
|
||||
[btrfs_headers="yes"], [btrfs_headers="no"])
|
||||
@@ -672,7 +636,7 @@ AC_SUBST(LIBMD)
|
||||
if test "$with_skey" = "yes"; then
|
||||
AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
|
||||
AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
|
||||
[AC_MSG_ERROR([liskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2])])
|
||||
[AC_MSG_ERROR([libskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2])])
|
||||
AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdio.h>
|
||||
@@ -682,14 +646,7 @@ if test "$with_skey" = "yes"; then
|
||||
]])],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])],[])
|
||||
fi
|
||||
|
||||
if test "$enable_utmpx" = "yes"; then
|
||||
if test "$ac_cv_header_utmpx_h" != "yes"; then
|
||||
AC_MSG_ERROR([The utmpx.h header file is required for utmpx support.])
|
||||
fi
|
||||
AC_DEFINE(USE_UTMPX,
|
||||
1,
|
||||
[Define if utmpx should be used])
|
||||
fi
|
||||
AC_CHECK_FUNC(fgetpwent_r, [AC_DEFINE(HAVE_FGETPWENT_R, 1, [Defined to 1 if you have the declaration of 'fgetpwent_r'])])
|
||||
|
||||
AC_DEFINE_UNQUOTED(SHELL, ["$SHELL"], [The default shell.])
|
||||
|
||||
@@ -723,7 +680,6 @@ AC_CONFIG_FILES([
|
||||
man/uk/Makefile
|
||||
man/zh_CN/Makefile
|
||||
man/zh_TW/Makefile
|
||||
libmisc/Makefile
|
||||
lib/Makefile
|
||||
libsubid/Makefile
|
||||
libsubid/subid.h
|
||||
@@ -731,7 +687,8 @@ AC_CONFIG_FILES([
|
||||
contrib/Makefile
|
||||
etc/Makefile
|
||||
etc/pam.d/Makefile
|
||||
shadow.spec
|
||||
etc/shadow-maint/Makefile
|
||||
tests/unit/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -739,7 +696,6 @@ echo
|
||||
echo "shadow will be compiled with the following features:"
|
||||
echo
|
||||
echo " auditing support: $with_audit"
|
||||
echo " CrackLib support: $with_libcrack"
|
||||
echo " PAM support: $with_libpam"
|
||||
if test "$with_libpam" = "yes"; then
|
||||
echo " suid account management tools: $enable_acct_tools_setuid"
|
||||
@@ -757,6 +713,9 @@ echo " yescrypt passwords encryption: $with_yescrypt"
|
||||
echo " nscd support: $with_nscd"
|
||||
echo " sssd support: $with_sssd"
|
||||
echo " subordinate IDs support: $enable_subids"
|
||||
echo " enable lastlog: $enable_lastlog"
|
||||
echo " enable logind: $enable_logind"
|
||||
echo " use file caps: $with_fcaps"
|
||||
echo " install su: $with_su"
|
||||
echo " enabled vendor dir: $enable_vendordir"
|
||||
echo
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# This is a dummy Makefile.am to get automake work flawlessly,
|
||||
# and also cooperate to make a distribution for `make dist'
|
||||
|
||||
EXTRA_DIST = README adduser.c adduser.sh adduser2.sh \
|
||||
atudel groupmems.shar pwdauth.c shadow-anonftp.patch \
|
||||
udbachk.tgz
|
||||
EXTRA_DIST = README adduser.c adduser.sh adduser2.sh
|
||||
|
||||
@@ -141,6 +141,8 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CMOCKA_CFLAGS = @CMOCKA_CFLAGS@
|
||||
CMOCKA_LIBS = @CMOCKA_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
@@ -174,9 +176,15 @@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBACL = @LIBACL@
|
||||
LIBADD_DL = @LIBADD_DL@
|
||||
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
|
||||
LIBADD_DLOPEN = @LIBADD_DLOPEN@
|
||||
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
|
||||
LIBATTR = @LIBATTR@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBCRACK = @LIBCRACK@
|
||||
LIBBSD = @LIBBSD@
|
||||
LIBBSD_CFLAGS = @LIBBSD_CFLAGS@
|
||||
LIBBSD_LIBS = @LIBBSD_LIBS@
|
||||
LIBCRYPT = @LIBCRYPT@
|
||||
LIBECONF = @LIBECONF@
|
||||
LIBICONV = @LIBICONV@
|
||||
@@ -192,6 +200,7 @@ LIBSUBID_ABI = @LIBSUBID_ABI@
|
||||
LIBSUBID_ABI_MAJOR = @LIBSUBID_ABI_MAJOR@
|
||||
LIBSUBID_ABI_MICRO = @LIBSUBID_ABI_MICRO@
|
||||
LIBSUBID_ABI_MINOR = @LIBSUBID_ABI_MINOR@
|
||||
LIBSYSTEMD = @LIBSYSTEMD@
|
||||
LIBTCB = @LIBTCB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
@@ -200,6 +209,8 @@ LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_DLLOADERS = @LT_DLLOADERS@
|
||||
LT_DLPREOPEN = @LT_DLPREOPEN@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
@@ -222,6 +233,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
@@ -293,10 +307,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
EXTRA_DIST = README adduser.c adduser.sh adduser2.sh \
|
||||
atudel groupmems.shar pwdauth.c shadow-anonftp.patch \
|
||||
udbachk.tgz
|
||||
|
||||
EXTRA_DIST = README adduser.c adduser.sh adduser2.sh
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
@@ -2,9 +2,6 @@ People keep sending various adduser programs and scripts... They are
|
||||
all in this directory. I haven't tested them, use at your own risk.
|
||||
Anyway, the best one I've seen so far is adduser-3.x from Debian.
|
||||
|
||||
atudel is a perl script to remove at jobs owned by the specified user
|
||||
(atrm in at-2.9 for Linux can't do that).
|
||||
|
||||
udbachk.tgz is a passwd/group/shadow file integrity checker.
|
||||
|
||||
--marekm
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
** Added in the password date field, which should always reflect the last
|
||||
** date the password was changed, for expiry purposes. "passwd" always
|
||||
** updates this field, so the adduser program should set it up right
|
||||
** initially (or a user could keep thier initial password forever ;)
|
||||
** initially (or a user could keep their initial password forever ;)
|
||||
** The number is in days since Jan 1st, 1970.
|
||||
**
|
||||
** Have fun with it, and someone please make
|
||||
@@ -118,6 +118,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "string/strcmp/streq.h"
|
||||
|
||||
|
||||
#define IMMEDIATE_CHANGE /* Expire newly created password, must be changed
|
||||
* immediately upon next login */
|
||||
#define HAVE_QUOTAS /* Obvious */
|
||||
@@ -291,12 +294,10 @@ main (void)
|
||||
printf ("Home Directory [%s/%s]: ", DEFAULT_HOME, usrname);
|
||||
fflush (stdout);
|
||||
safeget (dir, sizeof (dir));
|
||||
if (!strlen (dir))
|
||||
{ /* hit return */
|
||||
sprintf (dir, "%s/%s", DEFAULT_HOME, usrname);
|
||||
}
|
||||
if (!strlen(dir)) /* hit return */
|
||||
sprintf(dir, "%s/%s", DEFAULT_HOME, usrname);
|
||||
else if (dir[strlen (dir) - 1] == '/')
|
||||
sprintf (dir+strlen(dir), "%s", usrname);
|
||||
strcat(dir, usrname);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -308,7 +309,7 @@ main (void)
|
||||
fflush (stdout);
|
||||
safeget (shell, sizeof (shell));
|
||||
if (!strlen (shell))
|
||||
sprintf (shell, "%s", DEFAULT_SHELL);
|
||||
strcpy(shell, DEFAULT_SHELL);
|
||||
else
|
||||
{
|
||||
char *sh;
|
||||
@@ -316,7 +317,7 @@ main (void)
|
||||
#ifdef HAVE_GETUSERSHELL
|
||||
setusershell ();
|
||||
while ((sh = getusershell ()) != NULL)
|
||||
if (!strcmp (shell, sh))
|
||||
if (streq(shell, sh))
|
||||
ok = 1;
|
||||
endusershell ();
|
||||
#endif
|
||||
@@ -327,7 +328,7 @@ main (void)
|
||||
else
|
||||
{
|
||||
printf ("Shell NOT in /etc/shells, DEFAULT used\n");
|
||||
sprintf (shell, "%s", DEFAULT_SHELL);
|
||||
strcpy(shell, DEFAULT_SHELL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -489,14 +490,14 @@ safeget (char *buf, int maxlen)
|
||||
while ((c = getc (stdin)) != EOF && (c != '\n') && (++i < maxlen))
|
||||
{
|
||||
bad = (!isalnum (c) && (c != '_') && (c != ' '));
|
||||
*(buf++) = (char) c;
|
||||
*(buf++) = c;
|
||||
}
|
||||
*buf = '\0';
|
||||
stpcpy(buf, "");
|
||||
|
||||
if (bad)
|
||||
{
|
||||
printf ("\nString contained banned character. Please stick to alphanumerics.\n");
|
||||
*bstart = '\0';
|
||||
stpcpy(bstart, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,465 +0,0 @@
|
||||
#!/bin/sh
|
||||
# This is a shell archive (produced by GNU sharutils 4.2.1).
|
||||
# To extract the files from this archive, save it to some FILE, remove
|
||||
# everything before the `!/bin/sh' line above, then type `sh FILE'.
|
||||
#
|
||||
# Made on 2000-05-25 14:41 CDT by <gk4@gnu.austin.ibm.com>.
|
||||
# Source directory was `/home/gk4/src/groupmem'.
|
||||
#
|
||||
# Existing files will *not* be overwritten unless `-c' is specified.
|
||||
#
|
||||
# This shar contains:
|
||||
# length mode name
|
||||
# ------ ---------- ------------------------------------------
|
||||
# 1960 -rw-r--r-- Makefile
|
||||
# 6348 -rw-r--r-- groupmems.c
|
||||
# 3372 -rw------- groupmems.8
|
||||
#
|
||||
save_IFS="${IFS}"
|
||||
IFS="${IFS}:"
|
||||
gettext_dir=FAILED
|
||||
locale_dir=FAILED
|
||||
first_param="$1"
|
||||
for dir in $PATH
|
||||
do
|
||||
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
|
||||
&& ($dir/gettext --version >/dev/null 2>&1)
|
||||
then
|
||||
set `$dir/gettext --version 2>&1`
|
||||
if test "$3" = GNU
|
||||
then
|
||||
gettext_dir=$dir
|
||||
fi
|
||||
fi
|
||||
if test "$locale_dir" = FAILED && test -f $dir/shar \
|
||||
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
|
||||
then
|
||||
locale_dir=`$dir/shar --print-text-domain-dir`
|
||||
fi
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
|
||||
then
|
||||
echo=echo
|
||||
else
|
||||
TEXTDOMAINDIR=$locale_dir
|
||||
export TEXTDOMAINDIR
|
||||
TEXTDOMAIN=sharutils
|
||||
export TEXTDOMAIN
|
||||
echo="$gettext_dir/gettext -s"
|
||||
fi
|
||||
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
|
||||
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
|
||||
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
|
||||
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
|
||||
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
|
||||
shar_touch='touch -am $3$4$5$6$2 "$8"'
|
||||
else
|
||||
shar_touch=:
|
||||
echo
|
||||
$echo 'WARNING: not restoring timestamps. Consider getting and'
|
||||
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
|
||||
echo
|
||||
fi
|
||||
rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
|
||||
#
|
||||
if mkdir _sh10937; then
|
||||
$echo 'x -' 'creating lock directory'
|
||||
else
|
||||
$echo 'failed to create lock directory'
|
||||
exit 1
|
||||
fi
|
||||
# ============= Makefile ==============
|
||||
if test -f 'Makefile' && test "$first_param" != -c; then
|
||||
$echo 'x -' SKIPPING 'Makefile' '(file already exists)'
|
||||
else
|
||||
$echo 'x -' extracting 'Makefile' '(text)'
|
||||
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
|
||||
/*
|
||||
# SPDX-FileCopyrightText: 2000, International Business Machines, Inc.
|
||||
# SPDX-FileCopyrightText: 2000, George Kraft IV, gk4@us.ibm.com
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
X
|
||||
all: groupmems
|
||||
X
|
||||
groupmems: groupmems.c
|
||||
X cc -g -o groupmems groupmems.c -L. -lshadow
|
||||
X
|
||||
install: groupmems
|
||||
X -/usr/sbin/groupadd groups
|
||||
X install -o root -g groups -m 4770 groupmems /usr/bin
|
||||
X
|
||||
install.man: groupmems.8
|
||||
X install -o root -g root -m 644 groupmems.8 /usr/man/man8
|
||||
X
|
||||
SHAR_EOF
|
||||
(set 20 00 05 25 14 40 28 'Makefile'; eval "$shar_touch") &&
|
||||
chmod 0644 'Makefile' ||
|
||||
$echo 'restore of' 'Makefile' 'failed'
|
||||
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
|
||||
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
|
||||
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|
||||
|| $echo 'Makefile:' 'MD5 check failed'
|
||||
b46cf7ef8d59149093c011ced3f3103c Makefile
|
||||
SHAR_EOF
|
||||
else
|
||||
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
|
||||
test 1960 -eq "$shar_count" ||
|
||||
$echo 'Makefile:' 'original size' '1960,' 'current size' "$shar_count!"
|
||||
fi
|
||||
fi
|
||||
# ============= groupmems.c ==============
|
||||
if test -f 'groupmems.c' && test "$first_param" != -c; then
|
||||
$echo 'x -' SKIPPING 'groupmems.c' '(file already exists)'
|
||||
else
|
||||
$echo 'x -' extracting 'groupmems.c' '(text)'
|
||||
sed 's/^X//' << 'SHAR_EOF' > 'groupmems.c' &&
|
||||
/*
|
||||
X * SPDX-FileCopyrightText: 2000, International Business Machines, Inc.
|
||||
X * SPDX-FileCopyrightText: 2000, George Kraft IV, gk4@us.ibm.com
|
||||
X * SPDX-License-Identifier: BSD-3-Clause
|
||||
X */
|
||||
/*
|
||||
**
|
||||
** Utility "groupmem" adds and deletes members from a user's group.
|
||||
**
|
||||
** Setup (as "root"):
|
||||
**
|
||||
** groupadd -r groups
|
||||
** chmod 2770 groupmems
|
||||
** chown root.groups groupmems
|
||||
** groupmems -g groups -a gk4
|
||||
**
|
||||
** Usage (as "gk4"):
|
||||
**
|
||||
** groupmems -a olive
|
||||
** groupmems -a jordan
|
||||
** groupmems -a meghan
|
||||
** groupmems -a morgan
|
||||
** groupmems -a jake
|
||||
** groupmems -l
|
||||
** groupmems -d jake
|
||||
** groupmems -l
|
||||
*/
|
||||
X
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "defines.h"
|
||||
#include "groupio.h"
|
||||
X
|
||||
/* Exit Status Values */
|
||||
X
|
||||
#define EXIT_SUCCESS 0 /* success */
|
||||
#define EXIT_USAGE 1 /* invalid command syntax */
|
||||
#define EXIT_GROUP_FILE 2 /* group file access problems */
|
||||
#define EXIT_NOT_ROOT 3 /* not superuser */
|
||||
#define EXIT_NOT_EROOT 4 /* not effective superuser */
|
||||
#define EXIT_NOT_PRIMARY 5 /* not primary owner of group */
|
||||
#define EXIT_NOT_MEMBER 6 /* member of group does not exist */
|
||||
#define EXIT_MEMBER_EXISTS 7 /* member of group already exists */
|
||||
X
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
X
|
||||
/* Globals */
|
||||
X
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
static char *adduser = NULL;
|
||||
static char *deluser = NULL;
|
||||
static char *thisgroup = NULL;
|
||||
static int purge = FALSE;
|
||||
static int list = FALSE;
|
||||
static int exclusive = 0;
|
||||
X
|
||||
static int isroot(void) {
|
||||
X return getuid() ? FALSE : TRUE;
|
||||
}
|
||||
X
|
||||
static int isgroup(void) {
|
||||
X gid_t g = getgid();
|
||||
X struct group *grp = getgrgid(g);
|
||||
X
|
||||
X return TRUE;
|
||||
}
|
||||
X
|
||||
static char *whoami(void) {
|
||||
X struct group *grp = getgrgid(getgid());
|
||||
X struct passwd *usr = getpwuid(getuid());
|
||||
X
|
||||
X if (0 == strcmp(usr->pw_name, grp->gr_name)) {
|
||||
X return (char *)strdup(usr->pw_name);
|
||||
X } else {
|
||||
X return NULL;
|
||||
X }
|
||||
}
|
||||
X
|
||||
static void
|
||||
addtogroup(char *user, char **members) {
|
||||
X int i;
|
||||
X char **pmembers;
|
||||
X
|
||||
X for (i = 0; NULL != members[i]; i++ ) {
|
||||
X if (0 == strcmp(user, members[i])) {
|
||||
X fprintf(stderr, "Member already exists\n");
|
||||
X exit(EXIT_MEMBER_EXISTS);
|
||||
X }
|
||||
X }
|
||||
X
|
||||
X if (0 == i) {
|
||||
X pmembers = (char **)calloc(2, sizeof(char *));
|
||||
X } else {
|
||||
X pmembers = (char **)realloc(members, sizeof(char *)*(i+1));
|
||||
X }
|
||||
X
|
||||
X *members = *pmembers;
|
||||
X members[i] = user;
|
||||
X members[i+1] = NULL;
|
||||
}
|
||||
X
|
||||
static void
|
||||
rmfromgroup(char *user, char **members) {
|
||||
X int i;
|
||||
X int found = FALSE;
|
||||
X
|
||||
X i = 0;
|
||||
X while (!found && NULL != members[i]) {
|
||||
X if (0 == strcmp(user, members[i])) {
|
||||
X found = TRUE;
|
||||
X } else {
|
||||
X i++;
|
||||
X }
|
||||
X }
|
||||
X
|
||||
X while (found && NULL != members[i]) {
|
||||
X members[i] = members[++i];
|
||||
X }
|
||||
X
|
||||
X if (!found) {
|
||||
X fprintf(stderr, "Member to remove could not be found\n");
|
||||
X exit(EXIT_NOT_MEMBER);
|
||||
X }
|
||||
}
|
||||
X
|
||||
static void
|
||||
nomembers(char **members) {
|
||||
X int i;
|
||||
X
|
||||
X for (i = 0; NULL != members[i]; i++ ) {
|
||||
X members[i] = NULL;
|
||||
X }
|
||||
}
|
||||
X
|
||||
static void
|
||||
members(char **members) {
|
||||
X int i;
|
||||
X
|
||||
X for (i = 0; NULL != members[i]; i++ ) {
|
||||
X printf("%s ", members[i]);
|
||||
X
|
||||
X if (NULL == members[i+1]) {
|
||||
X printf("\n");
|
||||
X } else {
|
||||
X printf(" ");
|
||||
X }
|
||||
X }
|
||||
}
|
||||
X
|
||||
static void usage(void) {
|
||||
X fprintf(stderr, "usage: groupmems -a username | -d username | -D | -l [-g groupname]\n");
|
||||
X exit(EXIT_USAGE);
|
||||
}
|
||||
X
|
||||
main(int argc, char **argv) {
|
||||
X int arg, i;
|
||||
X char *name;
|
||||
X struct group *grp;
|
||||
X
|
||||
X while ((arg = getopt(argc, argv, "a:d:g:Dl")) != EOF) {
|
||||
X switch (arg) {
|
||||
X case 'a':
|
||||
X adduser = strdup(optarg);
|
||||
X ++exclusive;
|
||||
X break;
|
||||
X case 'd':
|
||||
X deluser = strdup(optarg);
|
||||
X ++exclusive;
|
||||
X break;
|
||||
X case 'g':
|
||||
X thisgroup = strdup(optarg);
|
||||
X break;
|
||||
X case 'D':
|
||||
X purge = TRUE;
|
||||
X ++exclusive;
|
||||
X break;
|
||||
X case 'l':
|
||||
X list = TRUE;
|
||||
X ++exclusive;
|
||||
X break;
|
||||
X default:
|
||||
X usage();
|
||||
X }
|
||||
X }
|
||||
X
|
||||
X if (exclusive > 1 || optind < argc) {
|
||||
X usage();
|
||||
X }
|
||||
X
|
||||
X if (!isroot() && NULL != thisgroup) {
|
||||
X fprintf(stderr, "Only root can add members to different groups\n");
|
||||
X exit(EXIT_NOT_ROOT);
|
||||
X } else if (isroot() && NULL != thisgroup) {
|
||||
X name = thisgroup;
|
||||
X } else if (!isgroup()) {
|
||||
X fprintf(stderr, "Group access is required\n");
|
||||
X exit(EXIT_NOT_EROOT);
|
||||
X } else if (NULL == (name = whoami())) {
|
||||
X fprintf(stderr, "Not primary owner of current group\n");
|
||||
X exit(EXIT_NOT_PRIMARY);
|
||||
X }
|
||||
X
|
||||
X if (!gr_lock()) {
|
||||
X fprintf(stderr, "Unable to lock group file\n");
|
||||
X exit(EXIT_GROUP_FILE);
|
||||
X }
|
||||
X
|
||||
X if (!gr_open(O_RDWR)) {
|
||||
X fprintf(stderr, "Unable to open group file\n");
|
||||
X exit(EXIT_GROUP_FILE);
|
||||
X }
|
||||
X
|
||||
X grp = (struct group *)gr_locate(name);
|
||||
X
|
||||
X if (NULL != adduser) {
|
||||
X addtogroup(adduser, grp->gr_mem);
|
||||
X gr_update(grp);
|
||||
X } else if (NULL != deluser) {
|
||||
X rmfromgroup(deluser, grp->gr_mem);
|
||||
X gr_update(grp);
|
||||
X } else if (purge) {
|
||||
X nomembers(grp->gr_mem);
|
||||
X gr_update(grp);
|
||||
X } else if (list) {
|
||||
X members(grp->gr_mem);
|
||||
X }
|
||||
X
|
||||
X if (!gr_close()) {
|
||||
X fprintf(stderr, "Cannot close group file\n");
|
||||
X exit(EXIT_GROUP_FILE);
|
||||
X }
|
||||
X
|
||||
X gr_unlock();
|
||||
X
|
||||
X exit(EXIT_SUCCESS);
|
||||
}
|
||||
X
|
||||
/* EOF */
|
||||
SHAR_EOF
|
||||
(set 20 00 05 25 14 36 38 'groupmems.c'; eval "$shar_touch") &&
|
||||
chmod 0644 'groupmems.c' ||
|
||||
$echo 'restore of' 'groupmems.c' 'failed'
|
||||
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
|
||||
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
|
||||
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|
||||
|| $echo 'groupmems.c:' 'MD5 check failed'
|
||||
f0dd68f8d762d89d24d3ce1f4141f981 groupmems.c
|
||||
SHAR_EOF
|
||||
else
|
||||
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'groupmems.c'`"
|
||||
test 6348 -eq "$shar_count" ||
|
||||
$echo 'groupmems.c:' 'original size' '6348,' 'current size' "$shar_count!"
|
||||
fi
|
||||
fi
|
||||
# ============= groupmems.8 ==============
|
||||
if test -f 'groupmems.8' && test "$first_param" != -c; then
|
||||
$echo 'x -' SKIPPING 'groupmems.8' '(file already exists)'
|
||||
else
|
||||
$echo 'x -' extracting 'groupmems.8' '(text)'
|
||||
sed 's/^X//' << 'SHAR_EOF' > 'groupmems.8' &&
|
||||
X.\"
|
||||
X.\" SPDX-FileCopyrightText: 2000, International Business Machines, Inc.
|
||||
X.\" SPDX-FileCopyrightText: 2000, George Kraft IV, gk4@us.ibm.com
|
||||
X.\" SPDX-License-Identifier: BSD-3-Clause
|
||||
X.\"
|
||||
X.\" $Id$
|
||||
X.\"
|
||||
X.TH GROUPMEMS 8
|
||||
X.SH NAME
|
||||
groupmems \- Administer members of a user's primary group
|
||||
X.SH SYNOPSIS
|
||||
X.B groupmems
|
||||
\fB-a\fI user_name \fR |
|
||||
\fB-d\fI user_name \fR |
|
||||
\fB-l\fR |
|
||||
\fB-D\fR |
|
||||
[\fB-g\fI group_name \fR]
|
||||
X.SH DESCRIPTION
|
||||
The \fBgroupmems\fR utility allows a user to administer their own
|
||||
group membership list without the requirement of superuser privileges.
|
||||
The \fBgroupmems\fR utility is for systems that configure its users to
|
||||
be in their own name sake primary group (i.e., guest / guest).
|
||||
X.P
|
||||
Only the superuser, as administrator, can use \fBgroupmems\fR to alter
|
||||
the memberships of other groups.
|
||||
X.IP "\fB-a \fIuser_name\fR"
|
||||
Add a new user to the group membership list.
|
||||
X.IP "\fB-d \fIuser_name\fR"
|
||||
Delete a user from the group membership list.
|
||||
X.IP "\fB-l\fR"
|
||||
List the group membership list.
|
||||
X.IP "\fB-D\fR"
|
||||
Delete all users from the group membership list.
|
||||
X.IP "\fB-g \fIgroup_name\fR"
|
||||
The superuser can specify which group membership list to modify.
|
||||
X.SH SETUP
|
||||
The \fBgroupmems\fR executable should be in mode \fB2770\fR as user \fBroot\fR
|
||||
and in group \fBgroups\fR. The system administrator can add users to
|
||||
group groups to allow or disallow them using the \fBgroupmems\fR utility
|
||||
to manager their own group membership list.
|
||||
X.P
|
||||
X $ groupadd -r groups
|
||||
X.br
|
||||
X $ chmod 2770 groupmems
|
||||
X.br
|
||||
X $ chown root.groups groupmems
|
||||
X.br
|
||||
X $ groupmems -g groups -a gk4
|
||||
X.SH FILES
|
||||
/etc/group
|
||||
X.br
|
||||
/etc/gshadow
|
||||
X.SH SEE ALSO
|
||||
X.BR chfn (1),
|
||||
X.BR chsh (1),
|
||||
X.BR useradd (8),
|
||||
X.BR userdel (8),
|
||||
X.BR usermod (8),
|
||||
X.BR passwd (1),
|
||||
X.BR groupadd (8),
|
||||
X.BR groupdel (8)
|
||||
X.SH AUTHOR
|
||||
George Kraft IV (gk4@us.ibm.com)
|
||||
X.\" EOF
|
||||
SHAR_EOF
|
||||
(set 20 00 05 25 14 38 23 'groupmems.8'; eval "$shar_touch") &&
|
||||
chmod 0600 'groupmems.8' ||
|
||||
$echo 'restore of' 'groupmems.8' 'failed'
|
||||
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
|
||||
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
|
||||
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|
||||
|| $echo 'groupmems.8:' 'MD5 check failed'
|
||||
181e6cd3a3c9d3df320197fa2cde2b4a groupmems.8
|
||||
SHAR_EOF
|
||||
else
|
||||
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'groupmems.8'`"
|
||||
test 3372 -eq "$shar_count" ||
|
||||
$echo 'groupmems.8:' 'original size' '3372,' 'current size' "$shar_count!"
|
||||
fi
|
||||
fi
|
||||
rm -fr _sh10937
|
||||
exit 0
|
||||
@@ -1,308 +0,0 @@
|
||||
/*
|
||||
* pwdauth.c - program to verify a given username/password pair.
|
||||
*
|
||||
* Run it with username in argv[1] (may be omitted - default is the
|
||||
* current user), and send it the password over a pipe on stdin.
|
||||
* Exit status: 0 - correct password, 1 - wrong password, >1 - other
|
||||
* errors. For use with shadow passwords, this program should be
|
||||
* installed setuid root.
|
||||
*
|
||||
* This can be used, for example, by xlock - you don't have to install
|
||||
* this large and complex (== possibly insecure) program setuid root,
|
||||
* just modify it to run this simple program to do the authentication.
|
||||
*
|
||||
* Recent versions (xlockmore-3.9) are cleaner, and drop privileges as
|
||||
* soon as possible after getting the user's encrypted password.
|
||||
* Using this program probably doesn't make it more secure, and has one
|
||||
* disadvantage: since we don't get the encrypted user's password at
|
||||
* startup (but at the time the user is authenticated), it is not clear
|
||||
* how we should handle errors (like getpwnam() returning NULL).
|
||||
* - fail the authentication? Problem: no way to unlock (other than kill
|
||||
* the process from somewhere else) if the NIS server stops responding.
|
||||
* - succeed and unlock? Problem: it's too easy to unlock by unplugging
|
||||
* the box from the network and waiting until NIS times out...
|
||||
*
|
||||
* This program is Copyright (C) 1996 Marek Michalkiewicz
|
||||
* <marekm@i17linuxb.ists.pwr.wroc.pl>.
|
||||
*
|
||||
* It may be used and distributed freely for any purposes. There is no
|
||||
* warranty - use at your own risk. I am not liable for any damages etc.
|
||||
* If you improve it, please send me your changes.
|
||||
*/
|
||||
|
||||
static char rcsid[] = "$Id$";
|
||||
|
||||
/*
|
||||
* Define USE_SYSLOG to use syslog() to log successful and failed
|
||||
* authentication. This should be safe even if your system has
|
||||
* the infamous syslog buffer overrun security problem...
|
||||
*/
|
||||
#define USE_SYSLOG
|
||||
|
||||
/*
|
||||
* Define HAVE_GETSPNAM to get shadow passwords using getspnam().
|
||||
* Some systems don't have getspnam(), but getpwnam() returns
|
||||
* encrypted passwords only if running as root.
|
||||
*
|
||||
* According to the xlock source (not tested, except Linux) -
|
||||
* define: Linux, Solaris 2.x, SVR4, ...
|
||||
* undef: HP-UX with Secured Passwords, FreeBSD, NetBSD, QNX.
|
||||
* Known not supported (yet): Ultrix, OSF/1, SCO.
|
||||
*/
|
||||
#define HAVE_GETSPNAM
|
||||
|
||||
/*
|
||||
* Define HAVE_PW_ENCRYPT to use pw_encrypt() instead of crypt().
|
||||
* pw_encrypt() is like the standard crypt(), except that it may
|
||||
* support better password hashing algorithms.
|
||||
*
|
||||
* Define if linking with libshadow.a from the shadow password
|
||||
* suite (Linux, SunOS 4.x?).
|
||||
*/
|
||||
#undef HAVE_PW_ENCRYPT
|
||||
|
||||
/*
|
||||
* Define HAVE_AUTH_METHODS to support the shadow suite specific
|
||||
* extension: the encrypted password field contains a list of
|
||||
* administrator defined authentication methods, separated by
|
||||
* semicolons. This program only supports the standard password
|
||||
* authentication method (a string that doesn't start with '@').
|
||||
*/
|
||||
#undef HAVE_AUTH_METHODS
|
||||
|
||||
/*
|
||||
* FAIL_DELAY - number of seconds to sleep before exiting if the
|
||||
* password was wrong, to slow down password guessing attempts.
|
||||
*/
|
||||
#define FAIL_DELAY 2
|
||||
|
||||
/* No user-serviceable parts below :-). */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#ifdef USE_SYSLOG
|
||||
#include <syslog.h>
|
||||
#ifndef LOG_AUTHPRIV
|
||||
#define LOG_AUTHPRIV LOG_AUTH
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETSPNAM
|
||||
#include <shadow.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PW_ENCRYPT
|
||||
extern char *pw_encrypt();
|
||||
#define crypt pw_encrypt
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read the password (one line) from fp. We don't turn off echo
|
||||
* because we expect input from a pipe.
|
||||
*/
|
||||
static char *
|
||||
get_line(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
static char buf[128];
|
||||
char *cp;
|
||||
int ch;
|
||||
|
||||
cp = buf;
|
||||
while ((ch = getc(fp)) != EOF && ch != '\0' && ch != '\n') {
|
||||
if (cp >= buf + sizeof buf - 1)
|
||||
break;
|
||||
*cp++ = ch;
|
||||
}
|
||||
*cp = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the password file entry for the current user. If the name
|
||||
* returned by getlogin() is correct (matches the current real uid),
|
||||
* return the entry for that user. Otherwise, return the entry (if
|
||||
* any) matching the current real uid. Return NULL on failure.
|
||||
*/
|
||||
static struct passwd *
|
||||
get_my_pwent()
|
||||
{
|
||||
uid_t uid = getuid();
|
||||
char *name = getlogin();
|
||||
|
||||
if (name && *name) {
|
||||
struct passwd *pw = getpwnam(name);
|
||||
|
||||
if (pw && pw->pw_uid == uid)
|
||||
return pw;
|
||||
}
|
||||
return getpwuid(uid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify the password. The system-dependent shadow support is here.
|
||||
*/
|
||||
static int
|
||||
password_auth_ok(pw, pass)
|
||||
const struct passwd *pw;
|
||||
const char *pass;
|
||||
{
|
||||
int result;
|
||||
char *cp;
|
||||
#ifdef HAVE_AUTH_METHODS
|
||||
char *buf;
|
||||
#endif
|
||||
#ifdef HAVE_GETSPNAM
|
||||
struct spwd *sp;
|
||||
#endif
|
||||
|
||||
if (pw) {
|
||||
#ifdef HAVE_GETSPNAM
|
||||
sp = getspnam(pw->pw_name);
|
||||
if (sp)
|
||||
cp = sp->sp_pwdp;
|
||||
else
|
||||
#endif
|
||||
cp = pw->pw_passwd;
|
||||
} else
|
||||
cp = "xx";
|
||||
|
||||
#ifdef HAVE_AUTH_METHODS
|
||||
buf = strdup(cp); /* will be modified by strtok() */
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Out of memory.\n");
|
||||
exit(13);
|
||||
}
|
||||
cp = strtok(buf, ";");
|
||||
while (cp && *cp == '@')
|
||||
cp = strtok(NULL, ";");
|
||||
|
||||
/* fail if no password authentication for this user */
|
||||
if (!cp)
|
||||
cp = "xx";
|
||||
#endif
|
||||
|
||||
if (*pass || *cp)
|
||||
result = (strcmp(crypt(pass, cp), cp) == 0);
|
||||
else
|
||||
result = 1; /* user with no password */
|
||||
|
||||
#ifdef HAVE_AUTH_METHODS
|
||||
free(buf);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Main program.
|
||||
*/
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
struct passwd *pw;
|
||||
char *pass, *name;
|
||||
char myname[32];
|
||||
|
||||
#ifdef USE_SYSLOG
|
||||
openlog("pwdauth", LOG_PID | LOG_CONS, LOG_AUTHPRIV);
|
||||
#endif
|
||||
pw = get_my_pwent();
|
||||
if (!pw) {
|
||||
#ifdef USE_SYSLOG
|
||||
syslog(LOG_ERR, "can't get login name for uid %d.\n",
|
||||
(int) getuid());
|
||||
#endif
|
||||
fprintf(stderr, "Who are you?\n");
|
||||
exit(2);
|
||||
}
|
||||
strncpy(myname, pw->pw_name, sizeof myname - 1);
|
||||
myname[sizeof myname - 1] = '\0';
|
||||
name = myname;
|
||||
|
||||
if (argc > 1) {
|
||||
name = argv[1];
|
||||
pw = getpwnam(name);
|
||||
}
|
||||
|
||||
pass = get_line(stdin);
|
||||
if (password_auth_ok(pw, pass)) {
|
||||
#ifdef USE_SYSLOG
|
||||
syslog(pw->pw_uid ? LOG_INFO : LOG_NOTICE,
|
||||
"user `%s' entered correct password for `%.32s'.\n",
|
||||
myname, name);
|
||||
#endif
|
||||
exit(0);
|
||||
}
|
||||
#ifdef USE_SYSLOG
|
||||
/* be careful not to overrun the syslog buffer */
|
||||
syslog((!pw || pw->pw_uid) ? LOG_NOTICE : LOG_WARNING,
|
||||
"user `%s' entered incorrect password for `%.32s'.\n",
|
||||
myname, name);
|
||||
#endif
|
||||
#ifdef FAIL_DELAY
|
||||
sleep(FAIL_DELAY);
|
||||
#endif
|
||||
fprintf(stderr, "Wrong password.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* You can use code similar to the following to run this program.
|
||||
* Return values: >=0 - program exit status (use the <sys/wait.h>
|
||||
* macros to get the exit code, it is shifted left by 8 bits),
|
||||
* -1 - check errno.
|
||||
*/
|
||||
int
|
||||
verify_password(const char *username, const char *password)
|
||||
{
|
||||
int pipe_fd[2];
|
||||
int pid, wpid, status;
|
||||
|
||||
if (pipe(pipe_fd))
|
||||
return -1;
|
||||
|
||||
if ((pid = fork()) == 0) {
|
||||
char *arg[3];
|
||||
char *env[1];
|
||||
|
||||
/* child */
|
||||
close(pipe_fd[1]);
|
||||
if (pipe_fd[0] != 0) {
|
||||
if (dup2(pipe_fd[0], 0) != 0)
|
||||
_exit(127);
|
||||
close(pipe_fd[0]);
|
||||
}
|
||||
arg[0] = "/usr/bin/pwdauth";
|
||||
arg[1] = username;
|
||||
arg[2] = NULL;
|
||||
env[0] = NULL;
|
||||
execve(arg[0], arg, env);
|
||||
_exit(127);
|
||||
} else if (pid == -1) {
|
||||
/* error */
|
||||
close(pipe_fd[0]);
|
||||
close(pipe_fd[1]);
|
||||
return -1;
|
||||
}
|
||||
/* parent */
|
||||
close(pipe_fd[0]);
|
||||
write(pipe_fd[1], password, strlen(password));
|
||||
write(pipe_fd[1], "\n", 1);
|
||||
close(pipe_fd[1]);
|
||||
|
||||
while ((wpid = wait(&status)) != pid) {
|
||||
if (wpid == -1)
|
||||
return -1;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
@@ -1,147 +0,0 @@
|
||||
Hello Marek,
|
||||
|
||||
I have created a diffile against the 980403 release that adds
|
||||
functionality to newusers for automatic handling of users with only
|
||||
anonymous ftp login (using the guestgroup feature in ftpaccess, which
|
||||
means that the users home directory looks like '/home/user/./'). It also
|
||||
adds a commandline argument to specify an initial directory structure
|
||||
for such users, with a tarball normally containing the bin,lib,etc
|
||||
directories used in the chrooted environment.
|
||||
|
||||
I am using it to automatically create chunks of users with only ftp
|
||||
access for a webserver.
|
||||
|
||||
I have tried to follow your coding standards and I believe it is bug
|
||||
free but.. well, who knows. :) It's not much code however.
|
||||
|
||||
I hope you find it useful. Do what you like with it, feel free to ask if
|
||||
anything is unclear.
|
||||
|
||||
Best rgds,
|
||||
Calle Karlsson
|
||||
ckn@kash.se
|
||||
|
||||
diff -uNr shadow-980403.orig/src/newusers.c shadow-980403/src/newusers.c
|
||||
--- shadow-980403.orig/src/newusers.c Fri Jan 30 00:22:43 1998
|
||||
+++ shadow-980403/src/newusers.c Fri Apr 17 16:55:33 1998
|
||||
@@ -76,11 +76,35 @@
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
- fprintf(stderr, "Usage: %s [ input ]\n", Prog);
|
||||
+ fprintf (stderr, "Usage: %s [-p prototype tarfile] [ input ]\n", Prog);
|
||||
+ fprintf (stderr, "The prototype tarfile is only used for users\n");
|
||||
+ fprintf (stderr, "marked as anonymous ftp users. It must be a full pathname.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
+ * createuserdir - create a directory and chmod it
|
||||
+ */
|
||||
+
|
||||
+static int
|
||||
+createuserdir (char * dir, int uid, int gid, int line)
|
||||
+{
|
||||
+ if (mkdir (dir, 0777 & ~getdef_num("UMASK", 077))) {
|
||||
+ fprintf (stderr, "%s: line %d: mkdir %s failed\n",
|
||||
+ Prog, line, dir);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (chown (dir, uid, gid)) {
|
||||
+ fprintf (stderr, "%s: line %d: chown %s failed\n",
|
||||
+ Prog, line, dir);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* add_group - create a new group or add a user to an existing group
|
||||
*/
|
||||
|
||||
@@ -328,6 +352,8 @@
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
+ char anonproto[BUFSIZ];
|
||||
+ int flag;
|
||||
char *fields[8];
|
||||
int nfields;
|
||||
char *cp;
|
||||
@@ -340,12 +366,23 @@
|
||||
|
||||
Prog = Basename(argv[0]);
|
||||
|
||||
- if (argc > 1 && argv[1][0] == '-')
|
||||
- usage ();
|
||||
+ * anonproto = '\0';
|
||||
+
|
||||
+ while ((flag = getopt (argc, argv, "p:h")) != EOF) {
|
||||
+ switch (flag) {
|
||||
+ case 'p':
|
||||
+ STRFCPY(anonproto, optarg);
|
||||
+ break;
|
||||
+ case 'h':
|
||||
+ default:
|
||||
+ usage ();
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (argc == 2) {
|
||||
- if (! freopen (argv[1], "r", stdin)) {
|
||||
- snprintf(buf, sizeof buf, "%s: %s", Prog, argv[1]);
|
||||
+ if (optind < argc) {
|
||||
+ if (! freopen (argv[optind], "r", stdin)) {
|
||||
+ snprintf(buf, sizeof buf, "%s: %s", Prog, argv[optind]);
|
||||
perror (buf);
|
||||
exit (1);
|
||||
}
|
||||
@@ -499,15 +536,36 @@
|
||||
if (fields[6][0])
|
||||
newpw.pw_shell = fields[6];
|
||||
|
||||
- if (newpw.pw_dir[0] && access(newpw.pw_dir, F_OK)) {
|
||||
- if (mkdir (newpw.pw_dir,
|
||||
- 0777 & ~getdef_num("UMASK", 077)))
|
||||
- fprintf (stderr, "%s: line %d: mkdir failed\n",
|
||||
- Prog, line);
|
||||
- else if (chown (newpw.pw_dir,
|
||||
- newpw.pw_uid, newpw.pw_gid))
|
||||
- fprintf (stderr, "%s: line %d: chown failed\n",
|
||||
- Prog, line);
|
||||
+ if (newpw.pw_dir[0]) {
|
||||
+ char * userdir = strdup (newpw.pw_dir);
|
||||
+ char * anonpart;
|
||||
+ int rc;
|
||||
+
|
||||
+ if ((anonpart = strstr (userdir, "/./"))) {
|
||||
+ * anonpart = '\0';
|
||||
+ anonpart += 2;
|
||||
+ }
|
||||
+
|
||||
+ if (access(userdir, F_OK))
|
||||
+ rc = createuserdir (userdir, newpw.pw_uid, newpw.pw_gid, line);
|
||||
+ else
|
||||
+ rc = 0;
|
||||
+
|
||||
+ if (rc == 0 && anonpart) {
|
||||
+ if (* anonproto) {
|
||||
+ char cmdbuf [BUFSIZ];
|
||||
+ snprintf(cmdbuf, sizeof cmdbuf,
|
||||
+ "cd %s; tar xf %s",
|
||||
+ userdir, anonproto);
|
||||
+ system (cmdbuf);
|
||||
+ }
|
||||
+ if (strlen (anonpart) > 1) {
|
||||
+ strcat (userdir, anonpart);
|
||||
+ if (access (userdir, F_OK))
|
||||
+ createuserdir (userdir, newpw.pw_uid, newpw.pw_gid, line);
|
||||
+ }
|
||||
+ }
|
||||
+ free (userdir);
|
||||
}
|
||||
|
||||
/*
|
||||
Binary file not shown.
12
doc/HOWTO
12
doc/HOWTO
@@ -471,12 +471,12 @@
|
||||
|
||||
The Shadow Suite contains replacement programs for:
|
||||
|
||||
su, login, passwd, newgrp, chfn, chsh, and id
|
||||
su, login, passwd, newgrp, chfn, chsh
|
||||
|
||||
The package also contains the new programs:
|
||||
|
||||
chage, newusers, dpasswd, gpasswd, useradd, userdel, usermod,
|
||||
groupadd, groupdel, groupmod, groups, pwck, grpck, lastlog, pwconv,
|
||||
groupadd, groupdel, groupmod, pwck, grpck, lastlog, pwconv,
|
||||
and pwunconv
|
||||
|
||||
Additionally, the library: libshadow.a is included for writing and/or
|
||||
@@ -586,8 +586,6 @@
|
||||
|
||||
· /usr/bin/chsh
|
||||
|
||||
· /usr/bin/id
|
||||
|
||||
The BETA package has a save target in the Makefile, but it's commented
|
||||
out because different distributions place the programs in different
|
||||
places.
|
||||
@@ -637,8 +635,6 @@
|
||||
|
||||
· /usr/man/man1/chsh.1.gz
|
||||
|
||||
· /usr/man/man1/id.1.gz
|
||||
|
||||
· /usr/man/man1/login.1.gz
|
||||
|
||||
· /usr/man/man1/passwd.1.gz
|
||||
@@ -1377,7 +1373,7 @@
|
||||
users or changing the group password, the /etc/gshadow file will be
|
||||
changed.
|
||||
|
||||
The programs groups, groupadd, groupmod, and groupdel are provided as
|
||||
The programs groupadd, groupmod, and groupdel are provided as
|
||||
part of the Shadow Suite to modify groups.
|
||||
|
||||
The format of the /etc/group file is as follows:
|
||||
@@ -1755,7 +1751,7 @@
|
||||
}
|
||||
#ifdef HAS_SHADOW
|
||||
if ((pw->pw_passwd && pw->pw_passwd[0] == '@'
|
||||
&& pw_auth (pw->pw_passwd+1, pw->pw_name, PW_LOGIN, NULL))
|
||||
&& pw_auth(pw->pw_passwd+1, pw->pw_name))
|
||||
|| !valid (passwd, pw)) {
|
||||
return (UPAP_AUTHNAK);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# This is a dummy Makefile.am to get automake work flawlessly,
|
||||
# and also cooperate to make a distribution for `make dist'
|
||||
|
||||
EXTRA_DIST = HOWTO README.limits \
|
||||
README.platforms WISHLIST console.c.spec.txt cracklib26.diff
|
||||
EXTRA_DIST = HOWTO README.limits
|
||||
|
||||
@@ -141,6 +141,8 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CMOCKA_CFLAGS = @CMOCKA_CFLAGS@
|
||||
CMOCKA_LIBS = @CMOCKA_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
@@ -174,9 +176,15 @@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBACL = @LIBACL@
|
||||
LIBADD_DL = @LIBADD_DL@
|
||||
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
|
||||
LIBADD_DLOPEN = @LIBADD_DLOPEN@
|
||||
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
|
||||
LIBATTR = @LIBATTR@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBCRACK = @LIBCRACK@
|
||||
LIBBSD = @LIBBSD@
|
||||
LIBBSD_CFLAGS = @LIBBSD_CFLAGS@
|
||||
LIBBSD_LIBS = @LIBBSD_LIBS@
|
||||
LIBCRYPT = @LIBCRYPT@
|
||||
LIBECONF = @LIBECONF@
|
||||
LIBICONV = @LIBICONV@
|
||||
@@ -192,6 +200,7 @@ LIBSUBID_ABI = @LIBSUBID_ABI@
|
||||
LIBSUBID_ABI_MAJOR = @LIBSUBID_ABI_MAJOR@
|
||||
LIBSUBID_ABI_MICRO = @LIBSUBID_ABI_MICRO@
|
||||
LIBSUBID_ABI_MINOR = @LIBSUBID_ABI_MINOR@
|
||||
LIBSYSTEMD = @LIBSYSTEMD@
|
||||
LIBTCB = @LIBTCB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
@@ -200,6 +209,8 @@ LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_DLLOADERS = @LT_DLLOADERS@
|
||||
LT_DLPREOPEN = @LT_DLPREOPEN@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
@@ -222,6 +233,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
@@ -293,9 +307,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
EXTRA_DIST = HOWTO README.limits \
|
||||
README.platforms WISHLIST console.c.spec.txt cracklib26.diff
|
||||
|
||||
EXTRA_DIST = HOWTO README.limits
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# $Id$
|
||||
#
|
||||
# This is the current (still incomplete) list of platforms this
|
||||
# package has been verified to work on. Additions (preferably
|
||||
# in the format as described below) are welcome. Thanks!
|
||||
#
|
||||
# V: last version reported to work
|
||||
# H: host type
|
||||
# L: Linux libc version
|
||||
# D: Linux distribution, or other OS name and version
|
||||
# C: changes (if any)
|
||||
# R: reported by
|
||||
|
||||
V: 980529
|
||||
H: sparc-unknown-linux-gnu
|
||||
L: glibc-2.0.7
|
||||
D: Ultrapenguin-1.0.9
|
||||
C: had to explicitly disable desrpc.
|
||||
R: Bjorn Christianson <bjorn@cascade.psychology.mcmaster.ca>
|
||||
|
||||
V: 980724
|
||||
H: i486-pc-linux-gnulibc1
|
||||
L: libc-5.4.33
|
||||
D: Debian-1.3.1.r6
|
||||
C: none (use dpkg-buildpackage)
|
||||
R: Marek Michalkiewicz <marekm@linux.org.pl>
|
||||
|
||||
V: current
|
||||
H: i686-pc-linux-gnu
|
||||
L: glibc-2.0.7.19981211
|
||||
D: Debian-2.1
|
||||
C: none (use dpkg-buildpackage)
|
||||
R: Marek Michalkiewicz <marekm@linux.org.pl>
|
||||
39
doc/WISHLIST
39
doc/WISHLIST
@@ -1,39 +0,0 @@
|
||||
$Id$
|
||||
|
||||
This is my wishlist for the shadow suite, in no particular order. Feel
|
||||
free to do anything from this list and mail me the diffs :-).
|
||||
|
||||
Patches in diff -u format, against the latest version (sometimes in the
|
||||
"beta" directory) are preferred and make my job easier. Please, no
|
||||
MIME, base64, quoted-printable, or HTML. For very big patches, or if
|
||||
your mailer can corrupt them, please use gzip and uuencode. Thanks!
|
||||
|
||||
New ideas to add to this list are welcome, too. --marekm
|
||||
|
||||
- fix all the bugs, of course
|
||||
- implement "su only" accounts (no logins, only su from other account)
|
||||
- rewrite getdef.c to be more general? (no hardcoded names)
|
||||
- patch for rlogind/telnetd to create utmp entry and fill in ut_addr
|
||||
- option to specify encrypted password in passwd (for yppasswdd, so it
|
||||
doesn't need to know about shadow/non-shadow); should probably use a pipe
|
||||
(less insecure than command line arguments)
|
||||
- add support for changing NIS passwords
|
||||
- add option to check passwords by piping them to external programs
|
||||
- add functionality of the contrib/rpasswd.c wrapper to passwd
|
||||
- option to generate pronounceable passwords (like on SCO), external program?
|
||||
- poppassd (remote password change for eudora etc.)
|
||||
- add support for passwd/shadow db files (glibc)
|
||||
- vipw: check password files for errors after editing
|
||||
- add "maximum time users allowed to stay logged in" limit option to logoutd
|
||||
- handle quotes in /etc/environment like the shell does (but sshd doesn't...)
|
||||
- better utmpx support (logoutd, ...)
|
||||
- better OPIE support (report number of logins left, etc.)
|
||||
- new option for /etc/suauth: don't load user's environment (force "su -")
|
||||
suggested by Ulisses Alonso Camaro
|
||||
- find out why recent releases won't compile on Solaris
|
||||
- newusers should be able to copy /etc/skel to the new home directory
|
||||
(like useradd)
|
||||
- add directories where other packages can add hooks for package-specific
|
||||
per-user configuration, to be executed with run-parts. Some hooks should
|
||||
be executed at package install time for existing users, likewise for
|
||||
package removal and possibly modification. (Debian Bug#36019)
|
||||
@@ -1,36 +0,0 @@
|
||||
$Id$
|
||||
|
||||
Specification for console.c source file --
|
||||
|
||||
input values --
|
||||
tty -- character pointer to device name with leading "/dev/"
|
||||
removed.
|
||||
|
||||
return values --
|
||||
0 -- false
|
||||
1 -- true
|
||||
|
||||
int console (char * tty)
|
||||
if "CONSOLE" string value is not present in login.defs
|
||||
return true
|
||||
|
||||
if the first character of "CONSOLE" string value is not "/"
|
||||
treat the string as a ":" delimited list of device
|
||||
names and search for the value of tty in that
|
||||
tokenized list.
|
||||
|
||||
if a match is found
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
if the file named by "CONSOLE" cannot be opened
|
||||
return true
|
||||
|
||||
scan the file looking for a match between the input line
|
||||
and the value of tty
|
||||
|
||||
if a match is found
|
||||
return true
|
||||
|
||||
return false
|
||||
@@ -1,340 +0,0 @@
|
||||
diff -ur orig/cracklib26_small/cracklib/fascist.c cracklib26_small/cracklib/fascist.c
|
||||
--- orig/cracklib26_small/cracklib/fascist.c Mon Dec 15 02:56:55 1997
|
||||
+++ cracklib26_small/cracklib/fascist.c Sat Apr 4 22:14:45 1998
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
+#include <string.h>
|
||||
|
||||
#define ISSKIP(x) (isspace(x) || ispunct(x))
|
||||
|
||||
@@ -460,28 +461,27 @@
|
||||
}
|
||||
|
||||
char *
|
||||
-FascistGecos(password, uid)
|
||||
+FascistGecosPw(password, pwd)
|
||||
char *password;
|
||||
- int uid;
|
||||
+ struct passwd *pwd;
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int wc;
|
||||
char *ptr;
|
||||
- struct passwd *pwp;
|
||||
char gbuffer[STRINGSIZE];
|
||||
char tbuffer[STRINGSIZE];
|
||||
char *uwords[STRINGSIZE];
|
||||
char longbuffer[STRINGSIZE * 2];
|
||||
|
||||
- if (!(pwp = getpwuid(uid)))
|
||||
+ if (!pwd)
|
||||
{
|
||||
return ("you are not registered in the password file");
|
||||
}
|
||||
|
||||
/* lets get really paranoid and assume a dangerously long gecos entry */
|
||||
|
||||
- strncpy(tbuffer, pwp->pw_name, STRINGSIZE);
|
||||
+ strncpy(tbuffer, pwd->pw_name, STRINGSIZE);
|
||||
tbuffer[STRINGSIZE-1] = '\0';
|
||||
if (GTry(tbuffer, password))
|
||||
{
|
||||
@@ -490,12 +490,13 @@
|
||||
|
||||
/* it never used to be that you got passwd strings > 1024 chars, but now... */
|
||||
|
||||
- strncpy(tbuffer, pwp->pw_gecos, STRINGSIZE);
|
||||
+ strncpy(tbuffer, pwd->pw_gecos, STRINGSIZE);
|
||||
tbuffer[STRINGSIZE-1] = '\0';
|
||||
strcpy(gbuffer, Lowercase(tbuffer));
|
||||
|
||||
wc = 0;
|
||||
ptr = gbuffer;
|
||||
+ uwords[0] = (char *) 0;
|
||||
|
||||
while (*ptr)
|
||||
{
|
||||
@@ -530,6 +531,8 @@
|
||||
*(ptr++) = '\0';
|
||||
}
|
||||
}
|
||||
+ if (!uwords[0])
|
||||
+ return ((char *) 0); /* empty gecos */
|
||||
#ifdef DEBUG
|
||||
for (i = 0; uwords[i]; i++)
|
||||
{
|
||||
@@ -586,9 +589,10 @@
|
||||
}
|
||||
|
||||
char *
|
||||
-FascistLook(pwp, instring)
|
||||
+FascistLookPw(pwp, instring, pwd)
|
||||
PWDICT *pwp;
|
||||
char *instring;
|
||||
+ struct passwd *pwd;
|
||||
{
|
||||
int i;
|
||||
char *ptr;
|
||||
@@ -667,7 +671,7 @@
|
||||
return ("it looks like a National Insurance number.");
|
||||
}
|
||||
|
||||
- if (ptr = FascistGecos(password, getuid()))
|
||||
+ if (ptr = FascistGecosPw(password, pwd ? pwd : getpwuid(getuid())))
|
||||
{
|
||||
return (ptr);
|
||||
}
|
||||
@@ -715,9 +719,10 @@
|
||||
}
|
||||
|
||||
char *
|
||||
-FascistCheck(password, path)
|
||||
+FascistCheckPw(password, path, pwd)
|
||||
char *password;
|
||||
char *path;
|
||||
+ struct passwd *pwd;
|
||||
{
|
||||
static char lastpath[STRINGSIZE];
|
||||
static PWDICT *pwp;
|
||||
@@ -750,5 +755,29 @@
|
||||
strncpy(lastpath, path, STRINGSIZE);
|
||||
}
|
||||
|
||||
- return (FascistLook(pwp, pwtrunced));
|
||||
+ return (FascistLookPw(pwp, pwtrunced, pwd));
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+FascistGecos(password, uid)
|
||||
+ char *password;
|
||||
+ int uid;
|
||||
+{
|
||||
+ return (FascistGecosPw(password, getpwuid(uid)));
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+FascistLook(pwp, instring)
|
||||
+ PWDICT *pwp;
|
||||
+ char *instring;
|
||||
+{
|
||||
+ return (FascistLookPw(pwp, instring, (char *) 0));
|
||||
+}
|
||||
+
|
||||
+char *
|
||||
+FascistCheck(password, path)
|
||||
+ char *password;
|
||||
+ char *path;
|
||||
+{
|
||||
+ return (FascistCheckPw(password, path, (char *) 0));
|
||||
}
|
||||
diff -ur orig/cracklib26_small/cracklib/packer.h cracklib26_small/cracklib/packer.h
|
||||
--- orig/cracklib26_small/cracklib/packer.h Mon Dec 15 00:09:30 1997
|
||||
+++ cracklib26_small/cracklib/packer.h Sat Jan 10 22:13:46 1998
|
||||
@@ -34,6 +34,7 @@
|
||||
FILE *dfp;
|
||||
FILE *wfp;
|
||||
|
||||
+ int canfree;
|
||||
int32 flags;
|
||||
#define PFOR_WRITE 0x0001
|
||||
#define PFOR_FLUSH 0x0002
|
||||
diff -ur orig/cracklib26_small/cracklib/packlib.c cracklib26_small/cracklib/packlib.c
|
||||
--- orig/cracklib26_small/cracklib/packlib.c Fri Jul 9 22:22:58 1993
|
||||
+++ cracklib26_small/cracklib/packlib.c Sat Jan 10 22:28:49 1998
|
||||
@@ -16,7 +16,7 @@
|
||||
char *mode;
|
||||
{
|
||||
int32 i;
|
||||
- static PWDICT pdesc;
|
||||
+ PWDICT *pdesc;
|
||||
char iname[STRINGSIZE];
|
||||
char dname[STRINGSIZE];
|
||||
char wname[STRINGSIZE];
|
||||
@@ -25,92 +25,94 @@
|
||||
FILE *ifp;
|
||||
FILE *wfp;
|
||||
|
||||
- if (pdesc.header.pih_magic == PIH_MAGIC)
|
||||
- {
|
||||
- fprintf(stderr, "%s: another dictionary already open\n", prefix);
|
||||
+ if ((pdesc = (PWDICT *) malloc(sizeof(PWDICT))) == 0)
|
||||
return ((PWDICT *) 0);
|
||||
- }
|
||||
|
||||
- memset(&pdesc, '\0', sizeof(pdesc));
|
||||
+ memset(pdesc, '\0', sizeof(*pdesc));
|
||||
|
||||
sprintf(iname, "%s.pwi", prefix);
|
||||
sprintf(dname, "%s.pwd", prefix);
|
||||
sprintf(wname, "%s.hwm", prefix);
|
||||
|
||||
- if (!(pdesc.dfp = fopen(dname, mode)))
|
||||
+ if (!(pdesc->dfp = fopen(dname, mode)))
|
||||
{
|
||||
perror(dname);
|
||||
+ free(pdesc);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
- if (!(pdesc.ifp = fopen(iname, mode)))
|
||||
+ if (!(pdesc->ifp = fopen(iname, mode)))
|
||||
{
|
||||
- fclose(pdesc.dfp);
|
||||
+ fclose(pdesc->dfp);
|
||||
perror(iname);
|
||||
+ free(pdesc);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
- if (pdesc.wfp = fopen(wname, mode))
|
||||
+ if (pdesc->wfp = fopen(wname, mode))
|
||||
{
|
||||
- pdesc.flags |= PFOR_USEHWMS;
|
||||
+ pdesc->flags |= PFOR_USEHWMS;
|
||||
}
|
||||
|
||||
- ifp = pdesc.ifp;
|
||||
- dfp = pdesc.dfp;
|
||||
- wfp = pdesc.wfp;
|
||||
+ ifp = pdesc->ifp;
|
||||
+ dfp = pdesc->dfp;
|
||||
+ wfp = pdesc->wfp;
|
||||
|
||||
if (mode[0] == 'w')
|
||||
{
|
||||
- pdesc.flags |= PFOR_WRITE;
|
||||
- pdesc.header.pih_magic = PIH_MAGIC;
|
||||
- pdesc.header.pih_blocklen = NUMWORDS;
|
||||
- pdesc.header.pih_numwords = 0;
|
||||
+ pdesc->flags |= PFOR_WRITE;
|
||||
+ pdesc->header.pih_magic = PIH_MAGIC;
|
||||
+ pdesc->header.pih_blocklen = NUMWORDS;
|
||||
+ pdesc->header.pih_numwords = 0;
|
||||
|
||||
- fwrite((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp);
|
||||
+ fwrite((char *) &pdesc->header, sizeof(pdesc->header), 1, ifp);
|
||||
} else
|
||||
{
|
||||
- pdesc.flags &= ~PFOR_WRITE;
|
||||
+ pdesc->flags &= ~PFOR_WRITE;
|
||||
|
||||
- if (!fread((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp))
|
||||
+ if (!fread((char *) &pdesc->header, sizeof(pdesc->header), 1, ifp))
|
||||
{
|
||||
fprintf(stderr, "%s: error reading header\n", prefix);
|
||||
|
||||
- pdesc.header.pih_magic = 0;
|
||||
+ pdesc->header.pih_magic = 0;
|
||||
fclose(ifp);
|
||||
fclose(dfp);
|
||||
+ free(pdesc);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
- if (pdesc.header.pih_magic != PIH_MAGIC)
|
||||
+ if (pdesc->header.pih_magic != PIH_MAGIC)
|
||||
{
|
||||
fprintf(stderr, "%s: magic mismatch\n", prefix);
|
||||
|
||||
- pdesc.header.pih_magic = 0;
|
||||
+ pdesc->header.pih_magic = 0;
|
||||
fclose(ifp);
|
||||
fclose(dfp);
|
||||
+ free(pdesc);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
- if (pdesc.header.pih_blocklen != NUMWORDS)
|
||||
+ if (pdesc->header.pih_blocklen != NUMWORDS)
|
||||
{
|
||||
fprintf(stderr, "%s: size mismatch\n", prefix);
|
||||
|
||||
- pdesc.header.pih_magic = 0;
|
||||
+ pdesc->header.pih_magic = 0;
|
||||
fclose(ifp);
|
||||
fclose(dfp);
|
||||
+ free(pdesc);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
- if (pdesc.flags & PFOR_USEHWMS)
|
||||
+ if (pdesc->flags & PFOR_USEHWMS)
|
||||
{
|
||||
- if (fread(pdesc.hwms, 1, sizeof(pdesc.hwms), wfp) != sizeof(pdesc.hwms))
|
||||
+ if (fread(pdesc->hwms, 1, sizeof(pdesc->hwms), wfp) != sizeof(pdesc->hwms))
|
||||
{
|
||||
- pdesc.flags &= ~PFOR_USEHWMS;
|
||||
+ pdesc->flags &= ~PFOR_USEHWMS;
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
- return (&pdesc);
|
||||
+ pdesc->canfree = 1;
|
||||
+ return (pdesc);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -159,8 +161,13 @@
|
||||
|
||||
fclose(pwp->ifp);
|
||||
fclose(pwp->dfp);
|
||||
+ if (pwp->wfp)
|
||||
+ fclose(pwp->wfp);
|
||||
|
||||
- pwp->header.pih_magic = 0;
|
||||
+ if (pwp->canfree)
|
||||
+ free(pwp);
|
||||
+ else
|
||||
+ pwp->header.pih_magic = 0;
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -307,6 +314,11 @@
|
||||
register char *this;
|
||||
int idx;
|
||||
|
||||
+/*
|
||||
+ * comment in npasswd-2.0beta4 says this:
|
||||
+ * This does not work under all circumstances, so don't bother
|
||||
+ */
|
||||
+#if 0
|
||||
if (pwp->flags & PFOR_USEHWMS)
|
||||
{
|
||||
idx = string[0] & 0xff;
|
||||
@@ -317,6 +329,10 @@
|
||||
lwm = 0;
|
||||
hwm = PW_WORDS(pwp) - 1;
|
||||
}
|
||||
+#else
|
||||
+ lwm = 0;
|
||||
+ hwm = PW_WORDS(pwp);
|
||||
+#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("---- %lu, %lu ----\n", lwm, hwm);
|
||||
diff -ur orig/cracklib26_small/util/mkdict cracklib26_small/util/mkdict
|
||||
--- orig/cracklib26_small/util/mkdict Fri Jul 9 22:23:03 1993
|
||||
+++ cracklib26_small/util/mkdict Sat Apr 4 22:31:45 1998
|
||||
@@ -14,9 +14,16 @@
|
||||
SORT="sort"
|
||||
###SORT="sort -T /tmp"
|
||||
|
||||
-cat $* |
|
||||
+### Use zcat to read compressed (as well as uncompressed) dictionaries.
|
||||
+### Compressed dictionaries can save quite a lot of disk space.
|
||||
+
|
||||
+CAT="gzip -cdf"
|
||||
+###CAT="zcat"
|
||||
+###CAT="cat"
|
||||
+
|
||||
+$CAT $* |
|
||||
tr '[A-Z]' '[a-z]' |
|
||||
- tr -cd '[\012a-z0-9]' |
|
||||
+ tr -cd '\012[a-z][0-9]' |
|
||||
$SORT |
|
||||
uniq |
|
||||
grep -v '^#' |
|
||||
@@ -20,4 +20,4 @@ EXTRA_DIST = \
|
||||
$(sysconf_DATA) \
|
||||
$(default_DATA)
|
||||
|
||||
SUBDIRS = pam.d
|
||||
SUBDIRS = pam.d shadow-maint
|
||||
|
||||
@@ -230,6 +230,8 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CMOCKA_CFLAGS = @CMOCKA_CFLAGS@
|
||||
CMOCKA_LIBS = @CMOCKA_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
@@ -263,9 +265,15 @@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBACL = @LIBACL@
|
||||
LIBADD_DL = @LIBADD_DL@
|
||||
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
|
||||
LIBADD_DLOPEN = @LIBADD_DLOPEN@
|
||||
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
|
||||
LIBATTR = @LIBATTR@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBCRACK = @LIBCRACK@
|
||||
LIBBSD = @LIBBSD@
|
||||
LIBBSD_CFLAGS = @LIBBSD_CFLAGS@
|
||||
LIBBSD_LIBS = @LIBBSD_LIBS@
|
||||
LIBCRYPT = @LIBCRYPT@
|
||||
LIBECONF = @LIBECONF@
|
||||
LIBICONV = @LIBICONV@
|
||||
@@ -281,6 +289,7 @@ LIBSUBID_ABI = @LIBSUBID_ABI@
|
||||
LIBSUBID_ABI_MAJOR = @LIBSUBID_ABI_MAJOR@
|
||||
LIBSUBID_ABI_MICRO = @LIBSUBID_ABI_MICRO@
|
||||
LIBSUBID_ABI_MINOR = @LIBSUBID_ABI_MINOR@
|
||||
LIBSYSTEMD = @LIBSYSTEMD@
|
||||
LIBTCB = @LIBTCB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
@@ -289,6 +298,8 @@ LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_DLLOADERS = @LT_DLLOADERS@
|
||||
LT_DLPREOPEN = @LT_DLPREOPEN@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
@@ -311,6 +322,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
@@ -396,7 +410,7 @@ EXTRA_DIST = \
|
||||
$(sysconf_DATA) \
|
||||
$(default_DATA)
|
||||
|
||||
SUBDIRS = pam.d
|
||||
SUBDIRS = pam.d shadow-maint
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
@@ -227,11 +227,6 @@ PASS_WARN_AGE 7
|
||||
#
|
||||
SU_WHEEL_ONLY no
|
||||
|
||||
#
|
||||
# If compiled with cracklib support, sets the path to the dictionaries
|
||||
#
|
||||
CRACKLIB_DICTPATH /var/cache/cracklib/cracklib_dict
|
||||
|
||||
#
|
||||
# Min/max values for automatic uid selection in useradd(8)
|
||||
#
|
||||
|
||||
@@ -2,20 +2,19 @@
|
||||
# and also cooperate to make a distribution for `make dist'
|
||||
|
||||
pamd_files = \
|
||||
chpasswd \
|
||||
chfn \
|
||||
chsh \
|
||||
groupmems \
|
||||
login \
|
||||
newusers \
|
||||
passwd
|
||||
|
||||
pamd_acct_tools_files = \
|
||||
chage \
|
||||
chgpasswd \
|
||||
chpasswd \
|
||||
groupadd \
|
||||
groupdel \
|
||||
groupmod \
|
||||
newusers \
|
||||
useradd \
|
||||
userdel \
|
||||
usermod
|
||||
|
||||
@@ -173,6 +173,8 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CMOCKA_CFLAGS = @CMOCKA_CFLAGS@
|
||||
CMOCKA_LIBS = @CMOCKA_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
@@ -206,9 +208,15 @@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBACL = @LIBACL@
|
||||
LIBADD_DL = @LIBADD_DL@
|
||||
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
|
||||
LIBADD_DLOPEN = @LIBADD_DLOPEN@
|
||||
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
|
||||
LIBATTR = @LIBATTR@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBCRACK = @LIBCRACK@
|
||||
LIBBSD = @LIBBSD@
|
||||
LIBBSD_CFLAGS = @LIBBSD_CFLAGS@
|
||||
LIBBSD_LIBS = @LIBBSD_LIBS@
|
||||
LIBCRYPT = @LIBCRYPT@
|
||||
LIBECONF = @LIBECONF@
|
||||
LIBICONV = @LIBICONV@
|
||||
@@ -224,6 +232,7 @@ LIBSUBID_ABI = @LIBSUBID_ABI@
|
||||
LIBSUBID_ABI_MAJOR = @LIBSUBID_ABI_MAJOR@
|
||||
LIBSUBID_ABI_MICRO = @LIBSUBID_ABI_MICRO@
|
||||
LIBSUBID_ABI_MINOR = @LIBSUBID_ABI_MINOR@
|
||||
LIBSYSTEMD = @LIBSYSTEMD@
|
||||
LIBTCB = @LIBTCB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
@@ -232,6 +241,8 @@ LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_DLLOADERS = @LT_DLLOADERS@
|
||||
LT_DLPREOPEN = @LT_DLPREOPEN@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
@@ -254,6 +265,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
@@ -325,15 +339,13 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
pamd_files = chfn chsh groupmems login passwd $(am__append_2)
|
||||
pamd_files = chpasswd chfn chsh groupmems login newusers passwd \
|
||||
$(am__append_2)
|
||||
pamd_acct_tools_files = \
|
||||
chage \
|
||||
chgpasswd \
|
||||
chpasswd \
|
||||
groupadd \
|
||||
groupdel \
|
||||
groupmod \
|
||||
newusers \
|
||||
useradd \
|
||||
userdel \
|
||||
usermod
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#%PAM-1.0
|
||||
auth sufficient pam_rootok.so
|
||||
account required pam_permit.so
|
||||
password include system-auth
|
||||
5
etc/shadow-maint/Makefile.am
Normal file
5
etc/shadow-maint/Makefile.am
Normal file
@@ -0,0 +1,5 @@
|
||||
shadowmaint_files = \
|
||||
groupdel-pre.d/01-kill_group_procs.sh \
|
||||
userdel-pre.d/01-kill_user_procs.sh
|
||||
|
||||
EXTRA_DIST = $(shadowmaint_files)
|
||||
508
etc/shadow-maint/Makefile.in
Normal file
508
etc/shadow-maint/Makefile.in
Normal file
@@ -0,0 +1,508 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = etc/shadow-maint
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CMOCKA_CFLAGS = @CMOCKA_CFLAGS@
|
||||
CMOCKA_LIBS = @CMOCKA_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
ECONF_CPPFLAGS = @ECONF_CPPFLAGS@
|
||||
EGREP = @EGREP@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
GROUP_NAME_MAX_LENGTH = @GROUP_NAME_MAX_LENGTH@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBACL = @LIBACL@
|
||||
LIBADD_DL = @LIBADD_DL@
|
||||
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
|
||||
LIBADD_DLOPEN = @LIBADD_DLOPEN@
|
||||
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
|
||||
LIBATTR = @LIBATTR@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBBSD = @LIBBSD@
|
||||
LIBBSD_CFLAGS = @LIBBSD_CFLAGS@
|
||||
LIBBSD_LIBS = @LIBBSD_LIBS@
|
||||
LIBCRYPT = @LIBCRYPT@
|
||||
LIBECONF = @LIBECONF@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBMD = @LIBMD@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPAM = @LIBPAM@
|
||||
LIBS = @LIBS@
|
||||
LIBSELINUX = @LIBSELINUX@
|
||||
LIBSEMANAGE = @LIBSEMANAGE@
|
||||
LIBSKEY = @LIBSKEY@
|
||||
LIBSUBID_ABI = @LIBSUBID_ABI@
|
||||
LIBSUBID_ABI_MAJOR = @LIBSUBID_ABI_MAJOR@
|
||||
LIBSUBID_ABI_MICRO = @LIBSUBID_ABI_MICRO@
|
||||
LIBSUBID_ABI_MINOR = @LIBSUBID_ABI_MINOR@
|
||||
LIBSYSTEMD = @LIBSYSTEMD@
|
||||
LIBTCB = @LIBTCB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LIYESCRYPT = @LIYESCRYPT@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_DLLOADERS = @LT_DLLOADERS@
|
||||
LT_DLPREOPEN = @LT_DLPREOPEN@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VENDORDIR = @VENDORDIR@
|
||||
VERSION = @VERSION@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMLCATALOG = @XMLCATALOG@
|
||||
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
||||
XSLTPROC = @XSLTPROC@
|
||||
YACC = @YACC@
|
||||
YFLAGS = @YFLAGS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
capcmd = @capcmd@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
shadowmaint_files = \
|
||||
groupdel-pre.d/01-kill_group_procs.sh \
|
||||
userdel-pre.d/01-kill_user_procs.sh
|
||||
|
||||
EXTRA_DIST = $(shadowmaint_files)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign etc/shadow-maint/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign etc/shadow-maint/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
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)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
tags TAGS:
|
||||
|
||||
ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
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)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
cscopelist-am ctags-am distclean distclean-generic \
|
||||
distclean-libtool 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
26
etc/shadow-maint/groupdel-pre.d/01-kill_group_procs.sh
Normal file
26
etc/shadow-maint/groupdel-pre.d/01-kill_group_procs.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
GROUPID=`awk -F: '$1 == "'"${SUBJECT}"'" { print $3 }' /etc/group`
|
||||
|
||||
if [ "${GROUPID}" = "" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for status in /proc/*/status; do
|
||||
# either this isn't a process or its already dead since expanding the list
|
||||
[ -f "$status" ] || continue
|
||||
|
||||
tbuf=${status%/status}
|
||||
pid=${tbuf#/proc/}
|
||||
case "$pid" in
|
||||
"$$") continue;;
|
||||
[0-9]*) :;;
|
||||
*) continue
|
||||
esac
|
||||
|
||||
grep -q '^Groups:.*\b'"${GROUPID}"'\b.*' "/proc/$pid/status" || continue
|
||||
|
||||
kill -9 "$pid" || echo "cannot kill $pid" 1>&2
|
||||
done
|
||||
|
||||
31
etc/shadow-maint/userdel-pre.d/01-kill_user_procs.sh
Executable file
31
etc/shadow-maint/userdel-pre.d/01-kill_user_procs.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
# Check user exists, and if so, send sigkill to processes that the user owns
|
||||
|
||||
ps -eo user >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
RUNNING=`ps -eo user | grep -Fx "$SUBJECT" | wc -l`
|
||||
# if the user does not exist, RUNNING will be 0
|
||||
if [ "${RUNNING}x" = "0x" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# If there is no ps -eo, traverse the process directly.
|
||||
|
||||
ls -1 /proc | while IFS= read -r PROC; do
|
||||
echo "$PROC" | grep -E '^[0-9]+$' >/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -d "/proc/${PROC}" ]; then
|
||||
USR=`stat -c "%U" /proc/${PROC}`
|
||||
if [ "${USR}" = "${SUBJECT}" ]; then
|
||||
echo "Killing ${SUBJECT} owned ${PROC}"
|
||||
kill -9 "${PROC}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
239
lib/Makefile.am
239
lib/Makefile.am
@@ -5,73 +5,283 @@ DEFS =
|
||||
|
||||
noinst_LTLIBRARIES = libshadow.la
|
||||
|
||||
if USE_PAM
|
||||
LIBCRYPT_PAM = $(LIBCRYPT)
|
||||
else
|
||||
LIBCRYPT_PAM =
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir) $(ECONF_CPPFLAGS)
|
||||
|
||||
libshadow_la_CPPFLAGS = $(ECONF_CPPFLAGS)
|
||||
if HAVE_VENDORDIR
|
||||
libshadow_la_CPPFLAGS += -DVENDORDIR=\"$(VENDORDIR)\"
|
||||
endif
|
||||
|
||||
libshadow_la_CPPFLAGS += -I$(top_srcdir)
|
||||
libshadow_la_CFLAGS = $(LIBBSD_CFLAGS) $(LIBCRYPT_PAM) $(LIBSYSTEMD)
|
||||
libshadow_la_LIBADD = $(LIBADD_DLOPEN)
|
||||
|
||||
libshadow_la_SOURCES = \
|
||||
addgrps.c \
|
||||
adds.c \
|
||||
adds.h \
|
||||
age.c \
|
||||
agetpass.c \
|
||||
agetpass.h \
|
||||
alloc/calloc.c \
|
||||
alloc/calloc.h \
|
||||
alloc/malloc.c \
|
||||
alloc/malloc.h \
|
||||
alloc/realloc.c \
|
||||
alloc/realloc.h \
|
||||
alloc/reallocf.c \
|
||||
alloc/reallocf.h \
|
||||
alloc/x/xcalloc.c \
|
||||
alloc/x/xcalloc.h \
|
||||
alloc/x/xmalloc.c \
|
||||
alloc/x/xmalloc.h \
|
||||
alloc/x/xrealloc.c \
|
||||
alloc/x/xrealloc.h \
|
||||
atoi/a2i/a2i.c \
|
||||
atoi/a2i/a2i.h \
|
||||
atoi/a2i/a2s.c \
|
||||
atoi/a2i/a2s.h \
|
||||
atoi/a2i/a2s_c.c \
|
||||
atoi/a2i/a2s_c.h \
|
||||
atoi/a2i/a2s_nc.c \
|
||||
atoi/a2i/a2s_nc.h \
|
||||
atoi/a2i/a2u.c \
|
||||
atoi/a2i/a2u.h \
|
||||
atoi/a2i/a2u_c.c \
|
||||
atoi/a2i/a2u_c.h \
|
||||
atoi/a2i/a2u_nc.c \
|
||||
atoi/a2i/a2u_nc.h \
|
||||
atoi/getnum.c \
|
||||
atoi/getnum.h \
|
||||
atoi/str2i/str2i.c \
|
||||
atoi/str2i/str2i.h \
|
||||
atoi/str2i/str2s.c \
|
||||
atoi/str2i/str2s.h \
|
||||
atoi/str2i/str2u.c \
|
||||
atoi/str2i/str2u.h \
|
||||
atoi/strtoi/strtoi.c \
|
||||
atoi/strtoi/strtoi.h \
|
||||
atoi/strtoi/strtou.c \
|
||||
atoi/strtoi/strtou.h \
|
||||
atoi/strtoi/strtou_noneg.c \
|
||||
atoi/strtoi/strtou_noneg.h \
|
||||
attr.h \
|
||||
audit_help.c \
|
||||
basename.c \
|
||||
bit.c \
|
||||
bit.h \
|
||||
cast.h \
|
||||
chkname.c \
|
||||
chkname.h \
|
||||
chowndir.c \
|
||||
chowntty.c \
|
||||
cleanup.c \
|
||||
cleanup_group.c \
|
||||
cleanup_user.c \
|
||||
commonio.c \
|
||||
commonio.h \
|
||||
console.c \
|
||||
copydir.c \
|
||||
csrand.c \
|
||||
defines.h \
|
||||
encrypt.c \
|
||||
env.c \
|
||||
exitcodes.h \
|
||||
faillog.h \
|
||||
failure.c \
|
||||
failure.h \
|
||||
fd.c \
|
||||
fields.c \
|
||||
find_new_gid.c \
|
||||
find_new_uid.c \
|
||||
find_new_sub_gids.c \
|
||||
find_new_sub_uids.c \
|
||||
fputsx.c \
|
||||
fs/readlink/areadlink.c \
|
||||
fs/readlink/areadlink.h \
|
||||
fs/readlink/readlinknul.c \
|
||||
fs/readlink/readlinknul.h \
|
||||
get_pid.c \
|
||||
getdate.h \
|
||||
getdate.y \
|
||||
getdef.c \
|
||||
getdef.h \
|
||||
get_gid.c \
|
||||
getlong.c \
|
||||
get_pid.c \
|
||||
get_uid.c \
|
||||
getulong.c \
|
||||
getgr_nam_gid.c \
|
||||
getrange.c \
|
||||
gettime.c \
|
||||
groupio.c \
|
||||
groupmem.c \
|
||||
groupio.h \
|
||||
gshadow.c \
|
||||
hushed.c \
|
||||
idmapping.h \
|
||||
idmapping.c \
|
||||
isexpired.c \
|
||||
limits.c \
|
||||
list.c \
|
||||
lockpw.c \
|
||||
loginprompt.c \
|
||||
mail.c \
|
||||
motd.c \
|
||||
must_be.h \
|
||||
myname.c \
|
||||
nss.c \
|
||||
nscd.c \
|
||||
nscd.h \
|
||||
shadowlog.c \
|
||||
shadowlog.h \
|
||||
shadowlog_internal.h \
|
||||
sssd.c \
|
||||
sssd.h \
|
||||
obscure.c \
|
||||
pam_defs.h \
|
||||
pam_pass.c \
|
||||
pam_pass_non_interactive.c \
|
||||
port.c \
|
||||
port.h \
|
||||
prefix_flag.c \
|
||||
prototypes.h \
|
||||
pwauth.c \
|
||||
pwauth.h \
|
||||
pwio.c \
|
||||
pwio.h \
|
||||
pwd_init.c \
|
||||
pwd2spwd.c \
|
||||
pwdcheck.c \
|
||||
pwmem.c \
|
||||
remove_tree.c \
|
||||
root_flag.c \
|
||||
run_part.h \
|
||||
run_part.c \
|
||||
subordinateio.h \
|
||||
subordinateio.c \
|
||||
salt.c \
|
||||
search/cmp/cmp.c \
|
||||
search/cmp/cmp.h \
|
||||
search/l/lfind.c \
|
||||
search/l/lfind.h \
|
||||
search/l/lsearch.c \
|
||||
search/l/lsearch.h \
|
||||
search/sort/qsort.c \
|
||||
search/sort/qsort.h \
|
||||
selinux.c \
|
||||
semanage.c \
|
||||
setugid.c \
|
||||
setupenv.c \
|
||||
sgetgrent.c \
|
||||
sgetpwent.c \
|
||||
sgetspent.c \
|
||||
sgroupio.c \
|
||||
sgroupio.h\
|
||||
shadow.c \
|
||||
shadow/grp/agetgroups.c \
|
||||
shadow/grp/agetgroups.h \
|
||||
shadowio.c \
|
||||
shadowio.h \
|
||||
shadowlog.c \
|
||||
shadowlog.h \
|
||||
shadowlog_internal.h \
|
||||
shadowmem.c \
|
||||
shell.c \
|
||||
sizeof.h \
|
||||
spawn.c \
|
||||
utent.c
|
||||
sssd.c \
|
||||
sssd.h \
|
||||
string/ctype/strisascii/strisdigit.c \
|
||||
string/ctype/strisascii/strisdigit.h \
|
||||
string/memset/memzero.c \
|
||||
string/memset/memzero.h \
|
||||
string/sprintf/snprintf.c \
|
||||
string/sprintf/snprintf.h \
|
||||
string/sprintf/stpeprintf.c \
|
||||
string/sprintf/stpeprintf.h \
|
||||
string/sprintf/xasprintf.c \
|
||||
string/sprintf/xasprintf.h \
|
||||
string/strchr/strchrcnt.c \
|
||||
string/strchr/strchrcnt.h \
|
||||
string/strchr/strchrscnt.c \
|
||||
string/strchr/strchrscnt.h \
|
||||
string/strchr/strnul.c \
|
||||
string/strchr/strnul.h \
|
||||
string/strcmp/strcaseeq.c \
|
||||
string/strcmp/strcaseeq.h \
|
||||
string/strcmp/streq.c \
|
||||
string/strcmp/streq.h \
|
||||
string/strcpy/stpecpy.c \
|
||||
string/strcpy/stpecpy.h \
|
||||
string/strcpy/strncat.c \
|
||||
string/strcpy/strncat.h \
|
||||
string/strcpy/strncpy.c \
|
||||
string/strcpy/strncpy.h \
|
||||
string/strcpy/strtcpy.c \
|
||||
string/strcpy/strtcpy.h \
|
||||
string/strdup/strndupa.c \
|
||||
string/strdup/strndupa.h \
|
||||
string/strdup/xstrdup.c \
|
||||
string/strdup/xstrdup.h \
|
||||
string/strdup/xstrndup.c \
|
||||
string/strdup/xstrndup.h \
|
||||
string/strftime.c \
|
||||
string/strftime.h \
|
||||
string/strspn/stpspn.c \
|
||||
string/strspn/stpspn.h \
|
||||
string/strspn/stprcspn.c \
|
||||
string/strspn/stprcspn.h \
|
||||
string/strspn/stprspn.c \
|
||||
string/strspn/stprspn.h \
|
||||
string/strspn/strrcspn.c \
|
||||
string/strspn/strrcspn.h \
|
||||
string/strspn/strrspn.c \
|
||||
string/strspn/strrspn.h \
|
||||
string/strtok/stpsep.c \
|
||||
string/strtok/stpsep.h \
|
||||
strtoday.c \
|
||||
sub.c \
|
||||
subordinateio.h \
|
||||
subordinateio.c \
|
||||
sulog.c \
|
||||
time/day_to_str.c \
|
||||
time/day_to_str.h \
|
||||
ttytype.c \
|
||||
typetraits.h \
|
||||
tz.c \
|
||||
ulimit.c \
|
||||
user_busy.c \
|
||||
valid.c \
|
||||
write_full.c \
|
||||
xgetpwnam.c \
|
||||
xprefix_getpwnam.c \
|
||||
xgetpwuid.c \
|
||||
xgetgrnam.c \
|
||||
xgetgrgid.c \
|
||||
xgetspnam.c \
|
||||
yesno.c
|
||||
|
||||
if WITH_TCB
|
||||
libshadow_la_SOURCES += tcbfuncs.c tcbfuncs.h
|
||||
endif
|
||||
|
||||
if WITH_BTRFS
|
||||
libshadow_la_SOURCES += btrfs.c
|
||||
endif
|
||||
|
||||
if ENABLE_LASTLOG
|
||||
libshadow_la_SOURCES += log.c
|
||||
endif
|
||||
|
||||
if ENABLE_LOGIND
|
||||
libshadow_la_SOURCES += logind.c
|
||||
else
|
||||
libshadow_la_SOURCES += utmp.c
|
||||
endif
|
||||
|
||||
if !WITH_LIBBSD
|
||||
libshadow_la_SOURCES += \
|
||||
freezero.h \
|
||||
freezero.c \
|
||||
readpassphrase.h \
|
||||
readpassphrase.c
|
||||
endif
|
||||
|
||||
# These files are unneeded for some reason, listed in
|
||||
# order of appearance:
|
||||
#
|
||||
@@ -79,4 +289,5 @@ endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
.indent.pro \
|
||||
gshadow_.h
|
||||
gshadow_.h \
|
||||
xgetXXbyYY.c
|
||||
|
||||
2262
lib/Makefile.in
2262
lib/Makefile.in
File diff suppressed because it is too large
Load Diff
81
lib/addgrps.c
Normal file
81
lib/addgrps.c
Normal file
@@ -0,0 +1,81 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined(USE_PAM)
|
||||
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <grp.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "alloc/reallocf.h"
|
||||
#include "search/l/lsearch.h"
|
||||
#include "shadow/grp/agetgroups.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/strchr/strchrscnt.h"
|
||||
|
||||
|
||||
/*
|
||||
* Add groups with names from LIST (separated by commas or colons)
|
||||
* to the supplementary group set. Silently ignore groups which are
|
||||
* already there.
|
||||
*/
|
||||
int
|
||||
add_groups(const char *list)
|
||||
{
|
||||
char *g, *p, *dup;
|
||||
FILE *shadow_logfd = log_get_logfd();
|
||||
gid_t *gids;
|
||||
size_t n;
|
||||
|
||||
gids = agetgroups(&n);
|
||||
if (gids == NULL)
|
||||
return -1;
|
||||
|
||||
gids = REALLOCF(gids, n + strchrscnt(list, ",:") + 1, gid_t);
|
||||
if (gids == NULL)
|
||||
return -1;
|
||||
|
||||
p = dup = strdup(list);
|
||||
if (dup == NULL)
|
||||
goto free_gids;
|
||||
|
||||
while (NULL != (g = strsep(&p, ",:"))) {
|
||||
struct group *grp;
|
||||
|
||||
grp = getgrnam(g); /* local, no need for xgetgrnam */
|
||||
if (NULL == grp) {
|
||||
fprintf(shadow_logfd, _("Warning: unknown group %s\n"), g);
|
||||
continue;
|
||||
}
|
||||
|
||||
LSEARCH(&grp->gr_gid, gids, &n);
|
||||
}
|
||||
free(dup);
|
||||
|
||||
if (setgroups(n, gids) == -1) {
|
||||
fprintf(shadow_logfd, "setgroups: %s\n", strerror(errno));
|
||||
goto free_gids;
|
||||
}
|
||||
|
||||
free(gids);
|
||||
return 0;
|
||||
|
||||
free_gids:
|
||||
free(gids);
|
||||
return -1;
|
||||
}
|
||||
#else /* !USE_PAM */
|
||||
extern int ISO_C_forbids_an_empty_translation_unit;
|
||||
#endif /* !USE_PAM */
|
||||
13
lib/adds.c
Normal file
13
lib/adds.c
Normal file
@@ -0,0 +1,13 @@
|
||||
// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "adds.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
extern inline long addsl2(long a, long b);
|
||||
extern inline long addslN(size_t n, long addend[n]);
|
||||
70
lib/adds.h
Normal file
70
lib/adds.h
Normal file
@@ -0,0 +1,70 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ADDS_H_
|
||||
#define SHADOW_INCLUDE_LIB_ADDS_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "search/sort/qsort.h"
|
||||
#include "sizeof.h"
|
||||
|
||||
|
||||
#define addsl(a, b, ...) \
|
||||
({ \
|
||||
long addend_[] = {a, b, __VA_ARGS__}; \
|
||||
\
|
||||
addslN(NITEMS(addend_), addend_); \
|
||||
})
|
||||
|
||||
|
||||
inline long addsl2(long a, long b);
|
||||
inline long addslN(size_t n, long addend[n]);
|
||||
|
||||
|
||||
inline long
|
||||
addsl2(long a, long b)
|
||||
{
|
||||
if (a > 0 && b > LONG_MAX - a) {
|
||||
errno = EOVERFLOW;
|
||||
return LONG_MAX;
|
||||
}
|
||||
if (a < 0 && b < LONG_MIN - a) {
|
||||
errno = EOVERFLOW;
|
||||
return LONG_MIN;
|
||||
}
|
||||
return a + b;
|
||||
}
|
||||
|
||||
|
||||
inline long
|
||||
addslN(size_t n, long addend[n])
|
||||
{
|
||||
int e;
|
||||
|
||||
if (n == 0) {
|
||||
errno = EDOM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
e = errno;
|
||||
while (n > 1) {
|
||||
QSORT(addend, n);
|
||||
|
||||
errno = 0;
|
||||
addend[0] = addsl2(addend[0], addend[--n]);
|
||||
if (errno == EOVERFLOW)
|
||||
return addend[0];
|
||||
}
|
||||
errno = e;
|
||||
return addend[0];
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
@@ -13,12 +13,15 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
#include "exitcodes.h"
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
||||
#include "adds.h"
|
||||
#include "defines.h"
|
||||
#include "exitcodes.h"
|
||||
#include "prototypes.h"
|
||||
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
#ifndef PASSWD_PROGRAM
|
||||
@@ -103,7 +106,7 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp)
|
||||
* passwd to work just like it would had they executed
|
||||
* it from the command line while logged in.
|
||||
*/
|
||||
#if defined(HAVE_INITGROUPS) && ! defined(USE_PAM)
|
||||
#if !defined(USE_PAM)
|
||||
if (setup_uid_gid (pw, false) != 0)
|
||||
#else
|
||||
if (setup_uid_gid (pw) != 0)
|
||||
@@ -112,7 +115,7 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp)
|
||||
_exit (126);
|
||||
}
|
||||
|
||||
(void) execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) 0);
|
||||
(void) execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) NULL);
|
||||
err = errno;
|
||||
perror ("Can't execute " PASSWD_PROGRAM);
|
||||
_exit ((ENOENT == err) ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
|
||||
@@ -139,7 +142,7 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp)
|
||||
|
||||
void agecheck (/*@null@*/const struct spwd *sp)
|
||||
{
|
||||
long now = (long) time ((time_t *) 0) / SCALE;
|
||||
long now = time(NULL) / DAY;
|
||||
long remain;
|
||||
|
||||
if (NULL == sp) {
|
||||
@@ -162,9 +165,9 @@ void agecheck (/*@null@*/const struct spwd *sp)
|
||||
return;
|
||||
}
|
||||
|
||||
remain = sp->sp_lstchg + sp->sp_max - now;
|
||||
remain = addsl(sp->sp_lstchg, sp->sp_max, -now);
|
||||
|
||||
if (remain <= sp->sp_warn) {
|
||||
remain /= DAY / SCALE;
|
||||
if (remain > 1) {
|
||||
(void) printf (_("Your password will expire in %ld days.\n"),
|
||||
remain);
|
||||
145
lib/agetpass.c
Normal file
145
lib/agetpass.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022, Alejandro Colomar <alx@kernel.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "agetpass.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <readpassphrase.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
#include "alloc/malloc.h"
|
||||
|
||||
#if WITH_LIBBSD == 0
|
||||
#include "freezero.h"
|
||||
#endif /* WITH_LIBBSD */
|
||||
|
||||
|
||||
/*
|
||||
* SYNOPSIS
|
||||
* [[gnu::malloc(erase_pass)]]
|
||||
* char *agetpass(const char *prompt);
|
||||
* char *agetpass_stdin();
|
||||
*
|
||||
* void erase_pass(char *pass);
|
||||
*
|
||||
* ARGUMENTS
|
||||
* agetpass()
|
||||
* prompt String to be printed before reading a password.
|
||||
*
|
||||
* erase_pass()
|
||||
* pass password previously returned by agetpass().
|
||||
*
|
||||
* DESCRIPTION
|
||||
* agetpass()
|
||||
* This function is very similar to getpass(3). It has several
|
||||
* advantages compared to getpass(3):
|
||||
*
|
||||
* - Instead of using a static buffer, agetpass() allocates memory
|
||||
* through malloc(3). This makes the function thread-safe, and
|
||||
* also reduces the visibility of the buffer.
|
||||
*
|
||||
* - agetpass() doesn't reallocate internally. Some
|
||||
* implementations of getpass(3), such as glibc, do that, as a
|
||||
* consequence of calling getline(3). That's a bug in glibc,
|
||||
* which allows leaking prefixes of passwords in freed memory.
|
||||
*
|
||||
* - agetpass() doesn't overrun the output buffer. If the input
|
||||
* password is too long, it simply fails. Some implementations
|
||||
* of getpass(3), share the same bug that gets(3) has.
|
||||
*
|
||||
* As soon as possible, the password obtained from agetpass() be
|
||||
* erased by calling erase_pass(), to avoid possibly leaking the
|
||||
* password.
|
||||
*
|
||||
* agetpass_stdin()
|
||||
* This function is the same as previous one (agetpass). Just the
|
||||
* password is read from stdin and terminal is not required.
|
||||
*
|
||||
* erase_pass()
|
||||
* This function first clears the password, by calling
|
||||
* explicit_bzero(3) (or an equivalent call), and then frees the
|
||||
* allocated memory by calling free(3).
|
||||
*
|
||||
* NULL is a valid input pointer, and in such a case, this call is
|
||||
* a no-op.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* agetpass() returns a newly allocated buffer containing the
|
||||
* password on success. On error, errno is set to indicate the
|
||||
* error, and NULL is returned.
|
||||
*
|
||||
* ERRORS
|
||||
* agetpass()
|
||||
* This function may fail for any errors that malloc(3) or
|
||||
* readpassphrase(3) may fail, and in addition it may fail for the
|
||||
* following errors:
|
||||
*
|
||||
* ENOBUFS
|
||||
* The input password was longer than PASS_MAX.
|
||||
*
|
||||
* CAVEATS
|
||||
* If a password is passed twice to erase_pass(), the behavior is
|
||||
* undefined.
|
||||
*/
|
||||
|
||||
|
||||
static char *
|
||||
agetpass_internal(const char *prompt, int flags)
|
||||
{
|
||||
char *pass;
|
||||
size_t len;
|
||||
|
||||
/*
|
||||
* Since we want to support passwords upto PASS_MAX, we need
|
||||
* PASS_MAX bytes for the password itself, and one more byte for
|
||||
* the terminating '\0'. We also want to detect truncation, and
|
||||
* readpassphrase(3) doesn't detect it, so we need some trick.
|
||||
* Let's add one more byte, and if the password uses it, it
|
||||
* means the introduced password was longer than PASS_MAX.
|
||||
*/
|
||||
pass = MALLOC(PASS_MAX + 2, char);
|
||||
if (pass == NULL)
|
||||
return NULL;
|
||||
|
||||
if (readpassphrase(prompt, pass, PASS_MAX + 2, flags) == NULL)
|
||||
goto fail;
|
||||
|
||||
len = strlen(pass);
|
||||
if (len == PASS_MAX + 1) {
|
||||
errno = ENOBUFS;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return pass;
|
||||
|
||||
fail:
|
||||
freezero(pass, PASS_MAX + 2);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
agetpass(const char *prompt)
|
||||
{
|
||||
return agetpass_internal(prompt, RPP_REQUIRE_TTY);
|
||||
}
|
||||
|
||||
char *
|
||||
agetpass_stdin()
|
||||
{
|
||||
return agetpass_internal(NULL, RPP_STDIN);
|
||||
}
|
||||
|
||||
void
|
||||
erase_pass(char *pass)
|
||||
{
|
||||
freezero(pass, PASS_MAX + 2);
|
||||
}
|
||||
23
lib/agetpass.h
Normal file
23
lib/agetpass.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023, Alejandro Colomar <alx@kernel.org>
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_AGETPASS_H_
|
||||
#define SHADOW_INCLUDE_LIB_AGETPASS_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "attr.h"
|
||||
#include "defines.h"
|
||||
|
||||
|
||||
void erase_pass(char *pass);
|
||||
ATTR_MALLOC(erase_pass)
|
||||
char *agetpass(const char *prompt);
|
||||
char *agetpass_stdin();
|
||||
|
||||
|
||||
#endif // include guard
|
||||
11
lib/alloc/calloc.c
Normal file
11
lib/alloc/calloc.c
Normal file
@@ -0,0 +1,11 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "alloc/calloc.h"
|
||||
20
lib/alloc/calloc.h
Normal file
20
lib/alloc/calloc.h
Normal file
@@ -0,0 +1,20 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ALLOC_CALLOC_H_
|
||||
#define SHADOW_INCLUDE_LIB_ALLOC_CALLOC_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#define CALLOC(n, type) \
|
||||
( \
|
||||
(type *) calloc(n, sizeof(type)) \
|
||||
)
|
||||
|
||||
|
||||
#endif // include guard
|
||||
16
lib/alloc/malloc.c
Normal file
16
lib/alloc/malloc.c
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "alloc/malloc.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
extern inline void *mallocarray(size_t nmemb, size_t size);
|
||||
34
lib/alloc/malloc.h
Normal file
34
lib/alloc/malloc.h
Normal file
@@ -0,0 +1,34 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ALLOC_MALLOC_H_
|
||||
#define SHADOW_INCLUDE_LIB_ALLOC_MALLOC_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
#define MALLOC(n, type) \
|
||||
( \
|
||||
(type *) mallocarray(n, sizeof(type)) \
|
||||
)
|
||||
|
||||
|
||||
ATTR_ALLOC_SIZE(1, 2)
|
||||
ATTR_MALLOC(free)
|
||||
inline void *mallocarray(size_t nmemb, size_t size);
|
||||
|
||||
|
||||
inline void *
|
||||
mallocarray(size_t nmemb, size_t size)
|
||||
{
|
||||
return reallocarray(NULL, nmemb, size);
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
11
lib/alloc/realloc.c
Normal file
11
lib/alloc/realloc.c
Normal file
@@ -0,0 +1,11 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "alloc/realloc.h"
|
||||
20
lib/alloc/realloc.h
Normal file
20
lib/alloc/realloc.h
Normal file
@@ -0,0 +1,20 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ALLOC_REALLOC_H_
|
||||
#define SHADOW_INCLUDE_LIB_ALLOC_REALLOC_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#define REALLOC(p, n, type) \
|
||||
( \
|
||||
_Generic(p, type *: (type *) reallocarray(p, (n) ?: 1, sizeof(type))) \
|
||||
)
|
||||
|
||||
|
||||
#endif // include guard
|
||||
16
lib/alloc/reallocf.c
Normal file
16
lib/alloc/reallocf.c
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "alloc/reallocf.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
extern inline void *reallocarrayf(void *p, size_t nmemb, size_t size);
|
||||
41
lib/alloc/reallocf.h
Normal file
41
lib/alloc/reallocf.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ALLOC_REALLOCF_H_
|
||||
#define SHADOW_INCLUDE_LIB_ALLOC_REALLOCF_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
#define REALLOCF(p, n, type) \
|
||||
( \
|
||||
_Generic(p, type *: (type *) reallocarrayf(p, (n) ?: 1, sizeof(type)))\
|
||||
)
|
||||
|
||||
|
||||
ATTR_ALLOC_SIZE(2, 3)
|
||||
ATTR_MALLOC(free)
|
||||
inline void *reallocarrayf(void *p, size_t nmemb, size_t size);
|
||||
|
||||
|
||||
inline void *
|
||||
reallocarrayf(void *p, size_t nmemb, size_t size)
|
||||
{
|
||||
void *q;
|
||||
|
||||
q = reallocarray(p, nmemb ?: 1, size ?: 1);
|
||||
|
||||
if (q == NULL)
|
||||
free(p);
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
36
lib/alloc/x/xcalloc.c
Normal file
36
lib/alloc/x/xcalloc.c
Normal file
@@ -0,0 +1,36 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "alloc/x/xcalloc.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "defines.h"
|
||||
#include "shadowlog.h"
|
||||
|
||||
|
||||
void *
|
||||
xcalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = calloc(nmemb, size);
|
||||
if (p == NULL)
|
||||
goto x;
|
||||
|
||||
return p;
|
||||
|
||||
x:
|
||||
fprintf(log_get_logfd(), _("%s: %s\n"),
|
||||
log_get_progname(), strerror(errno));
|
||||
exit(13);
|
||||
}
|
||||
28
lib/alloc/x/xcalloc.h
Normal file
28
lib/alloc/x/xcalloc.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ALLOC_X_XCALLOC_H_
|
||||
#define SHADOW_INCLUDE_LIB_ALLOC_X_XCALLOC_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
#define XCALLOC(n, type) \
|
||||
( \
|
||||
(type *) xcalloc(n, sizeof(type)) \
|
||||
)
|
||||
|
||||
|
||||
ATTR_ALLOC_SIZE(1, 2)
|
||||
ATTR_MALLOC(free)
|
||||
void *xcalloc(size_t nmemb, size_t size);
|
||||
|
||||
|
||||
#endif // include guard
|
||||
16
lib/alloc/x/xmalloc.c
Normal file
16
lib/alloc/x/xmalloc.c
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "alloc/x/xmalloc.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
extern inline void *xmallocarray(size_t nmemb, size_t size);
|
||||
35
lib/alloc/x/xmalloc.h
Normal file
35
lib/alloc/x/xmalloc.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ALLOC_X_XMALLOC_H_
|
||||
#define SHADOW_INCLUDE_LIB_ALLOC_X_XMALLOC_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "alloc/x/xrealloc.h"
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
#define XMALLOC(n, type) \
|
||||
( \
|
||||
(type *) xmallocarray(n, sizeof(type)) \
|
||||
)
|
||||
|
||||
|
||||
ATTR_ALLOC_SIZE(1, 2)
|
||||
ATTR_MALLOC(free)
|
||||
inline void *xmallocarray(size_t nmemb, size_t size);
|
||||
|
||||
|
||||
inline void *
|
||||
xmallocarray(size_t nmemb, size_t size)
|
||||
{
|
||||
return xreallocarray(NULL, nmemb, size);
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
35
lib/alloc/x/xrealloc.c
Normal file
35
lib/alloc/x/xrealloc.c
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "alloc/x/xrealloc.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alloc/reallocf.h"
|
||||
#include "defines.h"
|
||||
#include "shadowlog.h"
|
||||
|
||||
|
||||
void *
|
||||
xreallocarray(void *p, size_t nmemb, size_t size)
|
||||
{
|
||||
p = reallocarrayf(p, nmemb, size);
|
||||
if (p == NULL)
|
||||
goto x;
|
||||
|
||||
return p;
|
||||
|
||||
x:
|
||||
fprintf(log_get_logfd(), _("%s: %s\n"),
|
||||
log_get_progname(), strerror(errno));
|
||||
exit(13);
|
||||
}
|
||||
31
lib/alloc/x/xrealloc.h
Normal file
31
lib/alloc/x/xrealloc.h
Normal file
@@ -0,0 +1,31 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_MALLOC_H_
|
||||
#define SHADOW_INCLUDE_LIB_MALLOC_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
#define XREALLOC(ptr, n, type) \
|
||||
( \
|
||||
_Generic(ptr, type *: (type *) xreallocarray(ptr, n, sizeof(type))) \
|
||||
)
|
||||
|
||||
|
||||
ATTR_ALLOC_SIZE(2, 3)
|
||||
ATTR_MALLOC(free)
|
||||
void *xreallocarray(void *p, size_t nmemb, size_t size);
|
||||
|
||||
|
||||
#endif // include guard
|
||||
7
lib/atoi/a2i/a2i.c
Normal file
7
lib/atoi/a2i/a2i.c
Normal file
@@ -0,0 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2i.h"
|
||||
62
lib/atoi/a2i/a2i.h
Normal file
62
lib/atoi/a2i/a2i.h
Normal file
@@ -0,0 +1,62 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2I_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2I_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2s_c.h"
|
||||
#include "atoi/a2i/a2s_nc.h"
|
||||
#include "atoi/a2i/a2u_c.h"
|
||||
#include "atoi/a2i/a2u_nc.h"
|
||||
|
||||
|
||||
/*
|
||||
* See the manual of these macros in liba2i's documentation:
|
||||
* <http://www.alejandro-colomar.es/share/dist/liba2i/git/HEAD/liba2i-HEAD.pdf>
|
||||
*/
|
||||
|
||||
|
||||
#define a2i(TYPE, n, s, ...) \
|
||||
( \
|
||||
_Generic((void (*)(TYPE, typeof(s))) 0, \
|
||||
void (*)(short, const char *): a2sh_c, \
|
||||
void (*)(short, const void *): a2sh_c, \
|
||||
void (*)(short, char *): a2sh_nc, \
|
||||
void (*)(short, void *): a2sh_nc, \
|
||||
void (*)(int, const char *): a2si_c, \
|
||||
void (*)(int, const void *): a2si_c, \
|
||||
void (*)(int, char *): a2si_nc, \
|
||||
void (*)(int, void *): a2si_nc, \
|
||||
void (*)(long, const char *): a2sl_c, \
|
||||
void (*)(long, const void *): a2sl_c, \
|
||||
void (*)(long, char *): a2sl_nc, \
|
||||
void (*)(long, void *): a2sl_nc, \
|
||||
void (*)(long long, const char *): a2sll_c, \
|
||||
void (*)(long long, const void *): a2sll_c, \
|
||||
void (*)(long long, char *): a2sll_nc, \
|
||||
void (*)(long long, void *): a2sll_nc, \
|
||||
void (*)(unsigned short, const char *): a2uh_c, \
|
||||
void (*)(unsigned short, const void *): a2uh_c, \
|
||||
void (*)(unsigned short, char *): a2uh_nc, \
|
||||
void (*)(unsigned short, void *): a2uh_nc, \
|
||||
void (*)(unsigned int, const char *): a2ui_c, \
|
||||
void (*)(unsigned int, const void *): a2ui_c, \
|
||||
void (*)(unsigned int, char *): a2ui_nc, \
|
||||
void (*)(unsigned int, void *): a2ui_nc, \
|
||||
void (*)(unsigned long, const char *): a2ul_c, \
|
||||
void (*)(unsigned long, const void *): a2ul_c, \
|
||||
void (*)(unsigned long, char *): a2ul_nc, \
|
||||
void (*)(unsigned long, void *): a2ul_nc, \
|
||||
void (*)(unsigned long long, const char *): a2ull_c, \
|
||||
void (*)(unsigned long long, const void *): a2ull_c, \
|
||||
void (*)(unsigned long long, char *): a2ull_nc, \
|
||||
void (*)(unsigned long long, void *): a2ull_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
|
||||
#endif // include guard
|
||||
7
lib/atoi/a2i/a2s.c
Normal file
7
lib/atoi/a2i/a2s.c
Normal file
@@ -0,0 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2s.h"
|
||||
56
lib/atoi/a2i/a2s.h
Normal file
56
lib/atoi/a2i/a2s.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2s_c.h"
|
||||
#include "atoi/a2i/a2s_nc.h"
|
||||
|
||||
|
||||
#define a2sh(n, s, ...) \
|
||||
( \
|
||||
_Generic(s, \
|
||||
const char *: a2sh_c, \
|
||||
const void *: a2sh_c, \
|
||||
char *: a2sh_nc, \
|
||||
void *: a2sh_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
#define a2si(n, s, ...) \
|
||||
( \
|
||||
_Generic(s, \
|
||||
const char *: a2si_c, \
|
||||
const void *: a2si_c, \
|
||||
char *: a2si_nc, \
|
||||
void *: a2si_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
#define a2sl(n, s, ...) \
|
||||
( \
|
||||
_Generic(s, \
|
||||
const char *: a2sl_c, \
|
||||
const void *: a2sl_c, \
|
||||
char *: a2sl_nc, \
|
||||
void *: a2sl_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
#define a2sll(n, s, ...) \
|
||||
( \
|
||||
_Generic(s, \
|
||||
const char *: a2sll_c, \
|
||||
const void *: a2sll_c, \
|
||||
char *: a2sll_nc, \
|
||||
void *: a2sll_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
|
||||
#endif // include guard
|
||||
17
lib/atoi/a2i/a2s_c.c
Normal file
17
lib/atoi/a2i/a2s_c.c
Normal file
@@ -0,0 +1,17 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2s_c.h"
|
||||
|
||||
|
||||
extern inline int a2sh_c(short *restrict n, const char *s,
|
||||
const char **restrict endp, int base, short min, short max);
|
||||
extern inline int a2si_c(int *restrict n, const char *s,
|
||||
const char **restrict endp, int base, int min, int max);
|
||||
extern inline int a2sl_c(long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, long min, long max);
|
||||
extern inline int a2sll_c(long long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, long long min, long long max);
|
||||
64
lib/atoi/a2i/a2s_c.h
Normal file
64
lib/atoi/a2i/a2s_c.h
Normal file
@@ -0,0 +1,64 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_C_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_C_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "atoi/a2i/a2s_nc.h"
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2sh_c(short *restrict n, const char *s,
|
||||
const char **restrict endp, int base, short min, short max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2si_c(int *restrict n, const char *s,
|
||||
const char **restrict endp, int base, int min, int max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2sl_c(long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, long min, long max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2sll_c(long long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, long long min, long long max);
|
||||
|
||||
|
||||
inline int
|
||||
a2sh_c(short *restrict n, const char *s,
|
||||
const char **restrict endp, int base, short min, short max)
|
||||
{
|
||||
return a2sh_nc(n, (char *) s, (char **) endp, base, min, max);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2si_c(int *restrict n, const char *s,
|
||||
const char **restrict endp, int base, int min, int max)
|
||||
{
|
||||
return a2si_nc(n, (char *) s, (char **) endp, base, min, max);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2sl_c(long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, long min, long max)
|
||||
{
|
||||
return a2sl_nc(n, (char *) s, (char **) endp, base, min, max);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2sll_c(long long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, long long min, long long max)
|
||||
{
|
||||
return a2sll_nc(n, (char *) s, (char **) endp, base, min, max);
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
17
lib/atoi/a2i/a2s_nc.c
Normal file
17
lib/atoi/a2i/a2s_nc.c
Normal file
@@ -0,0 +1,17 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2s_nc.h"
|
||||
|
||||
|
||||
extern inline int a2sh_nc(short *restrict n, char *s,
|
||||
char **restrict endp, int base, short min, short max);
|
||||
extern inline int a2si_nc(int *restrict n, char *s,
|
||||
char **restrict endp, int base, int min, int max);
|
||||
extern inline int a2sl_nc(long *restrict n, char *s,
|
||||
char **restrict endp, int base, long min, long max);
|
||||
extern inline int a2sll_nc(long long *restrict n, char *s,
|
||||
char **restrict endp, int base, long long min, long long max);
|
||||
91
lib/atoi/a2i/a2s_nc.h
Normal file
91
lib/atoi/a2i/a2s_nc.h
Normal file
@@ -0,0 +1,91 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_NC_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_NC_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "atoi/strtoi/strtoi.h"
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2sh_nc(short *restrict n, char *s,
|
||||
char **restrict endp, int base, short min, short max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2si_nc(int *restrict n, char *s,
|
||||
char **restrict endp, int base, int min, int max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2sl_nc(long *restrict n, char *s,
|
||||
char **restrict endp, int base, long min, long max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2sll_nc(long long *restrict n, char *s,
|
||||
char **restrict endp, int base, long long min, long long max);
|
||||
|
||||
|
||||
inline int
|
||||
a2sh_nc(short *restrict n, char *s,
|
||||
char **restrict endp, int base, short min, short max)
|
||||
{
|
||||
int status;
|
||||
|
||||
*n = strtoi_(s, endp, base, min, max, &status);
|
||||
if (status != 0) {
|
||||
errno = status;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2si_nc(int *restrict n, char *s,
|
||||
char **restrict endp, int base, int min, int max)
|
||||
{
|
||||
int status;
|
||||
|
||||
*n = strtoi_(s, endp, base, min, max, &status);
|
||||
if (status != 0) {
|
||||
errno = status;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2sl_nc(long *restrict n, char *s,
|
||||
char **restrict endp, int base, long min, long max)
|
||||
{
|
||||
int status;
|
||||
|
||||
*n = strtoi_(s, endp, base, min, max, &status);
|
||||
if (status != 0) {
|
||||
errno = status;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2sll_nc(long long *restrict n, char *s,
|
||||
char **restrict endp, int base, long long min, long long max)
|
||||
{
|
||||
int status;
|
||||
|
||||
*n = strtoi_(s, endp, base, min, max, &status);
|
||||
if (status != 0) {
|
||||
errno = status;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
7
lib/atoi/a2i/a2u.c
Normal file
7
lib/atoi/a2i/a2u.c
Normal file
@@ -0,0 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2u.h"
|
||||
56
lib/atoi/a2i/a2u.h
Normal file
56
lib/atoi/a2i/a2u.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2u_c.h"
|
||||
#include "atoi/a2i/a2u_nc.h"
|
||||
|
||||
|
||||
#define a2uh(n, s, ...) \
|
||||
( \
|
||||
_Generic(s, \
|
||||
const char *: a2uh_c, \
|
||||
const void *: a2uh_c, \
|
||||
char *: a2uh_nc, \
|
||||
void *: a2uh_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
#define a2ui(n, s, ...) \
|
||||
( \
|
||||
_Generic(s, \
|
||||
const char *: a2ui_c, \
|
||||
const void *: a2ui_c, \
|
||||
char *: a2ui_nc, \
|
||||
void *: a2ui_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
#define a2ul(n, s, ...) \
|
||||
( \
|
||||
_Generic(s, \
|
||||
const char *: a2ul_c, \
|
||||
const void *: a2ul_c, \
|
||||
char *: a2ul_nc, \
|
||||
void *: a2ul_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
#define a2ull(n, s, ...) \
|
||||
( \
|
||||
_Generic(s, \
|
||||
const char *: a2ull_c, \
|
||||
const void *: a2ull_c, \
|
||||
char *: a2ull_nc, \
|
||||
void *: a2ull_nc \
|
||||
)(n, s, __VA_ARGS__) \
|
||||
)
|
||||
|
||||
|
||||
#endif // include guard
|
||||
19
lib/atoi/a2i/a2u_c.c
Normal file
19
lib/atoi/a2i/a2u_c.c
Normal file
@@ -0,0 +1,19 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2u_c.h"
|
||||
|
||||
|
||||
extern inline int a2uh_c(unsigned short *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned short min,
|
||||
unsigned short max);
|
||||
extern inline int a2ui_c(unsigned int *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned int min, unsigned int max);
|
||||
extern inline int a2ul_c(unsigned long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned long min, unsigned long max);
|
||||
extern inline int a2ull_c(unsigned long long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned long long min,
|
||||
unsigned long long max);
|
||||
65
lib/atoi/a2i/a2u_c.h
Normal file
65
lib/atoi/a2i/a2u_c.h
Normal file
@@ -0,0 +1,65 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_C_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_C_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2u_nc.h"
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2uh_c(unsigned short *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned short min,
|
||||
unsigned short max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2ui_c(unsigned int *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned int min, unsigned int max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2ul_c(unsigned long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned long min, unsigned long max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2ull_c(unsigned long long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned long long min,
|
||||
unsigned long long max);
|
||||
|
||||
|
||||
inline int
|
||||
a2uh_c(unsigned short *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned short min,
|
||||
unsigned short max)
|
||||
{
|
||||
return a2uh_nc(n, (char *) s, (char **) endp, base, min, max);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2ui_c(unsigned int *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned int min, unsigned int max)
|
||||
{
|
||||
return a2ui_nc(n, (char *) s, (char **) endp, base, min, max);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2ul_c(unsigned long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned long min, unsigned long max)
|
||||
{
|
||||
return a2ul_nc(n, (char *) s, (char **) endp, base, min, max);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2ull_c(unsigned long long *restrict n, const char *s,
|
||||
const char **restrict endp, int base, unsigned long long min,
|
||||
unsigned long long max)
|
||||
{
|
||||
return a2ull_nc(n, (char *) s, (char **) endp, base, min, max);
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
18
lib/atoi/a2i/a2u_nc.c
Normal file
18
lib/atoi/a2i/a2u_nc.c
Normal file
@@ -0,0 +1,18 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/a2i/a2u_nc.h"
|
||||
|
||||
|
||||
extern inline int a2uh_nc(unsigned short *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned short min, unsigned short max);
|
||||
extern inline int a2ui_nc(unsigned int *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned int min, unsigned int max);
|
||||
extern inline int a2ul_nc(unsigned long *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned long min, unsigned long max);
|
||||
extern inline int a2ull_nc(unsigned long long *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned long long min,
|
||||
unsigned long long max);
|
||||
94
lib/atoi/a2i/a2u_nc.h
Normal file
94
lib/atoi/a2i/a2u_nc.h
Normal file
@@ -0,0 +1,94 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_NC_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_NC_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "atoi/strtoi/strtou_noneg.h"
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2uh_nc(unsigned short *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned short min, unsigned short max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2ui_nc(unsigned int *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned int min, unsigned int max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2ul_nc(unsigned long *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned long min, unsigned long max);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
|
||||
inline int a2ull_nc(unsigned long long *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned long long min,
|
||||
unsigned long long max);
|
||||
|
||||
|
||||
inline int
|
||||
a2uh_nc(unsigned short *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned short min,
|
||||
unsigned short max)
|
||||
{
|
||||
int status;
|
||||
|
||||
*n = strtou_noneg(s, endp, base, min, max, &status);
|
||||
if (status != 0) {
|
||||
errno = status;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2ui_nc(unsigned int *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned int min, unsigned int max)
|
||||
{
|
||||
int status;
|
||||
|
||||
*n = strtou_noneg(s, endp, base, min, max, &status);
|
||||
if (status != 0) {
|
||||
errno = status;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2ul_nc(unsigned long *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned long min, unsigned long max)
|
||||
{
|
||||
int status;
|
||||
|
||||
*n = strtou_noneg(s, endp, base, min, max, &status);
|
||||
if (status != 0) {
|
||||
errno = status;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
a2ull_nc(unsigned long long *restrict n, char *s,
|
||||
char **restrict endp, int base, unsigned long long min,
|
||||
unsigned long long max)
|
||||
{
|
||||
int status;
|
||||
|
||||
*n = strtou_noneg(s, endp, base, min, max, &status);
|
||||
if (status != 0) {
|
||||
errno = status;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
16
lib/atoi/getnum.c
Normal file
16
lib/atoi/getnum.c
Normal file
@@ -0,0 +1,16 @@
|
||||
// SPDX-FileCopyrightText: 2009, Nicolas François
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "atoi/getnum.h"
|
||||
|
||||
|
||||
extern inline int get_fd(const char *restrict fdstr, int *restrict fd);
|
||||
extern inline int get_gid(const char *restrict gidstr, gid_t *restrict gid);
|
||||
extern inline int get_pid(const char *restrict pidstr, pid_t *restrict pid);
|
||||
extern inline int get_uid(const char *restrict uidstr, uid_t *restrict uid);
|
||||
60
lib/atoi/getnum.h
Normal file
60
lib/atoi/getnum.h
Normal file
@@ -0,0 +1,60 @@
|
||||
// SPDX-FileCopyrightText: 2009, Nicolas François
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_GETNUM_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_GETNUM_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "atoi/a2i/a2i.h"
|
||||
#include "atoi/a2i/a2s.h"
|
||||
#include "attr.h"
|
||||
#include "typetraits.h"
|
||||
|
||||
|
||||
ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
|
||||
inline int get_fd(const char *restrict fdstr, int *restrict fd);
|
||||
ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
|
||||
inline int get_gid(const char *restrict gidstr, gid_t *restrict gid);
|
||||
ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
|
||||
inline int get_pid(const char *restrict pidstr, pid_t *restrict pid);
|
||||
ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
|
||||
inline int get_uid(const char *restrict uidstr, uid_t *restrict uid);
|
||||
|
||||
|
||||
inline int
|
||||
get_fd(const char *restrict fdstr, int *restrict fd)
|
||||
{
|
||||
return a2si(fd, fdstr, NULL, 10, 0, INT_MAX);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
get_gid(const char *restrict gidstr, gid_t *restrict gid)
|
||||
{
|
||||
return a2i(gid_t, gid, gidstr, NULL, 10, type_min(gid_t), type_max(gid_t));
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
get_pid(const char *restrict pidstr, pid_t *restrict pid)
|
||||
{
|
||||
return a2i(pid_t, pid, pidstr, NULL, 10, 1, type_max(pid_t));
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
get_uid(const char *restrict uidstr, uid_t *restrict uid)
|
||||
{
|
||||
return a2i(uid_t, uid, uidstr, NULL, 10, type_min(uid_t), type_max(uid_t));
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
8
lib/atoi/str2i/str2i.c
Normal file
8
lib/atoi/str2i/str2i.c
Normal file
@@ -0,0 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/str2i/str2i.h"
|
||||
31
lib/atoi/str2i/str2i.h
Normal file
31
lib/atoi/str2i/str2i.h
Normal file
@@ -0,0 +1,31 @@
|
||||
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2I_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2I_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/str2i/str2s.h"
|
||||
#include "atoi/str2i/str2u.h"
|
||||
|
||||
|
||||
#define str2i(TYPE, ...) \
|
||||
( \
|
||||
_Generic((TYPE) 0, \
|
||||
short: str2sh, \
|
||||
int: str2si, \
|
||||
long: str2sl, \
|
||||
long long: str2sll, \
|
||||
unsigned short: str2uh, \
|
||||
unsigned int: str2ui, \
|
||||
unsigned long: str2ul, \
|
||||
unsigned long long: str2ull \
|
||||
)(__VA_ARGS__) \
|
||||
)
|
||||
|
||||
|
||||
#endif // include guard
|
||||
14
lib/atoi/str2i/str2s.c
Normal file
14
lib/atoi/str2i/str2s.c
Normal file
@@ -0,0 +1,14 @@
|
||||
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/str2i/str2s.h"
|
||||
|
||||
|
||||
extern inline int str2sh(short *restrict n, const char *restrict s);
|
||||
extern inline int str2si(int *restrict n, const char *restrict s);
|
||||
extern inline int str2sl(long *restrict n, const char *restrict s);
|
||||
extern inline int str2sll(long long *restrict n, const char *restrict s);
|
||||
57
lib/atoi/str2i/str2s.h
Normal file
57
lib/atoi/str2i/str2s.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2S_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2S_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "atoi/a2i/a2s.h"
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
||||
inline int str2sh(short *restrict n, const char *restrict s);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
||||
inline int str2si(int *restrict n, const char *restrict s);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
||||
inline int str2sl(long *restrict n, const char *restrict s);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
||||
inline int str2sll(long long *restrict n, const char *restrict s);
|
||||
|
||||
|
||||
inline int
|
||||
str2sh(short *restrict n, const char *restrict s)
|
||||
{
|
||||
return a2sh(n, s, NULL, 0, SHRT_MIN, SHRT_MAX);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
str2si(int *restrict n, const char *restrict s)
|
||||
{
|
||||
return a2si(n, s, NULL, 0, INT_MIN, INT_MAX);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
str2sl(long *restrict n, const char *restrict s)
|
||||
{
|
||||
return a2sl(n, s, NULL, 0, LONG_MIN, LONG_MAX);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
str2sll(long long *restrict n, const char *restrict s)
|
||||
{
|
||||
return a2sll(n, s, NULL, 0, LLONG_MIN, LLONG_MAX);
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
14
lib/atoi/str2i/str2u.c
Normal file
14
lib/atoi/str2i/str2u.c
Normal file
@@ -0,0 +1,14 @@
|
||||
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/str2i/str2u.h"
|
||||
|
||||
|
||||
extern inline int str2uh(unsigned short *restrict n, const char *restrict s);
|
||||
extern inline int str2ui(unsigned int *restrict n, const char *restrict s);
|
||||
extern inline int str2ul(unsigned long *restrict n, const char *restrict s);
|
||||
extern inline int str2ull(unsigned long long *restrict n, const char *restrict s);
|
||||
57
lib/atoi/str2i/str2u.h
Normal file
57
lib/atoi/str2i/str2u.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2U_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2U_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "atoi/a2i/a2u.h"
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
||||
inline int str2uh(unsigned short *restrict n, const char *restrict s);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
||||
inline int str2ui(unsigned int *restrict n, const char *restrict s);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
||||
inline int str2ul(unsigned long *restrict n, const char *restrict s);
|
||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
||||
inline int str2ull(unsigned long long *restrict n, const char *restrict s);
|
||||
|
||||
|
||||
inline int
|
||||
str2uh(unsigned short *restrict n, const char *restrict s)
|
||||
{
|
||||
return a2uh(n, s, NULL, 0, 0, USHRT_MAX);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
str2ui(unsigned int *restrict n, const char *restrict s)
|
||||
{
|
||||
return a2ui(n, s, NULL, 0, 0, UINT_MAX);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
str2ul(unsigned long *restrict n, const char *restrict s)
|
||||
{
|
||||
return a2ul(n, s, NULL, 0, 0, ULONG_MAX);
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
str2ull(unsigned long long *restrict n, const char *restrict s)
|
||||
{
|
||||
return a2ull(n, s, NULL, 0, 0, ULLONG_MAX);
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
13
lib/atoi/strtoi/strtoi.c
Normal file
13
lib/atoi/strtoi/strtoi.c
Normal file
@@ -0,0 +1,13 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/strtoi/strtoi.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
extern inline intmax_t strtoi_(const char *s, char **restrict endp, int base,
|
||||
intmax_t min, intmax_t max, int *restrict status);
|
||||
64
lib/atoi/strtoi/strtoi.h
Normal file
64
lib/atoi/strtoi/strtoi.h
Normal file
@@ -0,0 +1,64 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOI_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOI_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(1) ATTR_ACCESS(write_only, 2) ATTR_ACCESS(write_only, 6)
|
||||
inline intmax_t strtoi_(const char *s, char **restrict endp, int base,
|
||||
intmax_t min, intmax_t max, int *restrict status);
|
||||
|
||||
|
||||
inline intmax_t
|
||||
strtoi_(const char *s, char **restrict endp, int base,
|
||||
intmax_t min, intmax_t max, int *restrict status)
|
||||
{
|
||||
int e, st;
|
||||
char *end;
|
||||
intmax_t n;
|
||||
|
||||
if (endp == NULL)
|
||||
endp = &end;
|
||||
if (status == NULL)
|
||||
status = &st;
|
||||
|
||||
if (base != 0 && (base < 2 || base > 36)) {
|
||||
*status = EINVAL;
|
||||
return MAX(min, MIN(max, 0));
|
||||
}
|
||||
|
||||
e = errno;
|
||||
errno = 0;
|
||||
|
||||
n = strtoimax(s, endp, base);
|
||||
|
||||
if (*endp == s)
|
||||
*status = ECANCELED;
|
||||
else if (errno == ERANGE || n < min || n > max)
|
||||
*status = ERANGE;
|
||||
else if (**endp != '\0')
|
||||
*status = ENOTSUP;
|
||||
else
|
||||
*status = 0;
|
||||
|
||||
errno = e;
|
||||
|
||||
return MAX(min, MIN(max, n));
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
13
lib/atoi/strtoi/strtou.c
Normal file
13
lib/atoi/strtoi/strtou.c
Normal file
@@ -0,0 +1,13 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/strtoi/strtou.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
extern inline uintmax_t strtou_(const char *s, char **restrict endp, int base,
|
||||
uintmax_t min, uintmax_t max, int *restrict status);
|
||||
64
lib/atoi/strtoi/strtou.h
Normal file
64
lib/atoi/strtoi/strtou.h
Normal file
@@ -0,0 +1,64 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(1) ATTR_ACCESS(write_only, 2) ATTR_ACCESS(write_only, 6)
|
||||
inline uintmax_t strtou_(const char *s, char **restrict endp, int base,
|
||||
uintmax_t min, uintmax_t max, int *restrict status);
|
||||
|
||||
|
||||
inline uintmax_t
|
||||
strtou_(const char *s, char **restrict endp, int base,
|
||||
uintmax_t min, uintmax_t max, int *restrict status)
|
||||
{
|
||||
int e, st;
|
||||
char *end;
|
||||
uintmax_t n;
|
||||
|
||||
if (endp == NULL)
|
||||
endp = &end;
|
||||
if (status == NULL)
|
||||
status = &st;
|
||||
|
||||
if (base != 0 && (base < 2 || base > 36)) {
|
||||
*status = EINVAL;
|
||||
return MAX(min, 0);
|
||||
}
|
||||
|
||||
e = errno;
|
||||
errno = 0;
|
||||
|
||||
n = strtoumax(s, endp, base);
|
||||
|
||||
if (*endp == s)
|
||||
*status = ECANCELED;
|
||||
else if (errno == ERANGE || n < min || n > max)
|
||||
*status = ERANGE;
|
||||
else if (**endp != '\0')
|
||||
*status = ENOTSUP;
|
||||
else
|
||||
*status = 0;
|
||||
|
||||
errno = e;
|
||||
|
||||
return MAX(min, MIN(max, n));
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
13
lib/atoi/strtoi/strtou_noneg.c
Normal file
13
lib/atoi/strtoi/strtou_noneg.c
Normal file
@@ -0,0 +1,13 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "atoi/strtoi/strtou_noneg.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
extern inline uintmax_t strtou_noneg(const char *s, char **restrict endp,
|
||||
int base, uintmax_t min, uintmax_t max, int *restrict status);
|
||||
40
lib/atoi/strtoi/strtou_noneg.h
Normal file
40
lib/atoi/strtoi/strtou_noneg.h
Normal file
@@ -0,0 +1,40 @@
|
||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_NONEG_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_NONEG_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "atoi/strtoi/strtoi.h"
|
||||
#include "atoi/strtoi/strtou.h"
|
||||
#include "attr.h"
|
||||
|
||||
|
||||
ATTR_STRING(1) ATTR_ACCESS(write_only, 2) ATTR_ACCESS(write_only, 6)
|
||||
inline uintmax_t strtou_noneg(const char *s, char **restrict endp,
|
||||
int base, uintmax_t min, uintmax_t max, int *restrict status);
|
||||
|
||||
|
||||
inline uintmax_t
|
||||
strtou_noneg(const char *s, char **restrict endp, int base,
|
||||
uintmax_t min, uintmax_t max, int *restrict status)
|
||||
{
|
||||
int st;
|
||||
|
||||
if (status == NULL)
|
||||
status = &st;
|
||||
if (strtoi_(s, endp, base, 0, 1, status) == 0 && *status == ERANGE)
|
||||
return min;
|
||||
|
||||
return strtou_(s, endp, base, min, max, status);
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
35
lib/attr.h
Normal file
35
lib/attr.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef SHADOW_INCLUDE_LIB_ATTR_H_
|
||||
#define SHADOW_INCLUDE_LIB_ATTR_H_
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#if (__GNUC__ >= 10)
|
||||
# define MAYBE_UNUSED [[gnu::unused]]
|
||||
# define NORETURN [[gnu::__noreturn__]]
|
||||
# define format_attr(type, fmt, va) [[gnu::format(type, fmt, va)]]
|
||||
# define ATTR_ACCESS(...) [[gnu::access(__VA_ARGS__)]]
|
||||
# define ATTR_ALLOC_SIZE(...) [[gnu::alloc_size(__VA_ARGS__)]]
|
||||
#else
|
||||
# define MAYBE_UNUSED
|
||||
# define NORETURN
|
||||
# define format_attr(type, fmt, va)
|
||||
# define ATTR_ACCESS(...)
|
||||
# define ATTR_ALLOC_SIZE(...)
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ >= 11) && !defined(__clang__)
|
||||
# define ATTR_MALLOC(deallocator) [[gnu::malloc(deallocator)]]
|
||||
#else
|
||||
# define ATTR_MALLOC(deallocator)
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ >= 14)
|
||||
# define ATTR_STRING(i) [[gnu::null_terminated_string_arg(i)]]
|
||||
#else
|
||||
# define ATTR_STRING(i)
|
||||
#endif
|
||||
|
||||
|
||||
#endif // include guard
|
||||
136
lib/audit_help.c
Normal file
136
lib/audit_help.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2005 , Red Hat, Inc.
|
||||
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* Audit helper functions used throughout shadow
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef WITH_AUDIT
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <stdarg.h>
|
||||
#include <libaudit.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "attr.h"
|
||||
#include "prototypes.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/snprintf.h"
|
||||
|
||||
int audit_fd;
|
||||
|
||||
void audit_help_open (void)
|
||||
{
|
||||
audit_fd = audit_open ();
|
||||
if (audit_fd < 0) {
|
||||
/* You get these only when the kernel doesn't have
|
||||
* audit compiled in. */
|
||||
if ( (errno == EINVAL)
|
||||
|| (errno == EPROTONOSUPPORT)
|
||||
|| (errno == EAFNOSUPPORT)) {
|
||||
return;
|
||||
}
|
||||
(void) fputs (_("Cannot open audit interface - aborting.\n"),
|
||||
log_get_logfd());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will log a message to the audit system using a predefined
|
||||
* message format. For additional information on the user account lifecycle
|
||||
* events check
|
||||
* <https://github.com/linux-audit/audit-documentation/wiki/SPEC-User-Account-Lifecycle-Events>
|
||||
*
|
||||
* Parameter usage is as follows:
|
||||
*
|
||||
* type - type of message. A list of possible values is available in
|
||||
* "audit-records.h" file.
|
||||
* pgname - program's name
|
||||
* op - operation. "adding user", "changing finger info", "deleting group"
|
||||
* name - user's account or group name. If not available use NULL.
|
||||
* id - uid or gid that the operation is being performed on. This is used
|
||||
* only when user is NULL.
|
||||
*/
|
||||
void audit_logger (int type, MAYBE_UNUSED const char *pgname, const char *op,
|
||||
const char *name, unsigned int id,
|
||||
shadow_audit_result result)
|
||||
{
|
||||
if (audit_fd < 0) {
|
||||
return;
|
||||
} else {
|
||||
audit_log_acct_message (audit_fd, type, NULL, op, name, id,
|
||||
NULL, NULL, NULL, result);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will log a message to the audit system using a predefined
|
||||
* message format. For additional information on the group account lifecycle
|
||||
* events check
|
||||
* <https://github.com/linux-audit/audit-documentation/wiki/SPEC-User-Account-Lifecycle-Events>
|
||||
*
|
||||
* Parameter usage is as follows:
|
||||
*
|
||||
* type - type of message. A list of possible values is available in
|
||||
* "audit-records.h" file.
|
||||
* op - operation. "adding-user", "modify-group", "deleting-user-from-group"
|
||||
* name - user's account or group name. If not available use NULL.
|
||||
* id - uid or gid that the operation is being performed on. This is used
|
||||
* only when user is NULL.
|
||||
* grp_type - type of group: "grp" or "new_group"
|
||||
* grp - group name associated with event
|
||||
*/
|
||||
void
|
||||
audit_logger_with_group(int type, const char *op, const char *name,
|
||||
id_t id, const char *grp_type, const char *grp,
|
||||
shadow_audit_result result)
|
||||
{
|
||||
int len;
|
||||
char enc_group[GROUP_NAME_MAX_LENGTH * 2 + 1];
|
||||
char buf[NITEMS(enc_group) + 100];
|
||||
|
||||
if (audit_fd < 0)
|
||||
return;
|
||||
|
||||
len = strnlen(grp, sizeof(enc_group)/2);
|
||||
if (audit_value_needs_encoding(grp, len)) {
|
||||
SNPRINTF(buf, "%s %s=%s", op, grp_type,
|
||||
audit_encode_value(enc_group, grp, len));
|
||||
} else {
|
||||
SNPRINTF(buf, "%s %s=\"%s\"", op, grp_type, grp);
|
||||
}
|
||||
|
||||
audit_log_acct_message(audit_fd, type, NULL, buf, name, id,
|
||||
NULL, NULL, NULL, result);
|
||||
}
|
||||
|
||||
void audit_logger_message (const char *message, shadow_audit_result result)
|
||||
{
|
||||
if (audit_fd < 0) {
|
||||
return;
|
||||
} else {
|
||||
audit_log_user_message (audit_fd,
|
||||
AUDIT_USYS_CONFIG,
|
||||
message,
|
||||
NULL, /* hostname */
|
||||
NULL, /* addr */
|
||||
NULL, /* tty */
|
||||
result);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* WITH_AUDIT */
|
||||
extern int ISO_C_forbids_an_empty_translation_unit;
|
||||
#endif /* WITH_AUDIT */
|
||||
|
||||
31
lib/basename.c
Normal file
31
lib/basename.c
Normal file
@@ -0,0 +1,31 @@
|
||||
// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
|
||||
// SPDX-FileCopyrightText: 1996-1997, Marek Michałkiewicz
|
||||
// SPDX-FileCopyrightText: 2003-2005, Tomasz Kłoczko
|
||||
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/*
|
||||
* basename.c - not worth copyrighting :-). Some versions of Linux libc
|
||||
* already have basename(), other versions don't. To avoid confusion,
|
||||
* we will not use the function from libc and use a different name here.
|
||||
* --marekm
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "prototypes.h"
|
||||
#include "string/strspn/stprcspn.h"
|
||||
|
||||
|
||||
/*@observer@*/const char *
|
||||
Basename(const char *str)
|
||||
{
|
||||
if (str == NULL) {
|
||||
abort ();
|
||||
}
|
||||
|
||||
return stprcspn(str, "/");
|
||||
}
|
||||
19
lib/bit.c
Normal file
19
lib/bit.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 - 2023, Alejandro Colomar <alx@kernel.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
#include "bit.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
extern inline unsigned long bit_ceilul(unsigned long x);
|
||||
extern inline unsigned long bit_ceil_wrapul(unsigned long x);
|
||||
extern inline int leading_zerosul(unsigned long x);
|
||||
53
lib/bit.h
Normal file
53
lib/bit.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 - 2023, Alejandro Colomar <alx@kernel.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_BIT_H_
|
||||
#define SHADOW_INCLUDE_LIB_BIT_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
#ifndef ULONG_WIDTH
|
||||
#define ULONG_WIDTH (sizeof(unsigned long) * CHAR_BIT)
|
||||
#endif
|
||||
|
||||
|
||||
inline unsigned long bit_ceilul(unsigned long x);
|
||||
inline unsigned long bit_ceil_wrapul(unsigned long x);
|
||||
inline int leading_zerosul(unsigned long x);
|
||||
|
||||
|
||||
/* stdc_bit_ceilul(3) */
|
||||
inline unsigned long
|
||||
bit_ceilul(unsigned long x)
|
||||
{
|
||||
return 1 + (ULONG_MAX >> leading_zerosul(x));
|
||||
}
|
||||
|
||||
|
||||
/* stdc_bit_ceilul(3), but wrap instead of having Undefined Behavior */
|
||||
inline unsigned long
|
||||
bit_ceil_wrapul(unsigned long x)
|
||||
{
|
||||
if (x == 0)
|
||||
return 0;
|
||||
|
||||
return bit_ceilul(x);
|
||||
}
|
||||
|
||||
/* stdc_leading_zerosul(3) */
|
||||
inline int
|
||||
leading_zerosul(unsigned long x)
|
||||
{
|
||||
return (x == 0) ? ULONG_WIDTH : __builtin_clzl(x);
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
@@ -39,7 +39,7 @@ static int run_btrfs_subvolume_cmd(const char *subcmd, const char *arg1, const c
|
||||
NULL
|
||||
};
|
||||
|
||||
if (access(cmd, X_OK)) {
|
||||
if (!cmd || access(cmd, X_OK)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
15
lib/cast.h
Normal file
15
lib/cast.h
Normal file
@@ -0,0 +1,15 @@
|
||||
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
#ifndef SHADOW_INCLUDE_LIB_CAST_H_
|
||||
#define SHADOW_INCLUDE_LIB_CAST_H_
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#define const_cast(T, p) _Generic(p, const T: (T) (p))
|
||||
|
||||
|
||||
#endif // include guard
|
||||
140
lib/chkname.c
Normal file
140
lib/chkname.c
Normal file
@@ -0,0 +1,140 @@
|
||||
// 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
|
||||
// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar <alx@kernel.org>
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
/*
|
||||
* is_valid_user_name(), is_valid_group_name() - check the new user/group
|
||||
* name for validity;
|
||||
* return values:
|
||||
* true - OK
|
||||
* false - bad name
|
||||
* errors:
|
||||
* EINVAL Invalid name characters or sequences
|
||||
* EOVERFLOW Name longer than maximum size
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ident "$Id$"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "defines.h"
|
||||
#include "chkname.h"
|
||||
#include "string/ctype/strisascii/strisdigit.h"
|
||||
#include "string/strcmp/streq.h"
|
||||
|
||||
|
||||
#ifndef LOGIN_NAME_MAX
|
||||
# define LOGIN_NAME_MAX 256
|
||||
#endif
|
||||
|
||||
|
||||
int allow_bad_names = false;
|
||||
|
||||
|
||||
size_t
|
||||
login_name_max_size(void)
|
||||
{
|
||||
long conf;
|
||||
|
||||
conf = sysconf(_SC_LOGIN_NAME_MAX);
|
||||
if (conf == -1)
|
||||
return LOGIN_NAME_MAX;
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
is_valid_name(const char *name)
|
||||
{
|
||||
if (allow_bad_names) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* User/group names must match BRE regex:
|
||||
* [a-zA-Z0-9_.][a-zA-Z0-9_.-]*$\?
|
||||
*
|
||||
* as a non-POSIX, extension, allow "$" as the last char for
|
||||
* sake of Samba 3.x "add machine script"
|
||||
*
|
||||
* Also do not allow fully numeric names or just "." or "..".
|
||||
*/
|
||||
|
||||
if (strisdigit(name)) {
|
||||
errno = EINVAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (streq(name, "") ||
|
||||
streq(name, ".") ||
|
||||
streq(name, "..") ||
|
||||
!((*name >= 'a' && *name <= 'z') ||
|
||||
(*name >= 'A' && *name <= 'Z') ||
|
||||
(*name >= '0' && *name <= '9') ||
|
||||
*name == '_' ||
|
||||
*name == '.'))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
while (!streq(++name, "")) {
|
||||
if (!((*name >= 'a' && *name <= 'z') ||
|
||||
(*name >= 'A' && *name <= 'Z') ||
|
||||
(*name >= '0' && *name <= '9') ||
|
||||
*name == '_' ||
|
||||
*name == '.' ||
|
||||
*name == '-' ||
|
||||
streq(name, "$")
|
||||
))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
is_valid_user_name(const char *name)
|
||||
{
|
||||
if (strlen(name) >= login_name_max_size()) {
|
||||
errno = EOVERFLOW;
|
||||
return false;
|
||||
}
|
||||
|
||||
return is_valid_name(name);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
is_valid_group_name(const char *name)
|
||||
{
|
||||
/*
|
||||
* Arbitrary limit for group names.
|
||||
* HP-UX 10 limits to 16 characters
|
||||
*/
|
||||
if ( (GROUP_NAME_MAX_LENGTH > 0)
|
||||
&& (strlen (name) > GROUP_NAME_MAX_LENGTH))
|
||||
{
|
||||
errno = EOVERFLOW;
|
||||
return false;
|
||||
}
|
||||
|
||||
return is_valid_name (name);
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
#ifndef _CHKNAME_H_
|
||||
#define _CHKNAME_H_
|
||||
|
||||
|
||||
/*
|
||||
* is_valid_user_name(), is_valid_group_name() - check the new user/group
|
||||
* name for validity;
|
||||
@@ -19,8 +20,14 @@
|
||||
* false - bad name
|
||||
*/
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
extern size_t login_name_max_size(void);
|
||||
extern bool is_valid_user_name (const char *name);
|
||||
extern bool is_valid_group_name (const char *name);
|
||||
|
||||
@@ -13,12 +13,15 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "defines.h"
|
||||
#include "prototypes.h"
|
||||
#include "string/strcmp/streq.h"
|
||||
|
||||
|
||||
static int chown_tree_at (int at_fd,
|
||||
const char *path,
|
||||
uid_t old_uid,
|
||||
@@ -56,8 +59,8 @@ static int chown_tree_at (int at_fd,
|
||||
/*
|
||||
* Skip the "." and ".." entries
|
||||
*/
|
||||
if ( (strcmp (ent->d_name, ".") == 0)
|
||||
|| (strcmp (ent->d_name, "..") == 0)) {
|
||||
if ( streq(ent->d_name, ".")
|
||||
|| streq(ent->d_name, "..")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,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)) {
|
||||
|| (fchmod (STDIN_FILENO, getdef_num ("TTYPERM", 0600)) != 0)) {
|
||||
int err = errno;
|
||||
FILE *shadow_logfd = log_get_logfd();
|
||||
|
||||
@@ -44,7 +44,7 @@ void do_cleanups (void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* Make sure there were no overflow */
|
||||
/* Make sure there were no overflows */
|
||||
assert (NULL == cleanup_functions[CLEANUP_FUNCTIONS-1]);
|
||||
|
||||
if (getpid () != cleanup_pid) {
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "attr.h"
|
||||
#include "defines.h"
|
||||
#include "groupio.h"
|
||||
#include "sgroupio.h"
|
||||
@@ -22,7 +23,7 @@
|
||||
*/
|
||||
void cleanup_report_add_group (void *group_name)
|
||||
{
|
||||
const char *name = (const char *)group_name;
|
||||
const char *name = group_name;
|
||||
|
||||
SYSLOG ((LOG_ERR, "failed to add group %s", name));
|
||||
#ifdef WITH_AUDIT
|
||||
@@ -40,7 +41,7 @@ void cleanup_report_add_group (void *group_name)
|
||||
*/
|
||||
void cleanup_report_del_group (void *group_name)
|
||||
{
|
||||
const char *name = (const char *)group_name;
|
||||
const char *name = group_name;
|
||||
|
||||
SYSLOG ((LOG_ERR, "failed to remove group %s", name));
|
||||
#ifdef WITH_AUDIT
|
||||
@@ -61,7 +62,7 @@ void cleanup_report_mod_group (void *cleanup_info)
|
||||
gr_dbname (),
|
||||
info->action));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
||||
audit_logger (AUDIT_GRP_MGMT, log_get_progname(),
|
||||
info->audit_msg,
|
||||
info->name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
@@ -79,7 +80,7 @@ void cleanup_report_mod_gshadow (void *cleanup_info)
|
||||
sgr_dbname (),
|
||||
info->action));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
||||
audit_logger (AUDIT_GRP_MGMT, log_get_progname(),
|
||||
info->audit_msg,
|
||||
info->name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
@@ -95,12 +96,12 @@ void cleanup_report_mod_gshadow (void *cleanup_info)
|
||||
*/
|
||||
void cleanup_report_add_group_group (void *group_name)
|
||||
{
|
||||
const char *name = (const char *)group_name;
|
||||
const char *name = group_name;
|
||||
|
||||
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||
"adding group to /etc/group",
|
||||
"adding-group",
|
||||
name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
@@ -115,12 +116,12 @@ void cleanup_report_add_group_group (void *group_name)
|
||||
*/
|
||||
void cleanup_report_add_group_gshadow (void *group_name)
|
||||
{
|
||||
const char *name = (const char *)group_name;
|
||||
const char *name = group_name;
|
||||
|
||||
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||
"adding group to /etc/gshadow",
|
||||
audit_logger (AUDIT_GRP_MGMT, log_get_progname(),
|
||||
"adding-shadow-group",
|
||||
name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
@@ -136,14 +137,14 @@ void cleanup_report_add_group_gshadow (void *group_name)
|
||||
*/
|
||||
void cleanup_report_del_group_group (void *group_name)
|
||||
{
|
||||
const char *name = (const char *)group_name;
|
||||
const char *name = group_name;
|
||||
|
||||
SYSLOG ((LOG_ERR,
|
||||
"failed to remove group %s from %s",
|
||||
name, gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||
"removing group from /etc/group",
|
||||
audit_logger (AUDIT_DEL_GROUP, log_get_progname(),
|
||||
"removing-group",
|
||||
name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
@@ -159,14 +160,14 @@ void cleanup_report_del_group_group (void *group_name)
|
||||
*/
|
||||
void cleanup_report_del_group_gshadow (void *group_name)
|
||||
{
|
||||
const char *name = (const char *)group_name;
|
||||
const char *name = group_name;
|
||||
|
||||
SYSLOG ((LOG_ERR,
|
||||
"failed to remove group %s from %s",
|
||||
name, sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||
"removing group from /etc/gshadow",
|
||||
audit_logger (AUDIT_GRP_MGMT, log_get_progname(),
|
||||
"removing-shadow-group",
|
||||
name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
@@ -178,7 +179,7 @@ void cleanup_report_del_group_gshadow (void *group_name)
|
||||
*
|
||||
* It should be registered after the group file is successfully locked.
|
||||
*/
|
||||
void cleanup_unlock_group (unused void *arg)
|
||||
void cleanup_unlock_group (MAYBE_UNUSED void *arg)
|
||||
{
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (log_get_logfd(),
|
||||
@@ -186,7 +187,7 @@ void cleanup_unlock_group (unused void *arg)
|
||||
log_get_progname(), gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger_message ("unlocking group file",
|
||||
audit_logger_message ("unlocking-group",
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
}
|
||||
@@ -198,7 +199,7 @@ void cleanup_unlock_group (unused void *arg)
|
||||
*
|
||||
* It should be registered after the gshadow file is successfully locked.
|
||||
*/
|
||||
void cleanup_unlock_gshadow (unused void *arg)
|
||||
void cleanup_unlock_gshadow (MAYBE_UNUSED void *arg)
|
||||
{
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (log_get_logfd(),
|
||||
@@ -206,7 +207,7 @@ void cleanup_unlock_gshadow (unused void *arg)
|
||||
log_get_progname(), sgr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger_message ("unlocking gshadow file",
|
||||
audit_logger_message ("unlocking-gshadow",
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "attr.h"
|
||||
#include "defines.h"
|
||||
#include "pwio.h"
|
||||
#include "shadowio.h"
|
||||
@@ -16,13 +17,13 @@
|
||||
#include "shadowlog.h"
|
||||
|
||||
/*
|
||||
* cleanup_report_add_user - Report failure to add an user to the system
|
||||
* cleanup_report_add_user - Report failure to add a user to the system
|
||||
*
|
||||
* It should be registered when it is decided to add an user to the system.
|
||||
* It should be registered when it is decided to add a user to the system.
|
||||
*/
|
||||
void cleanup_report_add_user (void *user_name)
|
||||
{
|
||||
const char *name = (const char *)user_name;
|
||||
const char *name = user_name;
|
||||
|
||||
SYSLOG ((LOG_ERR, "failed to add user %s", name));
|
||||
#ifdef WITH_AUDIT
|
||||
@@ -43,7 +44,7 @@ void cleanup_report_mod_passwd (void *cleanup_info)
|
||||
pw_dbname (),
|
||||
info->action));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
||||
audit_logger (AUDIT_USER_MGMT, log_get_progname(),
|
||||
info->audit_msg,
|
||||
info->name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
@@ -51,40 +52,40 @@ void cleanup_report_mod_passwd (void *cleanup_info)
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup_report_add_user_passwd - Report failure to add an user to
|
||||
* cleanup_report_add_user_passwd - Report failure to add a user to
|
||||
* /etc/passwd
|
||||
*
|
||||
* It should be registered when it is decided to add an user to the
|
||||
* It should be registered when it is decided to add a user to the
|
||||
* /etc/passwd database.
|
||||
*/
|
||||
void cleanup_report_add_user_passwd (void *user_name)
|
||||
{
|
||||
const char *name = (const char *)user_name;
|
||||
const char *name = user_name;
|
||||
|
||||
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, pw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, log_get_progname(),
|
||||
"adding user to /etc/passwd",
|
||||
"adding-user",
|
||||
name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup_report_add_user_shadow - Report failure to add an user to
|
||||
* cleanup_report_add_user_shadow - Report failure to add a user to
|
||||
* /etc/shadow
|
||||
*
|
||||
* It should be registered when it is decided to add an user to the
|
||||
* It should be registered when it is decided to add a user to the
|
||||
* /etc/shadow database.
|
||||
*/
|
||||
void cleanup_report_add_user_shadow (void *user_name)
|
||||
{
|
||||
const char *name = (const char *)user_name;
|
||||
const char *name = user_name;
|
||||
|
||||
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, spw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, log_get_progname(),
|
||||
"adding user to /etc/shadow",
|
||||
audit_logger (AUDIT_USER_MGMT, log_get_progname(),
|
||||
"adding-shadow-user",
|
||||
name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
@@ -95,7 +96,7 @@ void cleanup_report_add_user_shadow (void *user_name)
|
||||
*
|
||||
* It should be registered after the passwd database is successfully locked.
|
||||
*/
|
||||
void cleanup_unlock_passwd (unused void *arg)
|
||||
void cleanup_unlock_passwd (MAYBE_UNUSED void *arg)
|
||||
{
|
||||
if (pw_unlock () == 0) {
|
||||
fprintf (log_get_logfd(),
|
||||
@@ -103,7 +104,7 @@ void cleanup_unlock_passwd (unused void *arg)
|
||||
log_get_progname(), pw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger_message ("unlocking passwd file",
|
||||
audit_logger_message ("unlocking-passwd",
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
}
|
||||
@@ -114,7 +115,7 @@ void cleanup_unlock_passwd (unused void *arg)
|
||||
*
|
||||
* It should be registered after the shadow database is successfully locked.
|
||||
*/
|
||||
void cleanup_unlock_shadow (unused void *arg)
|
||||
void cleanup_unlock_shadow (MAYBE_UNUSED void *arg)
|
||||
{
|
||||
if (spw_unlock () == 0) {
|
||||
fprintf (log_get_logfd(),
|
||||
@@ -122,7 +123,7 @@ void cleanup_unlock_shadow (unused void *arg)
|
||||
log_get_progname(), spw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger_message ("unlocking shadow file",
|
||||
audit_logger_message ("unlocking-shadow",
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user