From 01d39fc6201cab39a93a2e2cea39266b391b0fc1 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 31 Dec 2025 15:15:53 +0100 Subject: [PATCH 1/4] configure.ac, lib/Makefile.am: Respect $(bindir) in PASSWD_PROGRAM Suggested-by: Evgeny Grin (Karlson2k) Signed-off-by: Alejandro Colomar --- configure.ac | 3 --- lib/Makefile.am | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index c01264c004..e2bcf4b87e 100644 --- a/configure.ac +++ b/configure.ac @@ -97,9 +97,6 @@ done]) AC_DEFINE_UNQUOTED([FAILLOG_FILE], ["$shadow_cv_logdir/faillog"], [Path for faillog file.]) -AC_DEFINE_UNQUOTED([PASSWD_PROGRAM], ["$exec_prefix/bin/passwd"], - [Path to passwd program.]) - AC_ARG_ENABLE([shadowgrp], [AS_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])], [case "${enableval}" in diff --git a/lib/Makefile.am b/lib/Makefile.am index 7c488f8266..dcbd4beaac 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,8 @@ AUTOMAKE_OPTIONS = 1.0 foreign -DEFS = +DEFS = \ + -DPASSWD_PROGRAM='"$(bindir)/passwd"' noinst_LTLIBRARIES = libshadow.la From 33485016d6de8c68da822ec1bd787f833c1ded20 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 31 Dec 2025 19:09:04 +0100 Subject: [PATCH 2/4] lib/: Rename PASSWD_PROGRAM => PATH_PASSWD For consistency with definitions. Signed-off-by: Alejandro Colomar --- lib/Makefile.am | 2 +- lib/age.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index dcbd4beaac..b8802fd687 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = 1.0 foreign DEFS = \ - -DPASSWD_PROGRAM='"$(bindir)/passwd"' + -DPATH_PASSWD='"$(bindir)/passwd"' noinst_LTLIBRARIES = libshadow.la diff --git a/lib/age.c b/lib/age.c index bdb789e30d..a0a12e6261 100644 --- a/lib/age.c +++ b/lib/age.c @@ -23,11 +23,11 @@ #include "shadow/gshadow/endsgent.h" -#ident "$Id$" - -#ifndef PASSWD_PROGRAM -#define PASSWD_PROGRAM "/bin/passwd" +#ifndef PATH_PASSWD +#define PATH_PASSWD "/bin/passwd" #endif + + /* * expire - force password change if password expired * @@ -116,9 +116,9 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp) _exit (126); } - (void) execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) NULL); + (void) execl(PATH_PASSWD, PATH_PASSWD, pw->pw_name, (char *) NULL); err = errno; - perror ("Can't execute " PASSWD_PROGRAM); + perror("Can't execute " PATH_PASSWD); _exit ((ENOENT == err) ? E_CMD_NOTFOUND : E_CMD_NOEXEC); } else if ((pid_t) -1 == pid) { perror ("fork"); From 68432d56dd412adf25af5fea09c99f0365c633db Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 24 Feb 2025 23:34:09 +0100 Subject: [PATCH 3/4] configure.ac, src/Makefile.am: Follow GNU coding standards regarding directory variables According to Sam, if we just remove the definitions, autotools will provide the right values. Note that this changes the default from /usr to /usr/local, which is the right value according to the GNU conding standards (and also what the BSDs prefer, according to one conversation I had with Ingo Schwarze from OpenBSD). Closes: Link: Reported-by: Chris Hofstaedtler Cc: Sam James Signed-off-by: Alejandro Colomar --- configure.ac | 4 ---- src/Makefile.am | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index e2bcf4b87e..26d0a33f5d 100644 --- a/configure.ac +++ b/configure.ac @@ -19,10 +19,6 @@ AC_SUBST([LIBSUBID_ABI_MAJOR], [libsubid_abi_major]) AC_SUBST([LIBSUBID_ABI_MINOR], [libsubid_abi_minor]) AC_SUBST([LIBSUBID_ABI_MICRO], [libsubid_abi_micro]) -dnl Some hacks... -test "x$prefix" = "xNONE" && prefix="/usr" -test "X$prefix" = "X/usr" && exec_prefix="" - AC_USE_SYSTEM_EXTENSIONS AC_ENABLE_STATIC diff --git a/src/Makefile.am b/src/Makefile.am index c935e05b30..e73aba3c6a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,8 +2,8 @@ EXTRA_DIST = \ .indent.pro -ubindir = ${prefix}/bin -usbindir = ${prefix}/sbin +ubindir = ${exec_prefix}/bin +usbindir = ${exec_prefix}/sbin suidperms = 4755 sgidperms = 2755 @@ -24,7 +24,7 @@ AM_CFLAGS = $(LIBBSD_CFLAGS) # # also /lib/libshadow.so.x.xx (if any) could be moved to /usr/lib # and installation would be much simpler (just two directories, -# $prefix/bin and $prefix/sbin, no install-data hacks...) +# $exec_prefix/bin and $exec_prefix/sbin, no install-data hacks...) bin_PROGRAMS = login sbin_PROGRAMS = nologin From fe66955c0b8858a2c311c52af31b13a8db7a0eb8 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Fri, 28 Feb 2025 22:02:08 +0100 Subject: [PATCH 4/4] src/Makefile.am: Use $() for consistency Some code was using $() and other ${}. Use the same everywhere. Reported-by: Sam James Signed-off-by: Alejandro Colomar --- src/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index e73aba3c6a..9c0116a264 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,13 +2,13 @@ EXTRA_DIST = \ .indent.pro -ubindir = ${exec_prefix}/bin -usbindir = ${exec_prefix}/sbin +ubindir = $(exec_prefix)/bin +usbindir = $(exec_prefix)/sbin suidperms = 4755 sgidperms = 2755 AM_CPPFLAGS = \ - -I${top_srcdir}/lib \ + -I$(top_srcdir)/lib \ -I$(top_srcdir) \ -DLOCALEDIR=\"$(datadir)/locale\" \ $(ECONF_CPPFLAGS)