... and remove $(DATA) from EXTRA_DIST.
The change is performed automatically using the following script:
sed -i 's/^[a-z]*_DATA/dist_&/; /^EXTRA_DIST/ s/ \$(DATA)//' modules/*/Makefile.am
... and remove it from EXTRA_DIST
* modules/pam_timestamp/Makefile.am (EXTRA_DIST): Remove $(dist_TESTS).
(dist_TESTS): Rename to dist_check_SCRIPTS.
(TESTS): Replace $(dist_TESTS) with $(dist_check_SCRIPTS).
... and remove $(SCRIPTS) from EXTRA_DIST.
* modules/pam_namespace/Makefile.am (EXTRA_DIST): Remove $(SCRIPTS).
(secureconf_SCRIPTS): Rename to dist_secureconf_SCRIPTS.
Since Make.xml.rules is the only place where XSLTPROC_CUSTOM was used,
remove stereotypic definitions from other Makefiles, this way we no
longer have to worry about vendordir being used somewhere else in
documentation files.
Likewise, define VENDORDIR in config.h and remove stereotypic
-DVENDORDIR= additions from other Makefiles, this way we no longer
have to worry about VENDORDIR being used somewhere else in the code.
* configure.ac (AM_CONDITIONAL): Remove HAVE_VENDORDIR.
(AC_DEFINE_UNQUOTED): Add VENDORDIR.
(AC_SUBST): Remove VENDORDIR, add STRINGPARAM_VENDORDIR.
* Make.xml.rules.in: Replace $(XSLTPROC_CUSTOM) with
@STRINGPARAM_VENDORDIR@.
* doc/man/Makefile.am (XSLTPROC_CUSTOM): Remove.
* libpam/Makefile.am [HAVE_VENDORDIR]: Remove.
* modules/pam_securetty/Makefile.am [HAVE_VENDORDIR]: Remove.
(XSLTPROC_CUSTOM): Remove.
* modules/pam_securetty/pam_securetty.c: Move definitions of local
macros after config.h to benefit from macros defined there.
As namespace.init is listed in secureconf_SCRIPTS which is part of
generated SCRIPTS variable.
* modules/pam_namespace/Makefile.am (EXTRA_DIST): Replace namespace.init
with $(SCRIPTS).
* modules/pam_env/Makefile.am (EXTRA_DIST): Remove environment as it is
listed in sysconf_DATA which is part of DATA which is already listed in
EXTRA_DIST.
Since the GNU Automake distributes README files by default, the only
reason why README had to be listed in EXTRA_DIST was to make these
README files generated.
Since README is also listed in noinst_DATA, we can safely replace
README in EXTRA_DIST with $(DATA), this also opens the way for
further EXTRA_DIST cleanup.
* modules/*/Makefile.am (EXTRA_DIST): Replace README with $(DATA).
List in EXTRA_DIST those manual pages that are listed in man_MANS
as $(MANS).
* modules/pam_cracklib/Makefile.am (EXTRA_DIST): Replace pam_cracklib.8
with $(MANS).
* modules/pam_keyinit/Makefile.am (EXTRA_DIST): Replace pam_keyinit.8
with $(MANS).
* modules/pam_selinux/Makefile.am (EXTRA_DIST): Replace pam_selinux.8
with $(MANS).
* modules/pam_sepermit/Makefile.am (EXTRA_DIST): Replace pam_sepermit.8
and sepermit.conf.5 with $(MANS).
* modules/pam_tty_audit/Makefile.am (EXTRA_DIST): Replace
pam_tty_audit.8 with $(MANS).
* modules/pam_userdb/Makefile.am (EXTRA_DIST): Replace pam_userdb.8 with
$(MANS).
Manual pages already belong to man_MANS, listing them also
in noinst_DATA does not help in any way.
* modules/pam_cracklib/Makefile.am (noinst_DATA): Remove pam_cracklib.8.
* modules/pam_selinux/Makefile.am (noinst_DATA): Remove pam_selinux.8.
* modules/pam_sepermit/Makefile.am (noinst_DATA): Remove pam_sepermit.8
and sepermit.conf.5.
* modules/pam_userdb/Makefile.am (noinst_DATA): Remove pam_userdb.8.
Reported by gcc-10 -Warray-bounds:
In file included from /usr/include/string.h:494,
from modules/pam_issue/pam_issue.c:19:
In function 'strncat',
inlined from 'read_issue_quoted' at modules/pam_issue/pam_issue.c:197:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: '__builtin___strncat_chk' offset [260, 389] from the object at 'uts' is out of the bounds of referenced subobject 'version' with type 'char[65]' at offset 195 [-Werror=array-bounds]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from modules/pam_issue/pam_issue.c:26:
modules/pam_issue/pam_issue.c: In function 'read_issue_quoted':
/usr/include/x86_64-linux-gnu/sys/utsname.h:59:10: note: subobject 'version' declared here
59 | char version[_UTSNAME_VERSION_LENGTH];
| ^~~~~~~
In file included from /usr/include/string.h:494,
from modules/pam_issue/pam_issue.c:19:
In function 'strncat',
inlined from 'read_issue_quoted' at modules/pam_issue/pam_issue.c:188:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: '__builtin___strncat_chk' offset [65, 389] from the object at 'uts' is out of the bounds of referenced subobject 'sysname' with type 'char[65]' at offset 0 [-Werror=array-bounds]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from modules/pam_issue/pam_issue.c:26:
modules/pam_issue/pam_issue.c: In function 'read_issue_quoted':
/usr/include/x86_64-linux-gnu/sys/utsname.h:51:10: note: subobject 'sysname' declared here
51 | char sysname[_UTSNAME_SYSNAME_LENGTH];
| ^~~~~~~
In file included from /usr/include/string.h:494,
from modules/pam_issue/pam_issue.c:19:
In function 'strncat',
inlined from 'read_issue_quoted' at modules/pam_issue/pam_issue.c:194:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: '__builtin___strncat_chk' offset [195, 389] from the object at 'uts' is out of the bounds of referenced subobject 'release' with type 'char[65]' at offset 130 [-Werror=array-bounds]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from modules/pam_issue/pam_issue.c:26:
modules/pam_issue/pam_issue.c: In function 'read_issue_quoted':
/usr/include/x86_64-linux-gnu/sys/utsname.h:57:10: note: subobject 'release' declared here
57 | char release[_UTSNAME_RELEASE_LENGTH];
| ^~~~~~~
In file included from /usr/include/string.h:494,
from modules/pam_issue/pam_issue.c:19:
In function 'strncat',
inlined from 'read_issue_quoted' at modules/pam_issue/pam_issue.c:191:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: '__builtin___strncat_chk' offset [130, 389] from the object at 'uts' is out of the bounds of referenced subobject 'nodename' with type 'char[65]' at offset 65 [-Werror=array-bounds]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from modules/pam_issue/pam_issue.c:26:
modules/pam_issue/pam_issue.c: In function 'read_issue_quoted':
/usr/include/x86_64-linux-gnu/sys/utsname.h:54:10: note: subobject 'nodename' declared here
54 | char nodename[_UTSNAME_NODENAME_LENGTH];
| ^~~~~~~~
In file included from /usr/include/string.h:494,
from modules/pam_issue/pam_issue.c:19:
In function 'strncat',
inlined from 'read_issue_quoted' at modules/pam_issue/pam_issue.c:200:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: error: '__builtin___strncat_chk' offset [325, 389] from the object at 'uts' is out of the bounds of referenced subobject 'machine' with type 'char[65]' at offset 260 [-Werror=array-bounds]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from modules/pam_issue/pam_issue.c:26:
modules/pam_issue/pam_issue.c: In function 'read_issue_quoted':
/usr/include/x86_64-linux-gnu/sys/utsname.h:62:10: note: subobject 'machine' declared here
62 | char machine[_UTSNAME_MACHINE_LENGTH];
| ^~~~~~~
* modules/pam_issue/pam_issue.c (read_issue_quoted): Rewrite to avoid
strncat from potentially not null-terminated string buffer fields
of struct utsname.
* modules/pam_motd/pam_motd.c
(try_to_display_directories_with_overrides): Do not assign -1U to
dirscans_sizes[i] when scandir(motd_dir_path_split[i]) returns an error.
Resolves: https://bugzilla.altlinux.org/38389
Fixes: d57ab221 ("pam_motd: Cleanup the code and avoid unnecessary logging")
* modules/pam_motd/pam_motd.c
(try_to_display_directories_with_overrides): Do not access
elements of dirscans_sizes array if dirscans_sizes == NULL
due to an earlier memory allocation error.
Fixes: f9c9c721 ("pam_motd: Support multiple motd paths specified, with filename overrides (#69)")
* modules/pam_motd/pam_motd.c
(try_to_display_directories_with_overrides): Remove return statement
at the end of the function returning void.
Fixes: f9c9c721 ("pam_motd: Support multiple motd paths specified, with filename overrides (#69)")
pam_syslog already does all the prefixing we need.
* modules/pam_motd/pam_motd.c (pam_split_string,
try_to_display_directories_with_overrides): Remove "pam_motd: " prefix
from strings passed to pam_syslog.
Fixes: f9c9c721 ("pam_motd: Support multiple motd paths specified, with filename overrides (#69)")
pam_motd used to leak memory allocated for each motd file
successfully opened in try_to_display_directories_with_overrides.
* modules/pam_motd/pam_motd.c
(try_to_display_directories_with_overrides): Free abs_path.
Fixes: f9c9c721 ("pam_motd: Support multiple motd paths specified, with filename overrides (#69)")
Do not invoke calloc with the first argument equal to zero as the return
value can be NULL which is undistinguishable from memory allocation
error.
* modules/pam_motd/pam_motd.c
(try_to_display_directories_with_overrides): Skip if there are no
directory entries (dirscans_size_total == 0).
Fixes: f9c9c721 ("pam_motd: Support multiple motd paths specified, with filename overrides (#69)")
As dirnames_all is allocated with calloc, zeroing it out is pointless.
* modules/pam_motd/pam_motd.c
(try_to_display_directories_with_overrides): Remove redundant zeroing
of dirnames_all.
Fixes: f9c9c721 ("pam_motd: Support multiple motd paths specified, with filename overrides (#69)")
As WITH_SELINUX is already AC_DEFINE'd in configure.ac,
there is no point in adding -DWITH_SELINUX to CFLAGS.
* libpam/Makefile.am [HAVE_LIBSELINUX] (AM_CFLAGS): Do not add
-DWITH_SELINUX.
* modules/pam_rootok/Makefile.am: Likewise.
* modules/pam_unix/Makefile.am: Likewise.
Reported by gcc-10 -Wstringop-overflow:
In file included from /usr/include/string.h:494,
from modules/pam_filter/pam_filter.c:14:
In function 'strcpy',
inlined from 'process_args' at modules/pam_filter/pam_filter.c:137:2,
inlined from 'need_a_filter.isra' at modules/pam_filter/pam_filter.c:618:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:90:10: warning: '__builtin_memcpy' writing 6 bytes into a region of size 5 [-Wstringop-overflow=]
90 | return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/pam_filter/pam_filter.c: In function 'need_a_filter.isra':
modules/pam_filter/pam_filter.c:128:21: note: at offset 0 to an object with size 5 allocated by 'malloc' here
128 | levp[0] = (char *) malloc(size);
| ^~~~~~~~~~~~
* modules/pam_filter/pam_filter.c (process_args): Fix off-by-one heap
buffer overflow in case of a filter without arguments (argc == 0).
On ppc64le the compiler complains with the following diagnostics:
pam_setquota.c: In function 'debug':
pam_setquota.c:48:59: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' {aka 'const long unsigned int'} [-Wformat=]
48 | pam_syslog(pamh, LOG_DEBUG, "%s device=%s bsoftlimit=%llu bhardlimit=%llu "
| ~~~^
| |
| long long unsigned int
| %lu
......
51 | p->dqb_bsoftlimit, p->dqb_bhardlimit,
| ~~~~~~~~~~~~~~~~~
| |
| __u64 {aka const long unsigned int}
pam_setquota.c:48:75: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 7 has type '__u64' {aka 'const long unsigned int'} [-Wformat=]
48 | pam_syslog(pamh, LOG_DEBUG, "%s device=%s bsoftlimit=%llu bhardlimit=%llu "
| ~~~^
| |
| long long unsigned int
| %lu
......
51 | p->dqb_bsoftlimit, p->dqb_bhardlimit,
| ~~~~~~~~~~~~~~~~~
| |
| __u64 {aka const long unsigned int}
pam_setquota.c:48:31: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 8 has type '__u64' {aka 'const long unsigned int'} [-Wformat=]
48 | pam_syslog(pamh, LOG_DEBUG, "%s device=%s bsoftlimit=%llu bhardlimit=%llu "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
52 | p->dqb_isoftlimit, p->dqb_ihardlimit,
| ~~~~~~~~~~~~~~~~~
| |
| __u64 {aka const long unsigned int}
pam_setquota.c:49:46: note: format string is defined here
49 | "isoftlimit=%llu ihardlimit=%llu btime=%llu itime=%llu",
| ~~~^
| |
| long long unsigned int
| %lu
pam_setquota.c:48:31: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 9 has type '__u64' {aka 'const long unsigned int'} [-Wformat=]
48 | pam_syslog(pamh, LOG_DEBUG, "%s device=%s bsoftlimit=%llu bhardlimit=%llu "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
52 | p->dqb_isoftlimit, p->dqb_ihardlimit,
| ~~~~~~~~~~~~~~~~~
| |
| __u64 {aka const long unsigned int}
pam_setquota.c:49:62: note: format string is defined here
49 | "isoftlimit=%llu ihardlimit=%llu btime=%llu itime=%llu",
| ~~~^
| |
| long long unsigned int
| %lu
pam_setquota.c:48:31: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 10 has type '__u64' {aka 'const long unsigned int'} [-Wformat=]
48 | pam_syslog(pamh, LOG_DEBUG, "%s device=%s bsoftlimit=%llu bhardlimit=%llu "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
53 | p->dqb_btime, p->dqb_itime);
| ~~~~~~~~~~~~
| |
| __u64 {aka const long unsigned int}
pam_setquota.c:49:73: note: format string is defined here
49 | "isoftlimit=%llu ihardlimit=%llu btime=%llu itime=%llu",
| ~~~^
| |
| long long unsigned int
| %lu
pam_setquota.c:48:31: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 11 has type '__u64' {aka 'const long unsigned int'} [-Wformat=]
48 | pam_syslog(pamh, LOG_DEBUG, "%s device=%s bsoftlimit=%llu bhardlimit=%llu "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
53 | p->dqb_btime, p->dqb_itime);
| ~~~~~~~~~~~~
| |
| __u64 {aka const long unsigned int}
pam_setquota.c:49:84: note: format string is defined here
49 | "isoftlimit=%llu ihardlimit=%llu btime=%llu itime=%llu",
| ~~~^
| |
| long long unsigned int
| %lu
* modules/pam_setquota/pam_setquota.c (debug): Cast fields of type __u64
to unsigned long long.
This ensures "config.h" is included before any system header
which fixes the following bug reported by ALT diagnostics:
verify-elf: ERROR: ./lib/security/pam_timestamp.so: uses non-LFS functions: __fxstat open
* modules/pam_timestamp/hmacsha1.c: Include "config.h".
* modules/pam_access/pam_access.c (netgroup_match): Place the code
that calls getdomainname under HAVE_GETDOMAINNAME guard.
* modules/pam_issue/pam_issue.c (read_issue_quoted): Likewise.
Resolves: https://github.com/linux-pam/linux-pam/issues/43
According to crypt(5), md5 should not be used for new hashes. Let's
give a modern example with yescrypt.
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
The pam_unix.so will never return PAM_AUTHINFO_UNAVAIL on systems
that use the unix_chkpwd helper.
The reason is that in unix_chkpwd.c, towards the end of main(), if
helper_verify_password() does not return PAM_SUCCESS, main() ignores
the actual error that helper_verify_password() returned and instead
returns PAM_AUTH_ERR.
This commit corrects this behavior. Specifically, if
helper_verify_password() returns PAM_USER_UNKNOWN, which it does
when /etc/passwd entry indicates that shadow information is present
but the /etc/shadow entry is missing, the unix_chkpwd now exits
with PAM_AUTHINFO_UNAVAIL. For any other error from
helper_verify_password(), unix_chkpwd continues to exit with
PAM_AUTH_ERR.
* modules/pam_unix/unix_chkpwd.c (main): Return PAM_AUTHINFO_UNAVAIL
when helper_verify_password() returns PAM_USER_UNKNOWN.