Compare commits

...

6 Commits

Author SHA1 Message Date
Alejandro Colomar
f0f7fc60f2 Release 4.14.4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-11 23:46:58 +01:00
Tobias Stoeckmann
bc0151d4d3 lib/chkname.c: Take NUL byte into account
The _SC_LOGIN_NAME_MAX value includes space for the NUL byte.  The
length of name must smaller than this value to be valid.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Cherry-picked-from: 403a2e3771 ("lib/chkname.c: Take NUL byte into account")
Link: <https://github.com/shadow-maint/shadow/pull/935>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-05 00:46:30 +01:00
Alejandro Colomar
4b775cbff9 lib/chkname.c: Use tmp variable to avoid a -Wsign-compare warning
I used size_t because:

sysconf(3) can return -1 if the value is not supported, but then it can
only mean that there's no limit.  Having no limit is the same as having
a limit of SIZE_MAX (to which -1 is converted).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cherry-picked-from: 6be85b0baf ("lib/chkname.c: Use tmp variable to avoid a -Wsign-compare warning")
[alx: This is to cherry-pick the next commit without conflict]
Link: <https://github.com/shadow-maint/shadow/pull/801>
Link: <https://github.com/shadow-maint/shadow/pull/935>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-05 00:40:18 +01:00
loqs
bc2cc1106d Makefile: Move chpasswd and newusers to pamd target
Install pam configs for chpasswd and newusers when using:

	$ ./configure --with-libpam --disable-account-tools-setuid

Closes: <https://github.com/shadow-maint/shadow/issues/810>
Link: <https://github.com/shadow-maint/shadow/pull/928>
Tested-by: David Runge <dvzrv@archlinux.org>
Cherry-picked-from: 341d80c2c7 ("Makefile: move chpasswd and newusers to pamd target")
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-30 22:14:53 +01:00
Pablo Saavedra
f630203ed8 lib/logind.c: active_sessions_count(): Fix build error 'parameter name omitted'
Add the omitted parameter name.

Closes: <https://github.com/shadow-maint/shadow/issues/918>
Link: <https://github.com/shadow-maint/shadow/pull/919>
Signed-off-by: Pablo Saavedra <psaavedra@igalia.com>
Cherry-picked-from: da84d0ede7 ("Fix Build error 'parameter name omitted' in logind")
Cc: Michael Vetter <jubalh@iodoru.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-30 17:34:04 +01:00
Sam James
7540b05197 Link correctly with libdl
This fixes build with glibc-2.33 (newer glibc merged libdl and libpthread
into libc):
```
libtool: link: x86_64-pc-linux-gnu-gcc -isystem /usr/include/bsd -DLIBBSD_OVERLAY -O2 -pipe -Wl,-O1 -o login login.o login_nopam.o  -Wl,--as-needed ../lib/.libs/libshadow.a -lcrypt -lsystemd -lpam -lpam_misc -lbsd
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: ../lib/.libs/libshadow.a(libshadow_la-nss.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
```

In Debian, the needed macro from libtool seems to be in libltdl-dev.

Signed-off-by: Sam James <sam@gentoo.org>
Cc: Iker Pedrosa <ikerpedrosam@gmail.com>
Cherry-picked-from: 0f4e59fd00 ("Link correctly with libdl")
Link: <https://github.com/shadow-maint/shadow/pull/917>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-26 13:32:08 +01:00
6 changed files with 11 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ 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.14.3], [pkg-shadow-devel@lists.alioth.debian.org], [],
AC_INIT([shadow], [4.14.4], [pkg-shadow-devel@lists.alioth.debian.org], [],
[https://github.com/shadow-maint/shadow])
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
AC_CONFIG_MACRO_DIRS([m4])
@@ -32,6 +32,7 @@ AC_PROG_CC
AC_PROG_LN_S
AC_PROG_YACC
LT_INIT
LT_LIB_DLLOAD
dnl Checks for libraries.

View File

@@ -2,20 +2,20 @@
# and also cooperate to make a distribution for `make dist'
pamd_files = \
chpasswd \
chfn \
chsh \
groupmems \
login \
newusers \
passwd
pamd_acct_tools_files = \
chage \
chgpasswd \
chpasswd \
groupadd \
groupdel \
groupmod \
newusers \
useradd \
userdel \
usermod

View File

@@ -20,6 +20,7 @@ endif
libshadow_la_CPPFLAGS += -I$(top_srcdir)
libshadow_la_CFLAGS = $(LIBBSD_CFLAGS) $(LIBCRYPT_PAM) $(LIBSYSTEMD)
libshadow_la_LIBADD = $(LIBADD_DLOPEN)
libshadow_la_SOURCES = \
addgrps.c \

View File

@@ -74,12 +74,14 @@ static bool is_valid_name (const char *name)
bool is_valid_user_name (const char *name)
{
size_t maxlen;
/*
* User names length are limited by the kernel
*/
if (strlen (name) > sysconf(_SC_LOGIN_NAME_MAX)) {
maxlen = sysconf(_SC_LOGIN_NAME_MAX);
if (strlen(name) >= maxlen)
return false;
}
return is_valid_name (name);
}

View File

@@ -35,7 +35,7 @@ done:
return ret;
}
unsigned long active_sessions_count(const char *name, unsigned long unused)
unsigned long active_sessions_count(const char *name, unsigned long unused(limit))
{
struct passwd *pw;
unsigned long count = 0;

View File

@@ -9,7 +9,7 @@ RUN export DEBIAN_PRIORITY=critical \
RUN apt-get update -y \
&& apt-get dist-upgrade -y
RUN apt-get build-dep shadow -y
RUN apt-get install libbsd-dev pkgconf -y
RUN apt-get install libltdl-dev libbsd-dev pkgconf -y
COPY ./ /usr/local/src/shadow/
WORKDIR /usr/local/src/shadow/