Compare commits

..

1 Commits

Author SHA1 Message Date
Chris Hofstaedtler
e5b7b9fde8 Add Build-Depends: libcmocka-dev to run build-time tests 2024-07-06 23:57:40 +02:00
921 changed files with 15991 additions and 30512 deletions

View File

@@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = NEWS README
SUBDIRS = lib
if ENABLE_SUBIDS
@@ -14,7 +16,7 @@ endif
CLEANFILES = man/8.out man/po/remove-potcdate.* man/*/login.defs.d man/*/*.mo
EXTRA_DIST = NEWS README tests/
EXTRA_DIST = tests/
dist-hook:
chmod -R u+w $(distdir)/tests

View File

@@ -243,6 +243,7 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
@@ -389,10 +390,10 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = tests/
SUBDIRS = lib $(am__append_1) src po contrib doc etc tests/unit \
$(am__append_2)
CLEANFILES = man/8.out man/po/remove-potcdate.* man/*/login.defs.d man/*/*.mo
EXTRA_DIST = NEWS README tests/
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive

43
aclocal.m4 vendored
View File

@@ -22,14 +22,15 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
#
# Copyright (C) 1999-2008, 2011-2015 Free Software Foundation, Inc.
# Copyright (C) 1999-2008, 2011-2019, 2021-2022 Free Software
# Foundation, Inc.
# Written by Thomas Tanner, 1999
#
# This file 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.
# serial 20 LTDL_INIT
# serial 21 LTDL_INIT
# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE])
# ------------------------------------------
@@ -357,7 +358,7 @@ AC_CONFIG_COMMANDS_PRE([
if test -n "$_LT_LIBOBJS"; then
# Remove the extension.
_lt_sed_drop_objext='s/\.o$//;s/\.obj$//'
for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do
for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | $SED "$_lt_sed_drop_objext" | sort -u`; do
_ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext"
_ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo"
done
@@ -495,7 +496,7 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
# If you are looking for one http://www.opendarwin.org/projects/dlcompat
lt_cv_sys_dlopen_deplibs=yes
;;
freebsd* | dragonfly*)
freebsd* | dragonfly* | midnightbsd*)
lt_cv_sys_dlopen_deplibs=yes
;;
gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu)
@@ -930,8 +931,8 @@ AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], [])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 11 (pkg-config-0.29.1)
# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
@@ -973,7 +974,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.1])
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
@@ -1018,7 +1019,7 @@ dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
dnl only at the first occurence in configure.ac, so if the first place
dnl only at the first occurrence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
@@ -1074,7 +1075,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -1084,17 +1085,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
@@ -1105,8 +1106,8 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
@@ -1116,10 +1117,10 @@ _PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
$3
fi[]dnl
])dnl PKG_CHECK_MODULES

View File

@@ -341,6 +341,12 @@
/* Path to passwd program. */
#undef PASSWD_PROGRAM
/* Define if login should support the -r flag for rlogind. */
#undef RLOGIN
/* Define to the ruserok() "success" return value (0 or 1). */
#undef RUSEROK
/* Define to support the shadow group file. */
#undef SHADOWGRP

406
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for shadow 4.17.2.
# Generated by GNU Autoconf 2.71 for shadow 4.15.3.
#
# Report bugs to <pkg-shadow-devel@lists.alioth.debian.org>.
#
@@ -621,8 +621,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='shadow'
PACKAGE_TARNAME='shadow'
PACKAGE_VERSION='4.17.2'
PACKAGE_STRING='shadow 4.17.2'
PACKAGE_VERSION='4.15.3'
PACKAGE_STRING='shadow 4.15.3'
PACKAGE_BUGREPORT='pkg-shadow-devel@lists.alioth.debian.org'
PACKAGE_URL='https://github.com/shadow-maint/shadow'
@@ -763,6 +763,7 @@ ac_ct_AR
AR
DLLTOOL
OBJDUMP
FILECMD
NM
ac_ct_DUMPBIN
DUMPBIN
@@ -1488,7 +1489,7 @@ if test "$ac_init_help" = "long"; then
# 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.
cat <<_ACEOF
\`configure' configures shadow 4.17.2 to adapt to many kinds of systems.
\`configure' configures shadow 4.15.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1559,7 +1560,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of shadow 4.17.2:";;
short | recursive ) echo "Configuration of shadow 4.15.3:";;
esac
cat <<\_ACEOF
@@ -1738,7 +1739,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
shadow configure 4.17.2
shadow configure 4.15.3
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2338,7 +2339,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by shadow $as_me 4.17.2, which was
It was created by shadow $as_me 4.15.3, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3611,7 +3612,7 @@ fi
# Define the identity of the package.
PACKAGE='shadow'
VERSION='4.17.2'
VERSION='4.15.3'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -3845,13 +3846,13 @@ AM_BACKSLASH='\'
ac_config_headers="$ac_config_headers config.h"
LIBSUBID_ABI_MAJOR=5
LIBSUBID_ABI_MAJOR=4
LIBSUBID_ABI_MINOR=0
LIBSUBID_ABI_MICRO=0
LIBSUBID_ABI=5.0.0
LIBSUBID_ABI=4.0.0
test "$prefix" = "NONE" && prefix="/usr"
@@ -6356,8 +6357,8 @@ esac
macro_version='2.4.6'
macro_revision='2.4.6'
macro_version='2.4.7'
macro_revision='2.4.7'
@@ -6985,13 +6986,13 @@ else
mingw*) lt_bad_file=conftest.nm/nofile ;;
*) lt_bad_file=/dev/null ;;
esac
case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in
*$lt_bad_file* | *'Invalid file or object type'*)
lt_cv_path_NM="$tmp_nm -B"
break 2
;;
*)
case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in
*/dev/null*)
lt_cv_path_NM="$tmp_nm -p"
break 2
@@ -7129,7 +7130,7 @@ esac
fi
fi
case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in
*COFF*)
DUMPBIN="$DUMPBIN -symbols -headers"
;;
@@ -7222,7 +7223,7 @@ else $as_nop
lt_cv_sys_max_cmd_len=8192;
;;
bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*)
# This has been around since 386BSD, at least. Likely further.
if test -x /sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
@@ -7265,7 +7266,7 @@ else $as_nop
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
@@ -7470,6 +7471,114 @@ esac
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args.
set dummy ${ac_tool_prefix}file; 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_FILECMD+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$FILECMD"; then
ac_cv_prog_FILECMD="$FILECMD" # 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_FILECMD="${ac_tool_prefix}file"
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
FILECMD=$ac_cv_prog_FILECMD
if test -n "$FILECMD"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5
printf "%s\n" "$FILECMD" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_FILECMD"; then
ac_ct_FILECMD=$FILECMD
# Extract the first word of "file", so it can be a program name with args.
set dummy file; 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_ac_ct_FILECMD+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$ac_ct_FILECMD"; then
ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # 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_ac_ct_FILECMD="file"
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
ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD
if test -n "$ac_ct_FILECMD"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5
printf "%s\n" "$ac_ct_FILECMD" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_ct_FILECMD" = x; then
FILECMD=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
FILECMD=$ac_ct_FILECMD
fi
else
FILECMD="$ac_cv_prog_FILECMD"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
set dummy ${ac_tool_prefix}objdump; ac_word=$2
@@ -7613,7 +7722,7 @@ beos*)
bsdi[45]*)
lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
lt_cv_file_magic_cmd='/usr/bin/file -L'
lt_cv_file_magic_cmd='$FILECMD -L'
lt_cv_file_magic_test_file=/shlib/libc.so
;;
@@ -7647,14 +7756,14 @@ darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
freebsd* | dragonfly*)
freebsd* | dragonfly* | midnightbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_cmd=$FILECMD
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
esac
@@ -7668,7 +7777,7 @@ haiku*)
;;
hpux10.20* | hpux11*)
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_cmd=$FILECMD
case $host_cpu in
ia64*)
lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
@@ -7715,7 +7824,7 @@ netbsd* | netbsdelf*-gnu)
newos6*)
lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_cmd=$FILECMD
lt_cv_file_magic_test_file=/usr/lib/libnls.so
;;
@@ -8088,13 +8197,29 @@ esac
fi
: ${AR=ar}
: ${AR_FLAGS=cr}
# Use ARFLAGS variable as AR's operation code to sync the variable naming with
# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have
# higher priority because thats what people were doing historically (setting
# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS
# variable obsoleted/removed.
test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr}
lt_ar_flags=$AR_FLAGS
# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override
# by AR_FLAGS because that was never working and AR_FLAGS is about to die.
@@ -8511,7 +8636,7 @@ esac
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Gets list of data symbols to import.
lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'"
# Adjust the below global symbol transforms to fixup imported variables.
lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'"
@@ -8529,20 +8654,20 @@ fi
# Transform an extracted symbol line into a proper C declaration.
# Some systems (esp. on ia64) link data and code symbols differently,
# so use this general approach.
lt_cv_sys_global_symbol_to_cdecl="sed -n"\
lt_cv_sys_global_symbol_to_cdecl="$SED -n"\
$lt_cdecl_hook\
" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
# Transform an extracted symbol line into symbol name and symbol address
lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\
$lt_c_name_hook\
" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'"
# Transform an extracted symbol line into symbol name with lib prefix and
# symbol address.
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\
$lt_c_name_lib_hook\
" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\
@@ -8566,7 +8691,7 @@ for ac_symprfx in "" "_"; do
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Fake it for dumpbin and say T for any non-static function,
# D for any global variable and I for any imported variable.
# Also find C++ and __fastcall symbols from MSVC++,
# Also find C++ and __fastcall symbols from MSVC++ or ICC,
# which start with @ or ?.
lt_cv_sys_global_symbol_pipe="$AWK '"\
" {last_section=section; section=\$ 3};"\
@@ -8584,9 +8709,9 @@ for ac_symprfx in "" "_"; do
" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
" ' prfx=^$ac_symprfx"
else
lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'"
# Check to see that the pipe works correctly.
pipe_works=no
@@ -8786,7 +8911,7 @@ case $with_sysroot in #(
fi
;; #(
/*)
lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"`
;; #(
no|'')
;; #(
@@ -8911,7 +9036,7 @@ ia64-*-hpux*)
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
case `/usr/bin/file conftest.$ac_objext` in
case `$FILECMD conftest.$ac_objext` in
*ELF-32*)
HPUX_IA64_MODE=32
;;
@@ -8932,7 +9057,7 @@ ia64-*-hpux*)
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
if test yes = "$lt_cv_prog_gnu_ld"; then
case `/usr/bin/file conftest.$ac_objext` in
case `$FILECMD conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -melf32bsmip"
;;
@@ -8944,7 +9069,7 @@ ia64-*-hpux*)
;;
esac
else
case `/usr/bin/file conftest.$ac_objext` in
case `$FILECMD conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
;;
@@ -8970,7 +9095,7 @@ mips64*-*linux*)
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
emul=elf
case `/usr/bin/file conftest.$ac_objext` in
case `$FILECMD conftest.$ac_objext` in
*32-bit*)
emul="${emul}32"
;;
@@ -8978,7 +9103,7 @@ mips64*-*linux*)
emul="${emul}64"
;;
esac
case `/usr/bin/file conftest.$ac_objext` in
case `$FILECMD conftest.$ac_objext` in
*MSB*)
emul="${emul}btsmip"
;;
@@ -8986,7 +9111,7 @@ mips64*-*linux*)
emul="${emul}ltsmip"
;;
esac
case `/usr/bin/file conftest.$ac_objext` in
case `$FILECMD conftest.$ac_objext` in
*N32*)
emul="${emul}n32"
;;
@@ -9010,14 +9135,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
case `/usr/bin/file conftest.o` in
case `$FILECMD conftest.o` in
*32-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
case `/usr/bin/file conftest.o` in
case `$FILECMD conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
;;
@@ -9125,7 +9250,7 @@ printf "%s\n" "$lt_cv_cc_needs_belf" >&6; }
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
case `/usr/bin/file conftest.o` in
case `$FILECMD conftest.o` in
*64-bit*)
case $lt_cv_prog_gnu_ld in
yes*)
@@ -9908,8 +10033,8 @@ int forced_loaded() { return 2;}
_LT_EOF
echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
$LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
echo "$AR cr libconftest.a conftest.o" >&5
$AR cr libconftest.a conftest.o 2>&5
echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5
$AR $AR_FLAGS libconftest.a conftest.o 2>&5
echo "$RANLIB libconftest.a" >&5
$RANLIB libconftest.a 2>&5
cat > conftest.c << _LT_EOF
@@ -9936,17 +10061,12 @@ printf "%s\n" "$lt_cv_ld_force_load" >&6; }
_lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
darwin*) # darwin 5.x on
# if running on 10.5 or later, the deployment target defaults
# to the OS version, if on x86, and 10.4, the deployment
# target defaults to 10.4. Don't you love it?
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
10.0,*86*-darwin8*|10.0,*-darwin[912]*)
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
10.[012][,.]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
10.*|11.*)
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
darwin*)
case $MACOSX_DEPLOYMENT_TARGET,$host in
10.[012],*|,*powerpc*-darwin[5-8]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
*)
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
@@ -10243,8 +10363,8 @@ esac
ofile=libtool
can_build_shared=yes
# All known linkers require a '.a' archive for static linking (except MSVC,
# which needs '.lib').
# All known linkers require a '.a' archive for static linking (except MSVC and
# ICC, which need '.lib').
libext=a
with_gnu_ld=$lt_cv_prog_gnu_ld
@@ -10762,7 +10882,7 @@ lt_prog_compiler_static=
lt_prog_compiler_static='-qstaticlink'
;;
*)
case `$CC -V 2>&1 | sed 5q` in
case `$CC -V 2>&1 | $SED 5q` in
*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
# Sun Fortran 8.3 passes all unrecognized flags to the linker
lt_prog_compiler_pic='-KPIC'
@@ -11185,15 +11305,15 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# Microsoft Visual C++ or Intel C++ Compiler.
if test yes != "$GCC"; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
# we just hope/assume this is gcc and not c89 (= MSVC++ or ICC)
with_gnu_ld=yes
;;
openbsd* | bitrig*)
@@ -11248,7 +11368,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries
whole_archive_flag_spec=
fi
supports_anon_versioning=no
case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in
case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in
*GNU\ gold*) supports_anon_versioning=yes ;;
*\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
@@ -11360,6 +11480,7 @@ _LT_EOF
emximp -o $lib $output_objdir/$libname.def'
old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
enable_shared_with_static_runtimes=yes
file_list_spec='@'
;;
interix[3-9]*)
@@ -11374,7 +11495,7 @@ _LT_EOF
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
@@ -11417,7 +11538,7 @@ _LT_EOF
compiler_needs_object=yes
;;
esac
case `$CC -V 2>&1 | sed 5q` in
case `$CC -V 2>&1 | $SED 5q` in
*Sun\ C*) # Sun C 5.9
whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
compiler_needs_object=yes
@@ -11429,13 +11550,14 @@ _LT_EOF
if test yes = "$supports_anon_versioning"; then
archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
fi
case $cc_basename in
tcc*)
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
export_dynamic_flag_spec='-rdynamic'
;;
xlf* | bgf* | bgxlf* | mpixlf*)
@@ -11445,7 +11567,7 @@ _LT_EOF
archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
if test yes = "$supports_anon_versioning"; then
archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
fi
@@ -11577,7 +11699,7 @@ _LT_EOF
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
else
export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
fi
aix_use_runtimelinking=no
@@ -11848,12 +11970,12 @@ fi
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# Microsoft Visual C++ or Intel C++ Compiler.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
case $cc_basename in
cl*)
# Native MSVC
cl* | icl*)
# Native MSVC or ICC
hardcode_libdir_flag_spec=' '
allow_undefined_flag=unsupported
always_export_symbols=yes
@@ -11894,7 +12016,7 @@ fi
fi'
;;
*)
# Assume MSVC wrapper
# Assume MSVC and ICC wrapper
hardcode_libdir_flag_spec=' '
allow_undefined_flag=unsupported
# Tell ltmain to make .lib files, not .a files.
@@ -11935,8 +12057,8 @@ fi
output_verbose_link_cmd=func_echo_all
archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
else
ld_shlibs=no
@@ -11970,7 +12092,7 @@ fi
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly*)
freebsd* | dragonfly* | midnightbsd*)
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
@@ -12151,6 +12273,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; }
# Fabrice Bellard et al's Tiny C Compiler
ld_shlibs=yes
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
;;
esac
;;
@@ -12222,6 +12345,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; }
emximp -o $lib $output_objdir/$libname.def'
old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
enable_shared_with_static_runtimes=yes
file_list_spec='@'
;;
osf3*)
@@ -12914,7 +13038,7 @@ cygwin* | mingw* | pw32* | cegcc*)
case $host_os in
cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
;;
@@ -12924,14 +13048,14 @@ cygwin* | mingw* | pw32* | cegcc*)
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
;;
esac
dynamic_linker='Win32 ld.exe'
;;
*,cl*)
# Native MSVC
*,cl* | *,icl*)
# Native MSVC or ICC
libname_spec='$name'
soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
library_names_spec='$libname.dll.lib'
@@ -12950,7 +13074,7 @@ cygwin* | mingw* | pw32* | cegcc*)
done
IFS=$lt_save_ifs
# Convert to MSYS style.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
;;
cygwin*)
# Convert to unix form, then to dos form, then back to unix form
@@ -12987,7 +13111,7 @@ cygwin* | mingw* | pw32* | cegcc*)
;;
*)
# Assume MSVC wrapper
# Assume MSVC and ICC wrapper
library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib'
dynamic_linker='Win32 ld.exe'
;;
@@ -13020,7 +13144,7 @@ dgux*)
shlibpath_var=LD_LIBRARY_PATH
;;
freebsd* | dragonfly*)
freebsd* | dragonfly* | midnightbsd*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
if test -x /usr/bin/objformat; then
@@ -14185,30 +14309,41 @@ striplib=
old_striplib=
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
printf %s "checking whether stripping libraries is possible... " >&6; }
if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
if test -z "$STRIP"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
darwin*)
if test -n "$STRIP"; then
if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
old_striplib="$STRIP --strip-debug"
striplib="$STRIP --strip-unneeded"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else
case $host_os in
darwin*)
# FIXME - insert some real tests, host_os isn't really good enough
striplib="$STRIP -x"
old_striplib="$STRIP -S"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else
;;
freebsd*)
if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then
old_striplib="$STRIP --strip-debug"
striplib="$STRIP --strip-unneeded"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
;;
*)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
;;
*)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
;;
esac
;;
esac
fi
fi
@@ -15713,6 +15848,15 @@ printf "%s\n" "$shadow_cv_passwd_dir" >&6; }
printf "%s\n" "#define PASSWD_PROGRAM \"$shadow_cv_passwd_dir/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.
if test ${enable_shadowgrp+y}
then :
@@ -16215,8 +16359,8 @@ printf "%s\n" "no" >&6; }
fi
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CMOCKA" >&5
printf %s "checking for CMOCKA... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cmocka" >&5
printf %s "checking for cmocka... " >&6; }
if test -n "$CMOCKA_CFLAGS"; then
pkg_cv_CMOCKA_CFLAGS="$CMOCKA_CFLAGS"
@@ -16256,7 +16400,7 @@ fi
if test $pkg_failed = yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -16265,26 +16409,26 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
CMOCKA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cmocka" 2>&1`
CMOCKA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cmocka" 2>&1`
else
CMOCKA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cmocka" 2>&1`
CMOCKA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cmocka" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$CMOCKA_PKG_ERRORS" >&5
# Put the nasty error message in config.log where it belongs
echo "$CMOCKA_PKG_ERRORS" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libcmocka not found, cmocka tests will not be built" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libcmocka not found, cmocka tests will not be built" >&5
printf "%s\n" "$as_me: WARNING: libcmocka not found, cmocka tests will not be built" >&2;}
elif test $pkg_failed = untried; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libcmocka not found, cmocka tests will not be built" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libcmocka not found, cmocka tests will not be built" >&5
printf "%s\n" "$as_me: WARNING: libcmocka not found, cmocka tests will not be built" >&2;}
else
CMOCKA_CFLAGS=$pkg_cv_CMOCKA_CFLAGS
CMOCKA_LIBS=$pkg_cv_CMOCKA_LIBS
CMOCKA_CFLAGS=$pkg_cv_CMOCKA_CFLAGS
CMOCKA_LIBS=$pkg_cv_CMOCKA_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
have_cmocka="yes"
have_cmocka="yes"
fi
if test x$have_cmocka = xyes; then
HAVE_CMOCKA_TRUE=
@@ -16918,8 +17062,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBBSD" >&5
printf %s "checking for LIBBSD... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libbsd-overlay" >&5
printf %s "checking for libbsd-overlay... " >&6; }
if test -n "$LIBBSD_CFLAGS"; then
pkg_cv_LIBBSD_CFLAGS="$LIBBSD_CFLAGS"
@@ -16959,7 +17103,7 @@ fi
if test $pkg_failed = yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -16968,14 +17112,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBBSD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libbsd-overlay" 2>&1`
LIBBSD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libbsd-overlay" 2>&1`
else
LIBBSD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libbsd-overlay" 2>&1`
LIBBSD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libbsd-overlay" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBBSD_PKG_ERRORS" >&5
# Put the nasty error message in config.log where it belongs
echo "$LIBBSD_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libbsd-overlay) were not met:
as_fn_error $? "Package requirements (libbsd-overlay) were not met:
$LIBBSD_PKG_ERRORS
@@ -16986,9 +17130,9 @@ Alternatively, you may set the environment variables LIBBSD_CFLAGS
and LIBBSD_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
{ { 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 $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -17001,8 +17145,8 @@ See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
LIBBSD_CFLAGS=$pkg_cv_LIBBSD_CFLAGS
LIBBSD_LIBS=$pkg_cv_LIBBSD_LIBS
LIBBSD_CFLAGS=$pkg_cv_LIBBSD_CFLAGS
LIBBSD_LIBS=$pkg_cv_LIBBSD_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
@@ -18086,7 +18230,7 @@ if test "x$ac_cv_lib_skey_skeychallenge" = xyes
then :
LIBSKEY=-lskey
else $as_nop
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
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
fi
@@ -20846,7 +20990,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by shadow $as_me 4.17.2, which was
This file was extended by shadow $as_me 4.15.3, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20915,7 +21059,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
shadow config.status 4.17.2
shadow config.status 4.15.3
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
@@ -21078,6 +21222,7 @@ lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_q
lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`'
OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
@@ -21086,6 +21231,7 @@ want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`'
AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
@@ -21206,6 +21352,7 @@ LN_S \
lt_SP2NL \
lt_NL2SP \
reload_flag \
FILECMD \
OBJDUMP \
deplibs_check_method \
file_magic_cmd \
@@ -21214,7 +21361,6 @@ want_nocaseglob \
DLLTOOL \
sharedlib_from_linklib_cmd \
AR \
AR_FLAGS \
archiver_list_spec \
STRIP \
RANLIB \
@@ -22197,6 +22343,9 @@ to_host_file_cmd=$lt_cv_to_host_file_cmd
# convert \$build files to toolchain format.
to_tool_file_cmd=$lt_cv_to_tool_file_cmd
# A file(cmd) program that detects file types.
FILECMD=$lt_FILECMD
# An object symbol dumper.
OBJDUMP=$lt_OBJDUMP
@@ -22221,8 +22370,11 @@ sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
# The archiver.
AR=$lt_AR
# Flags to create an archive (by configure).
lt_ar_flags=$lt_ar_flags
# Flags to create an archive.
AR_FLAGS=$lt_AR_FLAGS
AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"}
# How to feed a file listing to the archiver.
archiver_list_spec=$lt_archiver_list_spec
@@ -22598,7 +22750,7 @@ ltmain=$ac_aux_dir/ltmain.sh
# if finds mixed CR/LF and LF-only lines. Since sed operates in
# text mode, it properly converts lines to CR/LF. This bash problem
# is reportedly fixed, but why not run on old versions too?
sed '$q' "$ltmain" >> "$cfgfile" \
$SED '$q' "$ltmain" >> "$cfgfile" \
|| (rm -f "$cfgfile"; exit 1)
mv -f "$cfgfile" "$ofile" ||

View File

@@ -1,10 +1,10 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
m4_define([libsubid_abi_major], 5)
m4_define([libsubid_abi_major], 4)
m4_define([libsubid_abi_minor], 0)
m4_define([libsubid_abi_micro], 0)
m4_define([libsubid_abi], [libsubid_abi_major.libsubid_abi_minor.libsubid_abi_micro])
AC_INIT([shadow], [4.17.2], [pkg-shadow-devel@lists.alioth.debian.org], [],
AC_INIT([shadow], [4.15.3], [pkg-shadow-devel@lists.alioth.debian.org], [],
[https://github.com/shadow-maint/shadow])
AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects tar-pax])
AC_CONFIG_MACRO_DIRS([m4])
@@ -159,6 +159,13 @@ fi])
AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
[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,
[AS_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
[case "${enableval}" in
@@ -689,7 +696,7 @@ AC_SUBST(LIBMD)
if test "$with_skey" = "yes"; then
AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
[AC_MSG_ERROR([libskey 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([liskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2])])
AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>

View File

@@ -161,6 +161,7 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@

View File

@@ -118,9 +118,6 @@
#include <sys/stat.h>
#include <syslog.h>
#include "string/strcmp/streq.h"
#define IMMEDIATE_CHANGE /* Expire newly created password, must be changed
* immediately upon next login */
#define HAVE_QUOTAS /* Obvious */
@@ -294,10 +291,12 @@ main (void)
printf ("Home Directory [%s/%s]: ", DEFAULT_HOME, usrname);
fflush (stdout);
safeget (dir, sizeof (dir));
if (!strlen(dir)) /* hit return */
sprintf(dir, "%s/%s", DEFAULT_HOME, usrname);
if (!strlen (dir))
{ /* hit return */
sprintf (dir, "%s/%s", DEFAULT_HOME, usrname);
}
else if (dir[strlen (dir) - 1] == '/')
strcat(dir, usrname);
sprintf (dir+strlen(dir), "%s", usrname);
}
else
{
@@ -309,7 +308,7 @@ main (void)
fflush (stdout);
safeget (shell, sizeof (shell));
if (!strlen (shell))
strcpy(shell, DEFAULT_SHELL);
sprintf (shell, "%s", DEFAULT_SHELL);
else
{
char *sh;
@@ -317,7 +316,7 @@ main (void)
#ifdef HAVE_GETUSERSHELL
setusershell ();
while ((sh = getusershell ()) != NULL)
if (streq(shell, sh))
if (!strcmp (shell, sh))
ok = 1;
endusershell ();
#endif
@@ -328,7 +327,7 @@ main (void)
else
{
printf ("Shell NOT in /etc/shells, DEFAULT used\n");
strcpy(shell, DEFAULT_SHELL);
sprintf (shell, "%s", DEFAULT_SHELL);
}
}
}
@@ -492,12 +491,12 @@ safeget (char *buf, int maxlen)
bad = (!isalnum (c) && (c != '_') && (c != ' '));
*(buf++) = c;
}
stpcpy(buf, "");
*buf = '\0';
if (bad)
{
printf ("\nString contained banned character. Please stick to alphanumerics.\n");
stpcpy(bstart, "");
*bstart = '\0';
}
}

16
debian/Makefile vendored Normal file
View File

@@ -0,0 +1,16 @@
PKG=shadow
SITE=ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/
deb:: check_cheese
include /usr/share/quilt/quilt.debbuild.mk
check_cheese:
@dpkg-parsechangelog | grep -q "\* The \".*\".* release\." || { \
echo ""; \
echo " ** **"; \
echo " ** Warning: not a cheesy release! **"; \
echo " ** **"; \
echo ""; \
exit 1; \
}

16
debian/NEWS vendored
View File

@@ -1,19 +1,3 @@
shadow (1:4.17.0~rc1-1) unstable; urgency=medium
Username checking now once again follows the upstream rules, for
an ecosystem-wide ruleset and security.
-- Chris Hofstaedtler <zeha@debian.org> Sun, 22 Dec 2024 20:12:35 +0100
shadow (1:4.16.0-5) unstable; urgency=medium
/var/log/faillog and the programs to read it are no longer part since
1:4.15.2-2.
The file isn't cleaned up automatically, which should be done manually,
unless it is still needed for special reasons.
-- Chris Hofstaedtler <zeha@debian.org> Sat, 16 Nov 2024 15:48:35 +0100
shadow (1:4.13+dfsg1-2) unstable; urgency=medium
The previous entry falsely states that PREVENT_NO_AUTH in /etc/login.defs

13
debian/README.Debian vendored
View File

@@ -1,14 +1,13 @@
Read this file first for a brief overview of the current version
of passwd.
Read this file first for a brief overview of the new versions of login
and passwd.
---Shadow passwords
The command `shadowconfig on' will turn on shadow password support.
This is the default. Turning off shadow passwords is not supported
anymore.
Together with shadow passwords, you get the ability to set password ages
and expirations with chage(1).
`shadowconfig off' will turn it back off. If you turn on shadow
password support, you'll gain the ability to set password ages and
expirations with chage(1).
NOTE: If you use the nscd package, you may have problems with a
slight delay in updating the password information. You may notice
@@ -28,7 +27,7 @@ support. PAM documentation is available in several formats in the
libpam-doc package.
---Encryption
---MD5 Encryption
This is enabled now using the /etc/pam.d/* files. Examples are given.

178
debian/changelog vendored
View File

@@ -1,181 +1,3 @@
shadow (1:4.17.2-5) unstable; urgency=medium
* Warn about future --badname removal.
Upstream PR 1158 plans to remove this flag, probably in the forky
timeframe. Warn users now.
* Import upstream patch to fix chfn (#1096187)
* Add regression test for #1096187
* Add regression test for #1095430
* Remove "shadowconfig off"
If needed please run pwunconv, grpunconv manually, but please understand
you are on your own.
-- Chris Hofstaedtler <zeha@debian.org> Mon, 17 Feb 2025 19:54:09 +0100
shadow (1:4.17.2-4) unstable; urgency=medium
* Revert upstreams chfn.c strsep change (Closes: #1096187)
-- Chris Hofstaedtler <zeha@debian.org> Mon, 17 Feb 2025 12:28:56 +0100
shadow (1:4.17.2-3) unstable; urgency=medium
* Revert upstreams strtoday calculation "fix" (Closes: #1095430)
-- Chris Hofstaedtler <zeha@debian.org> Sun, 16 Feb 2025 20:24:35 +0100
shadow (1:4.17.2-2) unstable; urgency=medium
* Upload to unstable.
* Apply upstream revert of "Use local time for human-readable dates"
(Closes: #1095430)
-- Chris Hofstaedtler <zeha@debian.org> Sat, 15 Feb 2025 17:21:17 +0100
shadow (1:4.17.2-1) experimental; urgency=medium
* New upstream version 4.17.2
* Apply upstream patch from Marc Haber to document E_BAD_NAME
* Refresh patches
-- Chris Hofstaedtler <zeha@debian.org> Sun, 09 Feb 2025 18:14:51 +0100
shadow (1:4.17.1-2) experimental; urgency=medium
* Rewrite shadowconfig(8) manpage.
Thanks to Alejandro Colomar <alx@kernel.org>
* Remove unnecessary Build-Depends: quilt.
Thanks to Bastian Germann (Closes: #1092461)
-- Chris Hofstaedtler <zeha@debian.org> Wed, 08 Jan 2025 12:40:10 +0100
shadow (1:4.17.1-1) experimental; urgency=medium
* New upstream version 4.17.1
-- Chris Hofstaedtler <zeha@debian.org> Sat, 04 Jan 2025 12:41:51 +0100
shadow (1:4.17.0-1) experimental; urgency=medium
* New upstream version 4.17.0
* Refresh patches.
-- Chris Hofstaedtler <zeha@debian.org> Sat, 28 Dec 2024 13:14:16 +0100
shadow (1:4.17.0~rc1-2) experimental; urgency=medium
* Remove Debian patch to relax username checks.
Per discussion on d-devel, with upstream, and with the
adduser maintainer.
Thanks: Marc Haber
-- Chris Hofstaedtler <zeha@debian.org> Sun, 22 Dec 2024 20:15:16 +0100
shadow (1:4.17.0~rc1-1) experimental; urgency=medium
* New upstream version 4.17.0~rc1
* Add upstream patch for new return-code for bad usernames
* Refresh patches
* d/copyright: update
* Forbid purely numeric user/group names, and "." and ".."
-- Chris Hofstaedtler <zeha@debian.org> Fri, 06 Dec 2024 19:55:32 +0100
shadow (1:4.16.0-7) unstable; urgency=medium
[ Florent 'Skia' Jacquet ]
* d/patches: fix 'upstream' test suite
-- Chris Hofstaedtler <zeha@debian.org> Fri, 06 Dec 2024 13:51:40 +0100
shadow (1:4.16.0-6) unstable; urgency=medium
* Add NEWS entry about faillog (Closes: #1074320)
-- Chris Hofstaedtler <zeha@debian.org> Fri, 06 Dec 2024 13:29:54 +0100
shadow (1:4.16.0-5) unstable; urgency=medium
[ Chris Hofstaedtler ]
* Always build with btrfs support on linux-any (Closes: #856557)
* debputy.manifest: merge path-metadata entries
* login.defs: remove info about write(1)
Which is not part of Debian trixie. (Closes: #1087519)
[ Pino Toscano ]
* Include <utmpx.h>, fixing the build on GNU/Hurd
-- Chris Hofstaedtler <zeha@debian.org> Fri, 15 Nov 2024 20:30:32 +0100
shadow (1:4.16.0-4) unstable; urgency=medium
* Drop Debian-only cppw, cpgr tools (Closes: #750752)
* Stop patching login, not installed anymore
* Define LOGIN_NAME_MAX on HURD
* Remove libsystemd-dev Build-Depends.
Only necessary for login(1).
* Stop building programs we do not install
-- Chris Hofstaedtler <zeha@debian.org> Tue, 06 Aug 2024 00:29:18 +0200
shadow (1:4.16.0-3) unstable; urgency=medium
* Upload to unstable.
* Fix FTBFS on hurd.
DEB_HOST_ARCH_OS was unset.
-- Chris Hofstaedtler <zeha@debian.org> Mon, 05 Aug 2024 17:21:27 +0200
shadow (1:4.16.0-2) experimental; urgency=medium
* passwd: switch Depends from login to login.defs
login will again be installed on fewer systems, but existing installs
will retain it (it is Protected: yes).
* Drop login package, to allow takeover by util-linux.
Move shadow.mo to Package: passwd, have passwd Replaces: older login.
* login.defs: ship manpage
* Re-add workarounds for tests in tests/tests directory.
4.15.3 fixed this, but 4.16.0 happened earlier.
-- Chris Hofstaedtler <zeha@debian.org> Mon, 05 Aug 2024 02:36:29 +0200
shadow (1:4.16.0-1) experimental; urgency=medium
* New upstream version 4.16.0
* Rebase patches
* Split /etc/login.defs into its own binary package (Closes: #1074394)
* Rename libsubid4 to libsubid5 (soname bump)
* d/watch: add versionmangle for -rc
-- Chris Hofstaedtler <zeha@debian.org> Fri, 02 Aug 2024 17:35:29 +0200
shadow (1:4.15.3-3) unstable; urgency=medium
* Forbid backslashes in user/group-names.
They can still be used with --force-badname, but it's a start. In the
long run I want to remove our relax patch, and upstream should fix the
line continuation too. For #1076619.
-- Chris Hofstaedtler <zeha@debian.org> Sun, 21 Jul 2024 21:05:32 +0200
shadow (1:4.15.3-2) unstable; urgency=medium
[ Pino Toscano ]
* d/rules: actually enable Linux-only options on Linux
This enables --enable-logind and --with-audit.
[ Chris Hofstaedtler ]
* Stop installing groupmems(8) (Closes: #1004472, LP: #2039541)
* login.defs: remove obsolete/confusing comments
* login.defs: resync comments with upstream
* login.defs: remove incomplete list of unused vars
* login.defs: remove obscure, defaulted vars
* login.defs: remove vars ignored by su(1)
* login.defs: remove CONSOLE_GROUPS, ignored with PAM
* login.defs: remove CONSOLE, ignored with PAM
-- Chris Hofstaedtler <zeha@debian.org> Sun, 07 Jul 2024 15:30:38 +0200
shadow (1:4.15.3-1) unstable; urgency=medium
* New upstream version 4.15.3

35
debian/control vendored
View File

@@ -19,12 +19,15 @@ Build-Depends:
libaudit-dev [linux-any],
libbsd-dev,
libcrypt-dev,
libcmocka-dev <!nocheck>,
libltdl-dev,
libpam0g-dev,
libselinux1-dev [linux-any],
libsemanage-dev [linux-any],
libsystemd-dev [linux-any],
libxml2-utils <!nodoc>,
pkgconf,
quilt,
systemd-dev [linux-any],
xsltproc <!nodoc>
Standards-Version: 4.7.0
@@ -39,25 +42,33 @@ Multi-Arch: foreign
Depends:
base-passwd (>= 3.6.4),
libpam-modules,
login.defs
login
Recommends:
sensible-utils
Replaces:
login (<< 1:4.16.0-2~)
Description: change and administer password and group data
This package includes passwd, chsh, chfn, and many other programs to
maintain password and group data.
.
Shadow passwords are supported. See /usr/share/doc/passwd/README.Debian
Package: login.defs
Architecture: all
Package: login
Architecture: any
Multi-Arch: foreign
Protected: yes
Depends:
libpam-modules,
libpam-runtime
Breaks:
hurd (<< 20140206~) [hurd-any]
Conflicts:
python-4suite (<< 0.99cvs20060405-1)
Replaces:
login (<< 1:4.16.0-2~)
Description: system user management configuration
This package provides the login.defs configuration file,
used by otherwise unrelated tools managing system users.
hurd (<< 20140206~) [hurd-any]
Description: system login tools
This package provides support for console-based logins and for
changing effective user or group IDs, including:
* login, the program that invokes a user shell on a virtual terminal;
* nologin, a dummy shell for disabled user accounts;
Package: uidmap
Architecture: any
@@ -67,7 +78,7 @@ Description: programs to help use subuids
These programs help unprivileged users to create uid and gid mappings in
user namespaces.
Package: libsubid5
Package: libsubid4
Section: libs
Priority: optional
Architecture: any
@@ -82,10 +93,10 @@ Priority: optional
Architecture: any
Multi-Arch: same
Depends:
libsubid5 (= ${binary:Version})
libsubid4 (= ${binary:Version})
Description: subordinate id handling library -- shared library
The library provides an interface for querying, granding and ungranting
subordinate user and group ids.
.
This package contains the C header files that are
needed for applications to use the libsubid library.
needed for applications to use the libsubid4 library.

18
debian/copyright vendored
View File

@@ -4,7 +4,7 @@ Source: https://github.com/shadow-maint/shadow
Files: *
Copyright: 1989-1994, Julianne Frances Haugh
2016-2024, Serge Hallyn <serge@hallyn.com>
2016-2022, Serge Hallyn <serge@hallyn.com>
License: BSD-3-clause
Files: man/po/da.po
@@ -57,7 +57,8 @@ Files: man/id/man1/login.1
Copyright: 1993, Rickard E. Faith <faith@cs.unc.edu>
License: BSD-3-clause
Files: man/ja/man5/limits.5
Files: man/ja/man1/groups.1
man/ja/man5/limits.5
man/ja/man8/vipw.8
Copyright: 2001, Maki KURODA
License: BSD-3-clause
@@ -77,10 +78,6 @@ Files: man/po/fr.po
Copyright: 2011-2013, Debian French l10n team <debian-l10n-french@lists.debian.org>
License: BSD-3-clause
Files: man/shadowconfig.8
Copyright: 2025 Alejandro Colomar <alx@kernel.org>
License: BSD-3-clause
Files: man/zh_TW/man5/*
Copyright: 1993, Michael Haardt <michael@moria.de>
1993, Scorpio, www.linuxforum.net
@@ -102,6 +99,10 @@ Files: man/hu/man1/su.1
Copyright: 1999, Ragnar Hojland Espinosa <ragnar@macula.net>
License: BSD-3-clause
Files: man/ja/man1/id.1
Copyright: 2000, ISHIKAWA Keisuke
License: BSD-3-clause
Files: man/ja/man8/pwconv.8
Copyright: 2001, Yuichi SATO
License: BSD-3-clause
@@ -136,6 +137,11 @@ Copyright: 1999-2001, Ben Collins <bcollins@debian.org>
2017-2022 Balint Reczey <balint@balintreczey.hu>
License: BSD-3-clause
Files: debian/patches/cppw-Add-tool.patch
Copyright: 1997, Guy Maor <maor@ece.utexas.edu>
1999, Stephen Frost <sfrost@snowman.net>
License: GPL-2+
Files: debian/passwd.expire.cron
Copyright: 1999, Ben Collins <bcollins@debian.org>
License: BSD-3-clause

1
debian/cpgr.8 vendored Normal file
View File

@@ -0,0 +1 @@
.so man8/cppw.8

27
debian/cppw.8 vendored Normal file
View File

@@ -0,0 +1,27 @@
.TH CPPW 8 "7 Apr 2005"
.SH NAME
cppw, cpgr \- copy with locking the given file to the password or group file
.SH SYNOPSIS
\fBcppw\fR [\fB\-h\fR] [\fB\-s\fR] password_file
.br
\fBcpgr\fR [\fB\-h\fR] [\fB\-s\fR] group_file
.SH DESCRIPTION
.BR cppw " and " cpgr
will copy, with locking, the given file to
.IR /etc/passwd " and " /etc/group ", respectively."
With the \fB\-s\fR flag, they will copy the shadow versions of those files,
.IR /etc/shadow " and " /etc/gshadow ", respectively."
With the \fB\-h\fR flag, the commands display a short help message and exit
silently.
.SH "SEE ALSO"
.BR vipw (8),
.BR vigr (8),
.BR group (5),
.BR passwd (5),
.BR shadow (5),
.BR gshadow (5)
.SH AUTHOR
\fBcppw\fR and \fBcpgr\fR were written by Stephen Frost, based on
\fBvipw\fR and \fBvigr\fR written by Guy Maor.

View File

@@ -3,22 +3,35 @@ packages:
passwd:
transformations:
- path-metadata:
paths:
- usr/bin/chfn
- usr/bin/chsh
- usr/bin/gpasswd
- usr/bin/passwd
path: usr/bin/chfn
mode: "u=rwxs,go=rx"
- path-metadata:
paths:
- usr/bin/chage
- usr/bin/expiry
path: usr/bin/chsh
mode: "u=rwxs,go=rx"
- path-metadata:
path: usr/bin/gpasswd
mode: "u=rwxs,go=rx"
- path-metadata:
path: usr/bin/passwd
mode: "u=rwxs,go=rx"
- path-metadata:
path: usr/bin/chage
group: "shadow"
mode: "u=rwx,go=rxs"
- path-metadata:
path: usr/bin/expiry
group: "shadow"
mode: "u=rwx,go=rxs"
login:
transformations:
- path-metadata:
path: usr/bin/newgrp
mode: "u=rwxs,go=rx"
uidmap:
transformations:
- path-metadata:
paths:
- usr/bin/newgidmap
- usr/bin/newuidmap
path: usr/bin/newgidmap
mode: "u=rwxs,go=rx"
- path-metadata:
path: usr/bin/newuidmap
mode: "u=rwxs,go=rx"

78
debian/dependencies vendored
View File

@@ -1,7 +1,19 @@
Build-Depends:
==============
* autoconf
* automake1.9
works with 1.7 or 1.9 (at least)
* libtool
* gettext
POT, PO, GMO regenerated?
* libpam0g-dev
OK
* debhelper (>= 4.1.16)
* po-debconf
OK
* quilt
patch system
* dpkg-dev (>= 1.13.5)
* xsltproc
used to generate the manpages
* docbook-xsl
@@ -13,4 +25,70 @@ Build-Depends:
Needed by JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN], [DocBook XML DTD V4.1.2], [], enable_man=no)
* libxml2-utils
needed by the JH_CHECK_XML_CATALOG macros
* cdbs
used in debian/rules
* libselinux1-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64]
* gnome-doc-utils (>= 0.4.3-1)
xml2po, 0.4.3-1 needed for the -l switch.
passwd Depends:
===============
* ${shlibs:Depends}
OK
* ${loginpam}
- hurd
login
libpam-modules (>= 0.72-5)
- other archs
+ login (>= 970502-1)
login is needed because some passwd utils need /etc/login.defs
login is Essential, so this is just to enforce the version
+ libpam-modules (>= 0.72-5)
* debianutils (>= 2.15.2)
After 1:4.0.12-6, {add,remove}-shell are distributed in debianutils (2.15)
/etc/shell was forgotten and introduced in debianutils in 2.15.2
passwd Conflicts:
=================
passwd Replaces:
================
Some of the passwd man pages are also distributed in some manpages* packages.
Look at the debian/02/run test to optimize these dependencies.
NOTE: Not all maintainers have been notified.
* manpages-de (<< 0.4-9), manpages-fi (<< 0.2-4), manpages-fr (<<1.64.0-1), manpages-hu (<< 20010119-5), manpages-it (<< 0.3.4-3), manpages-ja (<< 0.5.0.0.20050915-1), manpages-ko (<< 20050219-2), manpages-es (<< 1.55-4), manpages-es-extra (<< 0.8a-15), manpages-ru (<< 0.98-3)
All those packages have been updated during sarge->etch. So these Replaces
should be removed after lenny release
* manpages-tr, manpages-zh
Those packages are still in etch, so the Replaces should be kept even
after lenny release
login Pre-Depends:
==================
* ${shlibs:Depends}
* libpam-runtime (>= 0.76-14)
sarge contained 0.76-22
Why Pre-Depends? (because it's an essential package?)
login Depends:
==============
* libpam-modules (>= 0.72-5)
libpam-modules is needed.
potato contained 0.72-9
login Conflicts:
================
login Replaces:
===============
* Some of the login man pages are also distributed in some manpages* packages.
Look at the debian/02/run test to optimize these dependencies.
NOTE: Not all maintainers have been notified.
- manpages-fi, manpages-fr (<<1.64.0-1), manpages-hu, manpages-it, manpages-ko, manpages-ja (<< 0.5.0.0.20050915-1), manpages-de (<< 0.4-10), manpages-es-extra (<<0.8a-15)
Those are packages that have been updated during sarge->etch. These
Replaces should be removed after lenny
- manpages-tr, manpages-zh
Those packages are still in etch, so the Replaces should be kept even
after lenny release

2
debian/gbp.conf vendored
View File

@@ -1,2 +0,0 @@
[pq]
patch-numbers = False

10
debian/libsubid4.symbols vendored Normal file
View File

@@ -0,0 +1,10 @@
libsubid.so.4 libsubid4 #MINVER#
subid_get_gid_owners@Base 1:4.11.1
subid_get_gid_ranges@Base 1:4.11.1
subid_get_uid_owners@Base 1:4.11.1
subid_get_uid_ranges@Base 1:4.11.1
subid_grant_gid_range@Base 1:4.11.1
subid_grant_uid_range@Base 1:4.11.1
subid_init@Base 1:4.11.1
subid_ungrant_gid_range@Base 1:4.11.1
subid_ungrant_uid_range@Base 1:4.11.1

View File

@@ -1,11 +0,0 @@
libsubid.so.5 libsubid5 #MINVER#
subid_free@Base 1:4.16.0
subid_get_gid_owners@Base 1:4.16.0
subid_get_gid_ranges@Base 1:4.16.0
subid_get_uid_owners@Base 1:4.16.0
subid_get_uid_ranges@Base 1:4.16.0
subid_grant_gid_range@Base 1:4.16.0
subid_grant_uid_range@Base 1:4.16.0
subid_init@Base 1:4.16.0
subid_ungrant_gid_range@Base 1:4.16.0
subid_ungrant_uid_range@Base 1:4.16.0

324
debian/login.defs vendored Normal file
View File

@@ -0,0 +1,324 @@
#
# /etc/login.defs - Configuration control definitions for the login package.
#
# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH.
# If unspecified, some arbitrary (and possibly incorrect) value will
# be assumed. All other items are optional - if not specified then
# the described action or option will be inhibited.
#
# Comment lines (lines beginning with "#") and blank lines are ignored.
#
# Modified for Linux. --marekm
# REQUIRED for useradd/userdel/usermod
# Directory where mailboxes reside, _or_ name of file, relative to the
# home directory. If you _do_ define MAIL_DIR and MAIL_FILE,
# MAIL_DIR takes precedence.
#
# Essentially:
# - MAIL_DIR defines the location of users mail spool files
# (for mbox use) by appending the username to MAIL_DIR as defined
# below.
# - MAIL_FILE defines the location of the users mail spool files as the
# fully-qualified filename obtained by prepending the user home
# directory before $MAIL_FILE
#
# NOTE: This is no more used for setting up users MAIL environment variable
# which is, starting from shadow 4.0.12-1 in Debian, entirely the
# job of the pam_mail PAM modules
# See default PAM configuration files provided for
# login, su, etc.
#
# This is a temporary situation: setting these variables will soon
# move to /etc/default/useradd and the variables will then be
# no more supported
MAIL_DIR /var/mail
#MAIL_FILE .mail
#
# Enable display of unknown usernames when login failures are recorded.
#
# WARNING: Unknown usernames may become world readable.
# See #290803 and #298773 for details about how this could become a security
# concern
LOG_UNKFAIL_ENAB no
#
# Enable logging of successful logins
#
LOG_OK_LOGINS no
#
# Enable "syslog" logging of su activity - in addition to sulog file logging.
# SYSLOG_SG_ENAB does the same for newgrp and sg.
#
SYSLOG_SU_ENAB yes
SYSLOG_SG_ENAB yes
#
# If defined, all su activity is logged to this file.
#
#SULOG_FILE /var/log/sulog
#
# If defined, file which maps tty line to TERM environment parameter.
# Each line of the file is in a format something like "vt100 tty01".
#
#TTYTYPE_FILE /etc/ttytype
#
# If defined, the command name to display when running "su -". For
# example, if this is defined as "su" then a "ps" will display the
# command is "-su". If not defined, then "ps" would display the
# name of the shell actually being run, e.g. something like "-sh".
#
SU_NAME su
#
# If defined, file which inhibits all the usual chatter during the login
# sequence. If a full pathname, then hushed mode will be enabled if the
# user's name or shell are found in the file. If not a full pathname, then
# hushed mode will be enabled if the file exists in the user's home directory.
#
HUSHLOGIN_FILE .hushlogin
#HUSHLOGIN_FILE /etc/hushlogins
#
# *REQUIRED* The default PATH settings, for superuser and normal users.
#
# (they are minimal, add the rest in the shell startup files)
ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
#
# Terminal permissions
#
# TTYGROUP Login tty will be assigned this group ownership.
# TTYPERM Login tty will be set to this permission.
#
# If you have a "write" program which is "setgid" to a special group
# which owns the terminals, define TTYGROUP to the group number and
# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign
# TTYPERM to either 622 or 600.
#
# In Debian /usr/bin/bsd-write or similar programs are setgid tty
# However, the default and recommended value for TTYPERM is still 0600
# to not allow anyone to write to anyone else console or terminal
# Users can still allow other people to write them by issuing
# the "mesg y" command.
TTYGROUP tty
TTYPERM 0600
#
# Login configuration initializations:
#
# ERASECHAR Terminal ERASE character ('\010' = backspace).
# KILLCHAR Terminal KILL character ('\025' = CTRL/U).
#
# The ERASECHAR and KILLCHAR are used only on System V machines.
#
ERASECHAR 0177
KILLCHAR 025
# HOME_MODE is used by useradd(8) and newusers(8) to set the mode for new
# home directories.
HOME_MODE 0700
#
# Password aging controls:
#
# PASS_MAX_DAYS Maximum number of days a password may be used.
# PASS_MIN_DAYS Minimum number of days allowed between password changes.
# PASS_WARN_AGE Number of days warning given before a password expires.
#
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_WARN_AGE 7
#
# Min/max values for automatic uid selection in useradd
#
UID_MIN 1000
UID_MAX 60000
# System accounts
#SYS_UID_MIN 100
#SYS_UID_MAX 999
# Extra per user uids
SUB_UID_MIN 100000
SUB_UID_MAX 600100000
SUB_UID_COUNT 65536
#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN 1000
GID_MAX 60000
# System accounts
#SYS_GID_MIN 100
#SYS_GID_MAX 999
# Extra per user group ids
SUB_GID_MIN 100000
SUB_GID_MAX 600100000
SUB_GID_COUNT 65536
#
# Max number of login retries if password is bad. This will most likely be
# overriden by PAM, since the default pam_unix module has it's own built
# in of 3 retries. However, this is a safe fallback in case you are using
# an authentication module that does not enforce PAM_MAXTRIES.
#
LOGIN_RETRIES 5
#
# Max time in seconds for login
#
LOGIN_TIMEOUT 60
#
# Which fields may be changed by regular users using chfn - use
# any combination of letters "frwh" (full name, room number, work
# phone, home phone). If not defined, no changes are allowed.
# For backward compatibility, "yes" = "rwh" and "no" = "frwh".
#
CHFN_RESTRICT rwh
#
# Should login be allowed if we can't cd to the home directory?
# Default is no.
#
DEFAULT_HOME yes
#
# If defined, this command is run when removing a user.
# It should remove any at/cron/print jobs etc. owned by
# the user to be removed (passed as the first argument).
#
#USERDEL_CMD /usr/sbin/userdel_local
#
# If set to yes, userdel will remove the user's group if it contains no
# more members, and useradd will create by default a group with the name
# of the user.
#
# Other former uses of this variable such as setting the umask when
# user==primary group are not used in PAM environments, such as Debian
#
USERGROUPS_ENAB yes
#
# Instead of the real user shell, the program specified by this parameter
# will be launched, although its visible name (argv[0]) will be the shell's.
# The program may do whatever it wants (logging, additional authentification,
# banner, ...) before running the actual shell.
#
# FAKE_SHELL /bin/fakeshell
#
# If defined, either full pathname of a file containing device names or
# a ":" delimited list of device names. Root logins will be allowed only
# upon these devices.
#
# This variable is used by login and su.
#
#CONSOLE /etc/consoles
#CONSOLE console:tty01:tty02:tty03:tty04
#
# List of groups to add to the user's supplementary group set
# when logging in on the console (as determined by the CONSOLE
# setting). Default is none.
#
# Use with caution - it is possible for users to gain permanent
# access to these groups, even when not logged in on the console.
# How to do it is left as an exercise for the reader...
#
# This variable is used by login and su.
#
#CONSOLE_GROUPS floppy:audio:cdrom
#
# If set to MD5, MD5-based algorithm will be used for encrypting password
# If set to SHA256, SHA256-based algorithm will be used for encrypting password
# If set to SHA512, SHA512-based algorithm will be used for encrypting password
# If set to BCRYPT, BCRYPT-based algorithm will be used for encrypting password
# If set to YESCRYPT, YESCRYPT-based algorithm will be used for encrypting password
# If set to DES, DES-based algorithm will be used for encrypting password (default)
# MD5 and DES should not be used for new hashes, see crypt(5) for recommendations.
# Overrides the MD5_CRYPT_ENAB option
#
# Note: It is recommended to use a value consistent with
# the PAM modules configuration.
#
ENCRYPT_METHOD YESCRYPT
#
# The pwck(8) utility emits a warning for any system account with a home
# directory that does not exist. Some system accounts intentionally do
# not have a home directory. Such accounts may have this string as
# their home directory in /etc/passwd to avoid a spurious warning.
#
NONEXISTENT /nonexistent
#
# Allow newuidmap and newgidmap when running under an alternative
# primary group.
#
#GRANT_AUX_GROUP_SUBIDS yes
#
# Select the HMAC cryptography algorithm.
# Used in pam_timestamp module to calculate the keyed-hash message
# authentication code.
#
# Note: It is recommended to check hmac(3) to see the possible algorithms
# that are available in your system.
#
#HMAC_CRYPTO_ALGO SHA512
################# OBSOLETED BY PAM ##############
# #
# These options are now handled by PAM. Please #
# edit the appropriate file in /etc/pam.d/ to #
# enable the equivelants of them.
#
###############
#MOTD_FILE
#DIALUPS_CHECK_ENAB
#LASTLOG_ENAB
#MAIL_CHECK_ENAB
#OBSCURE_CHECKS_ENAB
#PORTTIME_CHECKS_ENAB
#SU_WHEEL_ONLY
#CRACKLIB_DICTPATH
#PASS_CHANGE_TRIES
#PASS_ALWAYS_WARN
#ENVIRON_FILE
#NOLOGINS_FILE
#ISSUE_FILE
#PASS_MIN_LEN
#PASS_MAX_LEN
#ULIMIT
#ENV_HZ
#CHFN_AUTH
#CHSH_AUTH
#FAIL_DELAY
################# OBSOLETED #######################
# #
# These options are no more handled by shadow. #
# #
# Shadow utilities will display a warning if they #
# still appear. #
# #
###################################################
# CLOSE_SESSIONS
# LOGIN_STRING
# NO_PASSWORD_CONSOLE
# QMAIL_DIR

View File

@@ -1 +0,0 @@
etc/login.defs etc

View File

@@ -1,2 +0,0 @@
usr/share/man/*/man5/login.defs.5
usr/share/man/man5/login.defs.5

View File

@@ -1,26 +0,0 @@
#!/bin/sh
set -e
_adopt_conffile() {
conffile=$1
pkg=$2
[ -f ${conffile}.dpkg-bak ] || return 0
md5sum="$(md5sum ${conffile} | sed -e 's/ .*//')"
old_md5sum="$(dpkg-query -W -f='${Conffiles}' $pkg | \
sed -n -e "\' ${conffile} ' { s/ obsolete$//; s/.* //; p }")"
# On new installs, if the conffile was preserved on upgrade by
# dpkg-maintscript helper, copy it back if the new file has not been
# modified yet
if [ "$md5sum" = "$old_md5sum" ]; then
mv ${conffile}.dpkg-bak ${conffile}
fi
}
if [ "$1" = configure ] && [ -z "$2" ]; then
_adopt_conffile /etc/login.defs login.defs
fi
#DEBHELPER#

1
debian/login.dirs vendored Normal file
View File

@@ -0,0 +1 @@
usr/share/lintian/overrides

5
debian/login.install vendored Normal file
View File

@@ -0,0 +1,5 @@
bin/login usr/bin
debian/login.defs etc
sbin/nologin usr/sbin
usr/bin/newgrp
usr/share/locale/*/LC_MESSAGES/shadow.mo

1
debian/login.links vendored Normal file
View File

@@ -0,0 +1 @@
usr/bin/newgrp usr/bin/sg

1
debian/login.lintian-overrides vendored Normal file
View File

@@ -0,0 +1 @@
login: elevated-privileges 4755 root/root [usr/bin/newgrp]

1
debian/login.maintscript vendored Normal file
View File

@@ -0,0 +1 @@
rm_conffile /etc/securetty 1:4.7-1~

10
debian/login.manpages vendored Normal file
View File

@@ -0,0 +1,10 @@
usr/share/man/*/man1/login.1
usr/share/man/*/man1/newgrp.1
usr/share/man/*/man1/sg.1
usr/share/man/*/man5/login.defs.5
usr/share/man/*/man8/nologin.8
usr/share/man/man1/login.1
usr/share/man/man1/newgrp.1
usr/share/man/man1/sg.1
usr/share/man/man5/login.defs.5
usr/share/man/man8/nologin.8

96
debian/login.pam vendored Normal file
View File

@@ -0,0 +1,96 @@
#
# The PAM configuration file for the Shadow `login' service
#
# Enforce a minimal delay in case of failure (in microseconds).
# (Replaces the `FAIL_DELAY' setting from login.defs)
# Note that other modules may require another minimal delay. (for example,
# to disable any delay, you should add the nodelay option to pam_unix)
auth optional pam_faildelay.so delay=3000000
# Outputs an issue file prior to each login prompt (Replaces the
# ISSUE_FILE option from login.defs). Uncomment for use
# auth required pam_issue.so issue=/etc/issue
# Disallows other than root logins when /etc/nologin exists
# (Replaces the `NOLOGINS_FILE' option from login.defs)
auth requisite pam_nologin.so
# SELinux needs to be the first session rule. This ensures that any
# lingering context has been cleared. Without this it is possible
# that a module could execute code in the wrong domain.
# When the module is present, "required" would be sufficient (When SELinux
# is disabled, this returns success.)
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
# Sets the loginuid process attribute
session required pam_loginuid.so
# Prints the message of the day upon successful login.
# (Replaces the `MOTD_FILE' option in login.defs)
# This includes a dynamically generated part from /run/motd.dynamic
# and a static (admin-editable) part from /etc/motd.
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate
# SELinux needs to intervene at login time to ensure that the process
# starts in the proper default security context. Only sessions which are
# intended to run in the user's context should be run after this.
# pam_selinux.so changes the SELinux context of the used TTY and configures
# SELinux in order to transition to the user context with the next execve()
# call.
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
# When the module is present, "required" would be sufficient (When SELinux
# is disabled, this returns success.)
# This module parses environment configuration file(s)
# and also allows you to use an extended config
# file /etc/security/pam_env.conf.
#
# parsing /etc/environment needs "readenv=1"
session required pam_env.so readenv=1
# locale variables can also be set in /etc/default/locale
# reading this file *in addition to /etc/environment* does not hurt
session required pam_env.so readenv=1 envfile=/etc/default/locale
# Standard Un*x authentication.
@include common-auth
# This allows certain extra groups to be granted to a user
# based on things like time of day, tty, service, and user.
# Please edit /etc/security/group.conf to fit your needs
# (Replaces the `CONSOLE_GROUPS' option in login.defs)
auth optional pam_group.so
# Uncomment and edit /etc/security/time.conf if you need to set
# time restraint on logins.
# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs
# as well as /etc/porttime)
# account requisite pam_time.so
# Uncomment and edit /etc/security/access.conf if you need to
# set access limits.
# (Replaces /etc/login.access file)
# account required pam_access.so
# Sets up user limits according to /etc/security/limits.conf
# (Replaces the use of /etc/limits in old login)
session required pam_limits.so
# Prints the status of the user's mailbox upon successful login
# (Replaces the `MAIL_CHECK_ENAB' option from login.defs).
#
# This also defines the MAIL environment variable
# However, userdel also needs MAIL_DIR and MAIL_FILE variables
# in /etc/login.defs to make sure that removing a user
# also removes the user's mail spool file.
# See comments in /etc/login.defs
session optional pam_mail.so standard
# Create a new session keyring.
session optional pam_keyinit.so force revoke
# Standard Un*x account and session
@include common-account
@include common-session
@include common-password

16
debian/not-installed vendored
View File

@@ -1,6 +1,4 @@
bin/groups
bin/login
# Workaround debhelper complaining about login.defs, although we install it.
etc/login.defs
etc/pam.d/chfn
etc/pam.d/chage
@@ -16,39 +14,27 @@ etc/pam.d/passwd
etc/pam.d/useradd
etc/pam.d/userdel
etc/pam.d/usermod
sbin/nologin
usr/bin/newgrp
usr/bin/faillog
usr/bin/sg
usr/lib/*/libsubid.la
usr/sbin/groupmems
usr/sbin/logoutd
usr/sbin/vigr
usr/share/man/*/man1/groups.1
usr/share/man/*/man1/login.1
usr/share/man/*/man1/logoutd.1
usr/share/man/*/man1/newgrp.1
usr/share/man/*/man1/sg.1
usr/share/man/*/man1/su.1
usr/share/man/*/man3/getspnam.3
usr/share/man/*/man3/shadow.3
usr/share/man/*/man5/faillog.5
usr/share/man/*/man5/suauth.5
usr/share/man/*/man8/faillog.8
usr/share/man/*/man8/groupmems.8
usr/share/man/*/man8/logoutd.8
usr/share/man/*/man8/nologin.8
usr/share/man/man1/groups.1
usr/share/man/man1/login.1
usr/share/man/man1/logoutd.1
usr/share/man/man1/newgrp.1
usr/share/man/man1/sg.1
usr/share/man/man1/su.1
usr/share/man/man3/getspnam.3
usr/share/man/man3/shadow.3
usr/share/man/man5/faillog.5
usr/share/man/man5/suauth.5
usr/share/man/man8/faillog.8
usr/share/man/man8/groupmems.8
usr/share/man/man8/logoutd.8
usr/share/man/man8/nologin.8

View File

@@ -8,8 +8,10 @@ usr/bin/gpasswd
usr/bin/passwd
usr/sbin/chgpasswd
usr/sbin/chpasswd
usr/sbin/cppw
usr/sbin/groupadd
usr/sbin/groupdel
usr/sbin/groupmems
usr/sbin/groupmod
usr/sbin/grpck
usr/sbin/grpconv
@@ -22,4 +24,3 @@ usr/sbin/useradd
usr/sbin/userdel
usr/sbin/usermod
usr/sbin/vipw
usr/share/locale/*/LC_MESSAGES/shadow.mo

1
debian/passwd.links vendored
View File

@@ -1 +1,2 @@
usr/sbin/cppw usr/sbin/cpgr
usr/sbin/vipw usr/sbin/vigr

View File

@@ -1,3 +1,5 @@
debian/cpgr.8
debian/cppw.8
usr/share/man/*/man1/chage.1
usr/share/man/*/man1/chfn.1
usr/share/man/*/man1/chsh.1
@@ -13,6 +15,7 @@ usr/share/man/*/man8/chgpasswd.8
usr/share/man/*/man8/chpasswd.8
usr/share/man/*/man8/groupadd.8
usr/share/man/*/man8/groupdel.8
usr/share/man/*/man8/groupmems.8
usr/share/man/*/man8/groupmod.8
usr/share/man/*/man8/grpck.8
usr/share/man/*/man8/grpconv.8
@@ -21,6 +24,7 @@ usr/share/man/*/man8/newusers.8
usr/share/man/*/man8/pwck.8
usr/share/man/*/man8/pwconv.8
usr/share/man/*/man8/pwunconv.8
usr/share/man/*/man8/shadowconfig.8
usr/share/man/*/man8/useradd.8
usr/share/man/*/man8/userdel.8
usr/share/man/*/man8/usermod.8
@@ -41,6 +45,7 @@ usr/share/man/man8/chgpasswd.8
usr/share/man/man8/chpasswd.8
usr/share/man/man8/groupadd.8
usr/share/man/man8/groupdel.8
usr/share/man/man8/groupmems.8
usr/share/man/man8/groupmod.8
usr/share/man/man8/grpck.8
usr/share/man/man8/grpconv.8

View File

@@ -1,28 +0,0 @@
From: Chris Hofstaedtler <zeha@debian.org>
Date: Sun, 16 Feb 2025 20:21:35 +0100
Subject: Revert "lib/strtoday.c: strtoday(): Fix calculation"
This reverts commit 1175932c0c86ee46ee298fd9cfa01653a2ba3a27.
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430
---
lib/strtoday.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/strtoday.c b/lib/strtoday.c
index 01f2e9b..f947778 100644
--- a/lib/strtoday.c
+++ b/lib/strtoday.c
@@ -67,9 +67,10 @@ long strtoday (const char *str)
return retdate;
}
- t = get_date(str, NULL);
+ t = get_date (str, NULL);
if ((time_t) - 1 == t) {
return -2;
}
- return t / DAY;
+ /* convert seconds to days since 1970-01-01 */
+ return (t + DAY / 2) / DAY;
}

View File

@@ -1,104 +0,0 @@
From: Chris Hofstaedtler <zeha@debian.org>
Date: Mon, 17 Feb 2025 18:17:15 +0100
Subject: Warn when --badname (and variants) are given
Upstream PR 1158 will remove them, probably in the forky timeframe.
---
src/newusers.c | 5 ++++-
src/pwck.c | 5 ++++-
src/useradd.c | 5 ++++-
src/usermod.c | 5 ++++-
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/newusers.c b/src/newusers.c
index 5e78dd9..964e668 100644
--- a/src/newusers.c
+++ b/src/newusers.c
@@ -125,7 +125,7 @@ static void usage (int status)
"\n"
"Options:\n"),
Prog);
- (void) fputs (_(" -b, --badname allow bad names\n"), usageout);
+ (void) fputs (_(" -b, --badname allow bad names (DEPRECATED)\n"), usageout);
#ifndef USE_PAM
(void) fprintf (usageout,
_(" -c, --crypt-method METHOD the crypt method (one of %s)\n"),
@@ -658,6 +658,9 @@ static void process_flags (int argc, char **argv)
switch (c) {
case 'b':
allow_bad_names = true;
+ fprintf (stderr,
+ _("%s: WARNING: -b and --badname are deprecated and will be removed\n"),
+ Prog);
break;
#ifndef USE_PAM
case 'c':
diff --git a/src/pwck.c b/src/pwck.c
index ae7ddad..8805422 100644
--- a/src/pwck.c
+++ b/src/pwck.c
@@ -133,7 +133,7 @@ usage (int status)
"Options:\n"),
Prog);
}
- (void) fputs (_(" -b, --badname allow bad names\n"), usageout);
+ (void) fputs (_(" -b, --badname allow bad names (DEPRECATED)\n"), usageout);
(void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
(void) fputs (_(" -q, --quiet report errors only\n"), usageout);
(void) fputs (_(" -r, --read-only display errors and warnings\n"
@@ -175,6 +175,9 @@ static void process_flags (int argc, char **argv)
switch (c) {
case 'b':
allow_bad_names = true;
+ fprintf (stderr,
+ _("%s: WARNING: --badname is deprecated and will be removed\n"),
+ Prog);
break;
case 'h':
usage (E_SUCCESS);
diff --git a/src/useradd.c b/src/useradd.c
index 92f8054..f5169b3 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -894,7 +894,7 @@ static void usage (int status)
"\n"
"Options:\n"),
Prog, Prog, Prog);
- (void) fputs (_(" --badname do not check for bad names\n"), usageout);
+ (void) fputs (_(" --badname do not check for bad names (DEPRECATED)\n"), usageout);
(void) fputs (_(" -b, --base-dir BASE_DIR base directory for the home directory of the\n"
" new account\n"), usageout);
#ifdef WITH_BTRFS
@@ -1240,6 +1240,9 @@ static void process_flags (int argc, char **argv)
break;
case 201:
allow_bad_names = true;
+ fprintf (stderr,
+ _("%s: WARNING: --badname is deprecated and will be removed\n"),
+ Prog);
break;
case 'c':
if (!VALID (optarg)) {
diff --git a/src/usermod.c b/src/usermod.c
index 24c5a4d..a06f2dc 100644
--- a/src/usermod.c
+++ b/src/usermod.c
@@ -383,7 +383,7 @@ usage (int status)
(void) fputs (_(" -a, --append append the user to the supplemental GROUPS\n"
" mentioned by the -G option without removing\n"
" the user from other groups\n"), usageout);
- (void) fputs (_(" -b, --badname allow bad names\n"), usageout);
+ (void) fputs (_(" -b, --badname allow bad names (DEPRECATED)\n"), usageout);
(void) fputs (_(" -c, --comment COMMENT new value of the GECOS field\n"), usageout);
(void) fputs (_(" -d, --home HOME_DIR new home directory for the user account\n"), usageout);
(void) fputs (_(" -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE\n"), usageout);
@@ -1043,6 +1043,9 @@ process_flags(int argc, char **argv)
break;
case 'b':
allow_bad_names = true;
+ fprintf (stderr,
+ _("%s: WARNING: -b, --badname and --badnames are deprecated and will be removed\n"),
+ Prog);
break;
case 'c':
if (!VALID (optarg)) {

View File

@@ -1,517 +0,0 @@
From: Shadow package maintainers <pkg-shadow-devel@lists.alioth.debian.org>
Date: Sun, 7 Jul 2024 14:06:39 +0200
Subject: Adapt login.defs for Debian
Remove settings only applicable to shadow's su, which we do not use.
Remove settings only applicable without PAM support enabled.
Remove obscure commented-out settings.
Remove explanation about write(1), which Debian does not ship anymore.
---
etc/login.defs | 375 ++++++++-------------------------------------------------
1 file changed, 47 insertions(+), 328 deletions(-)
diff --git a/etc/login.defs b/etc/login.defs
index 33622c2..91d3ec4 100644
--- a/etc/login.defs
+++ b/etc/login.defs
@@ -1,24 +1,38 @@
#
# /etc/login.defs - Configuration control definitions for the shadow package.
#
-# $Id$
-#
-#
-# Delay in seconds before being allowed another attempt after a login failure
-# Note: When PAM is used, some modules may enforce a minimum delay (e.g.
-# pam_unix(8) enforces a 2s delay)
-#
-FAIL_DELAY 3
-
-#
-# Enable logging and display of /var/log/faillog login(1) failure info.
-#
-FAILLOG_ENAB yes
+# REQUIRED for useradd/userdel/usermod
+# Directory where mailboxes reside, _or_ name of file, relative to the
+# home directory. If you _do_ define MAIL_DIR and MAIL_FILE,
+# MAIL_DIR takes precedence.
+#
+# Essentially:
+# - MAIL_DIR defines the location of users mail spool files
+# (for mbox use) by appending the username to MAIL_DIR as defined
+# below.
+# - MAIL_FILE defines the location of the users mail spool files as the
+# fully-qualified filename obtained by prepending the user home
+# directory before $MAIL_FILE
+#
+# NOTE: This is no more used for setting up users MAIL environment variable
+# which is, starting from shadow 4.0.12-1 in Debian, entirely the
+# job of the pam_mail PAM modules
+# See default PAM configuration files provided for
+# login, su, etc.
+#
+# This is a temporary situation: setting these variables will soon
+# move to /etc/default/useradd and the variables will then be
+# no more supported
+MAIL_DIR /var/mail
+#MAIL_FILE .mail
#
# Enable display of unknown usernames when login(1) failures are recorded.
#
+# WARNING: Unknown usernames may become world readable.
+# See #290803 and #298773 for details about how this could become a security
+# concern
LOG_UNKFAIL_ENAB no
#
@@ -26,110 +40,12 @@ LOG_UNKFAIL_ENAB no
#
LOG_OK_LOGINS no
-#
-# Enable logging and display of /var/log/lastlog login(1) time info.
-#
-LASTLOG_ENAB yes
-
-#
-# Limit the highest user ID number for which the lastlog entries should
-# be updated.
-#
-# No LASTLOG_UID_MAX means that there is no user ID limit for writing
-# lastlog entries.
-#
-#LASTLOG_UID_MAX
-
-#
-# Enable checking and display of mailbox status upon login.
-#
-# Disable if the shell startup files already check for mail
-# ("mailx -e" or equivalent).
-#
-MAIL_CHECK_ENAB yes
-
-#
-# Enable additional checks upon password changes.
-#
-OBSCURE_CHECKS_ENAB yes
-
-#
-# Enable checking of time restrictions specified in /etc/porttime.
-#
-PORTTIME_CHECKS_ENAB yes
-
-#
-# Enable setting of ulimit, umask, and niceness from passwd(5) gecos field.
-#
-QUOTAS_ENAB yes
-
-#
-# Enable "syslog" logging of su(1) activity - in addition to sulog file logging.
-# SYSLOG_SG_ENAB does the same for newgrp(1) and sg(1).
-#
-SYSLOG_SU_ENAB yes
-SYSLOG_SG_ENAB yes
-
-#
-# If defined, either full pathname of a file containing device names or
-# a ":" delimited list of device names. Root logins will be allowed only
-# from these devices.
-#
-CONSOLE /etc/securetty
-#CONSOLE console:tty01:tty02:tty03:tty04
-
-#
-# If defined, all su(1) activity is logged to this file.
-#
-#SULOG_FILE /var/log/sulog
-
-#
-# If defined, ":" delimited list of "message of the day" files to
-# be displayed upon login.
-#
-MOTD_FILE /etc/motd
-#MOTD_FILE /etc/motd:/usr/lib/news/news-motd
-
-#
-# If defined, this file will be output before each login(1) prompt.
-#
-#ISSUE_FILE /etc/issue
-
#
# If defined, file which maps tty line to TERM environment parameter.
# Each line of the file is in a format similar to "vt100 tty01".
#
#TTYTYPE_FILE /etc/ttytype
-#
-# If defined, login(1) failures will be logged here in a utmp format.
-# last(1), when invoked as lastb(1), will read /var/log/btmp, so...
-#
-FTMP_FILE /var/log/btmp
-
-#
-# If defined, name of file whose presence will inhibit non-root
-# logins. The content of this file should be a message indicating
-# why logins are inhibited.
-#
-NOLOGINS_FILE /etc/nologin
-
-#
-# If defined, the command name to display when running "su -". For
-# example, if this is defined as "su" then ps(1) will display the
-# command as "-su". If not defined, then ps(1) will display the
-# name of the shell actually being run, e.g. something like "-sh".
-#
-SU_NAME su
-
-#
-# *REQUIRED*
-# Directory where mailboxes reside, _or_ name of file, relative to the
-# home directory. If you _do_ define both, MAIL_DIR takes precedence.
-#
-MAIL_DIR /var/spool/mail
-#MAIL_FILE .mail
-
#
# If defined, file which inhibits all the usual chatter during the login
# sequence. If a full pathname, then hushed mode will be enabled if the
@@ -139,40 +55,21 @@ MAIL_DIR /var/spool/mail
HUSHLOGIN_FILE .hushlogin
#HUSHLOGIN_FILE /etc/hushlogins
-#
-# If defined, either a TZ environment parameter spec or the
-# fully-rooted pathname of a file containing such a spec.
-#
-#ENV_TZ TZ=CST6CDT
-#ENV_TZ /etc/tzname
-
-#
-# If defined, an HZ environment parameter spec.
-#
-# for Linux/x86
-ENV_HZ HZ=100
-# For Linux/Alpha...
-#ENV_HZ HZ=1024
-
#
# *REQUIRED* The default PATH settings, for superuser and normal users.
#
# (they are minimal, add the rest in the shell startup files)
-ENV_SUPATH PATH=/sbin:/bin:/usr/sbin:/usr/bin
-ENV_PATH PATH=/bin:/usr/bin
+ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
#
-# Terminal permissions
+# Terminal permissions for terminals after login(1).
+# These settings are ignored for remote and other logins.
#
# TTYGROUP Login tty will be assigned this group ownership.
# TTYPERM Login tty will be set to this permission.
#
-# If you have a write(1) program which is "setgid" to a special group
-# which owns the terminals, define TTYGROUP as the number of such group
-# and TTYPERM as 0620. Otherwise leave TTYGROUP commented out and
-# set TTYPERM to either 622 or 600.
-#
-TTYGROUP tty
+#TTYGROUP tty
TTYPERM 0600
#
@@ -180,61 +77,35 @@ TTYPERM 0600
#
# ERASECHAR Terminal ERASE character ('\010' = backspace).
# KILLCHAR Terminal KILL character ('\025' = CTRL/U).
-# ULIMIT Default "ulimit" value.
#
# The ERASECHAR and KILLCHAR are used only on System V machines.
-# The ULIMIT is used only if the system supports it.
-# (now it works with setrlimit too; ulimit is in 512-byte units)
-#
-# Prefix these values with "0" to get octal, "0x" to get hexadecimal.
#
ERASECHAR 0177
KILLCHAR 025
-#ULIMIT 2097152
-
-# Default initial "umask" value used by login(1) on non-PAM enabled systems.
-# Default "umask" value for pam_umask(8) on PAM enabled systems.
-# UMASK is also used by useradd(8) and newusers(8) to set the mode for new
-# home directories if HOME_MODE is not set.
-# 022 is the default value, but 027, or even 077, could be considered
-# for increased privacy. There is no One True Answer here: each sysadmin
-# must make up their mind.
-UMASK 022
# HOME_MODE is used by useradd(8) and newusers(8) to set the mode for new
# home directories.
-# If HOME_MODE is not set, the value of UMASK is used to create the mode.
-#HOME_MODE 0700
+HOME_MODE 0700
#
# Password aging controls:
#
# PASS_MAX_DAYS Maximum number of days a password may be used.
# PASS_MIN_DAYS Minimum number of days allowed between password changes.
-# PASS_MIN_LEN Minimum acceptable password length.
# PASS_WARN_AGE Number of days warning given before a password expires.
#
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
-PASS_MIN_LEN 5
PASS_WARN_AGE 7
-#
-# If "yes", the user must be listed as a member of the first gid 0 group
-# in /etc/group (called "root" on most Linux systems) to be able to "su"
-# to uid 0 accounts. If the group doesn't exist or is empty, no one
-# will be able to "su" to uid 0.
-#
-SU_WHEEL_ONLY no
-
#
# Min/max values for automatic uid selection in useradd(8)
#
UID_MIN 1000
UID_MAX 60000
# System accounts
-SYS_UID_MIN 101
-SYS_UID_MAX 999
+#SYS_UID_MIN 101
+#SYS_UID_MAX 999
# Extra per user uids
SUB_UID_MIN 100000
SUB_UID_MAX 600100000
@@ -246,8 +117,8 @@ SUB_UID_COUNT 65536
GID_MIN 1000
GID_MAX 60000
# System accounts
-SYS_GID_MIN 101
-SYS_GID_MAX 999
+#SYS_GID_MIN 101
+#SYS_GID_MAX 999
# Extra per user group ids
SUB_GID_MIN 100000
SUB_GID_MAX 600100000
@@ -255,6 +126,9 @@ SUB_GID_COUNT 65536
#
# Max number of login(1) retries if password is bad
+# This will most likely be overriden by PAM, since the default pam_unix module
+# has it's own built in of 3 retries. However, this is a safe fallback in case
+# you are using an authentication module that does not enforce PAM_MAXTRIES.
#
LOGIN_RETRIES 5
@@ -263,28 +137,6 @@ LOGIN_RETRIES 5
#
LOGIN_TIMEOUT 60
-#
-# Maximum number of attempts to change password if rejected (too easy)
-#
-PASS_CHANGE_TRIES 5
-
-#
-# Warn about weak passwords (but still allow them) if you are root.
-#
-PASS_ALWAYS_WARN yes
-
-#
-# Number of significant characters in the password for crypt().
-# Default is 8, don't change unless your crypt() is better.
-# Ignored if MD5_CRYPT_ENAB set to "yes".
-#
-#PASS_MAX_LEN 8
-
-#
-# Require password before chfn(1)/chsh(1) can make any changes.
-#
-CHFN_AUTH yes
-
#
# Which fields may be changed by regular users using chfn(1) - use
# any combination of letters "frwh" (full name, room number, work
@@ -294,29 +146,6 @@ CHFN_AUTH yes
CHFN_RESTRICT rwh
#
-# Password prompt (%s will be replaced by user name).
-#
-# XXX - it doesn't work correctly yet, for now leave it commented out
-# to use the default which is just "Password: ".
-#LOGIN_STRING "%s's Password: "
-
-#
-# Only works if compiled with MD5_CRYPT defined:
-# If set to "yes", new passwords will be encrypted using the MD5-based
-# algorithm compatible with the one used by recent releases of FreeBSD.
-# It supports passwords of unlimited length and longer salt strings.
-# Set to "no" if you need to copy encrypted passwords to other systems
-# which don't understand the new algorithm. Default is "no".
-#
-# Note: If you use PAM, it is recommended to use a value consistent with
-# the PAM modules configuration.
-#
-# This variable is deprecated. You should use ENCRYPT_METHOD instead.
-#
-#MD5_CRYPT_ENAB no
-
-#
-# Only works if compiled with ENCRYPTMETHOD_SELECT defined:
# If set to MD5, MD5-based algorithm will be used for encrypting password
# If set to SHA256, SHA256-based algorithm will be used for encrypting password
# If set to SHA512, SHA512-based algorithm will be used for encrypting password
@@ -326,66 +155,10 @@ CHFN_RESTRICT rwh
# MD5 and DES should not be used for new hashes, see crypt(5) for recommendations.
# Overrides the MD5_CRYPT_ENAB option
#
-# Note: If you use PAM, it is recommended to use a value consistent with
+# Note: It is recommended to use a value consistent with
# the PAM modules configuration.
#
-#ENCRYPT_METHOD DES
-
-#
-# Only works if ENCRYPT_METHOD is set to SHA256 or SHA512.
-#
-# Define the number of SHA rounds.
-# With a lot of rounds, it is more difficult to brute-force the password.
-# However, more CPU resources will be needed to authenticate users if
-# this value is increased.
-#
-# If not specified, the libc will choose the default number of rounds (5000),
-# which is orders of magnitude too low for modern hardware.
-# The values must be within the 1000-999999999 range.
-# If only one of the MIN or MAX values is set, then this value will be used.
-# If MIN > MAX, the highest value will be used.
-#
-#SHA_CRYPT_MIN_ROUNDS 5000
-#SHA_CRYPT_MAX_ROUNDS 5000
-
-#
-# Only works if ENCRYPT_METHOD is set to BCRYPT.
-#
-# Define the number of BCRYPT rounds.
-# With a lot of rounds, it is more difficult to brute-force the password.
-# However, more CPU resources will be needed to authenticate users if
-# this value is increased.
-#
-# If not specified, 13 rounds will be attempted.
-# If only one of the MIN or MAX values is set, then this value will be used.
-# If MIN > MAX, the highest value will be used.
-#
-#BCRYPT_MIN_ROUNDS 13
-#BCRYPT_MAX_ROUNDS 13
-
-#
-# Only works if ENCRYPT_METHOD is set to YESCRYPT.
-#
-# Define the YESCRYPT cost factor.
-# With a higher cost factor, it is more difficult to brute-force the password.
-# However, more CPU time and more memory will be needed to authenticate users
-# if this value is increased.
-#
-# If not specified, a cost factor of 5 will be used.
-# The value must be within the 1-11 range.
-#
-#YESCRYPT_COST_FACTOR 5
-
-#
-# List of groups to add to the user's supplementary group set
-# when logging in from the console (as determined by the CONSOLE
-# setting). Default is none.
-#
-# Use with caution - it is possible for users to gain permanent
-# access to these groups, even when not logged in from the console.
-# How to do it is left as an exercise for the reader...
-#
-#CONSOLE_GROUPS floppy:audio:cdrom
+ENCRYPT_METHOD YESCRYPT
#
# Should login be allowed if we can't cd to the home directory?
@@ -401,12 +174,6 @@ DEFAULT_HOME yes
#
NONEXISTENT /nonexistent
-#
-# If this file exists and is readable, login environment will be
-# read from it. Every line should be in the form name=value.
-#
-ENVIRON_FILE /etc/environment
-
#
# If defined, this command is run when removing a user.
# It should remove any at/cron/print jobs etc. owned by
@@ -415,59 +182,11 @@ ENVIRON_FILE /etc/environment
#USERDEL_CMD /usr/sbin/userdel_local
#
-# Enable setting of the umask group bits to be the same as owner bits
-# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is
-# the same as gid, and username is the same as the primary group name.
+# If set to yes, userdel(8) will remove the user's group if it contains no more
+# members, and useradd(8) will create by default a group with the name of the
+# user.
#
-# This also enables userdel(8) to remove user groups if no members exist.
+# Other former uses of this variable are not used in PAM environments, such as
+# Debian.
#
USERGROUPS_ENAB yes
-
-#
-# If set to a non-zero number, the shadow utilities will make sure that
-# groups never have more than this number of users on one line.
-# This permits to support split groups (groups split into multiple lines,
-# with the same group ID, to avoid limitation of the line length in the
-# group file).
-#
-# 0 is the default value and disables this feature.
-#
-#MAX_MEMBERS_PER_GROUP 0
-
-#
-# If useradd(8) should create home directories for users by default (non
-# system users only).
-# This option is overridden with the -M or -m flags on the useradd(8)
-# command-line.
-#
-#CREATE_HOME yes
-
-#
-# Force use shadow, even if shadow passwd & shadow group files are
-# missing.
-#
-#FORCE_SHADOW yes
-
-#
-# Allow newuidmap and newgidmap when running under an alternative
-# primary group.
-#
-#GRANT_AUX_GROUP_SUBIDS yes
-
-#
-# Prevents an empty password field to be interpreted as "no authentication
-# required".
-# Set to "yes" to prevent for all accounts
-# Set to "superuser" to prevent for UID 0 / root (default)
-# Set to "no" to not prevent for any account (dangerous, historical default)
-PREVENT_NO_AUTH superuser
-
-#
-# Select the HMAC cryptography algorithm.
-# Used in pam_timestamp module to calculate the keyed-hash message
-# authentication code.
-#
-# Note: It is recommended to check hmac(3) to see the possible algorithms
-# that are available in your system.
-#
-#HMAC_CRYPTO_ALGO SHA512

View File

@@ -1,25 +0,0 @@
From: Chris Hofstaedtler <zeha@debian.org>
Date: Tue, 6 Aug 2024 00:16:59 +0200
Subject: Define LOGIN_NAME_MAX on HURD
---
lib/chkname.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/chkname.c b/lib/chkname.c
index bee2e6b..c3fb552 100644
--- a/lib/chkname.c
+++ b/lib/chkname.c
@@ -29,6 +29,12 @@
#include <stddef.h>
#include <unistd.h>
+#ifdef __GNU__
+#ifndef LOGIN_NAME_MAX
+#define LOGIN_NAME_MAX 256
+#endif
+#endif
+
#include "defines.h"
#include "chkname.h"
#include "string/strcmp/streq.h"

View File

@@ -2,20 +2,30 @@ From: Shadow package maintainers <pkg-shadow-devel@lists.alioth.debian.org>
Date: Sat, 22 Jun 2024 17:39:41 +0200
Subject: Document the shadowconfig utility
Status wrt upstream: The shadowconfig utility is Debian-specific.
The man page is Debian-specific, but it used to be distributed by
upstream.
Status wrt upstream: The shadowconfig utility is debian specific.
Its man page also (but it used to be distributed)
---
man/Makefile.am | 1 +
man/man8/shadowconfig.8 | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
create mode 100644 man/man8/shadowconfig.8
man/Makefile.am | 2 ++
man/fr/Makefile.am | 1 +
man/fr/man8/shadowconfig.8 | 26 +++++++++++++++++++++++
man/ja/Makefile.am | 1 +
man/ja/man8/shadowconfig.8 | 25 ++++++++++++++++++++++
man/pl/Makefile.am | 1 +
man/pl/man8/shadowconfig.8 | 27 ++++++++++++++++++++++++
man/shadowconfig.8 | 41 ++++++++++++++++++++++++++++++++++++
man/shadowconfig.8.xml | 52 ++++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 176 insertions(+)
create mode 100644 man/fr/man8/shadowconfig.8
create mode 100644 man/ja/man8/shadowconfig.8
create mode 100644 man/pl/man8/shadowconfig.8
create mode 100644 man/shadowconfig.8
create mode 100644 man/shadowconfig.8.xml
diff --git a/man/Makefile.am b/man/Makefile.am
index 1405509..0e88fea 100644
index 83b1d68..dab98f4 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -36,6 +36,7 @@ man_MANS = \
@@ -37,6 +37,7 @@ man_MANS = \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
@@ -23,43 +33,248 @@ index 1405509..0e88fea 100644
man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
diff --git a/man/man8/shadowconfig.8 b/man/man8/shadowconfig.8
@@ -108,6 +109,7 @@ man_XMANS = \
porttime.5.xml \
pwck.8.xml \
pwconv.8.xml \
+ shadowconfig.8.xml \
shadow.3.xml \
shadow.5.xml \
sg.1.xml \
diff --git a/man/fr/Makefile.am b/man/fr/Makefile.am
index 335e029..78aee9a 100644
--- a/man/fr/Makefile.am
+++ b/man/fr/Makefile.am
@@ -32,6 +32,7 @@ man_MANS = \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
+ man8/shadowconfig.8 \
man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
diff --git a/man/fr/man8/shadowconfig.8 b/man/fr/man8/shadowconfig.8
new file mode 100644
index 0000000..a463a92
index 0000000..784da70
--- /dev/null
+++ b/man/man8/shadowconfig.8
@@ -0,0 +1,34 @@
+.TH shadowconfig 8 2025-02-17 "Debian shadow-utils"
+.SH Name
+shadowconfig \- turn shadow passwords on
+.
+.
+.SH Synopsis
+.SY shadowconfig on
+.YS
+.
+.
+.SH Description
+.I shadowconfig\ on
+will turn shadow passwords on.
+.
+.
+.SH Errors
+++ b/man/fr/man8/shadowconfig.8
@@ -0,0 +1,26 @@
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"$Id: shadowconfig.8,v 1.4 2001/08/23 23:10:48 kloczek Exp $
+.TH SHADOWCONFIG 8 "19 avril 1997" "Debian GNU/Linux"
+.SH NOM
+shadowconfig \- active ou désactive les mots de passe cachés
+.SH SYNOPSIS
+\fBshadowconfig\fP \fIon\fP | \fIoff\fP
+.SH DESCRIPTION
+.PP
+\fBshadowconfig on\fP active les mots de passe cachés («\ shadow passwords\ »)\ ; \fBshadowconfig off\fP les désactive. \fBShadowconfig\fP affiche un message
+d'erreur et quitte avec une valeur de retour non nulle s'il rencontre
+quelque chose d'inattendu. Dans ce cas, vous devrez corriger l'erreur avant
+de recommencer.
+
+Activer les mots de passe cachés lorsqu'ils sont déjà activés, ou les
+désactiver lorsqu'ils ne sont pas actifs est sans effet.
+
+Lisez \fI/usr/share/doc/passwd/README.Debian\fP pour une brève introduction aux
+mots de passe cachés et à leurs fonctionnalités.
+
+Notez que désactiver puis réactiver les mots de passe cachés aura pour
+conséquence la perte des informations d'âge sur les mots de passe.
+.SH TRADUCTION
+Nicolas FRANÇOIS, 2004.
+Veuillez signaler toute erreur à <\fIdebian\-l10\-french@lists.debian.org\fR>.
diff --git a/man/ja/Makefile.am b/man/ja/Makefile.am
index 13f18da..c72097f 100644
--- a/man/ja/Makefile.am
+++ b/man/ja/Makefile.am
@@ -27,6 +27,7 @@ man_MANS = \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
+ man8/shadowconfig.8 \
man1/sg.1 \
man5/shadow.5 \
man1/su.1 \
diff --git a/man/ja/man8/shadowconfig.8 b/man/ja/man8/shadowconfig.8
new file mode 100644
index 0000000..a75c6f7
--- /dev/null
+++ b/man/ja/man8/shadowconfig.8
@@ -0,0 +1,25 @@
+.\" all right reserved,
+.\" Translated Tue Oct 30 11:59:11 JST 2001
+.\" by Maki KURODA <mkuroda@aisys-jp.com>
+.\"
+.TH SHADOWCONFIG 8 "19 Apr 1997" "Debian GNU/Linux"
+.SH 名前
+shadowconfig \- shadow パスワードの設定をオン及びオフに切替える
+.SH 書式
+.B "shadowconfig"
+.IR on " | " off
+.SH 説明
+.PP
+.B shadowconfig on
+は shadow パスワードを有効にする。
+.B shadowconfig off
+は shadow パスワードを無効にする。
+.B shadowconfig
+will print an error message and exit with a nonzero code
+if it finds anything awry.
+If that happens,
+you should correct the error and run it again.
+Turning shadow passwords on when they are already on
+is harmless.
+.
+.
+.SH Caveats
+Turning shadow passwords off using shadowconfig
+is not supported anymore.
+.
+.
+.SH See also
+Read
+.I /usr/share/doc/passwd/README.Debian
+for a brief introduction to shadow passwords and related features.
+は何らかの間違いがあると、エラーメッセージを表示し、
+ゼロではない返り値を返す。
+もしそのようなことが起こった場合、エラーを修正し、再度実行しなければならない。
+shadow パスワードの設定がすでにオンの場合にオンに設定したり、
+すでにオフの場合にオフに設定しても、何の影響もない。
+
+.I /usr/share/doc/passwd/README.debian.gz
+には shadow パスワードとそれに関する特徴の簡単な紹介が書かれている。
diff --git a/man/pl/Makefile.am b/man/pl/Makefile.am
index b2f096f..aa79af2 100644
--- a/man/pl/Makefile.am
+++ b/man/pl/Makefile.am
@@ -18,6 +18,7 @@ man_MANS = \
man8/logoutd.8 \
man1/newgrp.1 \
man1/sg.1 \
+ man8/shadowconfig.8 \
man3/shadow.3 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/pl/man8/shadowconfig.8 b/man/pl/man8/shadowconfig.8
new file mode 100644
index 0000000..2016c9f
--- /dev/null
+++ b/man/pl/man8/shadowconfig.8
@@ -0,0 +1,27 @@
+.\" $Id: shadowconfig.8,v 1.3 2001/08/23 23:10:51 kloczek Exp $
+.\" {PTM/WK/1999-09-14}
+.TH SHADOWCONFIG 8 "19 kwietnia 1997" "Debian GNU/Linux"
+.SH NAZWA
+shadowconfig - przełącza ochronę haseł i grup przez pliki shadow
+.SH SKŁADNIA
+.B "shadowconfig"
+.IR on " | " off
+.SH OPIS
+.PP
+.B shadowconfig on
+włącza ochronę haseł i grup przez dodatkowe, przesłaniane pliki (shadow);
+.B shadowconfig off
+wyłącza dodatkowe pliki haseł i grup.
+.B shadowconfig
+wyświetla komunikat o błędzie i kończy pracę z niezerowym kodem jeśli
+znajdzie coś nieprawidłowego. W takim wypadku powinieneś poprawić błąd
+.\" if it finds anything awry.
+i uruchomić program ponownie.
+
+Włączenie ochrony haseł, gdy jest ona już włączona lub jej wyłączenie,
+gdy jest wyłączona jest nieszkodliwe.
+
+Przeczytaj
+.IR /usr/share/doc/passwd/README.debian.gz ,
+gdzie znajdziesz krótkie wprowadzenie do ochrony haseł z użyciem dodatkowych
+plików haseł przesłanianych (shadow passwords) i związanych tematów.
diff --git a/man/shadowconfig.8 b/man/shadowconfig.8
new file mode 100644
index 0000000..c0ee0af
--- /dev/null
+++ b/man/shadowconfig.8
@@ -0,0 +1,41 @@
+.\"Generated by db2man.xsl. Don't modify this, modify the source.
+.de Sh \" Subsection
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.TH "SHADOWCONFIG" 8 "19 Apr 1997" "" ""
+.SH NAME
+shadowconfig \- toggle shadow passwords on and off
+.SH "SYNOPSIS"
+.ad l
+.hy 0
+.HP 13
+\fBshadowconfig\fR \fB\fIon\fR\fR | \fB\fIoff\fR\fR
+.ad
+.hy
+
+.SH "DESCRIPTION"
+
+.PP
+\fBshadowconfig\fR on will turn shadow passwords on; \fIshadowconfig off\fR will turn shadow passwords off\&. \fBshadowconfig\fR will print an error message and exit with a nonzero code if it finds anything awry\&. If that happens, you should correct the error and run it again\&. Turning shadow passwords on when they are already on, or off when they are already off, is harmless\&.
+
+.PP
+Read \fI/usr/share/doc/passwd/README\&.Debian\fR for a brief introduction to shadow passwords and related features\&.
+
+.PP
+Note that turning shadow passwords off and on again will lose all password aging information\&.
+
diff --git a/man/shadowconfig.8.xml b/man/shadowconfig.8.xml
new file mode 100644
index 0000000..b4080ea
--- /dev/null
+++ b/man/shadowconfig.8.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+<refentry id='shadowconfig.8'>
+ <!-- $Id: shadowconfig.8.xml,v 1.6 2005/06/15 12:39:27 kloczek Exp $ -->
+ <refentryinfo>
+ <date>19 Apr 1997</date>
+ </refentryinfo>
+ <refmeta>
+ <refentrytitle>shadowconfig</refentrytitle>
+ <manvolnum>8</manvolnum>
+ <refmiscinfo class='date'>19 Apr 1997</refmiscinfo>
+ <refmiscinfo class='source'>Debian GNU/Linux</refmiscinfo>
+ </refmeta>
+ <refnamediv id='name'>
+ <refname>shadowconfig</refname>
+ <refpurpose>toggle shadow passwords on and off</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv id='synopsis'>
+ <cmdsynopsis>
+ <command>shadowconfig</command>
+ <group choice='plain'>
+ <arg choice='plain'><replaceable>on</replaceable></arg>
+ <arg choice='plain'><replaceable>off</replaceable></arg>
+ </group>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1 id='description'>
+ <title>DESCRIPTION</title>
+ <para><command>shadowconfig</command> on will turn shadow passwords on;
+ <emphasis remap='B'>shadowconfig off</emphasis> will turn shadow
+ passwords off. <command>shadowconfig</command> will print an error
+ message and exit with a nonzero code if it finds anything awry. If
+ that happens, you should correct the error and run it again. Turning
+ shadow passwords on when they are already on, or off when they are
+ already off, is harmless.
+ </para>
+
+ <para>
+ Read <filename>/usr/share/doc/passwd/README.Debian</filename> for a
+ brief introduction
+ to shadow passwords and related features.
+ </para>
+
+ <para>Note that turning shadow passwords off and on again will lose all
+ password
+ aging information.
+ </para>
+ </refsect1>
+</refentry>

View File

@@ -30,10 +30,10 @@ index 001e7d1..4888100 100644
</listitem>
</varlistentry>
diff --git a/src/useradd.c b/src/useradd.c
index 7623dab..954b329 100644
index 347334a..ac43edd 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -96,14 +96,14 @@ static const char Prog[] = "useradd";
@@ -91,14 +91,14 @@ static const char Prog[] = "useradd";
/*
* These defaults are used if there is no defaults file.
*/

View File

@@ -0,0 +1,106 @@
From: Shadow package maintainers <pkg-shadow-devel@lists.alioth.debian.org>
Date: Sat, 22 Jun 2024 17:39:41 +0200
Subject: Let pam_unix handle login failure delays
Fixes: #87648
Status wrt upstream: Forwarded but not applied yet
Note: If removed, FAIL_DELAY must be re-added to /etc/login.defs
---
lib/getdef.c | 1 -
src/login.c | 19 +++++--------------
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/lib/getdef.c b/lib/getdef.c
index 30f54ba..21307bb 100644
--- a/lib/getdef.c
+++ b/lib/getdef.c
@@ -84,7 +84,6 @@ static struct itemdef def_table[] = {
{"ENV_PATH", NULL},
{"ENV_SUPATH", NULL},
{"ERASECHAR", NULL},
- {"FAIL_DELAY", NULL},
{"FAKE_SHELL", NULL},
{"GID_MAX", NULL},
{"GID_MIN", NULL},
diff --git a/src/login.c b/src/login.c
index 9fed7b3..a5512d1 100644
--- a/src/login.c
+++ b/src/login.c
@@ -490,7 +490,6 @@ int main (int argc, char **argv)
const char *tmptty;
const char *cp;
const char *tmp;
- unsigned int delay;
unsigned int retries;
unsigned int timeout;
struct passwd *pwd = NULL;
@@ -500,6 +499,7 @@ int main (int argc, char **argv)
char *pam_user = NULL;
pid_t child;
#else
+ unsigned int delay;
bool is_console;
struct spwd *spwd = NULL;
# if defined(ENABLE_LASTLOG)
@@ -669,7 +669,6 @@ int main (int argc, char **argv)
}
environ = newenvp; /* make new environment active */
- delay = getdef_unum ("FAIL_DELAY", 1);
retries = getdef_unum ("LOGIN_RETRIES", RETRIES);
#ifdef USE_PAM
@@ -685,8 +684,7 @@ int main (int argc, char **argv)
/*
* hostname & tty are either set to NULL or their correct values,
- * depending on how much we know. We also set PAM's fail delay to
- * ours.
+ * depending on how much we know.
*
* PAM_RHOST and PAM_TTY are used for authentication, only use
* information coming from login or from the caller (e.g. no utmp)
@@ -695,10 +693,6 @@ int main (int argc, char **argv)
PAM_FAIL_CHECK;
retcode = pam_set_item (pamh, PAM_TTY, tty);
PAM_FAIL_CHECK;
-#ifdef HAS_PAM_FAIL_DELAY
- retcode = pam_fail_delay (pamh, 1000000 * delay);
- PAM_FAIL_CHECK;
-#endif
/* if fflg, then the user has already been authenticated */
if (!fflg) {
char hostn[256];
@@ -736,12 +730,6 @@ int main (int argc, char **argv)
bool failed = false;
failcount++;
-#ifdef HAS_PAM_FAIL_DELAY
- if (delay > 0) {
- retcode = pam_fail_delay(pamh, 1000000*delay);
- PAM_FAIL_CHECK;
- }
-#endif
retcode = pam_authenticate (pamh, 0);
@@ -1032,14 +1020,17 @@ int main (int argc, char **argv)
free (username);
username = NULL;
+#ifndef USE_PAM
/*
* Wait a while (a la SVR4 /usr/bin/login) before attempting
* to login the user again. If the earlier alarm occurs
* before the sleep() below completes, login will exit.
*/
+ delay = getdef_unum ("FAIL_DELAY", 1);
if (delay > 0) {
(void) sleep (delay);
}
+#endif
(void) puts (_("Login incorrect"));

View File

@@ -28,7 +28,7 @@ index 4888100..17987a6 100644
When invoked without the <option>-D</option> option, the
<command>useradd</command> command creates a new user account using
diff --git a/man/userdel.8.xml b/man/userdel.8.xml
index 32851f1..4373cd8 100644
index 5bd2981..384cc86 100644
--- a/man/userdel.8.xml
+++ b/man/userdel.8.xml
@@ -58,6 +58,12 @@

View File

@@ -0,0 +1,123 @@
From: Shadow package maintainers <pkg-shadow-devel@lists.alioth.debian.org>
Date: Sat, 22 Jun 2024 17:39:41 +0200
Subject: Relax usernames/groupnames checking
Allows any non-empty user/grounames that don't contain ':', ',' or '\n'
characters and don't start with '-', '+', or '~'. This patch is more
restrictive than original Karl's version. closes: #264879
Also closes: #377844
Comments from Karl Ramm (shadow 1:4.0.3-9, 20 Aug 2003 02:06:50 -0400):
I can't come up with a good justification as to why characters other
than ':'s and '\0's should be disallowed in group and usernames (other
than '-' as the leading character). Thus, the maintenance tools don't
anymore. closes: #79682, #166798, #171179
Status wrt upstream: Debian specific. Not to be used upstream
---
lib/chkname.c | 47 +++++++++++++++--------------------------------
man/groupadd.8.xml | 6 ++++++
man/useradd.8.xml | 8 ++++++++
3 files changed, 29 insertions(+), 32 deletions(-)
diff --git a/lib/chkname.c b/lib/chkname.c
index 995562f..d9678c6 100644
--- a/lib/chkname.c
+++ b/lib/chkname.c
@@ -54,44 +54,27 @@ static bool is_valid_name (const char *name)
}
/*
- * User/group names must match BRE regex:
- * [a-zA-Z0-9_.][a-zA-Z0-9_.-]*$\?
- *
- * as a non-POSIX, extension, allow "$" as the last char for
- * sake of Samba 3.x "add machine script"
- *
- * Also do not allow fully numeric names or just "." or "..".
- */
- int numeric;
-
- if ('\0' == *name ||
- ('.' == *name && (('.' == name[1] && '\0' == name[2]) ||
- '\0' == name[1])) ||
- !((*name >= 'a' && *name <= 'z') ||
- (*name >= 'A' && *name <= 'Z') ||
- (*name >= '0' && *name <= '9') ||
- *name == '_' ||
- *name == '.')) {
+ * POSIX indicate that usernames are composed of characters from the
+ * portable filename character set [A-Za-z0-9._-], and that the hyphen
+ * should not be used as the first character of a portable user name.
+ *
+ * Allow more relaxed user/group names in Debian -- ^[^-~+:,\s][^:,\s]*$
+ */
+ if ( ('\0' == *name)
+ || ('-' == *name)
+ || ('~' == *name)
+ || ('+' == *name)) {
return false;
}
- numeric = isdigit(*name);
-
- while ('\0' != *++name) {
- if (!((*name >= 'a' && *name <= 'z') ||
- (*name >= 'A' && *name <= 'Z') ||
- (*name >= '0' && *name <= '9') ||
- *name == '_' ||
- *name == '.' ||
- *name == '-' ||
- (*name == '$' && name[1] == '\0')
- )) {
+ do {
+ if ((':' == *name) || (',' == *name) || isspace(*name)) {
return false;
}
- numeric &= isdigit(*name);
- }
+ name++;
+ } while ('\0' != *name);
- return !numeric;
+ return true;
}
diff --git a/man/groupadd.8.xml b/man/groupadd.8.xml
index 61a548f..d472bd0 100644
--- a/man/groupadd.8.xml
+++ b/man/groupadd.8.xml
@@ -71,6 +71,12 @@
Fully numeric groupnames and groupnames . or .. are
also disallowed.
</para>
+ <para>
+ On Debian, the only constraints are that groupnames must neither start
+ with a dash ('-') nor plus ('+') nor tilde ('~') nor contain a
+ colon (':'), a comma (','), or a whitespace (space:' ',
+ end of line: '\n', tabulation: '\t', etc.).
+ </para>
<para>
Groupnames may only be up to &GROUP_NAME_MAX_LENGTH; characters long.
</para>
diff --git a/man/useradd.8.xml b/man/useradd.8.xml
index 17987a6..c98b214 100644
--- a/man/useradd.8.xml
+++ b/man/useradd.8.xml
@@ -735,6 +735,14 @@
<para>
Usernames may only be up to 256 characters long.
</para>
+ <para>
+ On Debian, the only constraints are that usernames must neither start
+ with a dash ('-') nor plus ('+') nor tilde ('~') nor contain a
+ colon (':'), a comma (','), or a whitespace (space: ' ',
+ end of line: '\n', tabulation: '\t', etc.). Note that using a slash
+ ('/') may break the default algorithm for the definition of the
+ user's home directory.
+ </para>
</refsect1>
<refsect1 id='configuration'>

View File

@@ -12,18 +12,18 @@ Fixes: #166793
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/lib/commonio.c b/lib/commonio.c
index 4d83e83..51e6300 100644
index 01a26c9..72e53b0 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
@@ -21,6 +21,7 @@
#include <sys/stat.h>
#include <stdlib.h>
#include <utime.h>
#include <errno.h>
#include <stdio.h>
#include <signal.h>
+#include <grp.h>
#include "alloc/malloc.h"
#include "alloc/reallocf.h"
@@ -953,12 +954,23 @@ int commonio_close (struct commonio_db *db)
#include "alloc.h"
#include "memzero.h"
@@ -956,12 +957,23 @@ int commonio_close (struct commonio_db *db)
if (errors != 0)
goto fail;
} else {
@@ -48,10 +48,10 @@ index 4d83e83..51e6300 100644
if (SNPRINTF(buf, "%s+", db->filename) == -1)
diff --git a/lib/sgroupio.c b/lib/sgroupio.c
index acb140d..6ffccd1 100644
index 0297df4..107b1e5 100644
--- a/lib/sgroupio.c
+++ b/lib/sgroupio.c
@@ -210,7 +210,7 @@ static struct commonio_db gshadow_db = {
@@ -209,7 +209,7 @@ static struct commonio_db gshadow_db = {
#ifdef WITH_SELINUX
NULL, /* scontext */
#endif

View File

@@ -1,564 +0,0 @@
From: Chris Hofstaedtler <zeha@debian.org>
Date: Tue, 6 Aug 2024 00:27:13 +0200
Subject: Stop building programs we do not install
---
man/Makefile.am | 16 ----------------
man/cs/Makefile.am | 9 ---------
man/da/Makefile.am | 3 ---
man/de/Makefile.am | 10 ----------
man/fr/Makefile.am | 10 ----------
man/hu/Makefile.am | 3 ---
man/id/Makefile.am | 1 -
man/it/Makefile.am | 10 ----------
man/ja/Makefile.am | 8 --------
man/ko/Makefile.am | 2 --
man/pl/Makefile.am | 6 ------
man/ru/Makefile.am | 9 ---------
man/sv/Makefile.am | 8 --------
man/tr/Makefile.am | 2 --
man/uk/Makefile.am | 9 ---------
man/zh_CN/Makefile.am | 10 ----------
man/zh_TW/Makefile.am | 2 --
src/Makefile.am | 7 +++----
18 files changed, 3 insertions(+), 122 deletions(-)
diff --git a/man/Makefile.am b/man/Makefile.am
index 0e88fea..18c012d 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -13,8 +13,6 @@ man_MANS = \
man8/chpasswd.8 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man1/gpasswd.1 \
man8/groupadd.8 \
@@ -25,22 +23,16 @@ man_MANS = \
man8/grpconv.8 \
man8/grpunconv.8 \
man5/gshadow.5 \
- man1/login.1 \
man5/login.defs.5 \
- man8/logoutd.8 \
- man1/newgrp.1 \
man8/newusers.8 \
- man8/nologin.8 \
man1/passwd.1 \
man5/passwd.5 \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
man8/shadowconfig.8 \
- man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
@@ -82,8 +74,6 @@ man_XMANS = \
chpasswd.8.xml \
chsh.1.xml \
expiry.1.xml \
- faillog.5.xml \
- faillog.8.xml \
getsubids.1.xml \
gpasswd.1.xml \
groupadd.8.xml \
@@ -96,12 +86,9 @@ man_XMANS = \
login.1.xml \
login.access.5.xml \
login.defs.5.xml \
- logoutd.8.xml \
newgidmap.1.xml \
- newgrp.1.xml \
newuidmap.1.xml \
newusers.8.xml \
- nologin.8.xml \
passwd.1.xml \
passwd.5.xml \
porttime.5.xml \
@@ -109,9 +96,6 @@ man_XMANS = \
pwconv.8.xml \
shadow.3.xml \
shadow.5.xml \
- sg.1.xml \
- su.1.xml \
- suauth.5.xml \
subgid.5.xml \
subuid.5.xml \
useradd.8.xml \
diff --git a/man/cs/Makefile.am b/man/cs/Makefile.am
index 45aec38..e1f9f87 100644
--- a/man/cs/Makefile.am
+++ b/man/cs/Makefile.am
@@ -3,25 +3,16 @@ mandir = @mandir@/cs
man_MANS = \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man1/gpasswd.1 \
man8/groupadd.8 \
man8/groupdel.8 \
man8/groupmod.8 \
man8/grpck.8 \
man5/gshadow.5 \
- man8/nologin.8 \
man5/passwd.5 \
man5/shadow.5 \
- man1/su.1 \
man8/vipw.8
if ENABLE_LASTLOG
man_MANS += man8/lastlog.8
endif
-
-EXTRA_DIST = $(man_MANS) \
- man8/groupmems.8 \
- man8/logoutd.8
-
diff --git a/man/da/Makefile.am b/man/da/Makefile.am
index c61b787..12234cb 100644
--- a/man/da/Makefile.am
+++ b/man/da/Makefile.am
@@ -6,10 +6,7 @@ man_MANS = \
man1/chfn.1 \
man8/groupdel.8 \
man5/gshadow.5 \
- man8/logoutd.8 \
man1/newgrp.1 \
- man8/nologin.8 \
- man1/sg.1 \
man8/vigr.8 \
man8/vipw.8
diff --git a/man/de/Makefile.am b/man/de/Makefile.am
index d3a6d6c..59602aa 100644
--- a/man/de/Makefile.am
+++ b/man/de/Makefile.am
@@ -8,34 +8,24 @@ man_MANS = \
man8/chpasswd.8 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man1/gpasswd.1 \
man8/groupadd.8 \
man8/groupdel.8 \
- man8/groupmems.8 \
man8/groupmod.8 \
man8/grpck.8 \
man8/grpconv.8 \
man8/grpunconv.8 \
man5/gshadow.5 \
- man1/login.1 \
man5/login.defs.5 \
- man8/logoutd.8 \
- man1/newgrp.1 \
man8/newusers.8 \
- man8/nologin.8 \
man1/passwd.1 \
man5/passwd.5 \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
- man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
- man1/su.1 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/fr/Makefile.am b/man/fr/Makefile.am
index 2365e23..6cbaadc 100644
--- a/man/fr/Makefile.am
+++ b/man/fr/Makefile.am
@@ -8,34 +8,24 @@ man_MANS = \
man8/chpasswd.8 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man1/gpasswd.1 \
man8/groupadd.8 \
man8/groupdel.8 \
- man8/groupmems.8 \
man8/groupmod.8 \
man8/grpck.8 \
man8/grpconv.8 \
man8/grpunconv.8 \
man5/gshadow.5 \
- man1/login.1 \
man5/login.defs.5 \
- man8/logoutd.8 \
- man1/newgrp.1 \
man8/newusers.8 \
- man8/nologin.8 \
man1/passwd.1 \
man5/passwd.5 \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
- man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
- man1/su.1 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/hu/Makefile.am b/man/hu/Makefile.am
index 6bf68e8..2930da3 100644
--- a/man/hu/Makefile.am
+++ b/man/hu/Makefile.am
@@ -4,11 +4,8 @@ mandir = @mandir@/hu
man_MANS = \
man1/chsh.1 \
man1/gpasswd.1 \
- man1/login.1 \
- man1/newgrp.1 \
man1/passwd.1 \
man5/passwd.5 \
- man1/sg.1 \
man1/su.1
if ENABLE_LASTLOG
diff --git a/man/id/Makefile.am b/man/id/Makefile.am
index 21f3dbe..566fa8b 100644
--- a/man/id/Makefile.am
+++ b/man/id/Makefile.am
@@ -3,7 +3,6 @@ mandir = @mandir@/id
man_MANS = \
man1/chsh.1 \
- man1/login.1 \
man8/useradd.8
EXTRA_DIST = $(man_MANS)
diff --git a/man/it/Makefile.am b/man/it/Makefile.am
index 736576c..3312232 100644
--- a/man/it/Makefile.am
+++ b/man/it/Makefile.am
@@ -8,34 +8,24 @@ man_MANS = \
man8/chpasswd.8 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man1/gpasswd.1 \
man8/groupadd.8 \
man8/groupdel.8 \
- man8/groupmems.8 \
man8/groupmod.8 \
man8/grpck.8 \
man8/grpconv.8 \
man8/grpunconv.8 \
man5/gshadow.5 \
- man1/login.1 \
man5/login.defs.5 \
- man8/logoutd.8 \
- man1/newgrp.1 \
man8/newusers.8 \
- man8/nologin.8 \
man1/passwd.1 \
man5/passwd.5 \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
- man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
- man1/su.1 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/ja/Makefile.am b/man/ja/Makefile.am
index b759726..1e22da2 100644
--- a/man/ja/Makefile.am
+++ b/man/ja/Makefile.am
@@ -7,8 +7,6 @@ man_MANS = \
man8/chpasswd.8 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man1/gpasswd.1 \
man8/groupadd.8 \
man8/groupdel.8 \
@@ -16,20 +14,14 @@ man_MANS = \
man8/grpck.8 \
man8/grpconv.8 \
man8/grpunconv.8 \
- man1/login.1 \
man5/login.defs.5 \
- man8/logoutd.8 \
- man1/newgrp.1 \
man8/newusers.8 \
man1/passwd.1 \
man5/passwd.5 \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
- man1/sg.1 \
man5/shadow.5 \
- man1/su.1 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/ko/Makefile.am b/man/ko/Makefile.am
index 4f73651..0f17a17 100644
--- a/man/ko/Makefile.am
+++ b/man/ko/Makefile.am
@@ -4,9 +4,7 @@ mandir = @mandir@/ko
man_MANS = \
man1/chfn.1 \
man1/chsh.1 \
- man1/login.1 \
man5/passwd.5 \
- man1/su.1 \
man8/vigr.8 \
man8/vipw.8
# newgrp.1 must be updated
diff --git a/man/pl/Makefile.am b/man/pl/Makefile.am
index 2a015f3..02f4533 100644
--- a/man/pl/Makefile.am
+++ b/man/pl/Makefile.am
@@ -6,17 +6,11 @@ man_MANS = \
man1/chage.1 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man8/groupadd.8 \
man8/groupdel.8 \
- man8/groupmems.8 \
man8/groupmod.8 \
man8/grpck.8 \
- man8/logoutd.8 \
- man1/newgrp.1 \
- man1/sg.1 \
man3/shadow.3 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/ru/Makefile.am b/man/ru/Makefile.am
index 845a603..9afcb22 100644
--- a/man/ru/Makefile.am
+++ b/man/ru/Makefile.am
@@ -8,22 +8,16 @@ man_MANS = \
man8/chpasswd.8 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man1/gpasswd.1 \
man8/groupadd.8 \
man8/groupdel.8 \
- man8/groupmems.8 \
man8/groupmod.8 \
man8/grpck.8 \
man8/grpconv.8 \
man8/grpunconv.8 \
man5/gshadow.5 \
- man1/login.1 \
man5/login.defs.5 \
- man8/logoutd.8 \
- man1/newgrp.1 \
man8/newusers.8 \
man8/nologin.8 \
man1/passwd.1 \
@@ -31,11 +25,8 @@ man_MANS = \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
- man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
- man1/su.1 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/sv/Makefile.am b/man/sv/Makefile.am
index 1918af7..d572c36 100644
--- a/man/sv/Makefile.am
+++ b/man/sv/Makefile.am
@@ -5,24 +5,16 @@ man_MANS = \
man1/chage.1 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man8/groupadd.8 \
man8/groupdel.8 \
- man8/groupmems.8 \
man8/groupmod.8 \
man8/grpck.8 \
man5/gshadow.5 \
- man8/logoutd.8 \
- man1/newgrp.1 \
- man8/nologin.8 \
man1/passwd.1 \
man5/passwd.5 \
man8/pwck.8 \
- man1/sg.1 \
man3/shadow.3 \
- man5/suauth.5 \
man8/userdel.8 \
man8/vigr.8 \
man8/vipw.8
diff --git a/man/tr/Makefile.am b/man/tr/Makefile.am
index 8d8b916..8b2aa2d 100644
--- a/man/tr/Makefile.am
+++ b/man/tr/Makefile.am
@@ -6,11 +6,9 @@ man_MANS = \
man8/groupadd.8 \
man8/groupdel.8 \
man8/groupmod.8 \
- man1/login.1 \
man1/passwd.1 \
man5/passwd.5 \
man5/shadow.5 \
- man1/su.1 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8
diff --git a/man/uk/Makefile.am b/man/uk/Makefile.am
index a0f106d..f069eea 100644
--- a/man/uk/Makefile.am
+++ b/man/uk/Makefile.am
@@ -8,34 +8,25 @@ man_MANS = \
man8/chpasswd.8 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man1/gpasswd.1 \
man8/groupadd.8 \
man8/groupdel.8 \
- man8/groupmems.8 \
man8/groupmod.8 \
man8/grpck.8 \
man8/grpconv.8 \
man8/grpunconv.8 \
man5/gshadow.5 \
- man1/login.1 \
man5/login.defs.5 \
- man8/logoutd.8 \
man1/newgrp.1 \
man8/newusers.8 \
- man8/nologin.8 \
man1/passwd.1 \
man5/passwd.5 \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
- man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
- man1/su.1 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/zh_CN/Makefile.am b/man/zh_CN/Makefile.am
index 59d1072..9402a9e 100644
--- a/man/zh_CN/Makefile.am
+++ b/man/zh_CN/Makefile.am
@@ -8,34 +8,24 @@ man_MANS = \
man8/chpasswd.8 \
man1/chsh.1 \
man1/expiry.1 \
- man5/faillog.5 \
- man8/faillog.8 \
man3/getspnam.3 \
man1/gpasswd.1 \
man8/groupadd.8 \
man8/groupdel.8 \
- man8/groupmems.8 \
man8/groupmod.8 \
man8/grpck.8 \
man8/grpconv.8 \
man8/grpunconv.8 \
man5/gshadow.5 \
- man1/login.1 \
man5/login.defs.5 \
- man8/logoutd.8 \
- man1/newgrp.1 \
man8/newusers.8 \
- man8/nologin.8 \
man1/passwd.1 \
man5/passwd.5 \
man8/pwck.8 \
man8/pwconv.8 \
man8/pwunconv.8 \
- man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
- man1/su.1 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
diff --git a/man/zh_TW/Makefile.am b/man/zh_TW/Makefile.am
index c36ed2c..6fb6a15 100644
--- a/man/zh_TW/Makefile.am
+++ b/man/zh_TW/Makefile.am
@@ -5,12 +5,10 @@ man_MANS = \
man1/chfn.1 \
man1/chsh.1 \
man8/chpasswd.8 \
- man1/newgrp.1 \
man8/groupadd.8 \
man8/groupdel.8 \
man8/groupmod.8 \
man5/passwd.5 \
- man1/su.1 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8
diff --git a/src/Makefile.am b/src/Makefile.am
index d4e6f3a..78722ad 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,8 +26,8 @@ AM_CFLAGS = $(LIBBSD_CFLAGS)
# and installation would be much simpler (just two directories,
# $prefix/bin and $prefix/sbin, no install-data hacks...)
-bin_PROGRAMS = login
-sbin_PROGRAMS = nologin
+bin_PROGRAMS =
+sbin_PROGRAMS =
ubin_PROGRAMS = faillog chage chfn chsh expiry gpasswd newgrp passwd
if ENABLE_SUBIDS
ubin_PROGRAMS += newgidmap newuidmap
@@ -48,7 +48,6 @@ usbin_PROGRAMS = \
grpck \
grpconv \
grpunconv \
- logoutd \
newusers \
pwck \
pwconv \
@@ -59,7 +58,7 @@ usbin_PROGRAMS = \
vipw
# sulogin from sysvinit
-noinst_PROGRAMS = sulogin
+noinst_PROGRAMS =
suidusbins =
suidbins =

View File

@@ -0,0 +1,287 @@
From: Nicolas FRANCOIS <nicolas.francois@centraliens.net>
Date: Sat, 22 Jun 2024 17:39:41 +0200
Subject: cppw: Add tool
---
po/POTFILES.in | 1 +
src/Makefile.am | 2 +
src/cppw.c | 238 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 241 insertions(+)
create mode 100644 src/cppw.c
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9ff6100..a60c93e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -86,6 +86,7 @@ src/chfn.c
src/chgpasswd.c
src/chpasswd.c
src/chsh.c
+src/cppw.c
src/expiry.c
src/faillog.c
src/gpasswd.c
diff --git a/src/Makefile.am b/src/Makefile.am
index b6cb09e..c86ba52 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,6 +39,7 @@ if WITH_SU
bin_PROGRAMS += su
endif
usbin_PROGRAMS = \
+ cppw \
chgpasswd \
chpasswd \
groupadd \
@@ -104,6 +105,7 @@ newuidmap_LDADD = $(LDADD) $(LIBAUDIT) $(LIBSELINUX) $(LIBCAP) $(LIBECONF) -l
newgidmap_LDADD = $(LDADD) $(LIBAUDIT) $(LIBSELINUX) $(LIBCAP) $(LIBECONF) -ldl
chfn_LDADD = $(LDADD) $(LIBPAM) $(LIBAUDIT) $(LIBSELINUX) $(LIBCRYPT_NOPAM) $(LIBSKEY) $(LIBMD) $(LIBECONF)
chgpasswd_LDADD = $(LDADD) $(LIBPAM_SUID) $(LIBAUDIT) $(LIBSELINUX) $(LIBCRYPT) $(LIBECONF)
+cppw_LDADD = $(LDADD) $(LIBAUDIT) $(LIBSELINUX)
chsh_LDADD = $(LDADD) $(LIBPAM) $(LIBAUDIT) $(LIBSELINUX) $(LIBCRYPT_NOPAM) $(LIBSKEY) $(LIBMD) $(LIBECONF)
chpasswd_LDADD = $(LDADD) $(LIBPAM) $(LIBAUDIT) $(LIBSELINUX) $(LIBCRYPT) $(LIBECONF) -ldl
expiry_LDADD = $(LDADD) $(LIBECONF)
diff --git a/src/cppw.c b/src/cppw.c
new file mode 100644
index 0000000..beb4c36
--- /dev/null
+++ b/src/cppw.c
@@ -0,0 +1,238 @@
+/*
+ cppw, cpgr copy with locking given file over the password or group file
+ with -s will copy with locking given file over shadow or gshadow file
+
+ Copyright (C) 1999 Stephen Frost <sfrost@snowman.net>
+
+ Based on vipw, vigr by:
+ Copyright (C) 1997 Guy Maor <maor@ece.utexas.edu>
+
+ 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 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ */
+
+#include <config.h>
+#include "defines.h"
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <utime.h>
+#include "exitcodes.h"
+#include "prototypes.h"
+#include "pwio.h"
+#include "shadowio.h"
+#include "groupio.h"
+#include "sgroupio.h"
+
+
+const char *Prog;
+
+const char *filename, *filenewname;
+static bool filelocked = false;
+static int (*unlock) (void);
+
+/* local function prototypes */
+static int create_copy (FILE *fp, const char *dest, struct stat *sb);
+static void cppwexit (const char *msg, int syserr, int ret);
+static void cppwcopy (const char *file,
+ const char *in_file,
+ int (*file_lock) (void),
+ int (*file_unlock) (void));
+
+static int create_copy (FILE *fp, const char *dest, struct stat *sb)
+{
+ struct utimbuf ub;
+ FILE *bkfp;
+ int c;
+ mode_t mask;
+
+ mask = umask (077);
+ bkfp = fopen (dest, "w");
+ (void) umask (mask);
+ if (NULL == bkfp) {
+ return -1;
+ }
+
+ rewind (fp);
+ while ((c = getc (fp)) != EOF) {
+ if (putc (c, bkfp) == EOF) {
+ break;
+ }
+ }
+
+ if ( (c != EOF)
+ || (fflush (bkfp) != 0)) {
+ (void) fclose (bkfp);
+ (void) unlink (dest);
+ return -1;
+ }
+ if ( (fsync (fileno (bkfp)) != 0)
+ || (fclose (bkfp) != 0)) {
+ (void) unlink (dest);
+ return -1;
+ }
+
+ ub.actime = sb->st_atime;
+ ub.modtime = sb->st_mtime;
+ if ( (utime (dest, &ub) != 0)
+ || (chmod (dest, sb->st_mode) != 0)
+ || (chown (dest, sb->st_uid, sb->st_gid) != 0)) {
+ (void) unlink (dest);
+ return -1;
+ }
+ return 0;
+}
+
+static void cppwexit (const char *msg, int syserr, int ret)
+{
+ int err = errno;
+ if (filelocked) {
+ (*unlock) ();
+ }
+ if (NULL != msg) {
+ fprintf (stderr, "%s: %s", Prog, msg);
+ if (0 != syserr) {
+ fprintf (stderr, ": %s", strerror (err));
+ }
+ (void) fputs ("\n", stderr);
+ }
+ if (NULL != filename) {
+ fprintf (stderr, _("%s: %s is unchanged\n"), Prog, filename);
+ } else {
+ fprintf (stderr, _("%s: no changes\n"), Prog);
+ }
+
+ exit (ret);
+}
+
+static void cppwcopy (const char *file,
+ const char *in_file,
+ int (*file_lock) (void),
+ int (*file_unlock) (void))
+{
+ struct stat st1;
+ FILE *f;
+ char filenew[1024];
+
+ snprintf (filenew, sizeof filenew, "%s.new", file);
+ unlock = file_unlock;
+ filename = file;
+ filenewname = filenew;
+
+ if (access (file, F_OK) != 0) {
+ cppwexit (file, 1, 1);
+ }
+ if (file_lock () == 0) {
+ cppwexit (_("Couldn't lock file"), 0, 5);
+ }
+ filelocked = true;
+
+ /* file to copy has same owners, perm */
+ if (stat (file, &st1) != 0) {
+ cppwexit (file, 1, 1);
+ }
+ f = fopen (in_file, "r");
+ if (NULL == f) {
+ cppwexit (in_file, 1, 1);
+ }
+ if (create_copy (f, filenew, &st1) != 0) {
+ cppwexit (_("Couldn't make copy"), errno, 1);
+ }
+
+ /* XXX - here we should check filenew for errors; if there are any,
+ * fail w/ an appropriate error code and let the user manually fix
+ * it. Use pwck or grpck to do the check. - Stephen (Shamelessly
+ * stolen from '--marekm's comment) */
+
+ if (rename (filenew, file) != 0) {
+ fprintf (stderr, _("%s: can't copy %s: %s)\n"),
+ Prog, filenew, strerror (errno));
+ cppwexit (NULL,0,1);
+ }
+
+ (*file_unlock) ();
+}
+
+int main (int argc, char **argv)
+{
+ int flag;
+ bool cpshadow = false;
+ char *in_file;
+ int e = E_USAGE;
+ bool do_cppw = true;
+
+ (void) setlocale (LC_ALL, "");
+ (void) bindtextdomain (PACKAGE, LOCALEDIR);
+ (void) textdomain (PACKAGE);
+
+ Prog = Basename (argv[0]);
+ if (strcmp (Prog, "cpgr") == 0) {
+ do_cppw = false;
+ }
+
+ while ((flag = getopt (argc, argv, "ghps")) != EOF) {
+ switch (flag) {
+ case 'p':
+ do_cppw = true;
+ break;
+ case 'g':
+ do_cppw = false;
+ break;
+ case 's':
+ cpshadow = true;
+ break;
+ case 'h':
+ e = E_SUCCESS;
+ /*pass through*/
+ default:
+ (void) fputs (_("Usage:\n\
+`cppw <file>' copys over /etc/passwd `cppw -s <file>' copys over /etc/shadow\n\
+`cpgr <file>' copys over /etc/group `cpgr -s <file>' copys over /etc/gshadow\n\
+"), (E_SUCCESS != e) ? stderr : stdout);
+ exit (e);
+ }
+ }
+
+ if (argc != optind + 1) {
+ cppwexit (_("wrong number of arguments, -h for usage"),0,1);
+ }
+
+ in_file = argv[optind];
+
+ if (do_cppw) {
+ if (cpshadow) {
+ cppwcopy (SHADOW_FILE, in_file, spw_lock, spw_unlock);
+ } else {
+ cppwcopy (PASSWD_FILE, in_file, pw_lock, pw_unlock);
+ }
+ } else {
+#ifdef SHADOWGRP
+ if (cpshadow) {
+ cppwcopy (SGROUP_FILE, in_file, sgr_lock, sgr_unlock);
+ } else
+#endif /* SHADOWGRP */
+ {
+ cppwcopy (GROUP_FILE, in_file, gr_lock, gr_unlock);
+ }
+ }
+
+ return 0;
+}
+

View File

@@ -0,0 +1,63 @@
From: Shadow package maintainers <pkg-shadow-devel@lists.alioth.debian.org>
Date: Sat, 22 Jun 2024 17:39:41 +0200
Subject: cppw: add selinux support
Status wrt upstream: cppw is not available upstream.
Needs to be reviewed by an SE-Linux aware person.
---
src/cppw.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/cppw.c b/src/cppw.c
index beb4c36..2cbbbc0 100644
--- a/src/cppw.c
+++ b/src/cppw.c
@@ -34,6 +34,9 @@
#include <sys/types.h>
#include <signal.h>
#include <utime.h>
+#ifdef WITH_SELINUX
+#include <selinux/selinux.h>
+#endif /* WITH_SELINUX */
#include "exitcodes.h"
#include "prototypes.h"
#include "pwio.h"
@@ -139,6 +142,22 @@ static void cppwcopy (const char *file,
if (access (file, F_OK) != 0) {
cppwexit (file, 1, 1);
}
+#ifdef WITH_SELINUX
+ /* if SE Linux is enabled then set the context of all new files
+ * to be the context of the file we are editing */
+ if (is_selinux_enabled () > 0) {
+ security_context_t passwd_context=NULL;
+ int ret = 0;
+ if (getfilecon (file, &passwd_context) < 0) {
+ cppwexit (_("Couldn't get file context"), errno, 1);
+ }
+ ret = setfscreatecon (passwd_context);
+ freecon (passwd_context);
+ if (0 != ret) {
+ cppwexit (_("setfscreatecon () failed"), errno, 1);
+ }
+ }
+#endif /* WITH_SELINUX */
if (file_lock () == 0) {
cppwexit (_("Couldn't lock file"), 0, 5);
}
@@ -167,6 +186,15 @@ static void cppwcopy (const char *file,
cppwexit (NULL,0,1);
}
+#ifdef WITH_SELINUX
+ /* unset the fscreatecon */
+ if (is_selinux_enabled () > 0) {
+ if (setfscreatecon (NULL)) {
+ cppwexit (_("setfscreatecon() failed"), errno, 1);
+ }
+ }
+#endif /* WITH_SELINUX */
+
(*file_unlock) ();
}

View File

@@ -0,0 +1,22 @@
From: Chris Hofstaedtler <zeha@debian.org>
Date: Sat, 6 Jul 2024 23:35:51 +0200
Subject: tests/libsubid/04_nss: fix setting basedir
---
tests/libsubid/04_nss/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/libsubid/04_nss/Makefile b/tests/libsubid/04_nss/Makefile
index 7d7ae3e..3fbf989 100644
--- a/tests/libsubid/04_nss/Makefile
+++ b/tests/libsubid/04_nss/Makefile
@@ -1,7 +1,7 @@
all: test_nss libsubid_zzz.so
-BASE_TEST_DIR ?= $(shell git rev-parse --show-toplevel)
-basedir := $(BASE_TEST_DIR)
+BUILD_BASE_DIR ?= $(shell git rev-parse --show-toplevel)
+basedir := $(BUILD_BASE_DIR)
test_nss: test_nss.c $(basedir)/lib/nss.c
gcc -c -I$(basedir)/lib/ -I$(basedir) -o test_nss.o test_nss.c

17
debian/patches/series vendored
View File

@@ -1,17 +1,10 @@
debian/cppw-Add-tool.patch
debian/cppw-add-selinux-support.patch
debian/Let-pam_unix-handle-login-failure-delays.patch
debian/Set-group-and-mode-for-g-shadow-files.patch
debian/Keep-using-Debian-adduser-defaults.patch
debian/Document-the-shadowconfig-utility.patch
debian/Recommend-using-adduser-and-deluser.patch
debian/Relax-usernames-groupnames-checking.patch
debian/tests-disable-su.patch
debian/Adapt-login.defs-for-Debian.patch
debian/Define-LOGIN_NAME_MAX-on-HURD.patch
debian/Stop-building-programs-we-do-not-install.patch
upstream/a015e919834c90b99947829c6c823f7fe93a8097-E_BAD_NAME.patch
upstream/man-useradd.8.xml-Document-new-exit-code-19-E_BAD_NAME.patch
upstream/Revert-lib-src-Use-local-time-for-human-readable-dates.patch
Revert-lib-strtoday.c-strtoday-Fix-calculation.patch
Warn-when-badname-and-variants-are-given.patch
upstream/src-chfn.c-Partially-revert-lib-src-Use-strsep-3-instead-.patch
upstream/src-chfn.c-Use-stpsep-instead-of-its-pattern.patch
upstream/src-chfn.c-Add-local-variable-to-refer-to-the-separated-f.patch
upstream/src-chfn.c-copy_field-Rename-local-variable.patch
debian/tests-libsubid-04_nss-fix-setting-basedir.patch

View File

@@ -1,70 +0,0 @@
From: Alejandro Colomar <alx@kernel.org>
Date: Fri, 14 Feb 2025 21:25:01 +0100
Subject: Revert "lib/, src/: Use local time for human-readable dates"
This reverts commit 3f5b4b56268269fefed55aa106f382037297d663.
The dates are stored as UTC, and are stored as a number of days since
Epoch. We don't have enough precision to translate it into local time.
Using local time has caused endless issues in users.
This patch is not enough for fixing this issue completely, since
printing a date without time-zone information means that the date is a
local date, but what we're printing is a UTC date. A future patch
should add time-zone information to the date.
For now, let's revert this change that has caused so many issues.
Fixes: 3f5b4b562682 (2024-08-01; "lib/, src/: Use local time for human-readable dates")
Link: <https://github.com/ansible/ansible/blob/devel/test/integration/targets/user/tasks/test_expires.yml#L2-L20>
Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430>
Link: <https://lists.iana.org/hyperkitty/list/tz@iana.org/message/ENE5IFV3GAH6WK22UJ6YU57D6TQINSP5/>
Link: <https://github.com/shadow-maint/shadow/issues/1202>
Link: <https://github.com/shadow-maint/shadow/issues/1057>
Link: <https://github.com/shadow-maint/shadow/issues/939>
Link: <https://github.com/shadow-maint/shadow/pull/1058>
Link: <https://github.com/shadow-maint/shadow/pull/1059#issuecomment-2309888519>
Link: <https://github.com/shadow-maint/shadow/pull/952>
Link: <https://github.com/shadow-maint/shadow/pull/942>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Gus Kenion <https://github.com/kenion>
Reported-by: Alejandro Colomar <alx@kernel.org>
Reported-by: Michael Vetter <jubalh@iodoru.org>
Reported-by: Lee Garrett <lgarrett@rocketjump.eu>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Tim Parenti <tim@timtimeonline.com>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
lib/time/day_to_str.h | 2 +-
src/chage.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/time/day_to_str.h b/lib/time/day_to_str.h
index b70e989..fe3308d 100644
--- a/lib/time/day_to_str.h
+++ b/lib/time/day_to_str.h
@@ -38,7 +38,7 @@ day_to_str(size_t size, char buf[size], long day)
return;
}
- if (localtime_r(&date, &tm) == NULL) {
+ if (gmtime_r(&date, &tm) == NULL) {
strtcpy(buf, "future", size);
return;
}
diff --git a/src/chage.c b/src/chage.c
index a7933e0..67e7e77 100644
--- a/src/chage.c
+++ b/src/chage.c
@@ -243,7 +243,7 @@ print_day_as_date(long day)
return;
}
- if (localtime_r(&date, &tm) == NULL) {
+ if (gmtime_r(&date, &tm) == NULL) {
puts(_("future"));
return;
}

View File

@@ -1,38 +0,0 @@
From: Alejandro Colomar <alx@kernel.org>
Date: Thu, 5 Dec 2024 17:38:54 +0100
Subject: [PATCH] src/useradd.c: E_BAD_NAME: Use a different error code for
bad login names
Wrappers like adduser(8) want to do their own stuff if the login name is
bad. For that, they need to be able to differentiate such an error.
Closes: <https://github.com/shadow-maint/shadow/issues/1103>
Suggested-by: Chris Hofstaedtler <zeha@debian.org>
Cc: Marc 'Zugschlus' Haber <mh+githubvisible@zugschlus.de>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Bug-Debian: 1074306
---
src/useradd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/useradd.c b/src/useradd.c
index 954b329..92f8054 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -201,6 +201,7 @@ static bool home_added = false;
#define E_SUB_UID_UPDATE 16 /* can't update the subordinate uid file */
#define E_SUB_GID_UPDATE 18 /* can't update the subordinate gid file */
#endif /* ENABLE_SUBIDS */
+#define E_BAD_NAME 19 /* Bad login name */
#define DGROUP "GROUP"
#define DGROUPS "GROUPS"
@@ -1549,7 +1550,7 @@ static void process_flags (int argc, char **argv)
user_name, AUDIT_NO_ID,
SHADOW_AUDIT_FAILURE);
#endif
- exit (E_BAD_ARG);
+ exit (E_BAD_NAME);
}
if (!dflg) {
char *uh;

View File

@@ -1,31 +0,0 @@
From: Marc Haber <mh+debian-packages@zugschlus.de>
Date: Thu, 5 Dec 2024 18:54:17 +0100
Subject: man/useradd.8.xml: Document new exit code 19 (E_BAD_NAME)
Link: <https://github.com/shadow-maint/shadow/issues/1103>
Link: <https://github.com/shadow-maint/shadow/pull/1141>
Signed-off-by: Marc 'Zugschlus' Haber <mh+githubvisible@zugschlus.de>
Cc: Chris Hofstaedtler <zeha@debian.org>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
man/useradd.8.xml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/man/useradd.8.xml b/man/useradd.8.xml
index 17987a6..dbdd9b1 100644
--- a/man/useradd.8.xml
+++ b/man/useradd.8.xml
@@ -898,6 +898,12 @@
<para>can't update SELinux user mapping</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><replaceable>19</replaceable></term>
+ <listitem>
+ <para>invalid user or group name</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</para>
</refsect1>

View File

@@ -1,37 +0,0 @@
From: Alejandro Colomar <alx@kernel.org>
Date: Mon, 17 Feb 2025 13:44:55 +0100
Subject: src/chfn.c: Add local variable to refer to the separated field
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
src/chfn.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/chfn.c b/src/chfn.c
index 1799d6b..3fc94dc 100644
--- a/src/chfn.c
+++ b/src/chfn.c
@@ -220,18 +220,20 @@ static char *copy_field (char *in, char *out, char *extra)
char *cp = NULL;
while (NULL != in) {
+ const char *f;
+
+ f = in;
cp = stpsep(in, ",");
- if (strchr (in, '=') == NULL) {
+ if (strchr(f, '=') == NULL)
break;
- }
if (NULL != extra) {
if (!streq(extra, "")) {
strcat (extra, ",");
}
- strcat (extra, in);
+ strcat(extra, f);
}
in = cp;
}

View File

@@ -1,67 +0,0 @@
From: Alejandro Colomar <alx@kernel.org>
Date: Mon, 17 Feb 2025 13:23:37 +0100
Subject: src/chfn.c: Partially revert "lib/,
src/: Use strsep(3) instead of its pattern"
This partially reverts commit 16cb664865541162c504a6f5ef5ca4b38b5e0c9a.
I'll try to reintroduce this change more carefully.
For now, let's revert to a known-good state.
The problem was due to accidentally ignoring the effects of the 'break'
on the 'cp' variable.
Fixes: 16cb66486554 (2024-07-01; "lib/, src/: Use strsep(3) instead of its pattern")
Closes: <https://github.com/shadow-maint/shadow/issues/1210>
Link: <https://github.com/shadow-maint/shadow/pull/1213>
Link: <https://github.com/shadow-maint/shadow/pull/1212>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Suggested-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
src/chfn.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/chfn.c b/src/chfn.c
index 4c96fba..f06cb44 100644
--- a/src/chfn.c
+++ b/src/chfn.c
@@ -216,27 +216,32 @@ static void new_fields (void)
*/
static char *copy_field (char *in, char *out, char *extra)
{
- while (NULL != in) {
- char *f;
+ char *cp = NULL;
- f = strsep(&in, ",");
+ while (NULL != in) {
+ cp = strchr (in, ',');
+ if (NULL != cp) {
+ *cp++ = '\0';
+ }
- if (strchr(f, '=') == NULL)
+ if (strchr (in, '=') == NULL) {
break;
+ }
if (NULL != extra) {
if (!streq(extra, "")) {
strcat (extra, ",");
}
- strcat(extra, f);
+ strcat (extra, in);
}
+ in = cp;
}
if ((NULL != in) && (NULL != out)) {
strcpy (out, in);
}
- return in;
+ return cp;
}
/*

View File

@@ -1,33 +0,0 @@
From: Alejandro Colomar <alx@kernel.org>
Date: Mon, 17 Feb 2025 13:40:02 +0100
Subject: src/chfn.c: Use stpsep() instead of its pattern
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
src/chfn.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/chfn.c b/src/chfn.c
index f06cb44..1799d6b 100644
--- a/src/chfn.c
+++ b/src/chfn.c
@@ -36,6 +36,7 @@
#include "string/strcmp/streq.h"
#include "string/strcpy/strtcpy.h"
#include "string/strdup/xstrdup.h"
+#include "string/strtok/stpsep.h"
/*
@@ -219,10 +220,7 @@ static char *copy_field (char *in, char *out, char *extra)
char *cp = NULL;
while (NULL != in) {
- cp = strchr (in, ',');
- if (NULL != cp) {
- *cp++ = '\0';
- }
+ cp = stpsep(in, ",");
if (strchr (in, '=') == NULL) {
break;

View File

@@ -1,47 +0,0 @@
From: Alejandro Colomar <alx@kernel.org>
Date: Mon, 17 Feb 2025 15:33:46 +0100
Subject: src/chfn.c: copy_field(): Rename local variable
This makes it more obvious what that pointer is.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
src/chfn.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/chfn.c b/src/chfn.c
index 3fc94dc..d62bb8a 100644
--- a/src/chfn.c
+++ b/src/chfn.c
@@ -217,13 +217,13 @@ static void new_fields (void)
*/
static char *copy_field (char *in, char *out, char *extra)
{
- char *cp = NULL;
+ char *next = NULL;
while (NULL != in) {
const char *f;
f = in;
- cp = stpsep(in, ",");
+ next = stpsep(in, ",");
if (strchr(f, '=') == NULL)
break;
@@ -235,13 +235,13 @@ static char *copy_field (char *in, char *out, char *extra)
strcat(extra, f);
}
- in = cp;
+ in = next;
}
if ((NULL != in) && (NULL != out)) {
strcpy (out, in);
}
- return cp;
+ return next;
}
/*

19
debian/rules vendored
View File

@@ -4,7 +4,6 @@
# Enable PIE, BINDNOW, and possible future flags.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/debhelper/dh_package_notes/package-notes.mk
@@ -25,9 +24,9 @@ DEB_CONFIGURE_EXTRA_FLAGS := \
--without-tcb \
ifeq ($(DEB_HOST_ARCH_OS),linux)
ifneq ($(DEB_HOST_ARCH_OS),linux)
DEB_CONFIGURE_EXTRA_FLAGS += --enable-logind
DEB_CONFIGURE_EXTRA_FLAGS += --with-audit
DEB_CONFIGURE_EXTRA_FLAGS += --with-btrfs
endif
ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
@@ -45,12 +44,26 @@ CFLAGS += -DDEFAULT_EDITOR="\"sensible-editor\""
override_dh_auto_configure:
dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS)
override_dh_install-arch:
ifneq ($(DEB_HOST_ARCH_OS),linux)
sed -i 's/session optional pam_keyinit.so/# Linux only # session optional pam_keyinit.so/' debian/login.pam
endif
dh_install -a
ifeq ($(DEB_HOST_ARCH_OS),hurd)
# /bin/login is provided by the hurd package.
rm -f debian/login/usr/bin/login
endif
override_dh_installpam:
# Distribute the pam.d files; unless for the commands with disabled PAM
# support
dh_installpam -p login
dh_installpam -p passwd --name=passwd
dh_installpam -p passwd --name=chfn
dh_installpam -p passwd --name=chsh
dh_installpam -p passwd --name=chpasswd
dh_installpam -p passwd --name=newusers
override_dh_auto_clean:
sed -i 's/# Linux only # //' debian/login.pam
dh_auto_clean

40
debian/salsa-ci.yml vendored
View File

@@ -1,40 +0,0 @@
---
include: https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
extract-source:
extends: .provisioning-extract-source
variables:
RELEASE: 'unstable'
build:
extends: .build-package
test-build-any:
extends: .test-build-package-any
test-build-all:
extends: .test-build-package-all
lintian:
extends: .test-lintian
autopkgtest:
extends: .test-autopkgtest
blhc:
extends: .test-blhc
reprotest:
extends: .test-reprotest
variables:
SALSA_CI_ENABLE_BUILD_PACKAGE_PROFILES: 1
test-build-profiles:
extends: .test-build-package-profiles
parallel:
matrix:
- BUILD_PROFILES: nocheck
- BUILD_PROFILES: nodoc

22
debian/shadowconfig vendored
View File

@@ -1,5 +1,5 @@
#!/bin/sh
# turn shadow passwords on on a Debian system
# turn shadow passwords on or off on a Debian system
set -e
@@ -36,6 +36,16 @@ shadowon () {
chmod 640 "${DPKG_ROOT}/etc/shadow" "${DPKG_ROOT}/etc/gshadow"
}
shadowoff () {
set -e
pwck -q -r
grpck -r
pwunconv
grpunconv
# sometimes the passwd perms get munged
chown root:root /etc/passwd /etc/group
chmod 644 /etc/passwd /etc/group
}
case "$1" in
"on")
@@ -47,10 +57,14 @@ case "$1" in
fi
;;
"off")
echo E: Turning shadow passwords off is no longer supported.
exit 1
if shadowoff ; then
echo Shadow passwords are now off.
else
echo Please correct the error and rerun \`$0 off\'
exit 1
fi
;;
*)
echo Usage: $0 on
echo Usage: $0 on \| off
;;
esac

2
debian/shlibs.local vendored
View File

@@ -1 +1 @@
deb: libsubid 5 libsubid5 (= ${binary:Version})
deb: libsubid 4 libsubid4 (= ${binary:Version})

View File

@@ -1,6 +0,0 @@
# debputy does not need misc:Depends
debhelper-but-no-misc-depends libsubid-dev
debhelper-but-no-misc-depends libsubid5
debhelper-but-no-misc-depends login.defs
debhelper-but-no-misc-depends passwd
debhelper-but-no-misc-depends uidmap

15
debian/tests/smoke vendored
View File

@@ -2,23 +2,12 @@
set -e
echo "Adding a user works"
echo "Adding an user works"
useradd shadow-test-user
grep '^shadow-test-user:x:' /etc/passwd
grep '^shadow-test-user:!:' /etc/shadow
# Regression test for #1096187. adduser uses this sequence.
echo "Changing a users name and work phone number works"
chfn "-f" "foo" "-r" "" shadow-test-user
chfn -w "" shadow-test-user
# Regression test for #1095430
TZ=Asia/Tokyo usermod --expiredate 1970-01-02 shadow-test-user
TZ=Asia/Tokyo LC_ALL=C chage -l shadow-test-user | grep 'Account expires'
# We expect 1970-01-02, as passed.
TZ=Asia/Tokyo LC_ALL=C chage -l shadow-test-user | grep -P '^Account expires.*Jan 02, 1970'
echo "Removing a user works"
echo "Removing an user works"
userdel shadow-test-user
! grep 'shadow-test-user' /etc/passwd
! grep 'shadow-test-user' /etc/shadow

View File

@@ -471,12 +471,12 @@
The Shadow Suite contains replacement programs for:
su, login, passwd, newgrp, chfn, chsh
su, login, passwd, newgrp, chfn, chsh, and id
The package also contains the new programs:
chage, newusers, dpasswd, gpasswd, useradd, userdel, usermod,
groupadd, groupdel, groupmod, pwck, grpck, lastlog, pwconv,
groupadd, groupdel, groupmod, groups, pwck, grpck, lastlog, pwconv,
and pwunconv
Additionally, the library: libshadow.a is included for writing and/or
@@ -586,6 +586,8 @@
· /usr/bin/chsh
· /usr/bin/id
The BETA package has a save target in the Makefile, but it's commented
out because different distributions place the programs in different
places.
@@ -635,6 +637,8 @@
· /usr/man/man1/chsh.1.gz
· /usr/man/man1/id.1.gz
· /usr/man/man1/login.1.gz
· /usr/man/man1/passwd.1.gz
@@ -1373,7 +1377,7 @@
users or changing the group password, the /etc/gshadow file will be
changed.
The programs groupadd, groupmod, and groupdel are provided as
The programs groups, groupadd, groupmod, and groupdel are provided as
part of the Shadow Suite to modify groups.
The format of the /etc/group file is as follows:

View File

@@ -161,6 +161,7 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@

View File

@@ -250,6 +250,7 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@

View File

@@ -193,6 +193,7 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@

View File

@@ -158,6 +158,7 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@

View File

@@ -29,48 +29,16 @@ libshadow_la_SOURCES = \
age.c \
agetpass.c \
agetpass.h \
alloc/calloc.c \
alloc/calloc.h \
alloc/malloc.c \
alloc/malloc.h \
alloc/realloc.c \
alloc/realloc.h \
alloc/reallocf.c \
alloc/reallocf.h \
alloc/x/xcalloc.c \
alloc/x/xcalloc.h \
alloc/x/xmalloc.c \
alloc/x/xmalloc.h \
alloc/x/xrealloc.c \
alloc/x/xrealloc.h \
atoi/a2i/a2i.c \
atoi/a2i/a2i.h \
atoi/a2i/a2s.c \
atoi/a2i/a2s.h \
atoi/a2i/a2s_c.c \
atoi/a2i/a2s_c.h \
atoi/a2i/a2s_nc.c \
atoi/a2i/a2s_nc.h \
atoi/a2i/a2u.c \
atoi/a2i/a2u.h \
atoi/a2i/a2u_c.c \
atoi/a2i/a2u_c.h \
atoi/a2i/a2u_nc.c \
atoi/a2i/a2u_nc.h \
atoi/getnum.c \
atoi/getnum.h \
atoi/str2i/str2i.c \
atoi/str2i/str2i.h \
atoi/str2i/str2s.c \
atoi/str2i/str2s.h \
atoi/str2i/str2u.c \
atoi/str2i/str2u.h \
atoi/strtoi/strtoi.c \
atoi/strtoi/strtoi.h \
atoi/strtoi/strtou.c \
atoi/strtoi/strtou.h \
atoi/strtoi/strtou_noneg.c \
atoi/strtoi/strtou_noneg.h \
alloc.c \
alloc.h \
atoi/a2i.c \
atoi/a2i.h \
atoi/str2i.c \
atoi/str2i.h \
atoi/strtoi.c \
atoi/strtoi.h \
atoi/strtou_noneg.c \
atoi/strtou_noneg.h \
attr.h \
audit_help.c \
basename.c \
@@ -103,11 +71,9 @@ libshadow_la_SOURCES = \
find_new_sub_gids.c \
find_new_sub_uids.c \
fputsx.c \
fs/readlink/areadlink.c \
fs/readlink/areadlink.h \
fs/readlink/readlinknul.c \
fs/readlink/readlinknul.h \
get_gid.c \
get_pid.c \
get_uid.c \
getdate.h \
getdate.y \
getdef.c \
@@ -128,6 +94,8 @@ libshadow_la_SOURCES = \
lockpw.c \
loginprompt.c \
mail.c \
memzero.c \
memzero.h \
motd.c \
must_be.h \
myname.c \
@@ -151,6 +119,7 @@ libshadow_la_SOURCES = \
pwdcheck.c \
pwmem.c \
remove_tree.c \
rlogin.c \
root_flag.c \
run_part.h \
run_part.c \
@@ -176,42 +145,18 @@ libshadow_la_SOURCES = \
spawn.c \
sssd.c \
sssd.h \
string/memset/memzero.c \
string/memset/memzero.h \
string/sprintf/snprintf.c \
string/sprintf/snprintf.h \
string/sprintf/stpeprintf.c \
string/sprintf/stpeprintf.h \
string/sprintf/xasprintf.c \
string/sprintf/xasprintf.h \
string/strchr/strchrcnt.c \
string/strchr/strchrcnt.h \
string/strchr/stpspn.c \
string/strchr/stpspn.h \
string/strchr/strnul.c \
string/strchr/strnul.h \
string/strchr/strrspn.c \
string/strchr/strrspn.h \
string/strcmp/streq.c \
string/strcmp/streq.h \
string/strcpy/stpecpy.c \
string/strcpy/stpecpy.h \
string/strcpy/strncat.c \
string/strcpy/strncat.h \
string/strcpy/strncpy.c \
string/strcpy/strncpy.h \
string/strcpy/strtcpy.c \
string/strcpy/strtcpy.h \
string/strdup/strndupa.c \
string/strdup/strndupa.h \
string/strdup/xstrdup.c \
string/strdup/xstrdup.h \
string/strdup/xstrndup.c \
string/strdup/xstrndup.h \
string/sprintf.c \
string/sprintf.h \
string/stpecpy.c \
string/stpecpy.h \
string/stpeprintf.c \
string/stpeprintf.h \
string/strftime.c \
string/strftime.h \
string/strtok/stpsep.c \
string/strtok/stpsep.h \
string/strncpy.h \
string/strtcpy.c \
string/strtcpy.h \
string/zustr2stp.h \
strtoday.c \
sub.c \
subordinateio.h \
@@ -220,7 +165,6 @@ libshadow_la_SOURCES = \
time/day_to_str.c \
time/day_to_str.h \
ttytype.c \
typetraits.h \
tz.c \
ulimit.c \
user_busy.c \

File diff suppressed because it is too large Load Diff

View File

@@ -14,30 +14,28 @@
#include "prototypes.h"
#include "defines.h"
#include <errno.h>
#include <grp.h>
#include <stdio.h>
#include <string.h>
#include <grp.h>
#include <errno.h>
#include "alloc/malloc.h"
#include "alloc/reallocf.h"
#include "alloc.h"
#include "shadowlog.h"
#ident "$Id$"
#define SEP ",:"
/*
* Add groups with names from LIST (separated by commas or colons)
* to the supplementary group set. Silently ignore groups which are
* already there.
* already there. Warning: uses strtok().
*/
int
add_groups(const char *list)
int add_groups (const char *list)
{
GETGROUPS_T *grouplist;
size_t i;
int ngroups;
bool added;
char *g, *p;
char *token;
char buf[1024];
int ret;
FILE *shadow_logfd = log_get_logfd();
@@ -72,13 +70,13 @@ add_groups(const char *list)
}
added = false;
p = buf;
while (NULL != (g = strsep(&p, ",:"))) {
for (token = strtok (buf, SEP); NULL != token; token = strtok (NULL, SEP)) {
struct group *grp;
grp = getgrnam(g); /* local, no need for xgetgrnam */
grp = getgrnam (token); /* local, no need for xgetgrnam */
if (NULL == grp) {
fprintf(shadow_logfd, _("Warning: unknown group %s\n"), g);
fprintf (shadow_logfd, _("Warning: unknown group %s\n"),
token);
continue;
}

View File

@@ -16,7 +16,7 @@
#ident "$Id$"
#include "alloc/malloc.h"
#include "alloc.h"
#if WITH_LIBBSD == 0
#include "freezero.h"

73
lib/alloc.c Normal file
View File

@@ -0,0 +1,73 @@
/*
* 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
lib/alloc.h Normal file
View File

@@ -0,0 +1,101 @@
// 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

View File

@@ -1,11 +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-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <config.h>
#include "alloc/calloc.h"

View File

@@ -1,20 +0,0 @@
// 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

View File

@@ -1,16 +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-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);

View File

@@ -1,34 +0,0 @@
// 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

View File

@@ -1,11 +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-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <config.h>
#include "alloc/realloc.h"

View File

@@ -1,20 +0,0 @@
// 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

View File

@@ -1,16 +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-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);

View File

@@ -1,41 +0,0 @@
// 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

View File

@@ -1,36 +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-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);
}

View File

@@ -1,28 +0,0 @@
// 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

View File

@@ -1,16 +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-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);

View File

@@ -1,35 +0,0 @@
// 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

View File

@@ -1,35 +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-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);
}

View File

@@ -1,31 +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"
#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

46
lib/atoi/a2i.c Normal file
View File

@@ -0,0 +1,46 @@
// 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
lib/atoi/a2i.h Normal file
View File

@@ -0,0 +1,386 @@
// 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

View File

@@ -1,7 +0,0 @@
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <config.h>
#include "atoi/a2i/a2i.h"

View File

@@ -1,62 +0,0 @@
// 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

View File

@@ -1,7 +0,0 @@
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <config.h>
#include "atoi/a2i/a2s.h"

View File

@@ -1,56 +0,0 @@
// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_H_
#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_H_
#include <config.h>
#include "atoi/a2i/a2s_c.h"
#include "atoi/a2i/a2s_nc.h"
#define a2sh(n, s, ...) \
( \
_Generic(s, \
const char *: a2sh_c, \
const void *: a2sh_c, \
char *: a2sh_nc, \
void *: a2sh_nc \
)(n, s, __VA_ARGS__) \
)
#define a2si(n, s, ...) \
( \
_Generic(s, \
const char *: a2si_c, \
const void *: a2si_c, \
char *: a2si_nc, \
void *: a2si_nc \
)(n, s, __VA_ARGS__) \
)
#define a2sl(n, s, ...) \
( \
_Generic(s, \
const char *: a2sl_c, \
const void *: a2sl_c, \
char *: a2sl_nc, \
void *: a2sl_nc \
)(n, s, __VA_ARGS__) \
)
#define a2sll(n, s, ...) \
( \
_Generic(s, \
const char *: a2sll_c, \
const void *: a2sll_c, \
char *: a2sll_nc, \
void *: a2sll_nc \
)(n, s, __VA_ARGS__) \
)
#endif // include guard

View File

@@ -1,17 +0,0 @@
// 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);

View File

@@ -1,64 +0,0 @@
// 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

View File

@@ -1,17 +0,0 @@
// 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);

View File

@@ -1,91 +0,0 @@
// 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

Some files were not shown because too many files have changed in this diff Show More