summaryrefslogtreecommitdiff
path: root/modules
Commit message (Collapse)AuthorAge
...
* pam_motd: fix NULL dereference on error pathDmitry V. Levin2020-04-26
| | | | | | | | | * 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)")
* pam_motd: remove redundant return statementDmitry V. Levin2020-04-26
| | | | | | | | * 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_motd: remove redundant prefix from syslog messagesDmitry V. Levin2020-04-26
| | | | | | | | | | 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: fix memory leakDmitry V. Levin2020-04-26
| | | | | | | | | | 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)")
* pam_motd: fix misleading error diagnosticsDmitry V. Levin2020-04-26
| | | | | | | | | | | | 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)")
* pam_motd: do not zero the memory allocated by callocDmitry V. Levin2020-04-26
| | | | | | | | | | 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)")
* build: cleanup: do not add -DWITH_SELINUX to CFLAGSDmitry V. Levin2020-04-26
| | | | | | | | | | 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.
* pam_filter: fix potential off-by-one heap buffer overflowDmitry V. Levin2020-04-24
| | | | | | | | | | | | | | | | | | | | 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).
* pam_setquota: remove PAM_EXTERN and PAM_STATIC partsDmitry V. Levin2020-04-24
| | | | | | | In other modules they were removed by commit Linux-PAM-1.3.0~14. * modules/pam_setquota/pam_setquota.c: Remove PAM_EXTERN and PAM_STATIC parts.
* pam_setquota: fix more harmless compilation warningsDmitry V. Levin2020-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* pam_timestamp: include "config.h" in hmacsha1.c as the first headerDmitry V. Levin2020-04-24
| | | | | | | | | 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".
* pam_setquota: apply WARN_CFLAGSDmitry V. Levin2020-04-24
| | | | | | All other modules already build with WARN_CFLAGS. * modules/pam_setquota/Makefile.am (AM_CFLAGS): Add $(WARN_CFLAGS).
* pam_setquota: fix harmless compilation warningsDmitry V. Levin2020-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix -Wunused-variable compilation warnings: pam_setquota.c: In function 'pam_sm_open_session': pam_setquota.c:173:9: warning: unused variable 'ep' [-Wunused-variable] 173 | char *ep, *val, *mntdevice = NULL; | ^~ pam_setquota.c:172:17: warning: unused variable 'ul' [-Wunused-variable] 172 | unsigned long ul; | ^~ Fix -Wunused-parameter compilation warnings: pam_setquota.c: In function 'pam_sm_open_session': pam_setquota.c:169:60: warning: unused parameter 'flags' [-Wunused-parameter] 169 | PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, | ~~~~^~~~~ pam_setquota.c: In function 'pam_sm_close_session': pam_setquota.c:382:40: warning: unused parameter 'pamh' [-Wunused-parameter] 382 | int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, | ~~~~~~~~~~~~~~^~~~ pam_setquota.c:382:50: warning: unused parameter 'flags' [-Wunused-parameter] 382 | int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, | ~~~~^~~~~ pam_setquota.c:382:61: warning: unused parameter 'argc' [-Wunused-parameter] 382 | int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, | ~~~~^~~~ pam_setquota.c:383:39: warning: unused parameter 'argv' [-Wunused-parameter] 383 | const char **argv) { | ~~~~~~~~~~~~~^~~~ * modules/pam_setquota/pam_setquota.c (pam_sm_open_session): Mark 'flags' parameter as unused. Remove unused 'ep' and 'ul' variables. (pam_sm_close_session): Mark all parameters as unused.
* pam_setquota: new module to set or modify disk quotas on session startSven Hartge2020-04-17
| | | | | | | This makes disk quotas usable with central user databases, such as MySQL or LDAP. Resolves: https://github.com/linux-pam/linux-pam/issues/92
* pam_access, pam_issue: do not assume that getdomainname always existsDmitry V. Levin2020-04-15
| | | | | | | | * 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
* pam_unix: modernize example in manual pageTopi Miettinen2020-04-12
| | | | | | | 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>
* pam_access: add an example of using groups in access.conf to permit accessLucas Ramage2020-04-07
| | | | | Resolves: https://github.com/linux-pam/linux-pam/issues/65 Resolves: https://github.com/linux-pam/linux-pam/pull/199
* pam_timestamp: Fix // in TIMESTAMPDIRPetr Lautrbach2020-03-31
| | | | | | | | | _PATH_VARRUN already provides trailing slash for building paths Fixes: $ strings /usr/lib64/security/pam_timestamp.so | grep /run/ /var/run//pam_timestamp /var/run//pam_timestamp/_pam_timestamp_key
* pam_unix: Return PAM_AUTHINFO_UNAVAIL when appropriate.James Ralston2020-03-30
| | | | | | | | | | | | | | | | | | | | | 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.
* Fix various typos found using codespell toolDmitry V. Levin2020-03-28
|
* pam_time: add conffile option to specify an alternative configuration fileblueskycs2c2020-03-24
| | | | | Resolves: https://github.com/linux-pam/linux-pam/pull/163 Resolves: https://github.com/linux-pam/linux-pam/pull/191
* pam_exec: require user name to be ready for the commandAlexander Zubkov2020-03-23
| | | | | | | | | | pam_exec module can be called when a user name has not been prompted yet. And thus the command is called without a user name available. This fix asks PAM for the user name to ensure it is ready or to force the prompt. Resolves: https://github.com/linux-pam/linux-pam/issues/131 Resolves: https://github.com/linux-pam/linux-pam/pull/195
* pam_selinux: fall back to log to syslog if audit logging failsChristian Göttsche2020-03-23
| | | | Resolves: https://github.com/linux-pam/linux-pam/pull/194
* pam_selinux: sanitize asprintf argument on failureChristian Göttsche2020-03-23
|
* pam_selinux: print additional information on failuresChristian Göttsche2020-03-23
|
* pam_selinux: convert send_audit_message to void functionChristian Göttsche2020-03-23
| | | | | The result is nowhere checked and other logging functions like pam_syslog are also not checked.
* pam_selinux: fix indentationChristian Göttsche2020-03-23
|
* pam_selinux: substitute legacy security_context_t typeChristian Göttsche2020-03-23
| | | | | | | | `security_context_t` is a legacy typedef to `char *`, substitute all usage. See https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9 https://github.com/SELinuxProject/selinux/blob/f8c110c8a615eb640510eab39640a0957a6ba19c/libselinux/include/selinux/selinux.h#L16
* modules/pam_userdb: use pam_str_skip_icase_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_userdb/pam_userdb.c: Include "pam_inline.h". (_pam_parse, user_lookup): Use pam_str_skip_icase_prefix instead of ugly strncasecmp invocations.
* modules/pam_umask: use pam_str_skip_icase_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_umask/pam_umask.c: Include "pam_inline.h". (parse_option, setup_limits_from_gecos): Use pam_str_skip_icase_prefix instead of ugly strncasecmp invocations.
* modules/pam_pwhistory: use pam_str_skip_icase_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_pwhistory/pam_pwhistory.c: Include "pam_inline.h". (parse_option): Use pam_str_skip_icase_prefix instead of ugly strncasecmp invocations.
* modules/pam_exec: use pam_str_skip_icase_prefixDmitry V. Levin2020-03-19
| | | | | * modules/pam_exec/pam_exec.c (call_exec): Use pam_str_skip_icase_prefix instead of ugly strncasecmp invocations.
* modules/pam_xauth: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_xauth/pam_xauth.c: Include "pam_inline.h". (pam_sm_open_session, pam_sm_close_session): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_wheel: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_wheel/pam_wheel.c: Include "pam_inline.h". (_pam_parse): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_unix: use pam_str_skip_prefix and pam_str_skip_prefix_lenDmitry V. Levin2020-03-19
| | | | | | | | | | | | | * modules/pam_unix/passverify.c: Include "pam_inline.h". (verify_pwd_hash): Use pam_str_skip_prefix instead of ugly strncmp invocations. * modules/pam_unix/support.c: Include "pam_inline.h". (_set_ctrl): Use pam_str_skip_prefix_len instead of hardcoding string lengths. * modules/pam_unix/md5_crypt.c: Include "pam_inline.h". (crypt_md5): Use pam_str_skip_prefix_len. squash! modules/pam_unix: use pam_str_skip_prefix and pam_str_skip_prefix_len
* modules/pam_tty_audit: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_tty_audit/pam_tty_audit.c: Include "pam_inline.h". (pam_sm_open_session): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_timestamp: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_timestamp/pam_timestamp.c: Include "pam_inline.h". (check_tty, get_timestamp_name, pam_sm_authenticate): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_tally: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_tally/pam_tally.c: Include "pam_inline.h". (tally_parse_args, getopts): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_tally2: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_tally2/pam_tally2.c: Include "pam_inline.h". (tally_parse_args, getopts): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_selinux: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_selinux/pam_selinux.c: Include "pam_inline.h". (compute_exec_context, compute_tty_context): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_securetty: use pam_str_skip_prefix and pam_str_skip_prefix_lenDmitry V. Levin2020-03-19
| | | | | | * modules/pam_securetty/pam_securetty.c: Include "pam_inline.h". (securetty_perform_check): Use pam_str_skip_prefix and pam_str_skip_prefix_len instead of ugly strncmp invocations.
* modules/pam_rhosts: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_rhosts/pam_rhosts.c: Include "pam_inline.h". (pam_sm_authenticate): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_nologin: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_nologin/pam_nologin.c: Include "pam_inline.h". (parse_args): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_namespace: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | * modules/pam_namespace/pam_namespace.c (root_shared): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_motd: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_motd/pam_motd.c: Include "pam_inline.h". (pam_sm_open_session): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_mkhomedir: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_mkhomedir/pam_mkhomedir.c: Include "pam_inline.h". (_pam_parse): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_mail: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_mail/pam_mail.c: Include "pam_inline.h". (_pam_parse): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_localuser: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_localuser/pam_localuser.c: Include "pam_inline.h". (pam_sm_authenticate): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_listfile: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_listfile/pam_listfile.c: Include "pam_inline.h". (pam_sm_authenticate): Use pam_str_skip_prefix instead of ugly strncmp invocations.
* modules/pam_limits: use pam_str_skip_prefixDmitry V. Levin2020-03-19
| | | | | | * modules/pam_limits/pam_limits.c: Include "pam_inline.h". (_pam_parse, parse_kernel_limits): Use pam_str_skip_prefix instead of ugly strncmp invocations.