Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d5ab87d61 | |||
| a9c3448878 | |||
| a475f464e0 | |||
| 65261e28f4 | |||
| bd724b34e0 | |||
| c2a3ebed18 | |||
| f78a468368 |
+2
-4
@@ -1,14 +1,12 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
EXTRA_DIST = NEWS README
|
|
||||||
|
|
||||||
SUBDIRS = lib
|
SUBDIRS = lib
|
||||||
|
|
||||||
if ENABLE_SUBIDS
|
if ENABLE_SUBIDS
|
||||||
SUBDIRS += libsubid
|
SUBDIRS += libsubid
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SUBDIRS += src po contrib doc etc tests/unit
|
SUBDIRS += src po doc etc tests/unit
|
||||||
|
|
||||||
if ENABLE_REGENERATE_MAN
|
if ENABLE_REGENERATE_MAN
|
||||||
SUBDIRS += man
|
SUBDIRS += man
|
||||||
@@ -16,7 +14,7 @@ endif
|
|||||||
|
|
||||||
CLEANFILES = man/8.out man/po/remove-potcdate.* man/*/login.defs.d man/*/*.mo
|
CLEANFILES = man/8.out man/po/remove-potcdate.* man/*/login.defs.d man/*/*.mo
|
||||||
|
|
||||||
EXTRA_DIST = tests/
|
EXTRA_DIST = NEWS README tests/
|
||||||
|
|
||||||
dist-hook:
|
dist-hook:
|
||||||
chmod -R u+w $(distdir)/tests
|
chmod -R u+w $(distdir)/tests
|
||||||
|
|||||||
+3
-5
@@ -163,7 +163,7 @@ am__define_uniq_tagged_files = \
|
|||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | $(am__uniquify_input)`
|
done | $(am__uniquify_input)`
|
||||||
DIST_SUBDIRS = lib libsubid src po contrib doc etc tests/unit man
|
DIST_SUBDIRS = lib libsubid src po doc etc tests/unit man
|
||||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||||
$(top_srcdir)/man/po/Makefile.in ABOUT-NLS AUTHORS.md COPYING \
|
$(top_srcdir)/man/po/Makefile.in ABOUT-NLS AUTHORS.md COPYING \
|
||||||
ChangeLog NEWS README compile config.guess config.rpath \
|
ChangeLog NEWS README compile config.guess config.rpath \
|
||||||
@@ -334,8 +334,6 @@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
|||||||
XMLCATALOG = @XMLCATALOG@
|
XMLCATALOG = @XMLCATALOG@
|
||||||
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
||||||
XSLTPROC = @XSLTPROC@
|
XSLTPROC = @XSLTPROC@
|
||||||
YACC = @YACC@
|
|
||||||
YFLAGS = @YFLAGS@
|
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
abs_top_builddir = @abs_top_builddir@
|
abs_top_builddir = @abs_top_builddir@
|
||||||
@@ -390,10 +388,10 @@ target_alias = @target_alias@
|
|||||||
top_build_prefix = @top_build_prefix@
|
top_build_prefix = @top_build_prefix@
|
||||||
top_builddir = @top_builddir@
|
top_builddir = @top_builddir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
EXTRA_DIST = tests/
|
SUBDIRS = lib $(am__append_1) src po doc etc tests/unit \
|
||||||
SUBDIRS = lib $(am__append_1) src po contrib doc etc tests/unit \
|
|
||||||
$(am__append_2)
|
$(am__append_2)
|
||||||
CLEANFILES = man/8.out man/po/remove-potcdate.* man/*/login.defs.d man/*/*.mo
|
CLEANFILES = man/8.out man/po/remove-potcdate.* man/*/login.defs.d man/*/*.mo
|
||||||
|
EXTRA_DIST = NEWS README tests/
|
||||||
all: config.h
|
all: config.h
|
||||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||||
|
|
||||||
|
|||||||
-70
@@ -20,10 +20,6 @@
|
|||||||
/* Path for faillog file. */
|
/* Path for faillog file. */
|
||||||
#undef 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 */
|
/* max group name length */
|
||||||
#undef GROUP_NAME_MAX_LENGTH
|
#undef GROUP_NAME_MAX_LENGTH
|
||||||
|
|
||||||
@@ -53,9 +49,6 @@
|
|||||||
the CoreFoundation framework. */
|
the CoreFoundation framework. */
|
||||||
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
|
#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.
|
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||||
*/
|
*/
|
||||||
#undef HAVE_DCGETTEXT
|
#undef HAVE_DCGETTEXT
|
||||||
@@ -98,45 +91,27 @@
|
|||||||
/* Defined to 1 if you have the declaration of 'fgetpwent_r' */
|
/* Defined to 1 if you have the declaration of 'fgetpwent_r' */
|
||||||
#undef HAVE_FGETPWENT_R
|
#undef HAVE_FGETPWENT_R
|
||||||
|
|
||||||
/* Define to 1 if you have the `futimes' function. */
|
|
||||||
#undef HAVE_FUTIMES
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getentropy' function. */
|
/* Define to 1 if you have the `getentropy' function. */
|
||||||
#undef HAVE_GETENTROPY
|
#undef HAVE_GETENTROPY
|
||||||
|
|
||||||
/* Define to 1 if you have the `getrandom' function. */
|
/* Define to 1 if you have the `getrandom' function. */
|
||||||
#undef HAVE_GETRANDOM
|
#undef HAVE_GETRANDOM
|
||||||
|
|
||||||
/* Define to 1 if you have the `getspnam' function. */
|
|
||||||
#undef HAVE_GETSPNAM
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getspnam_r' function. */
|
/* Define to 1 if you have the `getspnam_r' function. */
|
||||||
#undef HAVE_GETSPNAM_R
|
#undef HAVE_GETSPNAM_R
|
||||||
|
|
||||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||||
#undef HAVE_GETTEXT
|
#undef HAVE_GETTEXT
|
||||||
|
|
||||||
/* Define to 1 if you have the `getusershell' function. */
|
|
||||||
#undef HAVE_GETUSERSHELL
|
|
||||||
|
|
||||||
/* 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. */
|
/* Define if you have the iconv() function and it works. */
|
||||||
#undef HAVE_ICONV
|
#undef HAVE_ICONV
|
||||||
|
|
||||||
/* Define to 1 if you have the `initgroups' function. */
|
|
||||||
#undef HAVE_INITGROUPS
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `innetgr' function. */
|
/* Define to 1 if you have the `innetgr' function. */
|
||||||
#undef HAVE_INNETGR
|
#undef HAVE_INNETGR
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <lastlog.h> header file. */
|
|
||||||
#undef HAVE_LASTLOG_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `lckpwdf' function. */
|
/* Define to 1 if you have the `lckpwdf' function. */
|
||||||
#undef HAVE_LCKPWDF
|
#undef HAVE_LCKPWDF
|
||||||
|
|
||||||
@@ -164,9 +139,6 @@
|
|||||||
/* Define to 1 if you have the <minix/config.h> header file. */
|
/* Define to 1 if you have the <minix/config.h> header file. */
|
||||||
#undef HAVE_MINIX_CONFIG_H
|
#undef HAVE_MINIX_CONFIG_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. */
|
/* Define to 1 if you have the `putgrent' function. */
|
||||||
#undef HAVE_PUTGRENT
|
#undef HAVE_PUTGRENT
|
||||||
|
|
||||||
@@ -179,9 +151,6 @@
|
|||||||
/* Define to 1 if you have the <readpassphrase.h> header file. */
|
/* Define to 1 if you have the <readpassphrase.h> header file. */
|
||||||
#undef HAVE_READPASSPHRASE_H
|
#undef HAVE_READPASSPHRASE_H
|
||||||
|
|
||||||
/* 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. */
|
/* Define to 1 if you have the `rpmatch' function. */
|
||||||
#undef HAVE_RPMATCH
|
#undef HAVE_RPMATCH
|
||||||
|
|
||||||
@@ -197,9 +166,6 @@
|
|||||||
/* Define to 1 if you have the <semanage/semanage.h> header file. */
|
/* Define to 1 if you have the <semanage/semanage.h> header file. */
|
||||||
#undef HAVE_SEMANAGE_SEMANAGE_H
|
#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. */
|
/* Define to 1 if you have the `sgetgrent' function. */
|
||||||
#undef HAVE_SGETGRENT
|
#undef HAVE_SGETGRENT
|
||||||
|
|
||||||
@@ -209,12 +175,6 @@
|
|||||||
/* Define to 1 if you have the `sgetspent' function. */
|
/* Define to 1 if you have the `sgetspent' function. */
|
||||||
#undef HAVE_SGETSPENT
|
#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 if you have the shl_load function. */
|
/* Define if you have the shl_load function. */
|
||||||
#undef HAVE_SHL_LOAD
|
#undef HAVE_SHL_LOAD
|
||||||
|
|
||||||
@@ -260,15 +220,6 @@
|
|||||||
/* Define to 1 if `ut_xtime' is a member of `struct utmpx'. */
|
/* Define to 1 if `ut_xtime' is a member of `struct utmpx'. */
|
||||||
#undef HAVE_STRUCT_UTMPX_UT_XTIME
|
#undef HAVE_STRUCT_UTMPX_UT_XTIME
|
||||||
|
|
||||||
/* 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/statfs.h> header file. */
|
/* Define to 1 if you have the <sys/statfs.h> header file. */
|
||||||
#undef HAVE_SYS_STATFS_H
|
#undef HAVE_SYS_STATFS_H
|
||||||
|
|
||||||
@@ -281,9 +232,6 @@
|
|||||||
/* Define to 1 if you have the <tcb.h> header file. */
|
/* Define to 1 if you have the <tcb.h> header file. */
|
||||||
#undef HAVE_TCB_H
|
#undef HAVE_TCB_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <termio.h> header file. */
|
|
||||||
#undef HAVE_TERMIO_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#undef HAVE_UNISTD_H
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
@@ -296,9 +244,6 @@
|
|||||||
/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
|
/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
|
||||||
#undef HAVE_UTIME_NULL
|
#undef HAVE_UTIME_NULL
|
||||||
|
|
||||||
/* Define to 1 if you have the <utmp.h> header file. */
|
|
||||||
#undef HAVE_UTMP_H
|
|
||||||
|
|
||||||
/* Define to support vendor settings. */
|
/* Define to support vendor settings. */
|
||||||
#undef HAVE_VENDORDIR
|
#undef HAVE_VENDORDIR
|
||||||
|
|
||||||
@@ -341,12 +286,6 @@
|
|||||||
/* Path to passwd program. */
|
/* Path to passwd program. */
|
||||||
#undef 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. */
|
/* Define to support the shadow group file. */
|
||||||
#undef SHADOWGRP
|
#undef SHADOWGRP
|
||||||
|
|
||||||
@@ -518,14 +457,5 @@
|
|||||||
/* Define for large files, on AIX-style hosts. */
|
/* Define for large files, on AIX-style hosts. */
|
||||||
#undef _LARGE_FILES
|
#undef _LARGE_FILES
|
||||||
|
|
||||||
/* Path for utmp file. */
|
|
||||||
#undef _UTMP_FILE
|
|
||||||
|
|
||||||
/* Path for wtmp file. */
|
/* Path for wtmp file. */
|
||||||
#undef _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
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.71 for shadow 4.15.3.
|
# Generated by GNU Autoconf 2.71 for shadow 4.18.0.
|
||||||
#
|
#
|
||||||
# Report bugs to <pkg-shadow-devel@lists.alioth.debian.org>.
|
# Report bugs to <pkg-shadow-devel@lists.alioth.debian.org>.
|
||||||
#
|
#
|
||||||
@@ -621,8 +621,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='shadow'
|
PACKAGE_NAME='shadow'
|
||||||
PACKAGE_TARNAME='shadow'
|
PACKAGE_TARNAME='shadow'
|
||||||
PACKAGE_VERSION='4.15.3'
|
PACKAGE_VERSION='4.18.0'
|
||||||
PACKAGE_STRING='shadow 4.15.3'
|
PACKAGE_STRING='shadow 4.18.0'
|
||||||
PACKAGE_BUGREPORT='pkg-shadow-devel@lists.alioth.debian.org'
|
PACKAGE_BUGREPORT='pkg-shadow-devel@lists.alioth.debian.org'
|
||||||
PACKAGE_URL='https://github.com/shadow-maint/shadow'
|
PACKAGE_URL='https://github.com/shadow-maint/shadow'
|
||||||
|
|
||||||
@@ -671,6 +671,7 @@ INTLLIBS
|
|||||||
LTLIBICONV
|
LTLIBICONV
|
||||||
LIBICONV
|
LIBICONV
|
||||||
INTL_MACOSX_LIBS
|
INTL_MACOSX_LIBS
|
||||||
|
CPP
|
||||||
XGETTEXT_EXTRA_OPTIONS
|
XGETTEXT_EXTRA_OPTIONS
|
||||||
MSGMERGE
|
MSGMERGE
|
||||||
XGETTEXT_015
|
XGETTEXT_015
|
||||||
@@ -744,7 +745,6 @@ USE_SHA_CRYPT_FALSE
|
|||||||
USE_SHA_CRYPT_TRUE
|
USE_SHA_CRYPT_TRUE
|
||||||
GROUP_NAME_MAX_LENGTH
|
GROUP_NAME_MAX_LENGTH
|
||||||
LIBOBJS
|
LIBOBJS
|
||||||
CPP
|
|
||||||
LIBADD_DL
|
LIBADD_DL
|
||||||
LT_DLPREOPEN
|
LT_DLPREOPEN
|
||||||
LIBADD_DLD_LINK
|
LIBADD_DLD_LINK
|
||||||
@@ -781,8 +781,6 @@ build_vendor
|
|||||||
build_cpu
|
build_cpu
|
||||||
build
|
build
|
||||||
LIBTOOL
|
LIBTOOL
|
||||||
YFLAGS
|
|
||||||
YACC
|
|
||||||
LN_S
|
LN_S
|
||||||
MAINT
|
MAINT
|
||||||
MAINTAINER_MODE_FALSE
|
MAINTAINER_MODE_FALSE
|
||||||
@@ -930,17 +928,15 @@ CFLAGS
|
|||||||
LDFLAGS
|
LDFLAGS
|
||||||
LIBS
|
LIBS
|
||||||
CPPFLAGS
|
CPPFLAGS
|
||||||
YACC
|
|
||||||
YFLAGS
|
|
||||||
LT_SYS_LIBRARY_PATH
|
LT_SYS_LIBRARY_PATH
|
||||||
CPP
|
|
||||||
PKG_CONFIG
|
PKG_CONFIG
|
||||||
PKG_CONFIG_PATH
|
PKG_CONFIG_PATH
|
||||||
PKG_CONFIG_LIBDIR
|
PKG_CONFIG_LIBDIR
|
||||||
CMOCKA_CFLAGS
|
CMOCKA_CFLAGS
|
||||||
CMOCKA_LIBS
|
CMOCKA_LIBS
|
||||||
LIBBSD_CFLAGS
|
LIBBSD_CFLAGS
|
||||||
LIBBSD_LIBS'
|
LIBBSD_LIBS
|
||||||
|
CPP'
|
||||||
|
|
||||||
|
|
||||||
# Initialize some variables set by options.
|
# Initialize some variables set by options.
|
||||||
@@ -1489,7 +1485,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures shadow 4.15.3 to adapt to many kinds of systems.
|
\`configure' configures shadow 4.18.0 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1560,7 +1556,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of shadow 4.15.3:";;
|
short | recursive ) echo "Configuration of shadow 4.18.0:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1650,15 +1646,8 @@ Some influential environment variables:
|
|||||||
LIBS libraries to pass to the linker, e.g. -l<library>
|
LIBS libraries to pass to the linker, e.g. -l<library>
|
||||||
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
|
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
|
||||||
you have headers in a nonstandard directory <include dir>
|
you have headers in a nonstandard directory <include dir>
|
||||||
YACC The `Yet Another Compiler Compiler' implementation to use.
|
|
||||||
Defaults to the first program found out of: `bison -y', `byacc',
|
|
||||||
`yacc'.
|
|
||||||
YFLAGS The list of arguments that will be passed by default to $YACC.
|
|
||||||
This script will default YFLAGS to the empty string to avoid a
|
|
||||||
default value of `-d' given by some make applications.
|
|
||||||
LT_SYS_LIBRARY_PATH
|
LT_SYS_LIBRARY_PATH
|
||||||
User-defined run-time library search path.
|
User-defined run-time library search path.
|
||||||
CPP C preprocessor
|
|
||||||
PKG_CONFIG path to pkg-config utility
|
PKG_CONFIG path to pkg-config utility
|
||||||
PKG_CONFIG_PATH
|
PKG_CONFIG_PATH
|
||||||
directories to add to pkg-config's search path
|
directories to add to pkg-config's search path
|
||||||
@@ -1670,6 +1659,7 @@ Some influential environment variables:
|
|||||||
LIBBSD_CFLAGS
|
LIBBSD_CFLAGS
|
||||||
C compiler flags for LIBBSD, overriding pkg-config
|
C compiler flags for LIBBSD, overriding pkg-config
|
||||||
LIBBSD_LIBS linker flags for LIBBSD, overriding pkg-config
|
LIBBSD_LIBS linker flags for LIBBSD, overriding pkg-config
|
||||||
|
CPP C preprocessor
|
||||||
|
|
||||||
Use these variables to override the choices made by `configure' or to help
|
Use these variables to override the choices made by `configure' or to help
|
||||||
it to find libraries and programs with nonstandard names/locations.
|
it to find libraries and programs with nonstandard names/locations.
|
||||||
@@ -1739,7 +1729,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
shadow configure 4.15.3
|
shadow configure 4.18.0
|
||||||
generated by GNU Autoconf 2.71
|
generated by GNU Autoconf 2.71
|
||||||
|
|
||||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||||
@@ -2046,44 +2036,6 @@ printf "%s\n" "$ac_res" >&6; }
|
|||||||
|
|
||||||
} # ac_fn_c_check_member
|
} # ac_fn_c_check_member
|
||||||
|
|
||||||
# ac_fn_c_try_cpp LINENO
|
|
||||||
# ----------------------
|
|
||||||
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
|
|
||||||
ac_fn_c_try_cpp ()
|
|
||||||
{
|
|
||||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
|
||||||
if { { ac_try="$ac_cpp conftest.$ac_ext"
|
|
||||||
case "(($ac_try" in
|
|
||||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
|
||||||
*) ac_try_echo=$ac_try;;
|
|
||||||
esac
|
|
||||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
|
||||||
printf "%s\n" "$ac_try_echo"; } >&5
|
|
||||||
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
|
|
||||||
ac_status=$?
|
|
||||||
if test -s conftest.err; then
|
|
||||||
grep -v '^ *+' conftest.err >conftest.er1
|
|
||||||
cat conftest.er1 >&5
|
|
||||||
mv -f conftest.er1 conftest.err
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; } > conftest.i && {
|
|
||||||
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
|
||||||
test ! -s conftest.err
|
|
||||||
}
|
|
||||||
then :
|
|
||||||
ac_retval=0
|
|
||||||
else $as_nop
|
|
||||||
printf "%s\n" "$as_me: failed program was:" >&5
|
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
|
||||||
|
|
||||||
ac_retval=1
|
|
||||||
fi
|
|
||||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
|
||||||
as_fn_set_status $ac_retval
|
|
||||||
|
|
||||||
} # ac_fn_c_try_cpp
|
|
||||||
|
|
||||||
# ac_fn_c_try_run LINENO
|
# ac_fn_c_try_run LINENO
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
|
# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
|
||||||
@@ -2315,6 +2267,44 @@ rm -f conftest.val
|
|||||||
as_fn_set_status $ac_retval
|
as_fn_set_status $ac_retval
|
||||||
|
|
||||||
} # ac_fn_c_compute_int
|
} # ac_fn_c_compute_int
|
||||||
|
|
||||||
|
# ac_fn_c_try_cpp LINENO
|
||||||
|
# ----------------------
|
||||||
|
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
|
||||||
|
ac_fn_c_try_cpp ()
|
||||||
|
{
|
||||||
|
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||||
|
if { { ac_try="$ac_cpp conftest.$ac_ext"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||||
|
printf "%s\n" "$ac_try_echo"; } >&5
|
||||||
|
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
|
||||||
|
ac_status=$?
|
||||||
|
if test -s conftest.err; then
|
||||||
|
grep -v '^ *+' conftest.err >conftest.er1
|
||||||
|
cat conftest.er1 >&5
|
||||||
|
mv -f conftest.er1 conftest.err
|
||||||
|
fi
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; } > conftest.i && {
|
||||||
|
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
}
|
||||||
|
then :
|
||||||
|
ac_retval=0
|
||||||
|
else $as_nop
|
||||||
|
printf "%s\n" "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
ac_retval=1
|
||||||
|
fi
|
||||||
|
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||||
|
as_fn_set_status $ac_retval
|
||||||
|
|
||||||
|
} # ac_fn_c_try_cpp
|
||||||
ac_configure_args_raw=
|
ac_configure_args_raw=
|
||||||
for ac_arg
|
for ac_arg
|
||||||
do
|
do
|
||||||
@@ -2339,7 +2329,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by shadow $as_me 4.15.3, which was
|
It was created by shadow $as_me 4.18.0, which was
|
||||||
generated by GNU Autoconf 2.71. Invocation command line was
|
generated by GNU Autoconf 2.71. Invocation command line was
|
||||||
|
|
||||||
$ $0$ac_configure_args_raw
|
$ $0$ac_configure_args_raw
|
||||||
@@ -3612,7 +3602,7 @@ fi
|
|||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='shadow'
|
PACKAGE='shadow'
|
||||||
VERSION='4.15.3'
|
VERSION='4.18.0'
|
||||||
|
|
||||||
|
|
||||||
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
|
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
|
||||||
@@ -3846,13 +3836,13 @@ AM_BACKSLASH='\'
|
|||||||
ac_config_headers="$ac_config_headers config.h"
|
ac_config_headers="$ac_config_headers config.h"
|
||||||
|
|
||||||
|
|
||||||
LIBSUBID_ABI_MAJOR=4
|
LIBSUBID_ABI_MAJOR=5
|
||||||
|
|
||||||
LIBSUBID_ABI_MINOR=0
|
LIBSUBID_ABI_MINOR=0
|
||||||
|
|
||||||
LIBSUBID_ABI_MICRO=0
|
LIBSUBID_ABI_MICRO=0
|
||||||
|
|
||||||
LIBSUBID_ABI=4.0.0
|
LIBSUBID_ABI=5.0.0
|
||||||
|
|
||||||
|
|
||||||
test "$prefix" = "NONE" && prefix="/usr"
|
test "$prefix" = "NONE" && prefix="/usr"
|
||||||
@@ -6301,54 +6291,6 @@ else
|
|||||||
printf "%s\n" "no, using $LN_S" >&6; }
|
printf "%s\n" "no, using $LN_S" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for ac_prog in 'bison -y' byacc
|
|
||||||
do
|
|
||||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
|
||||||
set dummy $ac_prog; ac_word=$2
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
|
||||||
printf %s "checking for $ac_word... " >&6; }
|
|
||||||
if test ${ac_cv_prog_YACC+y}
|
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else $as_nop
|
|
||||||
if test -n "$YACC"; then
|
|
||||||
ac_cv_prog_YACC="$YACC" # Let the user override the test.
|
|
||||||
else
|
|
||||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
|
||||||
for as_dir in $PATH
|
|
||||||
do
|
|
||||||
IFS=$as_save_IFS
|
|
||||||
case $as_dir in #(((
|
|
||||||
'') as_dir=./ ;;
|
|
||||||
*/) ;;
|
|
||||||
*) as_dir=$as_dir/ ;;
|
|
||||||
esac
|
|
||||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
|
||||||
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
|
|
||||||
ac_cv_prog_YACC="$ac_prog"
|
|
||||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
|
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
IFS=$as_save_IFS
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
YACC=$ac_cv_prog_YACC
|
|
||||||
if test -n "$YACC"; then
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
|
|
||||||
printf "%s\n" "$YACC" >&6; }
|
|
||||||
else
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
printf "%s\n" "no" >&6; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
test -n "$YACC" && break
|
|
||||||
done
|
|
||||||
test -n "$YACC" || YACC="yacc"
|
|
||||||
|
|
||||||
case `pwd` in
|
case `pwd` in
|
||||||
*\ * | *\ *)
|
*\ * | *\ *)
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
|
||||||
@@ -14835,92 +14777,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "crypt.h" "ac_cv_header_crypt_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_crypt_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_CRYPT_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "utmp.h" "ac_cv_header_utmp_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_utmp_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_UTMP_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "termio.h" "ac_cv_header_termio_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_termio_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_TERMIO_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "sgtty.h" "ac_cv_header_sgtty_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_sgtty_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_SGTTY_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_sys_ioctl_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_paths_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_PATHS_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "sys/capability.h" "ac_cv_header_sys_capability_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_sys_capability_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_SYS_CAPABILITY_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "sys/random.h" "ac_cv_header_sys_random_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_sys_random_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_SYS_RANDOM_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "gshadow.h" "ac_cv_header_gshadow_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_gshadow_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_GSHADOW_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "lastlog.h" "ac_cv_header_lastlog_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_lastlog_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_LASTLOG_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "rpc/key_prot.h" "ac_cv_header_rpc_key_prot_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_rpc_key_prot_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_RPC_KEY_PROT_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "acl/libacl.h" "ac_cv_header_acl_libacl_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_acl_libacl_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_ACL_LIBACL_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "attr/libattr.h" "ac_cv_header_attr_libattr_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_attr_libattr_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_ATTR_LIBATTR_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "attr/error_context.h" "ac_cv_header_attr_error_context_h" "$ac_includes_default"
|
|
||||||
if test "x$ac_cv_header_attr_error_context_h" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_ATTR_ERROR_CONTEXT_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "shadow.h" "ac_cv_header_shadow_h" "$ac_includes_default"
|
ac_fn_c_check_header_compile "$LINENO" "shadow.h" "ac_cv_header_shadow_h" "$ac_includes_default"
|
||||||
if test "x$ac_cv_header_shadow_h" = xyes
|
if test "x$ac_cv_header_shadow_h" = xyes
|
||||||
then :
|
then :
|
||||||
@@ -14935,12 +14791,6 @@ if test "x$ac_cv_func_arc4random_buf" = xyes
|
|||||||
then :
|
then :
|
||||||
printf "%s\n" "#define HAVE_ARC4RANDOM_BUF 1" >>confdefs.h
|
printf "%s\n" "#define HAVE_ARC4RANDOM_BUF 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_func "$LINENO" "futimes" "ac_cv_func_futimes"
|
|
||||||
if test "x$ac_cv_func_futimes" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_FUTIMES 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
|
ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
|
||||||
if test "x$ac_cv_func_getentropy" = xyes
|
if test "x$ac_cv_func_getentropy" = xyes
|
||||||
@@ -14953,24 +14803,6 @@ if test "x$ac_cv_func_getrandom" = xyes
|
|||||||
then :
|
then :
|
||||||
printf "%s\n" "#define HAVE_GETRANDOM 1" >>confdefs.h
|
printf "%s\n" "#define HAVE_GETRANDOM 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_func "$LINENO" "getspnam" "ac_cv_func_getspnam"
|
|
||||||
if test "x$ac_cv_func_getspnam" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_GETSPNAM 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_func "$LINENO" "getusershell" "ac_cv_func_getusershell"
|
|
||||||
if test "x$ac_cv_func_getusershell" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_GETUSERSHELL 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_func "$LINENO" "initgroups" "ac_cv_func_initgroups"
|
|
||||||
if test "x$ac_cv_func_initgroups" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_INITGROUPS 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
ac_fn_c_check_func "$LINENO" "lckpwdf" "ac_cv_func_lckpwdf"
|
ac_fn_c_check_func "$LINENO" "lckpwdf" "ac_cv_func_lckpwdf"
|
||||||
if test "x$ac_cv_func_lckpwdf" = xyes
|
if test "x$ac_cv_func_lckpwdf" = xyes
|
||||||
@@ -14983,12 +14815,6 @@ if test "x$ac_cv_func_lutimes" = xyes
|
|||||||
then :
|
then :
|
||||||
printf "%s\n" "#define HAVE_LUTIMES 1" >>confdefs.h
|
printf "%s\n" "#define HAVE_LUTIMES 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
|
||||||
ac_fn_c_check_func "$LINENO" "setgroups" "ac_cv_func_setgroups"
|
|
||||||
if test "x$ac_cv_func_setgroups" = xyes
|
|
||||||
then :
|
|
||||||
printf "%s\n" "#define HAVE_SETGROUPS 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
ac_fn_c_check_func "$LINENO" "updwtmpx" "ac_cv_func_updwtmpx"
|
ac_fn_c_check_func "$LINENO" "updwtmpx" "ac_cv_func_updwtmpx"
|
||||||
if test "x$ac_cv_func_updwtmpx" = xyes
|
if test "x$ac_cv_func_updwtmpx" = xyes
|
||||||
@@ -15310,240 +15136,6 @@ printf "%s\n" "#define HAVE_STRUCT_UTMPX_UT_XTIME 1" >>confdefs.h
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
ac_ext=c
|
|
||||||
ac_cpp='$CPP $CPPFLAGS'
|
|
||||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
||||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
|
||||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
|
|
||||||
printf %s "checking how to run the C preprocessor... " >&6; }
|
|
||||||
# On Suns, sometimes $CPP names a directory.
|
|
||||||
if test -n "$CPP" && test -d "$CPP"; then
|
|
||||||
CPP=
|
|
||||||
fi
|
|
||||||
if test -z "$CPP"; then
|
|
||||||
if test ${ac_cv_prog_CPP+y}
|
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else $as_nop
|
|
||||||
# Double quotes because $CC needs to be expanded
|
|
||||||
for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp
|
|
||||||
do
|
|
||||||
ac_preproc_ok=false
|
|
||||||
for ac_c_preproc_warn_flag in '' yes
|
|
||||||
do
|
|
||||||
# Use a header file that comes with gcc, so configuring glibc
|
|
||||||
# with a fresh cross-compiler works.
|
|
||||||
# On the NeXT, cc -E runs the code through the compiler's parser,
|
|
||||||
# not just through cpp. "Syntax error" is here to catch this case.
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <limits.h>
|
|
||||||
Syntax error
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_cpp "$LINENO"
|
|
||||||
then :
|
|
||||||
|
|
||||||
else $as_nop
|
|
||||||
# Broken: fails on valid input.
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
|
||||||
|
|
||||||
# OK, works on sane cases. Now check whether nonexistent headers
|
|
||||||
# can be detected and how.
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <ac_nonexistent.h>
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_cpp "$LINENO"
|
|
||||||
then :
|
|
||||||
# Broken: success on invalid input.
|
|
||||||
continue
|
|
||||||
else $as_nop
|
|
||||||
# Passes both tests.
|
|
||||||
ac_preproc_ok=:
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
|
||||||
|
|
||||||
done
|
|
||||||
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
|
|
||||||
rm -f conftest.i conftest.err conftest.$ac_ext
|
|
||||||
if $ac_preproc_ok
|
|
||||||
then :
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
ac_cv_prog_CPP=$CPP
|
|
||||||
|
|
||||||
fi
|
|
||||||
CPP=$ac_cv_prog_CPP
|
|
||||||
else
|
|
||||||
ac_cv_prog_CPP=$CPP
|
|
||||||
fi
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
|
|
||||||
printf "%s\n" "$CPP" >&6; }
|
|
||||||
ac_preproc_ok=false
|
|
||||||
for ac_c_preproc_warn_flag in '' yes
|
|
||||||
do
|
|
||||||
# Use a header file that comes with gcc, so configuring glibc
|
|
||||||
# with a fresh cross-compiler works.
|
|
||||||
# On the NeXT, cc -E runs the code through the compiler's parser,
|
|
||||||
# not just through cpp. "Syntax error" is here to catch this case.
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <limits.h>
|
|
||||||
Syntax error
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_cpp "$LINENO"
|
|
||||||
then :
|
|
||||||
|
|
||||||
else $as_nop
|
|
||||||
# Broken: fails on valid input.
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
|
||||||
|
|
||||||
# OK, works on sane cases. Now check whether nonexistent headers
|
|
||||||
# can be detected and how.
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <ac_nonexistent.h>
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_cpp "$LINENO"
|
|
||||||
then :
|
|
||||||
# Broken: success on invalid input.
|
|
||||||
continue
|
|
||||||
else $as_nop
|
|
||||||
# Passes both tests.
|
|
||||||
ac_preproc_ok=:
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
|
||||||
|
|
||||||
done
|
|
||||||
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
|
|
||||||
rm -f conftest.i conftest.err conftest.$ac_ext
|
|
||||||
if $ac_preproc_ok
|
|
||||||
then :
|
|
||||||
|
|
||||||
else $as_nop
|
|
||||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
|
||||||
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
|
|
||||||
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
|
|
||||||
See \`config.log' for more details" "$LINENO" 5; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
ac_ext=c
|
|
||||||
ac_cpp='$CPP $CPPFLAGS'
|
|
||||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
||||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
|
||||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|
||||||
|
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
|
|
||||||
printf %s "checking for uid_t in sys/types.h... " >&6; }
|
|
||||||
if test ${ac_cv_type_uid_t+y}
|
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else $as_nop
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
_ACEOF
|
|
||||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
|
||||||
$EGREP "uid_t" >/dev/null 2>&1
|
|
||||||
then :
|
|
||||||
ac_cv_type_uid_t=yes
|
|
||||||
else $as_nop
|
|
||||||
ac_cv_type_uid_t=no
|
|
||||||
fi
|
|
||||||
rm -rf conftest*
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
|
|
||||||
printf "%s\n" "$ac_cv_type_uid_t" >&6; }
|
|
||||||
if test $ac_cv_type_uid_t = no; then
|
|
||||||
|
|
||||||
printf "%s\n" "#define uid_t int" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
printf "%s\n" "#define gid_t int" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5
|
|
||||||
printf %s "checking type of array argument to getgroups... " >&6; }
|
|
||||||
if test ${ac_cv_type_getgroups+y}
|
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else $as_nop
|
|
||||||
if test "$cross_compiling" = yes
|
|
||||||
then :
|
|
||||||
ac_cv_type_getgroups=cross
|
|
||||||
else $as_nop
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
/* Thanks to Mike Rendell for this test. */
|
|
||||||
$ac_includes_default
|
|
||||||
#define NGID 256
|
|
||||||
#undef MAX
|
|
||||||
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
|
|
||||||
int
|
|
||||||
main (void)
|
|
||||||
{
|
|
||||||
gid_t gidset[NGID];
|
|
||||||
int i, n;
|
|
||||||
union { gid_t gval; long int lval; } val;
|
|
||||||
|
|
||||||
val.lval = -1;
|
|
||||||
for (i = 0; i < NGID; i++)
|
|
||||||
gidset[i] = val.gval;
|
|
||||||
n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
|
|
||||||
gidset);
|
|
||||||
/* Exit non-zero if getgroups seems to require an array of ints. This
|
|
||||||
happens when gid_t is short int but getgroups modifies an array
|
|
||||||
of ints. */
|
|
||||||
return n > 0 && gidset[n] != val.gval;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_run "$LINENO"
|
|
||||||
then :
|
|
||||||
ac_cv_type_getgroups=gid_t
|
|
||||||
else $as_nop
|
|
||||||
ac_cv_type_getgroups=int
|
|
||||||
fi
|
|
||||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
|
||||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $ac_cv_type_getgroups = cross; then
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
_ACEOF
|
|
||||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
|
||||||
$EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1
|
|
||||||
then :
|
|
||||||
ac_cv_type_getgroups=gid_t
|
|
||||||
else $as_nop
|
|
||||||
ac_cv_type_getgroups=int
|
|
||||||
fi
|
|
||||||
rm -rf conftest*
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_getgroups" >&5
|
|
||||||
printf "%s\n" "$ac_cv_type_getgroups" >&6; }
|
|
||||||
|
|
||||||
printf "%s\n" "#define GETGROUPS_T $ac_cv_type_getgroups" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether utime accepts a null argument" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether utime accepts a null argument" >&5
|
||||||
@@ -15694,56 +15286,6 @@ printf "%s\n" "#define HAS_SECURE_GETENV 1" >>confdefs.h
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test "$ac_cv_header_shadow_h" = "yes"; then
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working shadow group support" >&5
|
|
||||||
printf %s "checking for working shadow group support... " >&6; }
|
|
||||||
if test ${ac_cv_libc_shadowgrp+y}
|
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else $as_nop
|
|
||||||
if test "$cross_compiling" = yes
|
|
||||||
then :
|
|
||||||
ac_cv_libc_shadowgrp=no
|
|
||||||
|
|
||||||
else $as_nop
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
#include <shadow.h>
|
|
||||||
#ifdef HAVE_GSHADOW_H
|
|
||||||
#include <gshadow.h>
|
|
||||||
#endif
|
|
||||||
int
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_run "$LINENO"
|
|
||||||
then :
|
|
||||||
ac_cv_libc_shadowgrp=yes
|
|
||||||
else $as_nop
|
|
||||||
ac_cv_libc_shadowgrp=no
|
|
||||||
fi
|
|
||||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
|
||||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libc_shadowgrp" >&5
|
|
||||||
printf "%s\n" "$ac_cv_libc_shadowgrp" >&6; }
|
|
||||||
|
|
||||||
if test "$ac_cv_libc_shadowgrp" = "yes"; then
|
|
||||||
|
|
||||||
printf "%s\n" "#define HAVE_SHADOWGRP 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking location of shared mail directory" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking location of shared mail directory" >&5
|
||||||
printf %s "checking location of shared mail directory... " >&6; }
|
printf %s "checking location of shared mail directory... " >&6; }
|
||||||
if test ${shadow_cv_maildir+y}
|
if test ${shadow_cv_maildir+y}
|
||||||
@@ -15784,28 +15326,6 @@ printf "%s\n" "#define MAIL_SPOOL_FILE \"$shadow_cv_mailfile\"" >>confdefs.h
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking location of utmp" >&5
|
|
||||||
printf %s "checking location of utmp... " >&6; }
|
|
||||||
if test ${shadow_cv_utmpdir+y}
|
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else $as_nop
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $shadow_cv_utmpdir" >&5
|
|
||||||
printf "%s\n" "$shadow_cv_utmpdir" >&6; }
|
|
||||||
if test "$shadow_cv_utmpdir" = "none"; then
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: utmp file not found" >&5
|
|
||||||
printf "%s\n" "$as_me: WARNING: utmp file not found" >&2;}
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "%s\n" "#define _UTMP_FILE \"$shadow_cv_utmpdir/utmp\"" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking location of faillog/lastlog/wtmp" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking location of faillog/lastlog/wtmp" >&5
|
||||||
printf %s "checking location of faillog/lastlog/wtmp... " >&6; }
|
printf %s "checking location of faillog/lastlog/wtmp... " >&6; }
|
||||||
if test ${shadow_cv_logdir+y}
|
if test ${shadow_cv_logdir+y}
|
||||||
@@ -15830,33 +15350,10 @@ printf "%s\n" "#define LASTLOG_FILE \"$shadow_cv_logdir/lastlog\"" >>confdefs.h
|
|||||||
printf "%s\n" "#define FAILLOG_FILE \"$shadow_cv_logdir/faillog\"" >>confdefs.h
|
printf "%s\n" "#define FAILLOG_FILE \"$shadow_cv_logdir/faillog\"" >>confdefs.h
|
||||||
|
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking location of the passwd program" >&5
|
|
||||||
printf %s "checking location of the passwd program... " >&6; }
|
|
||||||
if test ${shadow_cv_passwd_dir+y}
|
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else $as_nop
|
|
||||||
if test -f /usr/bin/passwd; then
|
|
||||||
shadow_cv_passwd_dir=/usr/bin
|
|
||||||
else
|
|
||||||
shadow_cv_passwd_dir=/bin
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $shadow_cv_passwd_dir" >&5
|
|
||||||
printf "%s\n" "$shadow_cv_passwd_dir" >&6; }
|
|
||||||
|
|
||||||
printf "%s\n" "#define PASSWD_PROGRAM \"$shadow_cv_passwd_dir/passwd\"" >>confdefs.h
|
printf "%s\n" "#define PASSWD_PROGRAM \"$exec_prefix/bin/passwd\"" >>confdefs.h
|
||||||
|
|
||||||
|
|
||||||
if test "$ac_cv_func_ruserok" = "yes"; then
|
|
||||||
|
|
||||||
printf "%s\n" "#define RLOGIN 1" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
printf "%s\n" "#define RUSEROK 0" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check whether --enable-shadowgrp was given.
|
# Check whether --enable-shadowgrp was given.
|
||||||
if test ${enable_shadowgrp+y}
|
if test ${enable_shadowgrp+y}
|
||||||
then :
|
then :
|
||||||
@@ -16835,7 +16332,7 @@ printf "%s\n" "#define ENABLE_LASTLOG 1" >>confdefs.h
|
|||||||
enable_lastlog="yes"
|
enable_lastlog="yes"
|
||||||
else
|
else
|
||||||
as_fn_error $? "Cannot enable support for lastlog on systems where the data structures aren't available" "$LINENO" 5
|
as_fn_error $? "Cannot enable support for lastlog on systems where the data structures aren't available" "$LINENO" 5
|
||||||
enable_subids="no"
|
enable_lastlog="no"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test "x$enable_lastlog" != "xno"; then
|
if test "x$enable_lastlog" != "xno"; then
|
||||||
@@ -18230,7 +17727,7 @@ if test "x$ac_cv_lib_skey_skeychallenge" = xyes
|
|||||||
then :
|
then :
|
||||||
LIBSKEY=-lskey
|
LIBSKEY=-lskey
|
||||||
else $as_nop
|
else $as_nop
|
||||||
as_fn_error $? "liskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2" "$LINENO" 5
|
as_fn_error $? "libskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -18756,6 +18253,139 @@ else $as_nop
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
ac_ext=c
|
||||||
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
|
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
|
||||||
|
printf %s "checking how to run the C preprocessor... " >&6; }
|
||||||
|
# On Suns, sometimes $CPP names a directory.
|
||||||
|
if test -n "$CPP" && test -d "$CPP"; then
|
||||||
|
CPP=
|
||||||
|
fi
|
||||||
|
if test -z "$CPP"; then
|
||||||
|
if test ${ac_cv_prog_CPP+y}
|
||||||
|
then :
|
||||||
|
printf %s "(cached) " >&6
|
||||||
|
else $as_nop
|
||||||
|
# Double quotes because $CC needs to be expanded
|
||||||
|
for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp
|
||||||
|
do
|
||||||
|
ac_preproc_ok=false
|
||||||
|
for ac_c_preproc_warn_flag in '' yes
|
||||||
|
do
|
||||||
|
# Use a header file that comes with gcc, so configuring glibc
|
||||||
|
# with a fresh cross-compiler works.
|
||||||
|
# On the NeXT, cc -E runs the code through the compiler's parser,
|
||||||
|
# not just through cpp. "Syntax error" is here to catch this case.
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <limits.h>
|
||||||
|
Syntax error
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_cpp "$LINENO"
|
||||||
|
then :
|
||||||
|
|
||||||
|
else $as_nop
|
||||||
|
# Broken: fails on valid input.
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||||
|
|
||||||
|
# OK, works on sane cases. Now check whether nonexistent headers
|
||||||
|
# can be detected and how.
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <ac_nonexistent.h>
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_cpp "$LINENO"
|
||||||
|
then :
|
||||||
|
# Broken: success on invalid input.
|
||||||
|
continue
|
||||||
|
else $as_nop
|
||||||
|
# Passes both tests.
|
||||||
|
ac_preproc_ok=:
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||||
|
|
||||||
|
done
|
||||||
|
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
|
||||||
|
rm -f conftest.i conftest.err conftest.$ac_ext
|
||||||
|
if $ac_preproc_ok
|
||||||
|
then :
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
ac_cv_prog_CPP=$CPP
|
||||||
|
|
||||||
|
fi
|
||||||
|
CPP=$ac_cv_prog_CPP
|
||||||
|
else
|
||||||
|
ac_cv_prog_CPP=$CPP
|
||||||
|
fi
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
|
||||||
|
printf "%s\n" "$CPP" >&6; }
|
||||||
|
ac_preproc_ok=false
|
||||||
|
for ac_c_preproc_warn_flag in '' yes
|
||||||
|
do
|
||||||
|
# Use a header file that comes with gcc, so configuring glibc
|
||||||
|
# with a fresh cross-compiler works.
|
||||||
|
# On the NeXT, cc -E runs the code through the compiler's parser,
|
||||||
|
# not just through cpp. "Syntax error" is here to catch this case.
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <limits.h>
|
||||||
|
Syntax error
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_cpp "$LINENO"
|
||||||
|
then :
|
||||||
|
|
||||||
|
else $as_nop
|
||||||
|
# Broken: fails on valid input.
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||||
|
|
||||||
|
# OK, works on sane cases. Now check whether nonexistent headers
|
||||||
|
# can be detected and how.
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <ac_nonexistent.h>
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_cpp "$LINENO"
|
||||||
|
then :
|
||||||
|
# Broken: success on invalid input.
|
||||||
|
continue
|
||||||
|
else $as_nop
|
||||||
|
# Passes both tests.
|
||||||
|
ac_preproc_ok=:
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||||
|
|
||||||
|
done
|
||||||
|
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
|
||||||
|
rm -f conftest.i conftest.err conftest.$ac_ext
|
||||||
|
if $ac_preproc_ok
|
||||||
|
then :
|
||||||
|
|
||||||
|
else $as_nop
|
||||||
|
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||||
|
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||||
|
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
|
||||||
|
See \`config.log' for more details" "$LINENO" 5; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
ac_ext=c
|
||||||
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
|
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
acl_libdirstem=lib
|
acl_libdirstem=lib
|
||||||
@@ -20381,7 +20011,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile po/Makefile.in doc/Makefile man/Makefile man/config.xml man/po/Makefile man/cs/Makefile man/da/Makefile man/de/Makefile man/es/Makefile man/fi/Makefile man/fr/Makefile man/hu/Makefile man/id/Makefile man/it/Makefile man/ja/Makefile man/ko/Makefile man/pl/Makefile man/pt_BR/Makefile man/ru/Makefile man/sv/Makefile man/tr/Makefile man/uk/Makefile man/zh_CN/Makefile man/zh_TW/Makefile lib/Makefile libsubid/Makefile libsubid/subid.h src/Makefile contrib/Makefile etc/Makefile etc/pam.d/Makefile etc/shadow-maint/Makefile tests/unit/Makefile"
|
ac_config_files="$ac_config_files Makefile po/Makefile.in doc/Makefile man/Makefile man/config.xml man/po/Makefile man/cs/Makefile man/da/Makefile man/de/Makefile man/es/Makefile man/fi/Makefile man/fr/Makefile man/hu/Makefile man/id/Makefile man/it/Makefile man/ja/Makefile man/ko/Makefile man/pl/Makefile man/pt_BR/Makefile man/ru/Makefile man/sv/Makefile man/tr/Makefile man/uk/Makefile man/zh_CN/Makefile man/zh_TW/Makefile lib/Makefile libsubid/Makefile libsubid/subid.h src/Makefile etc/Makefile etc/pam.d/Makefile etc/shadow-maint/Makefile tests/unit/Makefile"
|
||||||
|
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
# This file is a shell script that caches the results of configure
|
# This file is a shell script that caches the results of configure
|
||||||
@@ -20990,7 +20620,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by shadow $as_me 4.15.3, which was
|
This file was extended by shadow $as_me 4.18.0, which was
|
||||||
generated by GNU Autoconf 2.71. Invocation command line was
|
generated by GNU Autoconf 2.71. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -21059,7 +20689,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config='$ac_cs_config_escaped'
|
ac_cs_config='$ac_cs_config_escaped'
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
shadow config.status 4.15.3
|
shadow config.status 4.18.0
|
||||||
configured by $0, generated by GNU Autoconf 2.71,
|
configured by $0, generated by GNU Autoconf 2.71,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
@@ -21513,7 +21143,6 @@ do
|
|||||||
"libsubid/Makefile") CONFIG_FILES="$CONFIG_FILES libsubid/Makefile" ;;
|
"libsubid/Makefile") CONFIG_FILES="$CONFIG_FILES libsubid/Makefile" ;;
|
||||||
"libsubid/subid.h") CONFIG_FILES="$CONFIG_FILES libsubid/subid.h" ;;
|
"libsubid/subid.h") CONFIG_FILES="$CONFIG_FILES libsubid/subid.h" ;;
|
||||||
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
|
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
|
||||||
"contrib/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;;
|
|
||||||
"etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
|
"etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
|
||||||
"etc/pam.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/pam.d/Makefile" ;;
|
"etc/pam.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/pam.d/Makefile" ;;
|
||||||
"etc/shadow-maint/Makefile") CONFIG_FILES="$CONFIG_FILES etc/shadow-maint/Makefile" ;;
|
"etc/shadow-maint/Makefile") CONFIG_FILES="$CONFIG_FILES etc/shadow-maint/Makefile" ;;
|
||||||
|
|||||||
+9
-71
@@ -1,10 +1,10 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_PREREQ([2.69])
|
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_minor], 0)
|
||||||
m4_define([libsubid_abi_micro], 0)
|
m4_define([libsubid_abi_micro], 0)
|
||||||
m4_define([libsubid_abi], [libsubid_abi_major.libsubid_abi_minor.libsubid_abi_micro])
|
m4_define([libsubid_abi], [libsubid_abi_major.libsubid_abi_minor.libsubid_abi_micro])
|
||||||
AC_INIT([shadow], [4.15.3], [pkg-shadow-devel@lists.alioth.debian.org], [],
|
AC_INIT([shadow], [4.18.0], [pkg-shadow-devel@lists.alioth.debian.org], [],
|
||||||
[https://github.com/shadow-maint/shadow])
|
[https://github.com/shadow-maint/shadow])
|
||||||
AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects tar-pax])
|
AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects tar-pax])
|
||||||
AC_CONFIG_MACRO_DIRS([m4])
|
AC_CONFIG_MACRO_DIRS([m4])
|
||||||
@@ -30,26 +30,18 @@ AM_MAINTAINER_MODE
|
|||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_YACC
|
|
||||||
LT_INIT
|
LT_INIT
|
||||||
LT_LIB_DLLOAD
|
LT_LIB_DLLOAD
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
|
||||||
dnl Checks for header files.
|
|
||||||
AC_CHECK_HEADERS(crypt.h utmp.h \
|
|
||||||
termio.h sgtty.h sys/ioctl.h paths.h \
|
|
||||||
sys/capability.h sys/random.h \
|
|
||||||
gshadow.h lastlog.h rpc/key_prot.h acl/libacl.h \
|
|
||||||
attr/libattr.h attr/error_context.h)
|
|
||||||
|
|
||||||
dnl shadow now uses the libc's shadow implementation
|
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_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
|
||||||
|
|
||||||
AC_CHECK_FUNCS(arc4random_buf futimes \
|
AC_CHECK_FUNCS(arc4random_buf \
|
||||||
getentropy getrandom getspnam getusershell \
|
getentropy getrandom \
|
||||||
initgroups lckpwdf lutimes \
|
lckpwdf lutimes \
|
||||||
setgroups updwtmpx innetgr \
|
updwtmpx innetgr \
|
||||||
getspnam_r \
|
getspnam_r \
|
||||||
rpmatch \
|
rpmatch \
|
||||||
memset_explicit explicit_bzero stpecpy stpeprintf)
|
memset_explicit explicit_bzero stpecpy stpeprintf)
|
||||||
@@ -66,7 +58,6 @@ AC_CHECK_MEMBERS([struct utmpx.ut_name,
|
|||||||
struct utmpx.ut_xtime],,,[[#include <utmpx.h>]])
|
struct utmpx.ut_xtime],,,[[#include <utmpx.h>]])
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_TYPE_GETGROUPS
|
|
||||||
AC_FUNC_UTIME_NULL
|
AC_FUNC_UTIME_NULL
|
||||||
AC_REPLACE_FUNCS(putgrent putpwent putspent)
|
AC_REPLACE_FUNCS(putgrent putpwent putspent)
|
||||||
AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
|
AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
|
||||||
@@ -76,33 +67,6 @@ AC_CHECK_FUNC(secure_getenv, [AC_DEFINE(HAS_SECURE_GETENV,
|
|||||||
1,
|
1,
|
||||||
[Defined to 1 if you have the declaration of 'secure_getenv'])])
|
[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>
|
|
||||||
#ifdef HAVE_GSHADOW_H
|
|
||||||
#include <gshadow.h>
|
|
||||||
#endif
|
|
||||||
int
|
|
||||||
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,
|
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
|
[for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
|
||||||
if test -d $shadow_cv_maildir; then
|
if test -d $shadow_cv_maildir; then
|
||||||
@@ -125,18 +89,6 @@ if test $shadow_cv_mailfile != none; then
|
|||||||
[Name of user's mail spool file if stored in user's home directory.])
|
[Name of user's mail spool file if stored in user's home directory.])
|
||||||
fi
|
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,
|
AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
|
||||||
[for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
|
[for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
|
||||||
if test -d $shadow_cv_logdir; then
|
if test -d $shadow_cv_logdir; then
|
||||||
@@ -150,22 +102,9 @@ AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
|
|||||||
AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
|
AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
|
||||||
[Path for faillog file.])
|
[Path for faillog file.])
|
||||||
|
|
||||||
AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
|
AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$exec_prefix/bin/passwd",
|
||||||
[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",
|
|
||||||
[Path to passwd program.])
|
[Path to passwd program.])
|
||||||
|
|
||||||
dnl XXX - quick hack, should disappear before anyone notices :).
|
|
||||||
dnl XXX - I just read the above message :).
|
|
||||||
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,
|
AC_ARG_ENABLE(shadowgrp,
|
||||||
[AS_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
|
[AS_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
|
||||||
[case "${enableval}" in
|
[case "${enableval}" in
|
||||||
@@ -391,7 +330,7 @@ if test "$enable_lastlog" = "yes" && test "$ac_cv_header_lastlog_h" = "yes"; the
|
|||||||
enable_lastlog="yes"
|
enable_lastlog="yes"
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR([Cannot enable support for lastlog on systems where the data structures aren't available])
|
AC_MSG_ERROR([Cannot enable support for lastlog on systems where the data structures aren't available])
|
||||||
enable_subids="no"
|
enable_lastlog="no"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(ENABLE_LASTLOG, test "x$enable_lastlog" != "xno")
|
AM_CONDITIONAL(ENABLE_LASTLOG, test "x$enable_lastlog" != "xno")
|
||||||
@@ -696,7 +635,7 @@ AC_SUBST(LIBMD)
|
|||||||
if test "$with_skey" = "yes"; then
|
if test "$with_skey" = "yes"; then
|
||||||
AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
|
AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
|
||||||
AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
|
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_DEFINE(SKEY, 1, [Define to support S/Key logins.])
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -744,7 +683,6 @@ AC_CONFIG_FILES([
|
|||||||
libsubid/Makefile
|
libsubid/Makefile
|
||||||
libsubid/subid.h
|
libsubid/subid.h
|
||||||
src/Makefile
|
src/Makefile
|
||||||
contrib/Makefile
|
|
||||||
etc/Makefile
|
etc/Makefile
|
||||||
etc/pam.d/Makefile
|
etc/pam.d/Makefile
|
||||||
etc/shadow-maint/Makefile
|
etc/shadow-maint/Makefile
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# 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
|
|
||||||
@@ -1,508 +0,0 @@
|
|||||||
# 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@
|
|
||||||
|
|
||||||
# This is a dummy Makefile.am to get automake work flawlessly,
|
|
||||||
# and also cooperate to make a distribution for `make dist'
|
|
||||||
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 = contrib
|
|
||||||
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 README
|
|
||||||
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@
|
|
||||||
FILECMD = @FILECMD@
|
|
||||||
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@
|
|
||||||
EXTRA_DIST = README adduser.c adduser.sh adduser2.sh
|
|
||||||
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 contrib/Makefile'; \
|
|
||||||
$(am__cd) $(top_srcdir) && \
|
|
||||||
$(AUTOMAKE) --foreign contrib/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:
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
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.
|
|
||||||
|
|
||||||
udbachk.tgz is a passwd/group/shadow file integrity checker.
|
|
||||||
|
|
||||||
--marekm
|
|
||||||
@@ -1,502 +0,0 @@
|
|||||||
/****
|
|
||||||
** 04/21/96
|
|
||||||
** hacked even more, replaced gets() with something slightly harder to buffer
|
|
||||||
** overflow. Added support for setting a default quota on new account, with
|
|
||||||
** edquota -p. Other cleanups for security, I let some users run adduser suid
|
|
||||||
** root to add new accounts. (overflow checks, clobber environment, valid
|
|
||||||
** shell checks, restrictions on gid + home dir settings).
|
|
||||||
|
|
||||||
** Added max. username length. Used syslog() a bit for important events.
|
|
||||||
** Support to immediately expire account with passwd -e.
|
|
||||||
|
|
||||||
** Called it version 2.0! Because I felt like it!
|
|
||||||
|
|
||||||
** -- Chris, chris@ferret.lmh.ox.ac.uk
|
|
||||||
|
|
||||||
** 03/17/96
|
|
||||||
** hacked a bit more, removed unused code, cleaned up for gcc -Wall.
|
|
||||||
** --marekm
|
|
||||||
**
|
|
||||||
** 02/26/96
|
|
||||||
** modified to call shadow utils (useradd,chage,passwd) on shadowed
|
|
||||||
** systems - Cristian Gafton, gafton@sorosis.ro
|
|
||||||
**
|
|
||||||
** 6/27/95
|
|
||||||
** shadow-adduser 1.4:
|
|
||||||
**
|
|
||||||
** now it copies the /etc/skel dir into the person's dir,
|
|
||||||
** makes the mail folders, changed some defaults and made a 'make
|
|
||||||
** install' just for the hell of it.
|
|
||||||
**
|
|
||||||
** Greg Gallagher
|
|
||||||
** CIN.Net
|
|
||||||
**
|
|
||||||
** 1/28/95
|
|
||||||
** shadow-adduser 1.3:
|
|
||||||
**
|
|
||||||
** Basically a bug-fix on my additions in 1.2. Thanks to Terry Stewart
|
|
||||||
** (stew@texas.net) for pointing out one of the many idiotic bugs I introduced.
|
|
||||||
** It was such a stupid bug that I would have never seen it myself.
|
|
||||||
**
|
|
||||||
** Brandon
|
|
||||||
*****
|
|
||||||
** 01/27/95
|
|
||||||
**
|
|
||||||
** shadow-adduser 1.2:
|
|
||||||
** I took the C source from adduser-shadow (credits are below) and made
|
|
||||||
** it a little more worthwhile. Many small changes... Here's
|
|
||||||
** the ones I can remember:
|
|
||||||
**
|
|
||||||
** Removed support for non-shadowed systems (if you don't have shadow,
|
|
||||||
** use the original adduser, don't get this shadow version!)
|
|
||||||
** Added support for the correct /etc/shadow fields (Min days before
|
|
||||||
** password change, max days before password change, Warning days,
|
|
||||||
** and how many days from expiry date does the account go invalid)
|
|
||||||
** The previous version just left all of those fields blank.
|
|
||||||
** There is still one field left (expiry date for the account, period)
|
|
||||||
** which I have left blank because I do not use it and didn't want to
|
|
||||||
** spend any more time on this. I'm sure someone will put it in and
|
|
||||||
** tack another plethora of credits on here. :)
|
|
||||||
** 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 their initial password forever ;)
|
|
||||||
** The number is in days since Jan 1st, 1970.
|
|
||||||
**
|
|
||||||
** Have fun with it, and someone please make
|
|
||||||
** a real version(this is still just a hack)
|
|
||||||
** for us all to use (and Email it to me???)
|
|
||||||
**
|
|
||||||
** Brandon
|
|
||||||
** photon@usis.com
|
|
||||||
**
|
|
||||||
*****
|
|
||||||
** adduser 1.0: add a new user account (For systems not using shadow)
|
|
||||||
** With a nice little interface and a will to do all the work for you.
|
|
||||||
**
|
|
||||||
** Craig Hagan
|
|
||||||
** hagan@opine.cs.umass.edu
|
|
||||||
**
|
|
||||||
** Modified to really work, look clean, and find unused uid by Chris Cappuccio
|
|
||||||
** chris@slinky.cs.umass.edu
|
|
||||||
**
|
|
||||||
*****
|
|
||||||
**
|
|
||||||
** 01/19/95
|
|
||||||
**
|
|
||||||
** FURTHER modifications to enable shadow passwd support (kludged, but
|
|
||||||
** no more so than the original) by Dan Crowson - dcrowson@mo.net
|
|
||||||
**
|
|
||||||
** Search on DAN for all changes...
|
|
||||||
**
|
|
||||||
*****
|
|
||||||
**
|
|
||||||
** cc -O -o adduser adduser.c
|
|
||||||
** Use gcc if you have it... (political reasons beyond my control) (chris)
|
|
||||||
**
|
|
||||||
** I've gotten this program to work with success under Linux (without
|
|
||||||
** shadow) and SunOS 4.1.3. I would assume it should work pretty well
|
|
||||||
** on any system that uses no shadow. (chris)
|
|
||||||
**
|
|
||||||
** If you have no crypt() then try
|
|
||||||
** cc -DNO_CRYPT -O -o adduser adduser.c xfdes.c
|
|
||||||
** I'm not sure how login operates with no crypt()... I guess
|
|
||||||
** the same way we're doing it here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <grp.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/timeb.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <syslog.h>
|
|
||||||
|
|
||||||
#define IMMEDIATE_CHANGE /* Expire newly created password, must be changed
|
|
||||||
* immediately upon next login */
|
|
||||||
#define HAVE_QUOTAS /* Obvious */
|
|
||||||
#define EXPIRE_VALS_SET /* If defined, 'normal' users can't change
|
|
||||||
* password expiry values (if running suid root) */
|
|
||||||
|
|
||||||
#define HAVE_GETUSERSHELL /* FIXME: Isn't this defined in config.h too? */
|
|
||||||
#define LOGGING /* If we want to log various things to syslog */
|
|
||||||
#define MAX_USRNAME 8 /* Longer usernames seem to work on my system....
|
|
||||||
* But they're probably a poor idea */
|
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_SHELL "/bin/bash" /* because BASH is your friend */
|
|
||||||
#define DEFAULT_HOME "/home"
|
|
||||||
#define USERADD_PATH "/usr/sbin/useradd"
|
|
||||||
#define CHAGE_PATH "/usr/bin/chage"
|
|
||||||
#define PASSWD_PATH "/usr/bin/passwd"
|
|
||||||
#define EDQUOTA_PATH "/usr/sbin/edquota"
|
|
||||||
#define QUOTA_DEFAULT "defuser"
|
|
||||||
#define DEFAULT_GROUP 100
|
|
||||||
|
|
||||||
#define DEFAULT_MIN_PASS 0
|
|
||||||
#define DEFAULT_MAX_PASS 100
|
|
||||||
#define DEFAULT_WARN_PASS 14
|
|
||||||
#define DEFAULT_USER_DIE 366
|
|
||||||
|
|
||||||
void safeget (char *, int);
|
|
||||||
|
|
||||||
void
|
|
||||||
main (void)
|
|
||||||
{
|
|
||||||
char foo[32];
|
|
||||||
char usrname[32], person[32], dir[32], shell[32];
|
|
||||||
unsigned int group, min_pass, max_pass, warn_pass, user_die;
|
|
||||||
/* the group and uid of the new user */
|
|
||||||
int bad = 0, done = 0, correct = 0, olduid;
|
|
||||||
char cmd[255];
|
|
||||||
struct group *grp;
|
|
||||||
|
|
||||||
/* flags, in order:
|
|
||||||
* bad to see if the username is in /etc/passwd, or if strange stuff has
|
|
||||||
* been typed if the user might be put in group 0
|
|
||||||
* done allows the program to exit when a user has been added
|
|
||||||
* correct loops until a username is found that isn't in /etc/passwd
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* The real program starts HERE! */
|
|
||||||
|
|
||||||
if (geteuid () != 0)
|
|
||||||
{
|
|
||||||
printf ("It seems you don't have access to add a new user. Try\n");
|
|
||||||
printf ("logging in as root or su root to gain superuser access.\n");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sanity checks
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef LOGGING
|
|
||||||
openlog ("adduser", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH);
|
|
||||||
syslog (LOG_INFO, "invoked by user %s\n", getpwuid (getuid ())->pw_name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(grp = getgrgid (DEFAULT_GROUP)))
|
|
||||||
{
|
|
||||||
printf ("Error: the default group %d does not exist on this system!\n",
|
|
||||||
DEFAULT_GROUP);
|
|
||||||
printf ("adduser must be recompiled.\n");
|
|
||||||
#ifdef LOGGING
|
|
||||||
syslog (LOG_ERR, "warning: failed. no such default group\n");
|
|
||||||
closelog ();
|
|
||||||
#endif
|
|
||||||
exit (1);
|
|
||||||
};
|
|
||||||
|
|
||||||
while (!correct)
|
|
||||||
{ /* loop until a "good" usrname is chosen */
|
|
||||||
while (!done)
|
|
||||||
{
|
|
||||||
printf ("\nLogin to add (^C to quit): ");
|
|
||||||
fflush (stdout);
|
|
||||||
|
|
||||||
safeget (usrname, sizeof (usrname));
|
|
||||||
|
|
||||||
if (!strlen (usrname))
|
|
||||||
{
|
|
||||||
printf ("Empty input.\n");
|
|
||||||
done = 0;
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* what I saw here before made me think maybe I was running DOS */
|
|
||||||
/* might this be a solution? (chris) */
|
|
||||||
if (strlen (usrname) > MAX_USRNAME)
|
|
||||||
{
|
|
||||||
printf ("That name is longer than the maximum of %d characters. Choose another.\n", MAX_USRNAME);
|
|
||||||
done = 0;
|
|
||||||
}
|
|
||||||
else if (getpwnam (usrname) != NULL)
|
|
||||||
{
|
|
||||||
printf ("That name is in use, choose another.\n");
|
|
||||||
done = 0;
|
|
||||||
}
|
|
||||||
else if (strchr (usrname, ' ') != NULL)
|
|
||||||
{
|
|
||||||
printf ("No spaces in username!!\n");
|
|
||||||
done = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
done = 1;
|
|
||||||
}; /* done, we have a valid new user name */
|
|
||||||
|
|
||||||
/* all set, get the rest of the stuff */
|
|
||||||
printf ("\nEditing information for new user [%s]\n", usrname);
|
|
||||||
|
|
||||||
printf ("\nFull Name [%s]: ", usrname);
|
|
||||||
fflush (stdout);
|
|
||||||
safeget (person, sizeof (person));
|
|
||||||
if (!strlen (person))
|
|
||||||
{
|
|
||||||
bzero (person, sizeof (person));
|
|
||||||
strcpy (person, usrname);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (getuid () == 0)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
bad = 0;
|
|
||||||
printf ("GID [%d]: ", DEFAULT_GROUP);
|
|
||||||
fflush (stdout);
|
|
||||||
safeget (foo, sizeof (foo));
|
|
||||||
if (!strlen (foo))
|
|
||||||
group = DEFAULT_GROUP;
|
|
||||||
else if (isdigit (*foo))
|
|
||||||
{
|
|
||||||
group = atoi (foo);
|
|
||||||
if (!(grp = getgrgid (group)))
|
|
||||||
{
|
|
||||||
printf ("unknown gid %s\n", foo);
|
|
||||||
group = DEFAULT_GROUP;
|
|
||||||
bad = 1;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else if ((grp = getgrnam (foo)))
|
|
||||||
group = grp->gr_gid;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf ("unknown group %s\n", foo);
|
|
||||||
group = DEFAULT_GROUP;
|
|
||||||
bad = 1;
|
|
||||||
}
|
|
||||||
if (group == 0)
|
|
||||||
{ /* You're not allowed to make root group users! */
|
|
||||||
printf ("Creation of root group users not allowed (must be done by hand)\n");
|
|
||||||
group = DEFAULT_GROUP;
|
|
||||||
bad = 1;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
while (bad);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf ("Group will be default of: %d\n", DEFAULT_GROUP);
|
|
||||||
group = DEFAULT_GROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getuid () == 0)
|
|
||||||
{
|
|
||||||
printf ("\nIf home dir ends with a / then '%s' will be appended to it\n", usrname);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
else if (dir[strlen (dir) - 1] == '/')
|
|
||||||
sprintf (dir+strlen(dir), "%s", usrname);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf ("\nHome directory will be %s/%s\n", DEFAULT_HOME, usrname);
|
|
||||||
sprintf (dir, "%s/%s", DEFAULT_HOME, usrname);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf ("\nShell [%s]: ", DEFAULT_SHELL);
|
|
||||||
fflush (stdout);
|
|
||||||
safeget (shell, sizeof (shell));
|
|
||||||
if (!strlen (shell))
|
|
||||||
sprintf (shell, "%s", DEFAULT_SHELL);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *sh;
|
|
||||||
int ok = 0;
|
|
||||||
#ifdef HAVE_GETUSERSHELL
|
|
||||||
setusershell ();
|
|
||||||
while ((sh = getusershell ()) != NULL)
|
|
||||||
if (!strcmp (shell, sh))
|
|
||||||
ok = 1;
|
|
||||||
endusershell ();
|
|
||||||
#endif
|
|
||||||
if (!ok)
|
|
||||||
{
|
|
||||||
if (getuid () == 0)
|
|
||||||
printf ("Warning: root allowed non standard shell\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf ("Shell NOT in /etc/shells, DEFAULT used\n");
|
|
||||||
sprintf (shell, "%s", DEFAULT_SHELL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef EXPIRE_VALS_SET
|
|
||||||
if (getuid () == 0)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
printf ("\nMin. Password Change Days [%d]: ", DEFAULT_MIN_PASS);
|
|
||||||
fflush (stdout);
|
|
||||||
safeget (foo, sizeof (foo));
|
|
||||||
if (strlen (foo) > 1)
|
|
||||||
min_pass = DEFAULT_MIN_PASS;
|
|
||||||
else
|
|
||||||
min_pass = atoi (foo);
|
|
||||||
|
|
||||||
printf ("Max. Password Change Days [%d]: ", DEFAULT_MAX_PASS);
|
|
||||||
fflush (stdout);
|
|
||||||
safeget (foo, sizeof (foo));
|
|
||||||
if (strlen (foo) > 1)
|
|
||||||
max_pass = atoi (foo);
|
|
||||||
else
|
|
||||||
max_pass = DEFAULT_MAX_PASS;
|
|
||||||
|
|
||||||
printf ("Password Warning Days [%d]: ", DEFAULT_WARN_PASS);
|
|
||||||
fflush (stdout);
|
|
||||||
safeget (foo, sizeof (foo));
|
|
||||||
warn_pass = atoi (foo);
|
|
||||||
if (warn_pass == 0)
|
|
||||||
|
|
||||||
warn_pass = DEFAULT_WARN_PASS;
|
|
||||||
|
|
||||||
printf ("Days after Password Expiry for Account Locking [%d]: ", DEFAULT_USER_DIE);
|
|
||||||
fflush (stdout);
|
|
||||||
safeget (foo, sizeof (foo));
|
|
||||||
user_die = atoi (foo);
|
|
||||||
if (user_die == 0)
|
|
||||||
user_die = DEFAULT_USER_DIE;
|
|
||||||
|
|
||||||
#ifdef EXPIRE_VALS_SET
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf ("\nSorry, account expiry values are set.\n");
|
|
||||||
user_die = DEFAULT_USER_DIE;
|
|
||||||
warn_pass = DEFAULT_WARN_PASS;
|
|
||||||
max_pass = DEFAULT_MAX_PASS;
|
|
||||||
min_pass = DEFAULT_MIN_PASS;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf ("\nInformation for new user [%s] [%s]:\n", usrname, person);
|
|
||||||
printf ("Home directory: [%s] Shell: [%s]\n", dir, shell);
|
|
||||||
printf ("GID: [%d]\n", group);
|
|
||||||
printf ("MinPass: [%d] MaxPass: [%d] WarnPass: [%d] UserExpire: [%d]\n",
|
|
||||||
min_pass, max_pass, warn_pass, user_die);
|
|
||||||
printf ("\nIs this correct? [y/N]: ");
|
|
||||||
fflush (stdout);
|
|
||||||
safeget (foo, sizeof (foo));
|
|
||||||
|
|
||||||
done = bad = correct = (foo[0] == 'y' || foo[0] == 'Y');
|
|
||||||
|
|
||||||
if (bad != 1)
|
|
||||||
printf ("\nUser [%s] not added\n", usrname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clobber the environment, I run this suid root sometimes to let
|
|
||||||
* non root privileged accounts add users --chris */
|
|
||||||
|
|
||||||
*environ = NULL;
|
|
||||||
|
|
||||||
bzero (cmd, sizeof (cmd));
|
|
||||||
sprintf (cmd, "%s -g %d -d %s -s %s -c \"%s\" -m -k /etc/skel %s",
|
|
||||||
USERADD_PATH, group, dir, shell, person, usrname);
|
|
||||||
printf ("Calling useradd to add new user:\n%s\n", cmd);
|
|
||||||
if (system (cmd))
|
|
||||||
{
|
|
||||||
printf ("User add failed!\n");
|
|
||||||
#ifdef LOGGING
|
|
||||||
syslog (LOG_ERR, "could not add new user\n");
|
|
||||||
closelog ();
|
|
||||||
#endif
|
|
||||||
exit (errno);
|
|
||||||
};
|
|
||||||
|
|
||||||
olduid = getuid (); /* chage, passwd, edquota etc. require ruid = root
|
|
||||||
*/
|
|
||||||
setuid (0);
|
|
||||||
|
|
||||||
bzero (cmd, sizeof (cmd));
|
|
||||||
|
|
||||||
/* Chage runs suid root. => we need ruid root to run it with
|
|
||||||
* anything other than chage -l
|
|
||||||
*/
|
|
||||||
|
|
||||||
sprintf (cmd, "%s -m %d -M %d -W %d -I %d %s", CHAGE_PATH,
|
|
||||||
min_pass, max_pass, warn_pass, user_die, usrname);
|
|
||||||
printf ("%s\n", cmd);
|
|
||||||
if (system (cmd))
|
|
||||||
{
|
|
||||||
printf ("There was an error setting password expire values\n");
|
|
||||||
#ifdef LOGGING
|
|
||||||
syslog (LOG_ERR, "password expire values could not be set\n");
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/* I want to add a user completely with one easy command --chris */
|
|
||||||
|
|
||||||
#ifdef HAVE_QUOTAS
|
|
||||||
bzero (cmd, sizeof (cmd));
|
|
||||||
sprintf (cmd, "%s -p %s -u %s", EDQUOTA_PATH, QUOTA_DEFAULT, usrname);
|
|
||||||
printf ("%s\n", cmd);
|
|
||||||
if (system (cmd))
|
|
||||||
{
|
|
||||||
printf ("\nWarning: error setting quota\n");
|
|
||||||
#ifdef LOGGING
|
|
||||||
syslog (LOG_ERR, "warning: account created but NO quotas set!\n");
|
|
||||||
#endif /* LOGGING */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf ("\nDefault quota set.\n");
|
|
||||||
#endif /* HAVE_QUOTAS */
|
|
||||||
|
|
||||||
bzero (cmd, sizeof (cmd));
|
|
||||||
sprintf (cmd, "%s %s", PASSWD_PATH, usrname);
|
|
||||||
if (system (cmd))
|
|
||||||
{
|
|
||||||
printf ("\nWarning: error setting password\n");
|
|
||||||
#ifdef LOGGING
|
|
||||||
syslog (LOG_ERR, "warning: password set failed!\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef IMMEDIATE_CHANGE
|
|
||||||
bzero (cmd, sizeof (cmd));
|
|
||||||
sprintf (cmd, "%s -e %s", PASSWD_PATH, usrname);
|
|
||||||
if (system (cmd))
|
|
||||||
{
|
|
||||||
printf ("\nWarning: error expiring password\n");
|
|
||||||
#ifdef LOGGING
|
|
||||||
syslog (LOG_ERR, "warning: password expire failed!\n");
|
|
||||||
#endif /* LOGGING */
|
|
||||||
}
|
|
||||||
#endif /* IMMEDIATE_CHANGE */
|
|
||||||
|
|
||||||
setuid (olduid);
|
|
||||||
|
|
||||||
#ifdef LOGGING
|
|
||||||
closelog ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf ("\nDone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
safeget (char *buf, int maxlen)
|
|
||||||
{
|
|
||||||
int c, i = 0, bad = 0;
|
|
||||||
char *bstart = buf;
|
|
||||||
while ((c = getc (stdin)) != EOF && (c != '\n') && (++i < maxlen))
|
|
||||||
{
|
|
||||||
bad = (!isalnum (c) && (c != '_') && (c != ' '));
|
|
||||||
*(buf++) = c;
|
|
||||||
}
|
|
||||||
*buf = '\0';
|
|
||||||
|
|
||||||
if (bad)
|
|
||||||
{
|
|
||||||
printf ("\nString contained banned character. Please stick to alphanumerics.\n");
|
|
||||||
*bstart = '\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# adduser script for use with shadow passwords and useradd command.
|
|
||||||
# by Hrvoje Dogan <hdogan@student.math.hr>, Dec 1995.
|
|
||||||
|
|
||||||
echo -n "Login name for new user []:"
|
|
||||||
read LOGIN
|
|
||||||
if [ -z $LOGIN ]
|
|
||||||
then echo "Come on, man, you can't leave the login field empty...";exit
|
|
||||||
fi
|
|
||||||
echo
|
|
||||||
echo -n "User id for $LOGIN [ defaults to next available]:"
|
|
||||||
read ID
|
|
||||||
GUID="-u $ID"
|
|
||||||
if [ -z $ID ]
|
|
||||||
then GUID=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo -n "Initial group for $LOGIN [users]:"
|
|
||||||
read GID
|
|
||||||
GGID="-g $GID"
|
|
||||||
if [ -z $GID ]
|
|
||||||
then GGID=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo -n "Additional groups for $LOGIN []:"
|
|
||||||
read AGID
|
|
||||||
GAGID="-G $AGID"
|
|
||||||
if [ -z $AGID ]
|
|
||||||
then GAGID=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo -n "$LOGIN's home directory [/home/$LOGIN]:"
|
|
||||||
read HME
|
|
||||||
GHME="-d $HME"
|
|
||||||
if [ -z $HME ]
|
|
||||||
then GHME=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo -n "$LOGIN's shell [/bin/bash]:"
|
|
||||||
read SHL
|
|
||||||
GSHL="-s $SHL"
|
|
||||||
if [ -z $SHL ]
|
|
||||||
then GSHL=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo -n "$LOGIN's account expiry date (MM/DD/YY) []:"
|
|
||||||
read EXP
|
|
||||||
GEXP="-e $EXP"
|
|
||||||
if [ -z $EXP ]
|
|
||||||
then GEXP=""
|
|
||||||
fi
|
|
||||||
echo
|
|
||||||
echo OK, I'm about to make a new account. Here's what you entered so far:
|
|
||||||
echo New login name: $LOGIN
|
|
||||||
if [ -z $GUID ]
|
|
||||||
then echo New UID: [Next available]
|
|
||||||
else echo New UID: $UID
|
|
||||||
fi
|
|
||||||
if [ -z $GGID ]
|
|
||||||
then echo Initial group: users
|
|
||||||
else echo Initial group: $GID
|
|
||||||
fi
|
|
||||||
if [ -z $GAGID ]
|
|
||||||
then echo Additional groups: [none]
|
|
||||||
else echo Additional groups: $AGID
|
|
||||||
fi
|
|
||||||
if [ -z $GHME ]
|
|
||||||
then echo Home directory: /home/$LOGIN
|
|
||||||
else echo Home directory: $HME
|
|
||||||
fi
|
|
||||||
if [ -z $GSHL ]
|
|
||||||
then echo Shell: /bin/bash
|
|
||||||
else echo Shell: $SHL
|
|
||||||
fi
|
|
||||||
if [ -z $GEXP ]
|
|
||||||
then echo Expiry date: [no expiration]
|
|
||||||
else echo Expiry date: $EXP
|
|
||||||
fi
|
|
||||||
echo "This is it... if you want to bail out, you'd better do it now."
|
|
||||||
read FOO
|
|
||||||
echo Making new account...
|
|
||||||
/usr/sbin/useradd $GHME -m $GEXP $GGID $GAGID $GSHL $GUID $LOGIN
|
|
||||||
/usr/bin/chfn $LOGIN
|
|
||||||
/usr/bin/passwd $LOGIN
|
|
||||||
echo "Done..."
|
|
||||||
@@ -1,743 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# adduser Interactive user adding program.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1996 Petri Mattila, Prihateam Networks
|
|
||||||
# petri@prihateam.fi
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# Changes:
|
|
||||||
# 220496 v0.01 Initial version
|
|
||||||
# 230496 v0.02 More checks, embolden summary
|
|
||||||
# 240496 Even more checks
|
|
||||||
# 250496 Help with ?
|
|
||||||
# 040596 v0.03 Cleanups
|
|
||||||
# 050596 v0.04 Bug fixes, expire date checks
|
|
||||||
# 070596 v0.05 Iso-latin-1 names
|
|
||||||
#
|
|
||||||
|
|
||||||
## Defaults
|
|
||||||
|
|
||||||
# default groups
|
|
||||||
def_group="users"
|
|
||||||
def_other_groups=""
|
|
||||||
|
|
||||||
# default home directory
|
|
||||||
def_home_dir=/home/users
|
|
||||||
|
|
||||||
# default shell
|
|
||||||
def_shell=/bin/tcsh
|
|
||||||
|
|
||||||
# Default expiration date (mm/dd/yy)
|
|
||||||
def_expire=""
|
|
||||||
|
|
||||||
# default dates
|
|
||||||
def_pwd_min=0
|
|
||||||
def_pwd_max=90
|
|
||||||
def_pwd_warn=14
|
|
||||||
def_pwd_iact=14
|
|
||||||
|
|
||||||
|
|
||||||
# possible UIDs
|
|
||||||
uid_low=1000
|
|
||||||
uid_high=64000
|
|
||||||
|
|
||||||
# skel directory
|
|
||||||
skel=/etc/skel
|
|
||||||
|
|
||||||
# default mode for home directory
|
|
||||||
def_mode=711
|
|
||||||
|
|
||||||
# Regex, that the login name must meet, only ANSI characters
|
|
||||||
login_regex='^[0-9a-zA-Z_-]*$'
|
|
||||||
|
|
||||||
# Regex, that the user name must meet
|
|
||||||
# ANSI version
|
|
||||||
##name_regex='^[0-9a-zA-Z_-\ ]*$'
|
|
||||||
# ISO-LATIN-1 version
|
|
||||||
name_regex='^[0-9a-zA-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöùúûüýþÿ_-\ ]*$'
|
|
||||||
|
|
||||||
# set PATH
|
|
||||||
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
|
|
||||||
|
|
||||||
# Some special characters
|
|
||||||
case "$TERM" in
|
|
||||||
vt*|ansi*|con*|xterm*|linux*)
|
|
||||||
S='[1m' # start embolden
|
|
||||||
E='[m' # end embolden
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
S=''
|
|
||||||
E=''
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
## Functions
|
|
||||||
|
|
||||||
check_root() {
|
|
||||||
if test "$EUID" -ne 0
|
|
||||||
then
|
|
||||||
echo "You must be root to run this program."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_user() {
|
|
||||||
local usr pwd uid gid name home sh
|
|
||||||
|
|
||||||
cat /etc/passwd | (
|
|
||||||
while IFS=":" read usr pwd uid gid name home sh
|
|
||||||
do
|
|
||||||
if test "$1" = "${usr}"
|
|
||||||
then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
check_group() {
|
|
||||||
local read grp pwd gid members
|
|
||||||
|
|
||||||
cat /etc/group | (
|
|
||||||
while IFS=":" read grp pwd gid members
|
|
||||||
do
|
|
||||||
if test "$1" = "${grp}"
|
|
||||||
then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
check_other_groups() {
|
|
||||||
local grp check IFS
|
|
||||||
|
|
||||||
check="$1"
|
|
||||||
IFS=","
|
|
||||||
|
|
||||||
set ${check}
|
|
||||||
for grp
|
|
||||||
do
|
|
||||||
if check_group "${grp}"
|
|
||||||
then
|
|
||||||
echo "Group ${grp} does not exist."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
check_uid() {
|
|
||||||
local usr pwd uid gid name home sh
|
|
||||||
|
|
||||||
cat /etc/passwd | (
|
|
||||||
while IFS=":" read usr pwd uid gid name home sh
|
|
||||||
do
|
|
||||||
if test "$1" = "${uid}"
|
|
||||||
then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
read_yn() {
|
|
||||||
local ans ynd
|
|
||||||
|
|
||||||
ynd="$1"
|
|
||||||
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
read ans
|
|
||||||
case "${ans}" in
|
|
||||||
"") return ${ynd} ;;
|
|
||||||
[nN]) return 1 ;;
|
|
||||||
[yY]) return 0 ;;
|
|
||||||
*) echo -n "Y or N, please ? " ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_login() {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -n "Login: ${def_login:+[${def_login}] }"
|
|
||||||
read login
|
|
||||||
|
|
||||||
if test "${login}" = '?'
|
|
||||||
then
|
|
||||||
less /etc/passwd
|
|
||||||
echo
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "${login}" -a -n "${def_login}"
|
|
||||||
then
|
|
||||||
login="${def_login}"
|
|
||||||
echo "Using ${login}"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "${#login}" -gt 8
|
|
||||||
then
|
|
||||||
echo "Login must be at most 8 characters long"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "${#login}" -lt 2
|
|
||||||
then
|
|
||||||
echo "Login must be at least 2 characters long"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expr "${login}" : "${login_regex}" &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use letters, numbers and special characters _-,."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! check_user "${login}"
|
|
||||||
then
|
|
||||||
echo "Username ${login} is already in use"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_login="${login}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_name () {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -n "Real name: ${def_name:+[${def_name}] }"
|
|
||||||
read name
|
|
||||||
|
|
||||||
if test "${name}" = '?'
|
|
||||||
then
|
|
||||||
less /etc/passwd
|
|
||||||
echo
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "${name}" -a -n "${def_name}"
|
|
||||||
then
|
|
||||||
name="${def_name}"
|
|
||||||
echo "Using ${name}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "${#name}" -gt 32
|
|
||||||
then
|
|
||||||
echo "Name should be at most 32 characters long"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expr "${name}" : "${name_regex}" &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use letters, numbers, spaces and special characters ,._-"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_name="${name}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_home() {
|
|
||||||
local x
|
|
||||||
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -n "Home Directory: [${def_home_dir}/${login}] "
|
|
||||||
read home
|
|
||||||
|
|
||||||
if test -z "${home}"
|
|
||||||
then
|
|
||||||
home="${def_home_dir}/${login}"
|
|
||||||
echo "Using ${home}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expr "${home}" : '^[0-9a-zA-Z,._-\/]*$' &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use letters, numbers, spaces and special characters ,._-/"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
x="$(basename ${home})"
|
|
||||||
if test "${x}" != "${login}"
|
|
||||||
then
|
|
||||||
echo "Warning: you are about to use different login name and home directory."
|
|
||||||
fi
|
|
||||||
|
|
||||||
x="$(dirname ${home})"
|
|
||||||
if ! test -d "${x}"
|
|
||||||
then
|
|
||||||
echo "Directory ${x} does not exist."
|
|
||||||
echo "If you still want to use it, please make it manually."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_home_dir="${x}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_shell () {
|
|
||||||
local x
|
|
||||||
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -n "Shell: [${def_shell}] "
|
|
||||||
read shell
|
|
||||||
|
|
||||||
if test -z "${shell}"
|
|
||||||
then
|
|
||||||
shell="${def_shell}"
|
|
||||||
echo "Using ${shell}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for x in $(cat /etc/shells)
|
|
||||||
do
|
|
||||||
if test "${x}" = "${shell}"
|
|
||||||
then
|
|
||||||
def_shell="${shell}"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Possible shells are:"
|
|
||||||
cat /etc/shells
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_group () {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -n "Group: [${def_group}] "
|
|
||||||
read group
|
|
||||||
|
|
||||||
if test -z "${group}"
|
|
||||||
then
|
|
||||||
group="${def_group}"
|
|
||||||
echo "Using ${group}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "${group}" = '?'
|
|
||||||
then
|
|
||||||
less /etc/group
|
|
||||||
echo
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if check_group "${group}"
|
|
||||||
then
|
|
||||||
echo "Group ${group} does not exist."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_group="${group}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_other_groups () {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -n "Other groups: [${def_og:-none}] "
|
|
||||||
read other_groups
|
|
||||||
|
|
||||||
if test "${other_groups}" = '?'
|
|
||||||
then
|
|
||||||
less /etc/group
|
|
||||||
echo
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "${other_groups}"
|
|
||||||
then
|
|
||||||
if test -n "${def_og}"
|
|
||||||
then
|
|
||||||
other_groups="${def_og}"
|
|
||||||
echo "Using ${other_groups}"
|
|
||||||
else
|
|
||||||
echo "No other groups"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if ! check_other_groups "${other_groups}"
|
|
||||||
then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_og="${other_groups}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_uid () {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -n "uid: [first free] "
|
|
||||||
read uid
|
|
||||||
|
|
||||||
if test -z "${uid}"
|
|
||||||
then
|
|
||||||
echo "Using first free UID."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "${uid}" = '?'
|
|
||||||
then
|
|
||||||
less /etc/passwd
|
|
||||||
echo
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expr "${uid}" : '^[0-9]+$' &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use numbers only."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if test "${uid}" -lt "${uid_low}"
|
|
||||||
then
|
|
||||||
echo "UID must be greater than ${uid_low}"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if test "${uid}" -gt "${uid_high}"
|
|
||||||
then
|
|
||||||
echo "UID must be smaller than ${uid_high}"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if ! check_uid "${uid}"
|
|
||||||
then
|
|
||||||
echo "UID ${uid} is already in use"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_max_valid_days() {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -en "Maximum days between password changes: [${def_pwd_max}] "
|
|
||||||
read max_days
|
|
||||||
|
|
||||||
if test -z "${max_days}"
|
|
||||||
then
|
|
||||||
max_days="${def_pwd_max}"
|
|
||||||
echo "Using ${max_days}"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expr "${max_days}" : '^[0-9]+$' &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use numbers only."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if test "${max_days}" -lt 7
|
|
||||||
then
|
|
||||||
echo "Warning: you are using a value shorter than a week."
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_pwd_max="${max_days}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_min_valid_days() {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -en "Minimum days between password changes: [${def_pwd_min}] "
|
|
||||||
read min_days
|
|
||||||
|
|
||||||
if test -z "${min_days}"
|
|
||||||
then
|
|
||||||
min_days="${def_pwd_min}"
|
|
||||||
echo "Using ${min_days}"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expr "${min_days}" : '^[0-9]+$' &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use numbers only."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if test "${min_days}" -gt 7
|
|
||||||
then
|
|
||||||
echo "Warning: you are using a value longer than a week."
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_pwd_min="${min_days}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_warning_days() {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -en "Number of warning days before password expires: [${def_pwd_warn}] "
|
|
||||||
read warn_days
|
|
||||||
|
|
||||||
if test -z "${warn_days}"
|
|
||||||
then
|
|
||||||
warn_days="${def_pwd_warn}"
|
|
||||||
echo "Using ${warn_days}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expr "${warn_days}" : '^[0-9]+$' &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use numbers only."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if test "${warn_days}" -gt 14
|
|
||||||
then
|
|
||||||
echo "Warning: you are using a value longer than two week."
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_pwd_warn="${warn_days}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
read_inactive_days() {
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -en "Number of usable days after expiration: [${def_pwd_iact}] "
|
|
||||||
read iact_days
|
|
||||||
|
|
||||||
if test -z "${iact_days}"
|
|
||||||
then
|
|
||||||
iact_days="${def_pwd_iact}"
|
|
||||||
echo "Using ${iact_days}"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if ! expr "${iact_days}" : '^[0-9]+$' &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use numbers only."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if test "${iact_days}" -gt 14
|
|
||||||
then
|
|
||||||
echo "Warning: you are using a value that is more than two weeks."
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_pwd_iact="${iact_days}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_expire_date() {
|
|
||||||
local ans
|
|
||||||
|
|
||||||
echo
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
echo -en "Expire date of this account (mm/dd/yy): [${def_expire:-never}] "
|
|
||||||
read ans
|
|
||||||
|
|
||||||
if test -z "${ans}"
|
|
||||||
then
|
|
||||||
if test -z "${def_expire}"
|
|
||||||
then
|
|
||||||
ans="never"
|
|
||||||
else
|
|
||||||
ans="${def_expire}"
|
|
||||||
echo "Using ${def_expire}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "${ans}" = "never"
|
|
||||||
then
|
|
||||||
echo "Account will never expire."
|
|
||||||
def_expire=""
|
|
||||||
expire=""
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expr "${ans}" : '^[0-9][0-9]/[0-9][0-9]/[0-9][0-9]$' &> /dev/null
|
|
||||||
then
|
|
||||||
echo "Please use format mm/dd/yy"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! expire_date="$(date -d ${ans} '+%A, %B %d %Y')"
|
|
||||||
then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
def_expire="${expire}"
|
|
||||||
return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read_passwd_yn() {
|
|
||||||
echo -en "\nDo you want to set password [Y/n] ? "
|
|
||||||
if read_yn 0
|
|
||||||
then
|
|
||||||
set_pwd="YES"
|
|
||||||
else
|
|
||||||
set_pwd=""
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print_values() {
|
|
||||||
|
|
||||||
clear
|
|
||||||
cat << EOM
|
|
||||||
|
|
||||||
Login: ${S}${login}${E}
|
|
||||||
Group: ${S}${group}${E}
|
|
||||||
Other groups: ${S}${other_groups:-[none]}${E}
|
|
||||||
|
|
||||||
Real Name: ${S}${name}${E}
|
|
||||||
|
|
||||||
uid: ${S}${uid:-[first free]}${E}
|
|
||||||
home: ${S}${home}${E}
|
|
||||||
shell: ${S}${shell}${E}
|
|
||||||
|
|
||||||
Account expiration date: ${S}${expire_date:-never}${E}
|
|
||||||
Minimum days between password changes: ${S}${min_days}${E}
|
|
||||||
Maximum days between password changes: ${S}${max_days}${E}
|
|
||||||
Number of usable days after expiration: ${S}${iact_days}${E}
|
|
||||||
Number of warning days before expiration: ${S}${warn_days}${E}
|
|
||||||
|
|
||||||
${S}${set_pwd:+Set password for this account.}${E}
|
|
||||||
|
|
||||||
EOM
|
|
||||||
}
|
|
||||||
|
|
||||||
set_user() {
|
|
||||||
if ! useradd \
|
|
||||||
-c "${name}" \
|
|
||||||
-d "${home}" \
|
|
||||||
-g "${group}" \
|
|
||||||
-s "${shell}" \
|
|
||||||
${expire:+-e ${expire}} \
|
|
||||||
${uid:+-u ${uid}} \
|
|
||||||
${other_groups:+-G ${other_groups}} \
|
|
||||||
${login}
|
|
||||||
then
|
|
||||||
echo "Error ($?) in useradd...exiting..."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_aging() {
|
|
||||||
if ! passwd \
|
|
||||||
-x ${max_days} \
|
|
||||||
-n ${min_days} \
|
|
||||||
-w ${warn_days} \
|
|
||||||
-i ${iact_days} \
|
|
||||||
${login}
|
|
||||||
then
|
|
||||||
echo "Error ($?) in setting password aging...exiting..."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_password() {
|
|
||||||
if test -n "${set_pwd}"
|
|
||||||
then
|
|
||||||
echo
|
|
||||||
passwd ${login}
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_system() {
|
|
||||||
if test -d "${home}"
|
|
||||||
then
|
|
||||||
echo "Directory ${home} already exists."
|
|
||||||
echo "Skeleton files not copied."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n "Copying skeleton files..."
|
|
||||||
(
|
|
||||||
mkdir ${home}
|
|
||||||
cd ${skel} && cp -af . ${home}
|
|
||||||
chmod ${def_mode} ${home}
|
|
||||||
chown -R ${login}:${group} ${home}
|
|
||||||
)
|
|
||||||
echo "done."
|
|
||||||
|
|
||||||
## Add your own stuff here:
|
|
||||||
echo -n "Setting up other files..."
|
|
||||||
(
|
|
||||||
mailbox="/var/spool/mail/${login}"
|
|
||||||
touch ${mailbox}
|
|
||||||
chown "${login}:mail" ${mailbox}
|
|
||||||
chmod 600 ${mailbox}
|
|
||||||
)
|
|
||||||
echo "done."
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
read_values() {
|
|
||||||
clear
|
|
||||||
echo -e "\nPlease answer the following questions about the new user to be added."
|
|
||||||
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
read_login
|
|
||||||
read_name
|
|
||||||
read_group
|
|
||||||
read_other_groups
|
|
||||||
read_home
|
|
||||||
read_shell
|
|
||||||
read_uid
|
|
||||||
read_expire_date
|
|
||||||
read_max_valid_days
|
|
||||||
read_min_valid_days
|
|
||||||
read_warning_days
|
|
||||||
read_inactive_days
|
|
||||||
read_passwd_yn
|
|
||||||
|
|
||||||
print_values
|
|
||||||
|
|
||||||
echo -n "Is this correct [N/y] ? "
|
|
||||||
read_yn 1 && return
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
|
||||||
check_root
|
|
||||||
read_values
|
|
||||||
set_user
|
|
||||||
set_aging
|
|
||||||
set_system
|
|
||||||
set_password
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
## Run it 8-)
|
|
||||||
main
|
|
||||||
|
|
||||||
# End.
|
|
||||||
@@ -471,12 +471,12 @@
|
|||||||
|
|
||||||
The Shadow Suite contains replacement programs for:
|
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:
|
The package also contains the new programs:
|
||||||
|
|
||||||
chage, newusers, dpasswd, gpasswd, useradd, userdel, usermod,
|
chage, newusers, dpasswd, gpasswd, useradd, userdel, usermod,
|
||||||
groupadd, groupdel, groupmod, groups, pwck, grpck, lastlog, pwconv,
|
groupadd, groupdel, groupmod, pwck, grpck, lastlog, pwconv,
|
||||||
and pwunconv
|
and pwunconv
|
||||||
|
|
||||||
Additionally, the library: libshadow.a is included for writing and/or
|
Additionally, the library: libshadow.a is included for writing and/or
|
||||||
@@ -586,8 +586,6 @@
|
|||||||
|
|
||||||
· /usr/bin/chsh
|
· /usr/bin/chsh
|
||||||
|
|
||||||
· /usr/bin/id
|
|
||||||
|
|
||||||
The BETA package has a save target in the Makefile, but it's commented
|
The BETA package has a save target in the Makefile, but it's commented
|
||||||
out because different distributions place the programs in different
|
out because different distributions place the programs in different
|
||||||
places.
|
places.
|
||||||
@@ -637,8 +635,6 @@
|
|||||||
|
|
||||||
· /usr/man/man1/chsh.1.gz
|
· /usr/man/man1/chsh.1.gz
|
||||||
|
|
||||||
· /usr/man/man1/id.1.gz
|
|
||||||
|
|
||||||
· /usr/man/man1/login.1.gz
|
· /usr/man/man1/login.1.gz
|
||||||
|
|
||||||
· /usr/man/man1/passwd.1.gz
|
· /usr/man/man1/passwd.1.gz
|
||||||
@@ -1377,7 +1373,7 @@
|
|||||||
users or changing the group password, the /etc/gshadow file will be
|
users or changing the group password, the /etc/gshadow file will be
|
||||||
changed.
|
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.
|
part of the Shadow Suite to modify groups.
|
||||||
|
|
||||||
The format of the /etc/group file is as follows:
|
The format of the /etc/group file is as follows:
|
||||||
@@ -1755,7 +1751,7 @@
|
|||||||
}
|
}
|
||||||
#ifdef HAS_SHADOW
|
#ifdef HAS_SHADOW
|
||||||
if ((pw->pw_passwd && pw->pw_passwd[0] == '@'
|
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)) {
|
|| !valid (passwd, pw)) {
|
||||||
return (UPAP_AUTHNAK);
|
return (UPAP_AUTHNAK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -252,8 +252,6 @@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
|||||||
XMLCATALOG = @XMLCATALOG@
|
XMLCATALOG = @XMLCATALOG@
|
||||||
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
||||||
XSLTPROC = @XSLTPROC@
|
XSLTPROC = @XSLTPROC@
|
||||||
YACC = @YACC@
|
|
||||||
YFLAGS = @YFLAGS@
|
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
abs_top_builddir = @abs_top_builddir@
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
|||||||
@@ -341,8 +341,6 @@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
|||||||
XMLCATALOG = @XMLCATALOG@
|
XMLCATALOG = @XMLCATALOG@
|
||||||
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
||||||
XSLTPROC = @XSLTPROC@
|
XSLTPROC = @XSLTPROC@
|
||||||
YACC = @YACC@
|
|
||||||
YFLAGS = @YFLAGS@
|
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
abs_top_builddir = @abs_top_builddir@
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ pamd_files = \
|
|||||||
passwd
|
passwd
|
||||||
|
|
||||||
pamd_acct_tools_files = \
|
pamd_acct_tools_files = \
|
||||||
chage \
|
|
||||||
chgpasswd \
|
chgpasswd \
|
||||||
groupadd \
|
groupadd \
|
||||||
groupdel \
|
groupdel \
|
||||||
|
|||||||
@@ -284,8 +284,6 @@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
|||||||
XMLCATALOG = @XMLCATALOG@
|
XMLCATALOG = @XMLCATALOG@
|
||||||
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
||||||
XSLTPROC = @XSLTPROC@
|
XSLTPROC = @XSLTPROC@
|
||||||
YACC = @YACC@
|
|
||||||
YFLAGS = @YFLAGS@
|
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
abs_top_builddir = @abs_top_builddir@
|
abs_top_builddir = @abs_top_builddir@
|
||||||
@@ -343,7 +341,6 @@ top_srcdir = @top_srcdir@
|
|||||||
pamd_files = chpasswd chfn chsh groupmems login newusers passwd \
|
pamd_files = chpasswd chfn chsh groupmems login newusers passwd \
|
||||||
$(am__append_2)
|
$(am__append_2)
|
||||||
pamd_acct_tools_files = \
|
pamd_acct_tools_files = \
|
||||||
chage \
|
|
||||||
chgpasswd \
|
chgpasswd \
|
||||||
groupadd \
|
groupadd \
|
||||||
groupdel \
|
groupdel \
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#%PAM-1.0
|
|
||||||
auth sufficient pam_rootok.so
|
|
||||||
account required pam_permit.so
|
|
||||||
password include system-auth
|
|
||||||
@@ -249,8 +249,6 @@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
|||||||
XMLCATALOG = @XMLCATALOG@
|
XMLCATALOG = @XMLCATALOG@
|
||||||
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
XML_CATALOG_FILE = @XML_CATALOG_FILE@
|
||||||
XSLTPROC = @XSLTPROC@
|
XSLTPROC = @XSLTPROC@
|
||||||
YACC = @YACC@
|
|
||||||
YFLAGS = @YFLAGS@
|
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
abs_top_builddir = @abs_top_builddir@
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
|||||||
+122
-27
@@ -29,16 +29,44 @@ libshadow_la_SOURCES = \
|
|||||||
age.c \
|
age.c \
|
||||||
agetpass.c \
|
agetpass.c \
|
||||||
agetpass.h \
|
agetpass.h \
|
||||||
alloc.c \
|
alloc/calloc.c \
|
||||||
alloc.h \
|
alloc/calloc.h \
|
||||||
atoi/a2i.c \
|
alloc/malloc.c \
|
||||||
atoi/a2i.h \
|
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.c \
|
atoi/str2i.c \
|
||||||
atoi/str2i.h \
|
atoi/str2i.h \
|
||||||
atoi/strtoi.c \
|
atoi/strtoi/strtoi.c \
|
||||||
atoi/strtoi.h \
|
atoi/strtoi/strtoi.h \
|
||||||
atoi/strtou_noneg.c \
|
atoi/strtoi/strtou.c \
|
||||||
atoi/strtou_noneg.h \
|
atoi/strtoi/strtou.h \
|
||||||
|
atoi/strtoi/strtou_noneg.c \
|
||||||
|
atoi/strtoi/strtou_noneg.h \
|
||||||
attr.h \
|
attr.h \
|
||||||
audit_help.c \
|
audit_help.c \
|
||||||
basename.c \
|
basename.c \
|
||||||
@@ -66,16 +94,21 @@ libshadow_la_SOURCES = \
|
|||||||
failure.h \
|
failure.h \
|
||||||
fd.c \
|
fd.c \
|
||||||
fields.c \
|
fields.c \
|
||||||
|
fields.h \
|
||||||
find_new_gid.c \
|
find_new_gid.c \
|
||||||
find_new_uid.c \
|
find_new_uid.c \
|
||||||
find_new_sub_gids.c \
|
find_new_sub_gids.c \
|
||||||
find_new_sub_uids.c \
|
find_new_sub_uids.c \
|
||||||
fputsx.c \
|
fputsx.c \
|
||||||
get_gid.c \
|
fs/mkstemp/fmkomstemp.c \
|
||||||
|
fs/mkstemp/fmkomstemp.h \
|
||||||
|
fs/mkstemp/mkomstemp.c \
|
||||||
|
fs/mkstemp/mkomstemp.h \
|
||||||
|
fs/readlink/areadlink.c \
|
||||||
|
fs/readlink/areadlink.h \
|
||||||
|
fs/readlink/readlinknul.c \
|
||||||
|
fs/readlink/readlinknul.h \
|
||||||
get_pid.c \
|
get_pid.c \
|
||||||
get_uid.c \
|
|
||||||
getdate.h \
|
|
||||||
getdate.y \
|
|
||||||
getdef.c \
|
getdef.c \
|
||||||
getdef.h \
|
getdef.h \
|
||||||
getgr_nam_gid.c \
|
getgr_nam_gid.c \
|
||||||
@@ -94,10 +127,7 @@ libshadow_la_SOURCES = \
|
|||||||
lockpw.c \
|
lockpw.c \
|
||||||
loginprompt.c \
|
loginprompt.c \
|
||||||
mail.c \
|
mail.c \
|
||||||
memzero.c \
|
|
||||||
memzero.h \
|
|
||||||
motd.c \
|
motd.c \
|
||||||
must_be.h \
|
|
||||||
myname.c \
|
myname.c \
|
||||||
nss.c \
|
nss.c \
|
||||||
nscd.c \
|
nscd.c \
|
||||||
@@ -119,11 +149,18 @@ libshadow_la_SOURCES = \
|
|||||||
pwdcheck.c \
|
pwdcheck.c \
|
||||||
pwmem.c \
|
pwmem.c \
|
||||||
remove_tree.c \
|
remove_tree.c \
|
||||||
rlogin.c \
|
|
||||||
root_flag.c \
|
root_flag.c \
|
||||||
run_part.h \
|
run_part.h \
|
||||||
run_part.c \
|
run_part.c \
|
||||||
salt.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 \
|
selinux.c \
|
||||||
semanage.c \
|
semanage.c \
|
||||||
setugid.c \
|
setugid.c \
|
||||||
@@ -133,7 +170,8 @@ libshadow_la_SOURCES = \
|
|||||||
sgetspent.c \
|
sgetspent.c \
|
||||||
sgroupio.c \
|
sgroupio.c \
|
||||||
sgroupio.h\
|
sgroupio.h\
|
||||||
shadow.c \
|
shadow/grp/agetgroups.c \
|
||||||
|
shadow/grp/agetgroups.h \
|
||||||
shadowio.c \
|
shadowio.c \
|
||||||
shadowio.h \
|
shadowio.h \
|
||||||
shadowlog.c \
|
shadowlog.c \
|
||||||
@@ -145,18 +183,74 @@ libshadow_la_SOURCES = \
|
|||||||
spawn.c \
|
spawn.c \
|
||||||
sssd.c \
|
sssd.c \
|
||||||
sssd.h \
|
sssd.h \
|
||||||
string/sprintf.c \
|
string/ctype/strchrisascii/strchriscntrl.c \
|
||||||
string/sprintf.h \
|
string/ctype/strchrisascii/strchriscntrl.h \
|
||||||
string/stpecpy.c \
|
string/ctype/strisascii/strisdigit.c \
|
||||||
string/stpecpy.h \
|
string/ctype/strisascii/strisdigit.h \
|
||||||
string/stpeprintf.c \
|
string/ctype/strisascii/strisprint.c \
|
||||||
string/stpeprintf.h \
|
string/ctype/strisascii/strisprint.h \
|
||||||
|
string/ctype/strtoascii/strtolower.c \
|
||||||
|
string/ctype/strtoascii/strtolower.h \
|
||||||
|
string/memset/memzero.c \
|
||||||
|
string/memset/memzero.h \
|
||||||
|
string/sprintf/aprintf.c \
|
||||||
|
string/sprintf/aprintf.h \
|
||||||
|
string/sprintf/snprintf.c \
|
||||||
|
string/sprintf/snprintf.h \
|
||||||
|
string/sprintf/stpeprintf.c \
|
||||||
|
string/sprintf/stpeprintf.h \
|
||||||
|
string/sprintf/xaprintf.c \
|
||||||
|
string/sprintf/xaprintf.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/strcaseprefix.c \
|
||||||
|
string/strcmp/strcaseprefix.h \
|
||||||
|
string/strcmp/streq.c \
|
||||||
|
string/strcmp/streq.h \
|
||||||
|
string/strcmp/strprefix.c \
|
||||||
|
string/strcmp/strprefix.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.c \
|
||||||
string/strftime.h \
|
string/strftime.h \
|
||||||
string/strncpy.h \
|
string/strspn/stpspn.c \
|
||||||
string/strtcpy.c \
|
string/strspn/stpspn.h \
|
||||||
string/strtcpy.h \
|
string/strspn/stprcspn.c \
|
||||||
string/zustr2stp.h \
|
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 \
|
||||||
|
string/strtok/astrsep2ls.c \
|
||||||
|
string/strtok/astrsep2ls.h \
|
||||||
|
string/strtok/strsep2arr.c \
|
||||||
|
string/strtok/strsep2arr.h \
|
||||||
|
string/strtok/strsep2ls.c \
|
||||||
|
string/strtok/strsep2ls.h \
|
||||||
|
string/strtok/xastrsep2ls.c \
|
||||||
|
string/strtok/xastrsep2ls.h \
|
||||||
strtoday.c \
|
strtoday.c \
|
||||||
sub.c \
|
sub.c \
|
||||||
subordinateio.h \
|
subordinateio.h \
|
||||||
@@ -165,6 +259,7 @@ libshadow_la_SOURCES = \
|
|||||||
time/day_to_str.c \
|
time/day_to_str.c \
|
||||||
time/day_to_str.h \
|
time/day_to_str.h \
|
||||||
ttytype.c \
|
ttytype.c \
|
||||||
|
typetraits.h \
|
||||||
tz.c \
|
tz.c \
|
||||||
ulimit.c \
|
ulimit.c \
|
||||||
user_busy.c \
|
user_busy.c \
|
||||||
|
|||||||
+1241
-256
File diff suppressed because it is too large
Load Diff
+48
-81
@@ -1,114 +1,81 @@
|
|||||||
/*
|
// SPDX-FileCopyrightText: 1989-1994, Julianne Frances Haugh
|
||||||
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
|
||||||
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
// SPDX-FileCopyrightText: 2001-2006, Tomasz Kłoczko
|
||||||
* SPDX-FileCopyrightText: 2001 - 2006, Tomasz Kłoczko
|
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||||
* SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||||
*
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined (HAVE_SETGROUPS) && ! defined (USE_PAM)
|
#if !defined(USE_PAM)
|
||||||
|
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <grp.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <grp.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc/reallocf.h"
|
||||||
|
#include "search/l/lsearch.h"
|
||||||
|
#include "shadow/grp/agetgroups.h"
|
||||||
#include "shadowlog.h"
|
#include "shadowlog.h"
|
||||||
|
#include "string/strchr/strchrscnt.h"
|
||||||
|
|
||||||
#ident "$Id$"
|
|
||||||
|
|
||||||
#define SEP ",:"
|
|
||||||
/*
|
/*
|
||||||
* Add groups with names from LIST (separated by commas or colons)
|
* Add groups with names from LIST (separated by commas or colons)
|
||||||
* to the supplementary group set. Silently ignore groups which are
|
* to the supplementary group set. Silently ignore groups which are
|
||||||
* already there. Warning: uses strtok().
|
* already there.
|
||||||
*/
|
*/
|
||||||
int add_groups (const char *list)
|
int
|
||||||
|
add_groups(const char *list)
|
||||||
{
|
{
|
||||||
GETGROUPS_T *grouplist;
|
char *g, *p, *dup;
|
||||||
size_t i;
|
|
||||||
int ngroups;
|
|
||||||
bool added;
|
|
||||||
char *token;
|
|
||||||
char buf[1024];
|
|
||||||
int ret;
|
|
||||||
FILE *shadow_logfd = log_get_logfd();
|
FILE *shadow_logfd = log_get_logfd();
|
||||||
|
gid_t *gids;
|
||||||
|
size_t n;
|
||||||
|
|
||||||
if (strlen (list) >= sizeof (buf)) {
|
gids = agetgroups(&n);
|
||||||
errno = EINVAL;
|
if (gids == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
strcpy (buf, list);
|
|
||||||
|
|
||||||
i = 16;
|
gids = REALLOCF(gids, n + strchrscnt(list, ",:") + 1, gid_t);
|
||||||
for (;;) {
|
if (gids == NULL)
|
||||||
grouplist = MALLOC(i, GETGROUPS_T);
|
|
||||||
if (NULL == grouplist) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ngroups = getgroups (i, grouplist);
|
|
||||||
if ( ( (-1 == ngroups)
|
|
||||||
&& (EINVAL != errno))
|
|
||||||
|| (i > (size_t)ngroups)) {
|
|
||||||
/* Unexpected failure of getgroups or successful
|
|
||||||
* reception of the groups */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* not enough room, so try allocating a larger buffer */
|
|
||||||
free (grouplist);
|
|
||||||
i *= 2;
|
|
||||||
}
|
|
||||||
if (ngroups < 0) {
|
|
||||||
free (grouplist);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
added = false;
|
p = dup = strdup(list);
|
||||||
for (token = strtok (buf, SEP); NULL != token; token = strtok (NULL, SEP)) {
|
if (dup == NULL)
|
||||||
struct group *grp;
|
goto free_gids;
|
||||||
|
|
||||||
grp = getgrnam (token); /* local, no need for xgetgrnam */
|
while (NULL != (g = strsep(&p, ",:"))) {
|
||||||
|
struct group *grp;
|
||||||
|
|
||||||
|
grp = getgrnam(g); /* local, no need for xgetgrnam */
|
||||||
if (NULL == grp) {
|
if (NULL == grp) {
|
||||||
fprintf (shadow_logfd, _("Warning: unknown group %s\n"),
|
fprintf(shadow_logfd, _("Warning: unknown group %s\n"), g);
|
||||||
token);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < (size_t)ngroups && grouplist[i] != grp->gr_gid; i++);
|
LSEARCH(&grp->gr_gid, gids, &n);
|
||||||
|
}
|
||||||
|
free(dup);
|
||||||
|
|
||||||
if (i < (size_t)ngroups) {
|
if (setgroups(n, gids) == -1) {
|
||||||
continue;
|
fprintf(shadow_logfd, "setgroups: %s\n", strerror(errno));
|
||||||
}
|
goto free_gids;
|
||||||
|
|
||||||
if (ngroups >= sysconf (_SC_NGROUPS_MAX)) {
|
|
||||||
fputs (_("Warning: too many groups\n"), shadow_logfd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
grouplist = REALLOCF(grouplist, (size_t) ngroups + 1, GETGROUPS_T);
|
|
||||||
if (grouplist == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
grouplist[ngroups] = grp->gr_gid;
|
|
||||||
ngroups++;
|
|
||||||
added = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (added) {
|
free(gids);
|
||||||
ret = setgroups (ngroups, grouplist);
|
|
||||||
free (grouplist);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
free (grouplist);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
#else /* HAVE_SETGROUPS && !USE_PAM */
|
|
||||||
extern int ISO_C_forbids_an_empty_translation_unit;
|
|
||||||
#endif /* HAVE_SETGROUPS && !USE_PAM */
|
|
||||||
|
|
||||||
|
free_gids:
|
||||||
|
free(gids);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else /* !USE_PAM */
|
||||||
|
extern int ISO_C_forbids_an_empty_translation_unit;
|
||||||
|
#endif /* !USE_PAM */
|
||||||
|
|||||||
@@ -11,5 +11,3 @@
|
|||||||
|
|
||||||
extern inline long addsl2(long a, long b);
|
extern inline long addsl2(long a, long b);
|
||||||
extern inline long addslN(size_t n, long addend[n]);
|
extern inline long addslN(size_t n, long addend[n]);
|
||||||
|
|
||||||
extern inline int cmpl(const void *p1, const void *p2);
|
|
||||||
|
|||||||
+4
-20
@@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
|
#include "search/sort/qsort.h"
|
||||||
#include "sizeof.h"
|
#include "sizeof.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -20,15 +20,13 @@
|
|||||||
({ \
|
({ \
|
||||||
long addend_[] = {a, b, __VA_ARGS__}; \
|
long addend_[] = {a, b, __VA_ARGS__}; \
|
||||||
\
|
\
|
||||||
addslN(NITEMS(addend_), addend_); \
|
addslN(countof(addend_), addend_); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
inline long addsl2(long a, long b);
|
inline long addsl2(long a, long b);
|
||||||
inline long addslN(size_t n, long addend[n]);
|
inline long addslN(size_t n, long addend[n]);
|
||||||
|
|
||||||
inline int cmpl(const void *p1, const void *p2);
|
|
||||||
|
|
||||||
|
|
||||||
inline long
|
inline long
|
||||||
addsl2(long a, long b)
|
addsl2(long a, long b)
|
||||||
@@ -57,7 +55,7 @@ addslN(size_t n, long addend[n])
|
|||||||
|
|
||||||
e = errno;
|
e = errno;
|
||||||
while (n > 1) {
|
while (n > 1) {
|
||||||
qsort(addend, n, sizeof(addend[0]), cmpl);
|
QSORT(addend, n);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addend[0] = addsl2(addend[0], addend[--n]);
|
addend[0] = addsl2(addend[0], addend[--n]);
|
||||||
@@ -69,18 +67,4 @@ addslN(size_t n, long addend[n])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline int
|
|
||||||
cmpl(const void *p1, const void *p2)
|
|
||||||
{
|
|
||||||
const long *l1 = p1;
|
|
||||||
const long *l2 = p2;
|
|
||||||
|
|
||||||
if (*l1 < *l2)
|
|
||||||
return -1;
|
|
||||||
if (*l1 > *l2)
|
|
||||||
return +1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // include guard
|
#endif // include guard
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp)
|
|||||||
* passwd to work just like it would had they executed
|
* passwd to work just like it would had they executed
|
||||||
* it from the command line while logged in.
|
* 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)
|
if (setup_uid_gid (pw, false) != 0)
|
||||||
#else
|
#else
|
||||||
if (setup_uid_gid (pw) != 0)
|
if (setup_uid_gid (pw) != 0)
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#ident "$Id$"
|
#ident "$Id$"
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc/malloc.h"
|
||||||
|
|
||||||
#if WITH_LIBBSD == 0
|
#if WITH_LIBBSD == 0
|
||||||
#include "freezero.h"
|
#include "freezero.h"
|
||||||
|
|||||||
-73
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 , Alejandro Colomar <alx@kernel.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Replacements for malloc and strdup with error checking. Too trivial
|
|
||||||
to be worth copyrighting :-). I did that because a lot of code used
|
|
||||||
malloc and strdup without checking for NULL pointer, and I like some
|
|
||||||
message better than a core dump... --marekm
|
|
||||||
|
|
||||||
Yeh, but. Remember that bailing out might leave the system in some
|
|
||||||
bizarre state. You really want to put in error checking, then add
|
|
||||||
some back-out failure recovery code. -- jfh */
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#ident "$Id$"
|
|
||||||
|
|
||||||
#include "alloc.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "prototypes.h"
|
|
||||||
#include "shadowlog.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern inline void *xmalloc(size_t size);
|
|
||||||
extern inline void *xmallocarray(size_t nmemb, size_t size);
|
|
||||||
extern inline void *mallocarray(size_t nmemb, size_t size);
|
|
||||||
extern inline void *reallocarrayf(void *p, size_t nmemb, size_t size);
|
|
||||||
extern inline char *xstrdup(const char *str);
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
-101
@@ -1,101 +0,0 @@
|
|||||||
// 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"
|
|
||||||
#include "defines.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define CALLOC(n, type) ((type *) calloc(n, sizeof(type)))
|
|
||||||
#define XCALLOC(n, type) ((type *) xcalloc(n, sizeof(type)))
|
|
||||||
#define MALLOC(n, type) ((type *) mallocarray(n, sizeof(type)))
|
|
||||||
#define XMALLOC(n, type) ((type *) xmallocarray(n, sizeof(type)))
|
|
||||||
|
|
||||||
#define REALLOC(ptr, n, type) \
|
|
||||||
( \
|
|
||||||
_Generic(ptr, type *: (type *) reallocarray(ptr, n, sizeof(type))) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define REALLOCF(ptr, n, type) \
|
|
||||||
( \
|
|
||||||
_Generic(ptr, type *: (type *) reallocarrayf(ptr, n, sizeof(type))) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define XREALLOC(ptr, n, type) \
|
|
||||||
( \
|
|
||||||
_Generic(ptr, type *: (type *) xreallocarray(ptr, n, sizeof(type))) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
ATTR_MALLOC(free)
|
|
||||||
inline void *xmalloc(size_t size);
|
|
||||||
ATTR_MALLOC(free)
|
|
||||||
inline void *xmallocarray(size_t nmemb, size_t size);
|
|
||||||
ATTR_MALLOC(free)
|
|
||||||
inline void *mallocarray(size_t nmemb, size_t size);
|
|
||||||
ATTR_MALLOC(free)
|
|
||||||
inline void *reallocarrayf(void *p, size_t nmemb, size_t size);
|
|
||||||
ATTR_MALLOC(free)
|
|
||||||
inline char *xstrdup(const char *str);
|
|
||||||
|
|
||||||
ATTR_MALLOC(free)
|
|
||||||
void *xcalloc(size_t nmemb, size_t size);
|
|
||||||
ATTR_MALLOC(free)
|
|
||||||
void *xreallocarray(void *p, size_t nmemb, size_t size);
|
|
||||||
|
|
||||||
|
|
||||||
inline void *
|
|
||||||
xmalloc(size_t size)
|
|
||||||
{
|
|
||||||
return xmallocarray(1, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void *
|
|
||||||
xmallocarray(size_t nmemb, size_t size)
|
|
||||||
{
|
|
||||||
return xreallocarray(NULL, nmemb, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void *
|
|
||||||
mallocarray(size_t nmemb, size_t size)
|
|
||||||
{
|
|
||||||
return reallocarray(NULL, nmemb, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void *
|
|
||||||
reallocarrayf(void *p, size_t nmemb, size_t size)
|
|
||||||
{
|
|
||||||
void *q;
|
|
||||||
|
|
||||||
q = reallocarray(p, nmemb, size);
|
|
||||||
|
|
||||||
/* realloc(p, 0) is equivalent to free(p); avoid double free. */
|
|
||||||
if (q == NULL && nmemb != 0 && size != 0)
|
|
||||||
free(p);
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline char *
|
|
||||||
xstrdup(const char *str)
|
|
||||||
{
|
|
||||||
return strcpy(XMALLOC(strlen(str) + 1, char), str);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // include guard
|
|
||||||
@@ -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"
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -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"
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include "atoi/a2i.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);
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
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);
|
|
||||||
-386
@@ -1,386 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_H_
|
|
||||||
#define SHADOW_INCLUDE_LIB_ATOI_A2I_H_
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "atoi/strtoi.h"
|
|
||||||
#include "atoi/strtou_noneg.h"
|
|
||||||
#include "attr.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__) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
#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__) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#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__) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
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
|
|
||||||
a2sh_c(short *restrict n, const char *s,
|
|
||||||
const char **restrict endp, int base, short min, short max)
|
|
||||||
{
|
|
||||||
return a2sh(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(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(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(n, (char *) s, (char **) endp, base, min, 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(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(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(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(n, (char *) s, (char **) endp, base, min, 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -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"
|
||||||
@@ -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
|
||||||
@@ -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"
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// 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/a2i.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define a2sh(...) a2i(short, __VA_ARGS__)
|
||||||
|
#define a2si(...) a2i(int, __VA_ARGS__)
|
||||||
|
#define a2sl(...) a2i(long, __VA_ARGS__)
|
||||||
|
#define a2sll(...) a2i(long long, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
#endif // include guard
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -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"
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// 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/a2i.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define a2uh(...) a2i(unsigned short, __VA_ARGS__)
|
||||||
|
#define a2ui(...) a2i(unsigned int, __VA_ARGS__)
|
||||||
|
#define a2ul(...) a2i(unsigned long, __VA_ARGS__)
|
||||||
|
#define a2ull(...) a2i(unsigned long long, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
#endif // include guard
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
+1
-11
@@ -1,18 +1,8 @@
|
|||||||
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar <alx@kernel.org>
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "atoi/str2i.h"
|
#include "atoi/str2i.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);
|
|
||||||
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);
|
|
||||||
|
|||||||
+12
-89
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
// SPDX-FileCopyrightText: 2007-2009, Nicolas François
|
||||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar <alx@kernel.org>
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
@@ -9,100 +9,23 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "atoi/a2i.h"
|
#include "atoi/a2i/a2i.h"
|
||||||
#include "attr.h"
|
#include "typetraits.h"
|
||||||
|
|
||||||
|
|
||||||
#define str2i(TYPE, ...) \
|
#define str2i(T, ...) a2i(T, __VA_ARGS__, NULL, 0, type_min(T), type_max(T))
|
||||||
( \
|
|
||||||
_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__) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
#define str2sh(...) str2i(short, __VA_ARGS__)
|
||||||
|
#define str2si(...) str2i(int, __VA_ARGS__)
|
||||||
|
#define str2sl(...) str2i(long, __VA_ARGS__)
|
||||||
|
#define str2sll(...) str2i(long long, __VA_ARGS__)
|
||||||
|
|
||||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
#define str2uh(...) str2i(unsigned short, __VA_ARGS__)
|
||||||
inline int str2sh(short *restrict n, const char *restrict s);
|
#define str2ui(...) str2i(unsigned int, __VA_ARGS__)
|
||||||
ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
|
#define str2ul(...) str2i(unsigned long, __VA_ARGS__)
|
||||||
inline int str2si(int *restrict n, const char *restrict s);
|
#define str2ull(...) str2i(unsigned long long, __VA_ARGS__)
|
||||||
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);
|
|
||||||
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
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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
|
#endif // include guard
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include "atoi/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);
|
|
||||||
extern inline uintmax_t strtou_(const char *s, char **restrict endp, int base,
|
|
||||||
uintmax_t min, uintmax_t max, int *restrict status);
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_H_
|
|
||||||
#define SHADOW_INCLUDE_LIB_ATOI_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"
|
|
||||||
|
|
||||||
|
|
||||||
#define strtoNmax(TYPE, ...) \
|
|
||||||
( \
|
|
||||||
_Generic((TYPE) 0, \
|
|
||||||
intmax_t: strtoimax, \
|
|
||||||
uintmax_t: strtoumax \
|
|
||||||
)(__VA_ARGS__) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
#define strtoN(s, endp, base, min, max, status, TYPE) \
|
|
||||||
({ \
|
|
||||||
const char *s_ = s; \
|
|
||||||
char **endp_ = endp; \
|
|
||||||
int base_ = base; \
|
|
||||||
TYPE min_ = min; \
|
|
||||||
TYPE max_ = max; \
|
|
||||||
int *status_ = status; \
|
|
||||||
\
|
|
||||||
int e_, st_; \
|
|
||||||
char *end_; \
|
|
||||||
TYPE n_; \
|
|
||||||
\
|
|
||||||
if (endp_ == NULL) \
|
|
||||||
endp_ = &end_; \
|
|
||||||
if (status_ == NULL) \
|
|
||||||
status_ = &st_; \
|
|
||||||
\
|
|
||||||
if (base_ != 0 && (base_ < 0 || base_ > 36)) { \
|
|
||||||
*status_ = EINVAL; \
|
|
||||||
n_ = 0; \
|
|
||||||
\
|
|
||||||
} else { \
|
|
||||||
e_ = errno; \
|
|
||||||
errno = 0; \
|
|
||||||
n_ = strtoNmax(TYPE, 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_; \
|
|
||||||
} \
|
|
||||||
MAX(min_, MIN(max_, n_)); \
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
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 intmax_t
|
|
||||||
strtoi_(const char *s, char **restrict endp, int base,
|
|
||||||
intmax_t min, intmax_t max, int *restrict status)
|
|
||||||
{
|
|
||||||
return strtoN(s, endp, base, min, max, status, intmax_t);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline uintmax_t
|
|
||||||
strtou_(const char *s, char **restrict endp, int base,
|
|
||||||
uintmax_t min, uintmax_t max, int *restrict status)
|
|
||||||
{
|
|
||||||
return strtoN(s, endp, base, min, max, status, uintmax_t);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // include guard
|
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -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);
|
||||||
@@ -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
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "atoi/strtou_noneg.h"
|
#include "atoi/strtoi/strtou_noneg.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOU_NONEG_H_
|
#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_NONEG_H_
|
||||||
#define SHADOW_INCLUDE_LIB_ATOI_STRTOU_NONEG_H_
|
#define SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_NONEG_H_
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -12,7 +12,8 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "atoi/strtoi.h"
|
#include "atoi/strtoi/strtoi.h"
|
||||||
|
#include "atoi/strtoi/strtou.h"
|
||||||
#include "attr.h"
|
#include "attr.h"
|
||||||
|
|
||||||
|
|
||||||
+9
-7
@@ -5,16 +5,18 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if (__GNUC__ >= 10)
|
||||||
# define MAYBE_UNUSED __attribute__((unused))
|
# define MAYBE_UNUSED [[gnu::unused]]
|
||||||
# define NORETURN __attribute__((__noreturn__))
|
# define NORETURN [[gnu::__noreturn__]]
|
||||||
# define format_attr(type, fmt, va) __attribute__((format(type, fmt, va)))
|
# define format_attr(type, fmt, va) [[gnu::format(type, fmt, va)]]
|
||||||
# define ATTR_ACCESS(...) __attribute__((access(__VA_ARGS__)))
|
# define ATTR_ACCESS(...) [[gnu::access(__VA_ARGS__)]]
|
||||||
|
# define ATTR_ALLOC_SIZE(...) [[gnu::alloc_size(__VA_ARGS__)]]
|
||||||
#else
|
#else
|
||||||
# define MAYBE_UNUSED
|
# define MAYBE_UNUSED
|
||||||
# define NORETURN
|
# define NORETURN
|
||||||
# define format_attr(type, fmt, va)
|
# define format_attr(type, fmt, va)
|
||||||
# define ATTR_ACCESS(...)
|
# define ATTR_ACCESS(...)
|
||||||
|
# define ATTR_ALLOC_SIZE(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (__GNUC__ >= 11) && !defined(__clang__)
|
#if (__GNUC__ >= 11) && !defined(__clang__)
|
||||||
@@ -24,9 +26,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (__GNUC__ >= 14)
|
#if (__GNUC__ >= 14)
|
||||||
# define ATTR_STRING(...) [[gnu::null_terminated_string_arg(__VA_ARGS__)]]
|
# define ATTR_STRING(i) [[gnu::null_terminated_string_arg(i)]]
|
||||||
#else
|
#else
|
||||||
# define ATTR_STRING(...)
|
# define ATTR_STRING(i)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+50
-3
@@ -25,6 +25,8 @@
|
|||||||
#include "attr.h"
|
#include "attr.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "shadowlog.h"
|
#include "shadowlog.h"
|
||||||
|
#include "string/sprintf/snprintf.h"
|
||||||
|
|
||||||
int audit_fd;
|
int audit_fd;
|
||||||
|
|
||||||
void audit_help_open (void)
|
void audit_help_open (void)
|
||||||
@@ -46,10 +48,14 @@ void audit_help_open (void)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This function will log a message to the audit system using a predefined
|
* This function will log a message to the audit system using a predefined
|
||||||
* message format. Parameter usage is as follows:
|
* 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>
|
||||||
*
|
*
|
||||||
* type - type of message: AUDIT_USER_CHAUTHTOK for changing any account
|
* Parameter usage is as follows:
|
||||||
* attributes.
|
*
|
||||||
|
* type - type of message. A list of possible values is available in
|
||||||
|
* "audit-records.h" file.
|
||||||
* pgname - program's name
|
* pgname - program's name
|
||||||
* op - operation. "adding user", "changing finger info", "deleting group"
|
* op - operation. "adding user", "changing finger info", "deleting group"
|
||||||
* name - user's account or group name. If not available use NULL.
|
* name - user's account or group name. If not available use NULL.
|
||||||
@@ -68,6 +74,47 @@ void audit_logger (int type, MAYBE_UNUSED const char *pgname, const char *op,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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[countof(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)
|
void audit_logger_message (const char *message, shadow_audit_result result)
|
||||||
{
|
{
|
||||||
if (audit_fd < 0) {
|
if (audit_fd < 0) {
|
||||||
|
|||||||
+13
-13
@@ -1,10 +1,8 @@
|
|||||||
/*
|
// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
|
||||||
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
// SPDX-FileCopyrightText: 1996-1997, Marek Michałkiewicz
|
||||||
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
// SPDX-FileCopyrightText: 2003-2005, Tomasz Kłoczko
|
||||||
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||||
*
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* basename.c - not worth copyrighting :-). Some versions of Linux libc
|
* basename.c - not worth copyrighting :-). Some versions of Linux libc
|
||||||
@@ -15,17 +13,19 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ident "$Id$"
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
/*@observer@*/const char *Basename (const char *str)
|
#include "string/strspn/stprcspn.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*@observer@*/const char *
|
||||||
|
Basename(const char *str)
|
||||||
{
|
{
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *cp = strrchr (str, '/');
|
return stprcspn(str, "/");
|
||||||
|
|
||||||
return (NULL != cp) ? cp + 1 : str;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-19
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-FileCopyrightText: 1996-2000, Marek Michałkiewicz
|
// SPDX-FileCopyrightText: 1996-2000, Marek Michałkiewicz
|
||||||
// SPDX-FileCopyrightText: 2001-2005, Tomasz Kłoczko
|
// SPDX-FileCopyrightText: 2001-2005, Tomasz Kłoczko
|
||||||
// SPDX-FileCopyrightText: 2005-2008, Nicolas François
|
// SPDX-FileCopyrightText: 2005-2008, Nicolas François
|
||||||
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar <alx@kernel.org>
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
@@ -12,6 +12,9 @@
|
|||||||
* return values:
|
* return values:
|
||||||
* true - OK
|
* true - OK
|
||||||
* false - bad name
|
* false - bad name
|
||||||
|
* errors:
|
||||||
|
* EINVAL Invalid name characters or sequences
|
||||||
|
* EOVERFLOW Name longer than maximum size
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -28,6 +31,13 @@
|
|||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "chkname.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;
|
int allow_bad_names = false;
|
||||||
@@ -38,16 +48,16 @@ login_name_max_size(void)
|
|||||||
{
|
{
|
||||||
long conf;
|
long conf;
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
conf = sysconf(_SC_LOGIN_NAME_MAX);
|
conf = sysconf(_SC_LOGIN_NAME_MAX);
|
||||||
if (conf == -1 && errno != 0)
|
if (conf == -1)
|
||||||
return LOGIN_NAME_MAX;
|
return LOGIN_NAME_MAX;
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool is_valid_name (const char *name)
|
static bool
|
||||||
|
is_valid_name(const char *name)
|
||||||
{
|
{
|
||||||
if (allow_bad_names) {
|
if (allow_bad_names) {
|
||||||
return true;
|
return true;
|
||||||
@@ -62,57 +72,67 @@ static bool is_valid_name (const char *name)
|
|||||||
*
|
*
|
||||||
* Also do not allow fully numeric names or just "." or "..".
|
* Also do not allow fully numeric names or just "." or "..".
|
||||||
*/
|
*/
|
||||||
int numeric;
|
|
||||||
|
|
||||||
if ('\0' == *name ||
|
if (strisdigit(name)) {
|
||||||
('.' == *name && (('.' == name[1] && '\0' == name[2]) ||
|
errno = EINVAL;
|
||||||
'\0' == name[1])) ||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (streq(name, "") ||
|
||||||
|
streq(name, ".") ||
|
||||||
|
streq(name, "..") ||
|
||||||
!((*name >= 'a' && *name <= 'z') ||
|
!((*name >= 'a' && *name <= 'z') ||
|
||||||
(*name >= 'A' && *name <= 'Z') ||
|
(*name >= 'A' && *name <= 'Z') ||
|
||||||
(*name >= '0' && *name <= '9') ||
|
(*name >= '0' && *name <= '9') ||
|
||||||
*name == '_' ||
|
*name == '_' ||
|
||||||
*name == '.')) {
|
*name == '.'))
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
numeric = isdigit(*name);
|
while (!streq(++name, "")) {
|
||||||
|
|
||||||
while ('\0' != *++name) {
|
|
||||||
if (!((*name >= 'a' && *name <= 'z') ||
|
if (!((*name >= 'a' && *name <= 'z') ||
|
||||||
(*name >= 'A' && *name <= 'Z') ||
|
(*name >= 'A' && *name <= 'Z') ||
|
||||||
(*name >= '0' && *name <= '9') ||
|
(*name >= '0' && *name <= '9') ||
|
||||||
*name == '_' ||
|
*name == '_' ||
|
||||||
*name == '.' ||
|
*name == '.' ||
|
||||||
*name == '-' ||
|
*name == '-' ||
|
||||||
(*name == '$' && name[1] == '\0')
|
streq(name, "$")
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
numeric &= isdigit(*name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return !numeric;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
is_valid_user_name(const char *name)
|
is_valid_user_name(const char *name)
|
||||||
{
|
{
|
||||||
if (strlen(name) >= login_name_max_size())
|
if (strlen(name) >= login_name_max_size()) {
|
||||||
|
errno = EOVERFLOW;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return is_valid_name(name);
|
return is_valid_name(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_valid_group_name (const char *name)
|
bool
|
||||||
|
is_valid_group_name(const char *name)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Arbitrary limit for group names.
|
* Arbitrary limit for group names.
|
||||||
* HP-UX 10 limits to 16 characters
|
* HP-UX 10 limits to 16 characters
|
||||||
*/
|
*/
|
||||||
if ( (GROUP_NAME_MAX_LENGTH > 0)
|
if ( (GROUP_NAME_MAX_LENGTH > 0)
|
||||||
&& (strlen (name) > GROUP_NAME_MAX_LENGTH)) {
|
&& (strlen (name) > GROUP_NAME_MAX_LENGTH))
|
||||||
|
{
|
||||||
|
errno = EOVERFLOW;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-4
@@ -13,12 +13,15 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "prototypes.h"
|
|
||||||
#include "defines.h"
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "defines.h"
|
||||||
|
#include "prototypes.h"
|
||||||
|
#include "string/strcmp/streq.h"
|
||||||
|
|
||||||
|
|
||||||
static int chown_tree_at (int at_fd,
|
static int chown_tree_at (int at_fd,
|
||||||
const char *path,
|
const char *path,
|
||||||
uid_t old_uid,
|
uid_t old_uid,
|
||||||
@@ -56,8 +59,8 @@ static int chown_tree_at (int at_fd,
|
|||||||
/*
|
/*
|
||||||
* Skip the "." and ".." entries
|
* Skip the "." and ".." entries
|
||||||
*/
|
*/
|
||||||
if ( (strcmp (ent->d_name, ".") == 0)
|
if ( streq(ent->d_name, ".")
|
||||||
|| (strcmp (ent->d_name, "..") == 0)) {
|
|| streq(ent->d_name, "..")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ void do_cleanups (void)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
/* Make sure there were no overflow */
|
/* Make sure there were no overflows */
|
||||||
assert (NULL == cleanup_functions[CLEANUP_FUNCTIONS-1]);
|
assert (NULL == cleanup_functions[CLEANUP_FUNCTIONS-1]);
|
||||||
|
|
||||||
if (getpid () != cleanup_pid) {
|
if (getpid () != cleanup_pid) {
|
||||||
|
|||||||
+11
-11
@@ -62,7 +62,7 @@ void cleanup_report_mod_group (void *cleanup_info)
|
|||||||
gr_dbname (),
|
gr_dbname (),
|
||||||
info->action));
|
info->action));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
audit_logger (AUDIT_GRP_MGMT, log_get_progname(),
|
||||||
info->audit_msg,
|
info->audit_msg,
|
||||||
info->name, AUDIT_NO_ID,
|
info->name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -80,7 +80,7 @@ void cleanup_report_mod_gshadow (void *cleanup_info)
|
|||||||
sgr_dbname (),
|
sgr_dbname (),
|
||||||
info->action));
|
info->action));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
audit_logger (AUDIT_GRP_MGMT, log_get_progname(),
|
||||||
info->audit_msg,
|
info->audit_msg,
|
||||||
info->name, AUDIT_NO_ID,
|
info->name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -101,7 +101,7 @@ void cleanup_report_add_group_group (void *group_name)
|
|||||||
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||||
"adding group to /etc/group",
|
"adding-group",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
@@ -120,8 +120,8 @@ void cleanup_report_add_group_gshadow (void *group_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
audit_logger (AUDIT_GRP_MGMT, log_get_progname(),
|
||||||
"adding group to /etc/gshadow",
|
"adding-shadow-group",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
@@ -143,8 +143,8 @@ void cleanup_report_del_group_group (void *group_name)
|
|||||||
"failed to remove group %s from %s",
|
"failed to remove group %s from %s",
|
||||||
name, gr_dbname ()));
|
name, gr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
audit_logger (AUDIT_DEL_GROUP, log_get_progname(),
|
||||||
"removing group from /etc/group",
|
"removing-group",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
@@ -166,8 +166,8 @@ void cleanup_report_del_group_gshadow (void *group_name)
|
|||||||
"failed to remove group %s from %s",
|
"failed to remove group %s from %s",
|
||||||
name, sgr_dbname ()));
|
name, sgr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
audit_logger (AUDIT_GRP_MGMT, log_get_progname(),
|
||||||
"removing group from /etc/gshadow",
|
"removing-shadow-group",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
@@ -187,7 +187,7 @@ void cleanup_unlock_group (MAYBE_UNUSED void *arg)
|
|||||||
log_get_progname(), gr_dbname ());
|
log_get_progname(), gr_dbname ());
|
||||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger_message ("unlocking group file",
|
audit_logger_message ("unlocking-group",
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ void cleanup_unlock_gshadow (MAYBE_UNUSED void *arg)
|
|||||||
log_get_progname(), sgr_dbname ());
|
log_get_progname(), sgr_dbname ());
|
||||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger_message ("unlocking gshadow file",
|
audit_logger_message ("unlocking-gshadow",
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -44,7 +44,7 @@ void cleanup_report_mod_passwd (void *cleanup_info)
|
|||||||
pw_dbname (),
|
pw_dbname (),
|
||||||
info->action));
|
info->action));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
audit_logger (AUDIT_USER_MGMT, log_get_progname(),
|
||||||
info->audit_msg,
|
info->audit_msg,
|
||||||
info->name, AUDIT_NO_ID,
|
info->name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -65,7 +65,7 @@ void cleanup_report_add_user_passwd (void *user_name)
|
|||||||
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, pw_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, pw_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_USER, log_get_progname(),
|
audit_logger (AUDIT_ADD_USER, log_get_progname(),
|
||||||
"adding user to /etc/passwd",
|
"adding-user",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
@@ -84,8 +84,8 @@ void cleanup_report_add_user_shadow (void *user_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, spw_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, spw_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_USER, log_get_progname(),
|
audit_logger (AUDIT_USER_MGMT, log_get_progname(),
|
||||||
"adding user to /etc/shadow",
|
"adding-shadow-user",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
@@ -104,7 +104,7 @@ void cleanup_unlock_passwd (MAYBE_UNUSED void *arg)
|
|||||||
log_get_progname(), pw_dbname ());
|
log_get_progname(), pw_dbname ());
|
||||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger_message ("unlocking passwd file",
|
audit_logger_message ("unlocking-passwd",
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ void cleanup_unlock_shadow (MAYBE_UNUSED void *arg)
|
|||||||
log_get_progname(), spw_dbname ());
|
log_get_progname(), spw_dbname ());
|
||||||
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger_message ("unlocking shadow file",
|
audit_logger_message ("unlocking-shadow",
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+52
-59
@@ -11,28 +11,35 @@
|
|||||||
|
|
||||||
#ident "$Id$"
|
#ident "$Id$"
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc/malloc.h"
|
||||||
#include "memzero.h"
|
#include "alloc/reallocf.h"
|
||||||
|
#include "atoi/getnum.h"
|
||||||
|
#include "commonio.h"
|
||||||
|
#include "defines.h"
|
||||||
#include "nscd.h"
|
#include "nscd.h"
|
||||||
#include "sssd.h"
|
|
||||||
#ifdef WITH_TCB
|
#ifdef WITH_TCB
|
||||||
#include <tcb.h>
|
#include <tcb.h>
|
||||||
#endif /* WITH_TCB */
|
#endif /* WITH_TCB */
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "commonio.h"
|
|
||||||
#include "shadowlog_internal.h"
|
#include "shadowlog_internal.h"
|
||||||
#include "string/sprintf.h"
|
#include "sssd.h"
|
||||||
|
#include "string/memset/memzero.h"
|
||||||
|
#include "string/sprintf/aprintf.h"
|
||||||
|
#include "string/sprintf/snprintf.h"
|
||||||
|
#include "string/strcmp/streq.h"
|
||||||
|
#include "string/strcmp/strprefix.h"
|
||||||
|
#include "string/strtok/stpsep.h"
|
||||||
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
@@ -69,17 +76,10 @@ int lrename (const char *old, const char *new)
|
|||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
char *r = NULL;
|
char *r = NULL;
|
||||||
|
|
||||||
#ifndef __GLIBC__
|
|
||||||
char resolved_path[PATH_MAX];
|
|
||||||
#endif /* !__GLIBC__ */
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (lstat (new, &sb) == 0 && S_ISLNK (sb.st_mode)) {
|
if (lstat (new, &sb) == 0 && S_ISLNK (sb.st_mode)) {
|
||||||
#ifdef __GLIBC__ /* now a POSIX.1-2008 feature */
|
|
||||||
r = realpath (new, NULL);
|
r = realpath (new, NULL);
|
||||||
#else /* !__GLIBC__ */
|
|
||||||
r = realpath (new, resolved_path);
|
|
||||||
#endif /* !__GLIBC__ */
|
|
||||||
if (NULL == r) {
|
if (NULL == r) {
|
||||||
perror ("realpath in lrename()");
|
perror ("realpath in lrename()");
|
||||||
} else {
|
} else {
|
||||||
@@ -89,9 +89,7 @@ int lrename (const char *old, const char *new)
|
|||||||
|
|
||||||
res = rename (old, new);
|
res = rename (old, new);
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
|
||||||
free (r);
|
free (r);
|
||||||
#endif /* __GLIBC__ */
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -194,7 +192,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
buf[len] = '\0';
|
stpcpy(&buf[len], "");
|
||||||
if (get_pid(buf, &pid) == -1) {
|
if (get_pid(buf, &pid) == -1) {
|
||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
@@ -364,9 +362,12 @@ int commonio_lock_nowait (struct commonio_db *db, bool log)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(&file, "%s.%ju", db->filename, (uintmax_t) getpid()) == -1)
|
file = aprintf("%s.%ju", db->filename, (uintmax_t) getpid());
|
||||||
|
if (file == NULL)
|
||||||
goto cleanup_ENOMEM;
|
goto cleanup_ENOMEM;
|
||||||
if (asprintf(&lock, "%s.lock", db->filename) == -1)
|
|
||||||
|
lock = aprintf("%s.lock", db->filename);
|
||||||
|
if (lock == NULL)
|
||||||
goto cleanup_ENOMEM;
|
goto cleanup_ENOMEM;
|
||||||
|
|
||||||
if (do_lock_file (file, lock, log) != 0) {
|
if (do_lock_file (file, lock, log) != 0) {
|
||||||
@@ -519,7 +520,7 @@ static void add_one_entry (struct commonio_db *db,
|
|||||||
|
|
||||||
static bool name_is_nis (const char *name)
|
static bool name_is_nis (const char *name)
|
||||||
{
|
{
|
||||||
return (('+' == name[0]) || ('-' == name[0]));
|
return strprefix(name, "+") || strprefix(name, "-");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -573,9 +574,7 @@ static void add_one_entry_nis (struct commonio_db *db,
|
|||||||
int commonio_open (struct commonio_db *db, int mode)
|
int commonio_open (struct commonio_db *db, int mode)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
char *cp;
|
|
||||||
char *line;
|
char *line;
|
||||||
struct commonio_entry *p;
|
|
||||||
void *eptr = NULL;
|
void *eptr = NULL;
|
||||||
int flags = mode;
|
int flags = mode;
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
@@ -636,21 +635,21 @@ int commonio_open (struct commonio_db *db, int mode)
|
|||||||
|
|
||||||
buflen = BUFLEN;
|
buflen = BUFLEN;
|
||||||
buf = MALLOC(buflen, char);
|
buf = MALLOC(buflen, char);
|
||||||
if (NULL == buf) {
|
if (NULL == buf)
|
||||||
goto cleanup_ENOMEM;
|
goto cleanup_errno;
|
||||||
}
|
|
||||||
|
|
||||||
while (db->ops->fgets (buf, buflen, db->fp) == buf) {
|
while (db->ops->fgets (buf, buflen, db->fp) == buf) {
|
||||||
|
struct commonio_entry *p;
|
||||||
|
|
||||||
while ( (strrchr (buf, '\n') == NULL)
|
while ( (strrchr (buf, '\n') == NULL)
|
||||||
&& (feof (db->fp) == 0)) {
|
&& (feof (db->fp) == 0)) {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
buflen += BUFLEN;
|
buflen += BUFLEN;
|
||||||
cp = REALLOC(buf, buflen, char);
|
buf = REALLOCF(buf, buflen, char);
|
||||||
if (NULL == cp) {
|
if (NULL == buf)
|
||||||
goto cleanup_buf;
|
goto cleanup_errno;
|
||||||
}
|
|
||||||
buf = cp;
|
|
||||||
len = strlen (buf);
|
len = strlen (buf);
|
||||||
if (db->ops->fgets (buf + len,
|
if (db->ops->fgets (buf + len,
|
||||||
(int) (buflen - len),
|
(int) (buflen - len),
|
||||||
@@ -658,10 +657,7 @@ int commonio_open (struct commonio_db *db, int mode)
|
|||||||
goto cleanup_buf;
|
goto cleanup_buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cp = strrchr (buf, '\n');
|
stpsep(buf, "\n");
|
||||||
if (NULL != cp) {
|
|
||||||
*cp = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
line = strdup (buf);
|
line = strdup (buf);
|
||||||
if (NULL == line) {
|
if (NULL == line) {
|
||||||
@@ -713,7 +709,6 @@ int commonio_open (struct commonio_db *db, int mode)
|
|||||||
free (line);
|
free (line);
|
||||||
cleanup_buf:
|
cleanup_buf:
|
||||||
free (buf);
|
free (buf);
|
||||||
cleanup_ENOMEM:
|
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
cleanup_errno:
|
cleanup_errno:
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
@@ -832,10 +827,8 @@ int commonio_sort_wrt (struct commonio_db *shadow,
|
|||||||
if (NULL == spw_ptr->eptr) {
|
if (NULL == spw_ptr->eptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strcmp (name, shadow->ops->getname (spw_ptr->eptr))
|
if (streq(name, shadow->ops->getname(spw_ptr->eptr)))
|
||||||
== 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (NULL == spw_ptr) {
|
if (NULL == spw_ptr) {
|
||||||
continue;
|
continue;
|
||||||
@@ -894,7 +887,7 @@ static int write_all (const struct commonio_db *db)
|
|||||||
|
|
||||||
int commonio_close (struct commonio_db *db)
|
int commonio_close (struct commonio_db *db)
|
||||||
{
|
{
|
||||||
int errors = 0;
|
bool errors = false;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@@ -935,25 +928,25 @@ int commonio_close (struct commonio_db *db)
|
|||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
if (set_selinux_file_context (db->filename, S_IFREG) != 0) {
|
if (set_selinux_file_context (db->filename, S_IFREG) != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (create_backup (buf, db->fp) != 0) {
|
if (create_backup (buf, db->fp) != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclose (db->fp) != 0) {
|
if (fclose (db->fp) != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
db->fp = NULL;
|
db->fp = NULL;
|
||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
if (reset_selinux_file_context () != 0) {
|
if (reset_selinux_file_context () != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (errors != 0)
|
if (errors)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@@ -969,7 +962,7 @@ int commonio_close (struct commonio_db *db)
|
|||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
if (set_selinux_file_context (db->filename, S_IFREG) != 0) {
|
if (set_selinux_file_context (db->filename, S_IFREG) != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -979,24 +972,24 @@ int commonio_close (struct commonio_db *db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (write_all (db) != 0) {
|
if (write_all (db) != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fflush (db->fp) != 0) {
|
if (fflush (db->fp) != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fsync (fileno (db->fp)) != 0) {
|
if (fsync (fileno (db->fp)) != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclose (db->fp) != 0) {
|
if (fclose (db->fp) != 0) {
|
||||||
errors++;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
db->fp = NULL;
|
db->fp = NULL;
|
||||||
|
|
||||||
if (errors != 0) {
|
if (errors) {
|
||||||
unlink (buf);
|
unlink (buf);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1014,11 +1007,11 @@ int commonio_close (struct commonio_db *db)
|
|||||||
nscd_need_reload = true;
|
nscd_need_reload = true;
|
||||||
goto success;
|
goto success;
|
||||||
fail:
|
fail:
|
||||||
errors++;
|
errors = true;
|
||||||
success:
|
success:
|
||||||
|
|
||||||
free_linked_list (db);
|
free_linked_list (db);
|
||||||
return errors == 0;
|
return !errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
static /*@dependent@*/ /*@null@*/struct commonio_entry *next_entry_by_name (
|
static /*@dependent@*/ /*@null@*/struct commonio_entry *next_entry_by_name (
|
||||||
@@ -1036,7 +1029,7 @@ static /*@dependent@*/ /*@null@*/struct commonio_entry *next_entry_by_name (
|
|||||||
for (p = pos; NULL != p; p = p->next) {
|
for (p = pos; NULL != p; p = p->next) {
|
||||||
ep = p->eptr;
|
ep = p->eptr;
|
||||||
if ( (NULL != ep)
|
if ( (NULL != ep)
|
||||||
&& (strcmp (db->ops->getname (ep), name) == 0)) {
|
&& streq(db->ops->getname(ep), name)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1242,7 +1235,7 @@ int commonio_rewind (struct commonio_db *db)
|
|||||||
|
|
||||||
if (!db->isopen) {
|
if (!db->isopen) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (NULL == db->cursor) {
|
if (NULL == db->cursor) {
|
||||||
db->cursor = db->head;
|
db->cursor = db->head;
|
||||||
|
|||||||
+17
-15
@@ -9,20 +9,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "defines.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "defines.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "string/strtcpy.h"
|
#include "string/strcmp/streq.h"
|
||||||
|
#include "string/strcmp/strprefix.h"
|
||||||
|
#include "string/strcpy/strtcpy.h"
|
||||||
|
#include "string/strtok/stpsep.h"
|
||||||
|
|
||||||
#ident "$Id$"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is now rather generic function which decides if "tty" is listed
|
* This is now rather generic function which decides if "tty" is listed
|
||||||
* under "cfgin" in config (directly or indirectly). Fallback to default if
|
* under "cfgin" in config (directly or indirectly). Fallback to default if
|
||||||
* something is bad.
|
* something is bad.
|
||||||
*/
|
*/
|
||||||
static bool is_listed (const char *cfgin, const char *tty, bool def)
|
static bool
|
||||||
|
is_listed(const char *cfgin, const char *tty, bool def)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[1024], *s;
|
char buf[1024], *s;
|
||||||
@@ -45,14 +51,13 @@ static bool is_listed (const char *cfgin, const char *tty, bool def)
|
|||||||
|
|
||||||
if (*cons != '/') {
|
if (*cons != '/') {
|
||||||
char *pbuf;
|
char *pbuf;
|
||||||
|
|
||||||
STRTCPY(buf, cons);
|
STRTCPY(buf, cons);
|
||||||
pbuf = &buf[0];
|
pbuf = buf;
|
||||||
while ((s = strtok (pbuf, ":")) != NULL) {
|
while (NULL != (s = strsep(&pbuf, ":"))) {
|
||||||
if (strcmp (s, tty) == 0) {
|
if (streq(s, tty)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pbuf = NULL;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -72,9 +77,8 @@ static bool is_listed (const char *cfgin, const char *tty, bool def)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
while (fgets (buf, sizeof (buf), fp) != NULL) {
|
while (fgets (buf, sizeof (buf), fp) != NULL) {
|
||||||
/* Remove optional trailing '\n'. */
|
stpsep(buf, "\n");
|
||||||
buf[strcspn (buf, "\n")] = '\0';
|
if (streq(buf, tty)) {
|
||||||
if (strcmp (buf, tty) == 0) {
|
|
||||||
(void) fclose (fp);
|
(void) fclose (fp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -100,9 +104,7 @@ static bool is_listed (const char *cfgin, const char *tty, bool def)
|
|||||||
|
|
||||||
bool console (const char *tty)
|
bool console (const char *tty)
|
||||||
{
|
{
|
||||||
if (strncmp (tty, "/dev/", 5) == 0) {
|
tty = strprefix(tty, "/dev/") ?: tty;
|
||||||
tty += 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_listed ("CONSOLE", tty, true);
|
return is_listed ("CONSOLE", tty, true);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-51
@@ -17,9 +17,11 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc/x/xmalloc.h"
|
||||||
#include "attr.h"
|
#include "attr.h"
|
||||||
|
#include "fs/readlink/areadlink.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
@@ -36,7 +38,10 @@
|
|||||||
#include <attr/libattr.h>
|
#include <attr/libattr.h>
|
||||||
#endif /* WITH_ATTR */
|
#endif /* WITH_ATTR */
|
||||||
#include "shadowlog.h"
|
#include "shadowlog.h"
|
||||||
#include "string/sprintf.h"
|
#include "string/sprintf/aprintf.h"
|
||||||
|
#include "string/sprintf/xaprintf.h"
|
||||||
|
#include "string/strcmp/streq.h"
|
||||||
|
#include "string/strcmp/strprefix.h"
|
||||||
|
|
||||||
|
|
||||||
static /*@null@*/const char *src_orig;
|
static /*@null@*/const char *src_orig;
|
||||||
@@ -66,7 +71,6 @@ static int copy_dir (const struct path_info *src, const struct path_info *dst,
|
|||||||
const struct stat *statp, const struct timespec mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
static /*@null@*/char *readlink_malloc (const char *filename);
|
|
||||||
static int copy_symlink (const struct path_info *src, const struct path_info *dst,
|
static int copy_symlink (const struct path_info *src, const struct path_info *dst,
|
||||||
MAYBE_UNUSED bool reset_selinux,
|
MAYBE_UNUSED bool reset_selinux,
|
||||||
const struct stat *statp, const struct timespec mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
@@ -230,7 +234,7 @@ static /*@exposed@*/ /*@null@*/struct link_name *check_link (const char *name, c
|
|||||||
lp->ln_dev = sb->st_dev;
|
lp->ln_dev = sb->st_dev;
|
||||||
lp->ln_ino = sb->st_ino;
|
lp->ln_ino = sb->st_ino;
|
||||||
lp->ln_count = sb->st_nlink;
|
lp->ln_count = sb->st_nlink;
|
||||||
xasprintf(&lp->ln_name, "%s%s", dst_orig, name + strlen(src_orig));
|
lp->ln_name = xaprintf("%s%s", dst_orig, name + strlen(src_orig));
|
||||||
lp->ln_next = links;
|
lp->ln_next = links;
|
||||||
links = lp;
|
links = lp;
|
||||||
|
|
||||||
@@ -313,19 +317,19 @@ static int copy_tree_impl (const struct path_info *src, const struct path_info *
|
|||||||
/*
|
/*
|
||||||
* Skip the "." and ".." entries
|
* Skip the "." and ".." entries
|
||||||
*/
|
*/
|
||||||
if (strcmp(ent->d_name, ".") == 0 ||
|
if (streq(ent->d_name, ".") ||
|
||||||
strcmp(ent->d_name, "..") == 0)
|
streq(ent->d_name, ".."))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(&src_name, "%s/%s", src->full_path, ent->d_name) == -1)
|
src_name = aprintf("%s/%s", src->full_path, ent->d_name);
|
||||||
{
|
if (src_name == NULL) {
|
||||||
err = -1;
|
err = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (asprintf(&dst_name, "%s/%s", dst->full_path, ent->d_name) == -1)
|
dst_name = aprintf("%s/%s", dst->full_path, ent->d_name);
|
||||||
{
|
if (dst_name == NULL) {
|
||||||
err = -1;
|
err = -1;
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
@@ -536,42 +540,6 @@ static int copy_dir (const struct path_info *src, const struct path_info *dst,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* readlink_malloc - wrapper for readlink
|
|
||||||
*
|
|
||||||
* return NULL on error.
|
|
||||||
* The return string shall be freed by the caller.
|
|
||||||
*/
|
|
||||||
static /*@null@*/char *readlink_malloc (const char *filename)
|
|
||||||
{
|
|
||||||
size_t size = 1024;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
ssize_t nchars;
|
|
||||||
char *buffer = MALLOC(size, char);
|
|
||||||
if (NULL == buffer) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
nchars = readlink (filename, buffer, size);
|
|
||||||
|
|
||||||
if (nchars < 0) {
|
|
||||||
free(buffer);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((size_t) nchars < size) { /* The buffer was large enough */
|
|
||||||
/* readlink does not nul-terminate */
|
|
||||||
buffer[nchars] = '\0';
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try again with a bigger buffer */
|
|
||||||
free (buffer);
|
|
||||||
size *= 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copy_symlink - copy a symlink
|
* copy_symlink - copy a symlink
|
||||||
*
|
*
|
||||||
@@ -602,19 +570,18 @@ static int copy_symlink (const struct path_info *src, const struct path_info *ds
|
|||||||
* destination directory name.
|
* destination directory name.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
oldlink = readlink_malloc (src->full_path);
|
oldlink = areadlink(src->full_path);
|
||||||
if (NULL == oldlink) {
|
if (NULL == oldlink)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
/* If src was a link to an entry of the src_orig directory itself,
|
/* If src was a link to an entry of the src_orig directory itself,
|
||||||
* create a link to the corresponding entry in the dst_orig
|
* create a link to the corresponding entry in the dst_orig
|
||||||
* directory.
|
* directory.
|
||||||
*/
|
*/
|
||||||
if (strncmp(oldlink, src_orig, strlen(src_orig)) == 0) {
|
if (strprefix(oldlink, src_orig)) {
|
||||||
char *dummy;
|
char *dummy;
|
||||||
|
|
||||||
xasprintf(&dummy, "%s%s", dst_orig, oldlink + strlen(src_orig));
|
dummy = xaprintf("%s%s", dst_orig, oldlink + strlen(src_orig));
|
||||||
free(oldlink);
|
free(oldlink);
|
||||||
oldlink = dummy;
|
oldlink = dummy;
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-17
@@ -1,21 +1,19 @@
|
|||||||
/*
|
// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
|
||||||
* SPDX-FileCopyrightText: Alejandro Colomar <alx@kernel.org>
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ident "$Id$"
|
#ident "$Id$"
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#if HAVE_SYS_RANDOM_H
|
#if __has_include(<sys/random.h>)
|
||||||
#include <sys/random.h>
|
# include <sys/random.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "bit.h"
|
#include "bit.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
@@ -34,7 +32,7 @@ static unsigned long csrand_uniform_slow(unsigned long n);
|
|||||||
unsigned long
|
unsigned long
|
||||||
csrand(void)
|
csrand(void)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
int fd;
|
||||||
unsigned long r;
|
unsigned long r;
|
||||||
|
|
||||||
#ifdef HAVE_GETENTROPY
|
#ifdef HAVE_GETENTROPY
|
||||||
@@ -56,17 +54,16 @@ csrand(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Use /dev/urandom as a last resort. */
|
/* Use /dev/urandom as a last resort. */
|
||||||
fp = fopen("/dev/urandom", "r");
|
fd = open("/dev/urandom", O_RDONLY);
|
||||||
if (NULL == fp) {
|
if (fd == -1)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (read(fd, &r, sizeof(r)) != sizeof(r)) {
|
||||||
|
close(fd);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fread(&r, sizeof(r), 1, fp) != 1) {
|
close(fd);
|
||||||
fclose(fp);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|||||||
+10
-7
@@ -41,7 +41,7 @@
|
|||||||
* crypt(3), crypt_gensalt(3), and their
|
* crypt(3), crypt_gensalt(3), and their
|
||||||
* feature test macros may be defined in here.
|
* feature test macros may be defined in here.
|
||||||
*/
|
*/
|
||||||
#if HAVE_CRYPT_H
|
#if __has_include(<crypt.h>)
|
||||||
# include <crypt.h>
|
# include <crypt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -50,13 +50,8 @@
|
|||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* Possible cases:
|
|
||||||
* - /usr/include/shadow.h exists and includes the shadow group stuff.
|
|
||||||
* - /usr/include/shadow.h exists, but we use our own gshadow.h.
|
|
||||||
*/
|
|
||||||
#include <shadow.h>
|
#include <shadow.h>
|
||||||
#if defined(SHADOWGRP) && !defined(GSHADOW)
|
#if defined(SHADOWGRP)
|
||||||
#include "gshadow_.h"
|
#include "gshadow_.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -70,6 +65,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PATH_MAX
|
||||||
|
#define PATH_MAX 4096
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAXHOSTNAMELEN
|
||||||
|
#define MAXHOSTNAMELEN 64
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
#ifndef LOG_WARN
|
#ifndef LOG_WARN
|
||||||
|
|||||||
+5
-2
@@ -17,6 +17,8 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "shadowlog_internal.h"
|
#include "shadowlog_internal.h"
|
||||||
|
#include "string/strcmp/strprefix.h"
|
||||||
|
|
||||||
|
|
||||||
/*@exposed@*//*@null@*/char *pw_encrypt (const char *clear, const char *salt)
|
/*@exposed@*//*@null@*/char *pw_encrypt (const char *clear, const char *salt)
|
||||||
{
|
{
|
||||||
@@ -35,7 +37,7 @@
|
|||||||
|
|
||||||
/* Some crypt() do not return NULL if the algorithm is not
|
/* Some crypt() do not return NULL if the algorithm is not
|
||||||
* supported, and return a DES encrypted password. */
|
* supported, and return a DES encrypted password. */
|
||||||
if ((NULL != salt) && (salt[0] == '$') && (strlen (cp) <= 13))
|
if ((NULL != salt) && strprefix(salt, "$") && (strlen (cp) <= 13))
|
||||||
{
|
{
|
||||||
/*@observer@*/const char *method;
|
/*@observer@*/const char *method;
|
||||||
switch (salt[1])
|
switch (salt[1])
|
||||||
@@ -65,7 +67,8 @@
|
|||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
_("crypt method not supported by libcrypt? (%s)\n"),
|
_("crypt method not supported by libcrypt? (%s)\n"),
|
||||||
method);
|
method);
|
||||||
exit (EXIT_FAILURE);
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen (cp) != 13) {
|
if (strlen (cp) != 13) {
|
||||||
|
|||||||
@@ -16,11 +16,15 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc/x/xmalloc.h"
|
||||||
|
#include "alloc/x/xrealloc.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "shadowlog.h"
|
#include "shadowlog.h"
|
||||||
#include "string/sprintf.h"
|
#include "string/sprintf/snprintf.h"
|
||||||
|
#include "string/sprintf/xaprintf.h"
|
||||||
|
#include "string/strcmp/strprefix.h"
|
||||||
|
#include "string/strdup/xstrdup.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -74,7 +78,7 @@ void addenv (const char *string, /*@null@*/const char *value)
|
|||||||
size_t i, n;
|
size_t i, n;
|
||||||
|
|
||||||
if (NULL != value) {
|
if (NULL != value) {
|
||||||
xasprintf(&newstring, "%s=%s", string, value);
|
newstring = xaprintf("%s=%s", string, value);
|
||||||
} else {
|
} else {
|
||||||
newstring = xstrdup (string);
|
newstring = xstrdup (string);
|
||||||
}
|
}
|
||||||
@@ -172,7 +176,7 @@ void set_env (int argc, char *const *argv)
|
|||||||
const char *const *p;
|
const char *const *p;
|
||||||
|
|
||||||
for (p = forbid; NULL != *p; p++) {
|
for (p = forbid; NULL != *p; p++) {
|
||||||
if (strncmp (*argv, *p, strlen (*p)) == 0) {
|
if (strprefix(*argv, *p)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +211,7 @@ void sanitize_env (void)
|
|||||||
|
|
||||||
for (cur = envp; NULL != *cur; cur++) {
|
for (cur = envp; NULL != *cur; cur++) {
|
||||||
for (bad = forbid; NULL != *bad; bad++) {
|
for (bad = forbid; NULL != *bad; bad++) {
|
||||||
if (strncmp (*cur, *bad, strlen (*bad)) == 0) {
|
if (strprefix(*cur, *bad)) {
|
||||||
for (move = cur; NULL != *move; move++) {
|
for (move = cur; NULL != *move; move++) {
|
||||||
*move = *(move + 1);
|
*move = *(move + 1);
|
||||||
}
|
}
|
||||||
@@ -219,7 +223,7 @@ void sanitize_env (void)
|
|||||||
|
|
||||||
for (cur = envp; NULL != *cur; cur++) {
|
for (cur = envp; NULL != *cur; cur++) {
|
||||||
for (bad = noslash; NULL != *bad; bad++) {
|
for (bad = noslash; NULL != *bad; bad++) {
|
||||||
if (strncmp (*cur, *bad, strlen (*bad)) != 0) {
|
if (!strprefix(*cur, *bad)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strchr (*cur, '/') == NULL) {
|
if (strchr (*cur, '/') == NULL) {
|
||||||
|
|||||||
+4
-6
@@ -18,10 +18,10 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "faillog.h"
|
#include "faillog.h"
|
||||||
#include "failure.h"
|
#include "failure.h"
|
||||||
#include "memzero.h"
|
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
#include "string/memset/memzero.h"
|
||||||
#include "string/strftime.h"
|
#include "string/strftime.h"
|
||||||
#include "string/strtcpy.h"
|
#include "string/strcpy/strtcpy.h"
|
||||||
|
|
||||||
|
|
||||||
#define YEAR (365L*DAY)
|
#define YEAR (365L*DAY)
|
||||||
@@ -82,7 +82,7 @@ void failure (uid_t uid, const char *tty, struct faillog *fl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
STRTCPY(fl->fail_line, tty);
|
STRTCPY(fl->fail_line, tty);
|
||||||
(void) time (&fl->fail_time);
|
fl->fail_time = time(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Seek back to the correct position in the file and write the
|
* Seek back to the correct position in the file and write the
|
||||||
@@ -126,7 +126,7 @@ static bool too_many_failures (const struct faillog *fl)
|
|||||||
return true; /* locked until reset manually */
|
return true; /* locked until reset manually */
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) time (&now);
|
now = time(NULL);
|
||||||
if ((fl->fail_time + fl->fail_locktime) < now) {
|
if ((fl->fail_time + fl->fail_locktime) < now) {
|
||||||
return false; /* enough time since last failure */
|
return false; /* enough time since last failure */
|
||||||
}
|
}
|
||||||
@@ -242,14 +242,12 @@ void failprint (const struct faillog *fail)
|
|||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
char lasttimeb[256];
|
char lasttimeb[256];
|
||||||
char *lasttime = lasttimeb;
|
char *lasttime = lasttimeb;
|
||||||
time_t NOW;
|
|
||||||
|
|
||||||
if (0 == fail->fail_cnt) {
|
if (0 == fail->fail_cnt) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tp = localtime (&(fail->fail_time));
|
tp = localtime (&(fail->fail_time));
|
||||||
(void) time (&NOW);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print all information we have.
|
* Print all information we have.
|
||||||
|
|||||||
+30
-47
@@ -9,51 +9,45 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ident "$Id$"
|
#include "fields.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
#include "string/ctype/strisascii/strisprint.h"
|
||||||
|
#include "string/ctype/strchrisascii/strchriscntrl.h"
|
||||||
|
#include "string/strcmp/streq.h"
|
||||||
|
#include "string/strspn/stpspn.h"
|
||||||
|
#include "string/strspn/stprspn.h"
|
||||||
|
#include "string/strtok/stpsep.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* valid_field - insure that a field contains all legal characters
|
* valid_field - insure that a field contains all legal characters
|
||||||
*
|
*
|
||||||
* The supplied field is scanned for non-printable and other illegal
|
* Return:
|
||||||
* characters.
|
* -1 Illegal or control characters are present.
|
||||||
* + -1 is returned if an illegal or control character is present.
|
* 1 Non-ASCII characters are present.
|
||||||
* + 1 is returned if no illegal or control characters are present,
|
* 0 All chatacters are legal and ASCII.
|
||||||
* but the field contains a non-printable character.
|
|
||||||
* + 0 is returned otherwise.
|
|
||||||
*/
|
*/
|
||||||
int valid_field (const char *field, const char *illegal)
|
int
|
||||||
|
valid_field_(const char *field, const char *illegal)
|
||||||
{
|
{
|
||||||
const char *cp;
|
if (NULL == field)
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
if (NULL == field) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
/* For each character of field, search if it appears in the list
|
if (strpbrk(field, illegal))
|
||||||
* of illegal characters. */
|
|
||||||
if (illegal && NULL != strpbrk (field, illegal)) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
if (strchriscntrl(field))
|
||||||
|
return -1;
|
||||||
|
if (strisprint(field))
|
||||||
|
return 0;
|
||||||
|
if (streq(field, ""))
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* Search if there are non-printable or control characters */
|
return 1; // !ASCII
|
||||||
for (cp = field; '\0' != *cp; cp++) {
|
|
||||||
unsigned char c = *cp;
|
|
||||||
if (!isprint (c)) {
|
|
||||||
err = 1;
|
|
||||||
}
|
|
||||||
if (iscntrl (c)) {
|
|
||||||
err = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -62,7 +56,8 @@ int valid_field (const char *field, const char *illegal)
|
|||||||
* prompt the user with the name of the field being changed and the
|
* prompt the user with the name of the field being changed and the
|
||||||
* current value.
|
* current value.
|
||||||
*/
|
*/
|
||||||
void change_field (char *buf, size_t maxsize, const char *prompt)
|
void
|
||||||
|
change_field(char *buf, size_t maxsize, const char *prompt)
|
||||||
{
|
{
|
||||||
char newf[200];
|
char newf[200];
|
||||||
char *cp;
|
char *cp;
|
||||||
@@ -77,29 +72,17 @@ void change_field (char *buf, size_t maxsize, const char *prompt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cp = strchr (newf, '\n');
|
if (stpsep(newf, "\n") == NULL)
|
||||||
if (NULL == cp) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
*cp = '\0';
|
|
||||||
|
|
||||||
if ('\0' != newf[0]) {
|
if (!streq(newf, "")) {
|
||||||
/*
|
/*
|
||||||
* Remove leading and trailing whitespace. This also
|
* Remove leading and trailing whitespace. This also
|
||||||
* makes it possible to change the field to empty, by
|
* makes it possible to change the field to empty, by
|
||||||
* entering a space. --marekm
|
* entering a space. --marekm
|
||||||
*/
|
*/
|
||||||
|
stpcpy(stprspn(newf, " \t"), "");
|
||||||
while (newf < cp && isspace (cp[-1])) {
|
cp = stpspn(newf, " \t");
|
||||||
cp--;
|
|
||||||
}
|
|
||||||
*cp = '\0';
|
|
||||||
|
|
||||||
cp = newf;
|
|
||||||
while (isspace (*cp)) {
|
|
||||||
cp++;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy (buf, cp);
|
strcpy (buf, cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2025, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
#ifndef _SHADOW_INCLUDE_LIB_FIELDS_H_
|
||||||
|
#define _SHADOW_INCLUDE_LIB_FIELDS_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define valid_field(field, illegal) valid_field_(field, "" illegal "")
|
||||||
|
|
||||||
|
|
||||||
|
int valid_field_(const char *field, const char *illegal);
|
||||||
|
void change_field(char *buf, size_t maxsize, const char *prompt);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // include guard
|
||||||
+2
-1
@@ -9,10 +9,11 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc/calloc.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "groupio.h"
|
#include "groupio.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
|||||||
+6
-5
@@ -9,10 +9,11 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc/calloc.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "pwio.h"
|
#include "pwio.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
@@ -304,7 +305,7 @@ int find_new_uid(bool sys_user,
|
|||||||
return 0;
|
return 0;
|
||||||
} else if (result == EEXIST || result == EINVAL) {
|
} else if (result == EEXIST || result == EINVAL) {
|
||||||
/*
|
/*
|
||||||
* This GID is in use or unusable, we'll
|
* This UID is in use or unusable, we'll
|
||||||
* continue to the next.
|
* continue to the next.
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
@@ -350,7 +351,7 @@ int find_new_uid(bool sys_user,
|
|||||||
return 0;
|
return 0;
|
||||||
} else if (result == EEXIST || result == EINVAL) {
|
} else if (result == EEXIST || result == EINVAL) {
|
||||||
/*
|
/*
|
||||||
* This GID is in use or unusable, we'll
|
* This UID is in use or unusable, we'll
|
||||||
* continue to the next.
|
* continue to the next.
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
@@ -413,7 +414,7 @@ int find_new_uid(bool sys_user,
|
|||||||
return 0;
|
return 0;
|
||||||
} else if (result == EEXIST || result == EINVAL) {
|
} else if (result == EEXIST || result == EINVAL) {
|
||||||
/*
|
/*
|
||||||
* This GID is in use or unusable, we'll
|
* This UID is in use or unusable, we'll
|
||||||
* continue to the next.
|
* continue to the next.
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
@@ -459,7 +460,7 @@ int find_new_uid(bool sys_user,
|
|||||||
return 0;
|
return 0;
|
||||||
} else if (result == EEXIST || result == EINVAL) {
|
} else if (result == EEXIST || result == EINVAL) {
|
||||||
/*
|
/*
|
||||||
* This GID is in use or unusable, we'll
|
* This UID is in use or unusable, we'll
|
||||||
* continue to the next.
|
* continue to the next.
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+7
-8
@@ -10,10 +10,11 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
#include "string/strcmp/streq.h"
|
||||||
#ident "$Id$"
|
|
||||||
|
|
||||||
|
|
||||||
/*@null@*/char *
|
/*@null@*/char *
|
||||||
@@ -25,7 +26,7 @@ fgetsx(/*@returned@*/char *restrict buf, int cnt, FILE *restrict f)
|
|||||||
while (cnt > 0) {
|
while (cnt > 0) {
|
||||||
if (fgets (cp, cnt, f) != cp) {
|
if (fgets (cp, cnt, f) != cp) {
|
||||||
if (cp == buf) {
|
if (cp == buf) {
|
||||||
return 0;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -33,10 +34,8 @@ fgetsx(/*@returned@*/char *restrict buf, int cnt, FILE *restrict f)
|
|||||||
ep = strrchr (cp, '\\');
|
ep = strrchr (cp, '\\');
|
||||||
if ((NULL != ep) && (*(ep + 1) == '\n')) {
|
if ((NULL != ep) && (*(ep + 1) == '\n')) {
|
||||||
cnt -= ep - cp;
|
cnt -= ep - cp;
|
||||||
if (cnt > 0) {
|
if (cnt > 0)
|
||||||
cp = ep;
|
cp = stpcpy(ep, "");
|
||||||
*cp = '\0';
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -48,7 +47,7 @@ int fputsx (const char *s, FILE * stream)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; '\0' != *s; i++, s++) {
|
for (i = 0; !streq(s, ""); i++, s++) {
|
||||||
if (putc (*s, stream) == EOF) {
|
if (putc (*s, stream) == EOF) {
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "fs/mkstemp/fmkomstemp.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern inline FILE *fmkomstemp(char *template, unsigned int flags, mode_t m);
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SHADOW_INCLUDE_LIB_FS_MKSTEMP_FMKOMSTEMP_H_
|
||||||
|
#define SHADOW_INCLUDE_LIB_FS_MKSTEMP_FMKOMSTEMP_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "fs/mkstemp/mkomstemp.h"
|
||||||
|
|
||||||
|
|
||||||
|
inline FILE *fmkomstemp(char *template, unsigned int flags, mode_t m);
|
||||||
|
|
||||||
|
|
||||||
|
// FILE make with-open(2)-flags with-mode secure temporary
|
||||||
|
inline FILE *
|
||||||
|
fmkomstemp(char *template, unsigned int flags, mode_t m)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
fd = mkomstemp(template, flags, m);
|
||||||
|
if (fd == -1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
fp = fdopen(fd, "w");
|
||||||
|
if (fp == NULL)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
return fp;
|
||||||
|
fail:
|
||||||
|
close(fd);
|
||||||
|
unlink(template);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // include guard
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "fs/mkstemp/mkomstemp.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern inline int mkomstemp(char *template, unsigned int flags, mode_t m);
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SHADOW_INCLUDE_LIB_FS_MKSTEMP_MKOMSTEMP_H_
|
||||||
|
#define SHADOW_INCLUDE_LIB_FS_MKSTEMP_MKOMSTEMP_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
inline int mkomstemp(char *template, unsigned int flags, mode_t m);
|
||||||
|
|
||||||
|
|
||||||
|
// make with-open(2)-like-flags with-mode secure temporary
|
||||||
|
inline int
|
||||||
|
mkomstemp(char *template, unsigned int flags, mode_t m)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = mkostemp(template, flags);
|
||||||
|
if (fd == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (fchmod(fd, m) == -1)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
return fd;
|
||||||
|
fail:
|
||||||
|
close(fd);
|
||||||
|
unlink(template);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // include guard
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "fs/readlink/areadlink.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern inline char *areadlink(const char *link);
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SHADOW_INCLUDE_LIB_FS_READLINK_AREADLINK_H_
|
||||||
|
#define SHADOW_INCLUDE_LIB_FS_READLINK_AREADLINK_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "defines.h"
|
||||||
|
#include "alloc/malloc.h"
|
||||||
|
#include "attr.h"
|
||||||
|
#include "fs/readlink/readlinknul.h"
|
||||||
|
|
||||||
|
|
||||||
|
ATTR_STRING(1)
|
||||||
|
inline char *areadlink(const char *link);
|
||||||
|
|
||||||
|
|
||||||
|
// Similar to readlink(2), but allocate and terminate the string.
|
||||||
|
inline char *
|
||||||
|
areadlink(const char *link)
|
||||||
|
{
|
||||||
|
size_t size = PATH_MAX;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
int len;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
buf = MALLOC(size, char);
|
||||||
|
if (NULL == buf)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
len = readlinknul(link, buf, size);
|
||||||
|
if (len != -1)
|
||||||
|
return buf;
|
||||||
|
|
||||||
|
free(buf);
|
||||||
|
if (errno != E2BIG)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
size *= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // include guard
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "fs/readlink/readlinknul.h"
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern inline ssize_t readlinknul(const char *restrict link, char *restrict buf,
|
||||||
|
ssize_t size);
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar <alx@kernel.org>
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SHADOW_INCLUDE_LIB_FS_READLINK_READLINKNUL_H_
|
||||||
|
#define SHADOW_INCLUDE_LIB_FS_READLINK_READLINKNUL_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "attr.h"
|
||||||
|
#include "sizeof.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define READLINKNUL(link, buf) readlinknul(link, buf, countof(buf))
|
||||||
|
|
||||||
|
|
||||||
|
ATTR_STRING(1)
|
||||||
|
inline ssize_t readlinknul(const char *restrict link, char *restrict buf,
|
||||||
|
ssize_t size);
|
||||||
|
|
||||||
|
|
||||||
|
// Similar to readlink(2), but terminate the string.
|
||||||
|
inline ssize_t
|
||||||
|
readlinknul(const char *restrict link, char *restrict buf, ssize_t size)
|
||||||
|
{
|
||||||
|
ssize_t len;
|
||||||
|
|
||||||
|
len = readlink(link, buf, size);
|
||||||
|
if (len == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (len == size) {
|
||||||
|
stpcpy(&buf[size-1], "");
|
||||||
|
errno = E2BIG;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
stpcpy(&buf[len], "");
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // include guard
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#ident "$Id$"
|
|
||||||
|
|
||||||
#include "prototypes.h"
|
|
||||||
#include "defines.h"
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
get_gid(const char *gidstr, gid_t *gid)
|
|
||||||
{
|
|
||||||
char *end;
|
|
||||||
long long val;
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
val = strtoll(gidstr, &end, 10);
|
|
||||||
if ( ('\0' == *gidstr)
|
|
||||||
|| ('\0' != *end)
|
|
||||||
|| (0 != errno)
|
|
||||||
|| (/*@+longintegral@*/val != (gid_t)val)/*@=longintegral@*/) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*gid = val;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+19
-48
@@ -1,42 +1,22 @@
|
|||||||
/*
|
// SPDX-FileCopyrightText: 2009, Nicolas François
|
||||||
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
|
||||||
*
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ident "$Id$"
|
#include <limits.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include "prototypes.h"
|
|
||||||
#include "defines.h"
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include "string/sprintf.h"
|
#include "defines.h"
|
||||||
|
#include "atoi/getnum.h"
|
||||||
|
#include "defines.h"
|
||||||
|
#include "prototypes.h"
|
||||||
|
#include "string/sprintf/snprintf.h"
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
get_pid(const char *pidstr, pid_t *pid)
|
|
||||||
{
|
|
||||||
char *end;
|
|
||||||
long long val;
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
val = strtoll(pidstr, &end, 10);
|
|
||||||
if ( ('\0' == *pidstr)
|
|
||||||
|| ('\0' != *end)
|
|
||||||
|| (0 != errno)
|
|
||||||
|| (val < 1)
|
|
||||||
|| (/*@+longintegral@*/val != (pid_t)val)/*@=longintegral@*/) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*pid = val;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If use passed in fd:4 as an argument, then return the
|
* If use passed in fd:4 as an argument, then return the
|
||||||
* value '4', the fd to use.
|
* value '4', the fd to use.
|
||||||
@@ -44,20 +24,12 @@ get_pid(const char *pidstr, pid_t *pid)
|
|||||||
*/
|
*/
|
||||||
int get_pidfd_from_fd(const char *pidfdstr)
|
int get_pidfd_from_fd(const char *pidfdstr)
|
||||||
{
|
{
|
||||||
char *end;
|
int pidfd;
|
||||||
long long val;
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
dev_t proc_st_dev, proc_st_rdev;
|
dev_t proc_st_dev, proc_st_rdev;
|
||||||
|
|
||||||
errno = 0;
|
if (get_fd(pidfdstr, &pidfd) == -1)
|
||||||
val = strtoll(pidfdstr, &end, 10);
|
|
||||||
if ( ('\0' == *pidfdstr)
|
|
||||||
|| ('\0' != *end)
|
|
||||||
|| (0 != errno)
|
|
||||||
|| (val < 0)
|
|
||||||
|| (/*@+longintegral@*/val != (int)val)/*@=longintegral@*/) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (stat("/proc/self/uid_map", &st) < 0) {
|
if (stat("/proc/self/uid_map", &st) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -66,7 +38,7 @@ int get_pidfd_from_fd(const char *pidfdstr)
|
|||||||
proc_st_dev = st.st_dev;
|
proc_st_dev = st.st_dev;
|
||||||
proc_st_rdev = st.st_rdev;
|
proc_st_rdev = st.st_rdev;
|
||||||
|
|
||||||
if (fstat(val, &st) < 0) {
|
if (fstat(pidfd, &st) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,28 +46,27 @@ int get_pidfd_from_fd(const char *pidfdstr)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)val;
|
return pidfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int open_pidfd(const char *pidstr)
|
int open_pidfd(const char *pidstr)
|
||||||
{
|
{
|
||||||
int proc_dir_fd;
|
int proc_dir_fd;
|
||||||
char proc_dir_name[32];
|
char proc_dir_name[PATH_MAX];
|
||||||
pid_t target;
|
pid_t target;
|
||||||
|
|
||||||
if (get_pid(pidstr, &target) == -1)
|
if (get_pid(pidstr, &target) == -1)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
/* max string length is 6 + 10 + 1 + 1 = 18, allocate 32 bytes */
|
if (SNPRINTF(proc_dir_name, "/proc/%d/", target) == -1) {
|
||||||
if (SNPRINTF(proc_dir_name, "/proc/%u/", target) == -1) {
|
fprintf(stderr, "snprintf of proc path failed for %d: %s\n",
|
||||||
fprintf(stderr, "snprintf of proc path failed for %u: %s\n",
|
|
||||||
target, strerror(errno));
|
target, strerror(errno));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_dir_fd = open(proc_dir_name, O_DIRECTORY);
|
proc_dir_fd = open(proc_dir_name, O_DIRECTORY);
|
||||||
if (proc_dir_fd < 0) {
|
if (proc_dir_fd < 0) {
|
||||||
fprintf(stderr, _("Could not open proc directory for target %u: %s\n"),
|
fprintf(stderr, _("Could not open proc directory for target %d: %s\n"),
|
||||||
target, strerror(errno));
|
target, strerror(errno));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user