aboutsummaryrefslogtreecommitdiff
path: root/libpam
Commit message (Collapse)AuthorAgeFilesLines
* libpam: add supplementary groups on priv dropAllison Karlitskaya2020-11-101-4/+13
| | | | | | | | | | | | | | Replace the setgroups(0, NULL) call in pam_modutil_drop_priv() with a call to initgroups(). This makes sure that the user's supplementary groups are also configured. Fall back to setgroups(0, NULL) in case the initgroups() call fails. This fixes the permission check in pam_motd: this feature was intended to allow setting permissions on a motd file to prevent it from being shown to users who are not a member of a particular group (for example, wheel). Closes #292
* libpam: Fix memory leak on error path in _pam_start_internal()Andreas Schneider2020-11-041-0/+3
| | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
* libpam: Fix memory leak with pam_start_confdir()Andreas Schneider2020-11-041-0/+3
| | | | | | | | | | | | | | | | | | Found with AddressSanitzer in pam_wrapper tests. ==985738== 44 bytes in 4 blocks are definitely lost in loss record 18 of 18 ==985738== at 0x4839809: malloc (vg_replace_malloc.c:307) ==985738== by 0x48957E1: _pam_strdup (pam_misc.c:129) ==985738== by 0x489851B: _pam_start_internal (pam_start.c:85) ==985738== by 0x4849C8C: libpam_pam_start_confdir (pam_wrapper.c:418) ==985738== by 0x484AF94: pwrap_pam_start (pam_wrapper.c:1461) ==985738== by 0x484AFEE: pam_start (pam_wrapper.c:1483) ==985738== by 0x401723: setup_noconv (test_pam_wrapper.c:189) ==985738== by 0x4889E82: ??? (in /usr/lib64/libcmocka.so.0.7.0) ==985738== by 0x488A444: _cmocka_run_group_tests (in /usr/lib64/libcmocka.so.0.7.0) ==985738== by 0x403EE5: main (test_pam_wrapper.c:1059) Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
* pam_dispatch: fix unread store statementikerexxe2020-11-031-1/+0
| | | | | libpam/pam_dispatch: remove store statement since the value is never read.
* pam_modutil_sanitize_fds: Add explicit casts to avoid warningsTomas Mraz2020-10-201-3/+3
|
* Revert "libpam/pam_modutil_sanitize.c: optimize the way to close fds"Tomas Mraz2020-10-201-59/+14
| | | | This reverts commit 1b087edc7f05237bf5eccc405704cd82b848e761.
* pam_inline.h: cleanup pam_read_passwords a bitDmitry V. Levin2020-07-151-5/+6
| | | | | | | * libpam/include/pam_inline.h (pam_read_passwords): Increment pptr once instead of using pptr+1 several times. This change is not expected to affect the code generated by the compiler as the latter is likely to perform the optimization itself.
* Move read_passwords function from pam_unix to pam_inline.hikerexxe2020-07-151-0/+50
| | | | | | | | | | | | | | [ldv: rewrote commit message] * modules/pam_unix/passverify.h (read_passwords): Remove prototype. * modules/pam_unix/passverify.c (read_passwords): Move ... * libpam/include/pam_inline.h: ... here, rename to pam_read_passwords, add static inline qualifiers. Include <unistd.h> and <errno.h>. * modules/pam_unix/unix_chkpwd.c: Include "pam_inline.h". (main): Replace read_passwords with pam_read_passwords. * modules/pam_unix/unix_update.c: Include "pam_inline.h". (set_password): Replace read_passwords with pam_read_passwords.
* pam_modutil_check_user_in_passwd: avoid timing attacksDmitry V. Levin2020-06-161-1/+3
| | | | | | * libpam/pam_modutil_check_user.c (pam_modutil_check_user_in_passwd): Do not exit the file reading loop when the user is found, continue reading the file to avoid timing attacks.
* Move check_user_in_passwd from pam_localuser.c to pam_modutilFabrice Fontaine2020-06-154-0/+101
| | | | | | | | | | | | | | | | | | Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> * modules/pam_localuser/pam_localuser.c: Include <security/pam_modutil.h>. (pam_sm_authenticate): Replace check_user_in_passwd with pam_modutil_check_user_in_passwd. (check_user_in_passwd): Rename to pam_modutil_check_user_in_passwd, move to ... * libpam/pam_modutil_check_user.c: ... new file. * libpam/Makefile.am (libpam_la_SOURCES): Add pam_modutil_check_user.c. * libpam/include/security/pam_modutil.h (pam_modutil_check_user_in_passwd): New function declaration. * libpam/libpam.map (LIBPAM_MODUTIL_1.4.1): New interface. Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
* Introduce test_assert.hDmitry V. Levin2020-05-212-1/+56
| | | | | | | | Introduce a new internal header file for definitions of handy macros providing convenient assertion testing functionality. * libpam/include/test_assert.h: New file. * libpam/Makefile.am (noinst_HEADERS): Add include/test_assert.h.
* pam_get_user: do not override valid values returned by the conversation functionDmitry V. Levin2020-05-061-22/+26
| | | | | | | | | | When the conversation function returned a value different from PAM_CONV_AGAIN and provided no response, pam_get_user used to replace the return value with PAM_CONV_ERR. Fix this and replace the return value only if it was PAM_SUCCESS. * libpam/pam_item.c (pam_get_user): Do not override valid values returned by the conversation function.
* pam_get_user: filter conversation function return valuesDmitry V. Levin2020-05-061-0/+10
| | | | | | | | | | Do not assume that the conversation function provided by the application strictly follows the return values guidelines, replace undocumented return values with PAM_CONV_ERR. * libpam/pam_item.c (pam_get_user): If the value returned by the conversation function is not one of PAM_SUCCESS, PAM_BUF_ERR, PAM_CONV_AGAIN, or PAM_CONV_ERR, replace it with PAM_CONV_ERR.
* pam_get_user: consistently return PAM_SYSTEM_ERR if user specified a NULL ↵Dmitry V. Levin2020-05-061-2/+2
| | | | | | | | | | | | | | | | | | | pointer pam_get_user returns PAM_SYSTEM_ERR in case of pamh == NULL. In case of user == NULL, however, it used to return PAM_PERM_DENIED, and in case of NULL conversation function it used to return PAM_SERVICE_ERR. According to the documentation, PAM_SYSTEM_ERR shall be returned if a NULL pointer was submitted. Fix this inconsistency and return PAM_SYSTEM_ERR in each of these programming error cases. * libpam/pam_item.c (pam_get_user): Return PAM_SYSTEM_ERR instead of PAM_PERM_DENIED if user == NULL. Return PAM_SYSTEM_ERR instead of PAM_SERVICE_ERR if pamh->pam_conversation == NULL.
* build: rework vendordir substitutionDmitry V. Levin2020-04-281-3/+0
| | | | | | | | | | | | | | | | | | | | | | | 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.
* build: cleanup: do not add -DWITH_SELINUX to CFLAGSDmitry V. Levin2020-04-261-3/+0
| | | | | | | | | | 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.
* Fix various typos found using codespell toolDmitry V. Levin2020-03-284-7/+7
|
* _pam_load_module: reduce redundancyDmitry V. Levin2020-03-241-9/+16
| | | | | | | * libpam/pam_handlers.c (_pam_load_module): Reorganize $ISA handling to reduce redundancy. Resolves: https://github.com/linux-pam/linux-pam/pull/198
* Introduce pam_str_skip_icase_prefix_len and pam_str_skip_icase_prefixDmitry V. Levin2020-03-191-0/+15
| | | | | | | | | | | | | | | | Every time I see a code like if (strncasecmp(argv, "remember=", 9) == 0) options->remember = strtol(&argv[9], NULL, 10); my eyes are bleeding. Similar to pam_str_skip_prefix_len() and pam_str_skip_prefix(), introduce a new helper inline function pam_str_skip_icase_prefix_len() and a new macro pam_str_skip_icase_prefix() on top of it, to be used in subsequent commits to cleanup the ugliness. * libpam/include/pam_inline.h (pam_str_skip_icase_prefix_len): New function. (pam_str_skip_icase_prefix): New macro.
* Introduce pam_str_skip_prefix_len and pam_str_skip_prefixDmitry V. Levin2020-03-191-0/+15
| | | | | | | | | | | | | | | Every time I see a code like if (!strncmp(*argv,"user_readenv=",13)) *user_readenv = atoi(13+*argv); my eyes are bleeding. Introduce a new helper inline function pam_str_skip_prefix_len() and a new macro pam_str_skip_prefix() on top of it, to be used in subsequent commits to cleanup the ugliness. * libpam/include/pam_inline.h: Include <string.h>. (pam_str_skip_prefix_len): New function. (pam_str_skip_prefix): New macro.
* Use PAM_ARRAY_SIZEDmitry V. Levin2020-03-191-1/+2
| | | | | | | | | | | | | | | | | | | | | Replace all instances of sizeof(x) / sizeof(*x) with PAM_ARRAY_SIZE(x) which is less error-prone and implements an additional type check. * libpam/pam_handlers.c: Include "pam_inline.h". (_pam_open_config_file): Use PAM_ARRAY_SIZE. * modules/pam_exec/pam_exec.c: Include "pam_inline.h". (call_exec): Use PAM_ARRAY_SIZE. * modules/pam_namespace/pam_namespace.c: Include "pam_inline.h". (filter_mntopts): Use PAM_ARRAY_SIZE. * modules/pam_timestamp/hmacfile.c: Include "pam_inline.h". (testvectors): Use PAM_ARRAY_SIZE. * modules/pam_xauth/pam_xauth.c: Include "pam_inline.h". (run_coprocess, pam_sm_open_session): Use PAM_ARRAY_SIZE. * tests/tst-pam_get_item.c: Include "pam_inline.h". (main): Use PAM_ARRAY_SIZE. * tests/tst-pam_set_item.c: Likewise. * xtests/tst-pam_pwhistory1.c: Likewise. * xtests/tst-pam_time1.c: Likewise.
* Introduce pam_inline.hDmitry V. Levin2020-03-193-1/+52
| | | | | | | | | | Introduce a new internal header file for definitions of handly inline functions and macros providing some convenient functionality to libpam and its modules. * libpam/include/pam_cc_compat.h (PAM_SAME_TYPE): New macro. * libpam/include/pam_inline.h: New file. * libpam/Makefile.am (noinst_HEADERS): Add include/pam_inline.h.
* Fix remaining clang -Wcast-align compilation warningsDmitry V. Levin2020-03-191-0/+12
| | | | | | | | | | | | Introduce DIAG_PUSH_IGNORE_CAST_ALIGN and DIAG_POP_IGNORE_CAST_ALIGN macros, use them to silence remaining clang -Wcast-align compilation warnings. * libpam/include/pam_cc_compat.h (DIAG_PUSH_IGNORE_CAST_ALIGN, DIAG_POP_IGNORE_CAST_ALIGN): New macros. * modules/pam_access/pam_access.c: Include "pam_cc_compat.h". (from_match, network_netmask_match): Wrap inet_ntop invocations in DIAG_PUSH_IGNORE_CAST_ALIGN and DIAG_POP_IGNORE_CAST_ALIGN.
* Fix most of clang -Wcast-align compilation warningsDmitry V. Levin2020-03-191-0/+6
| | | | | | | | | | | | | | | | | | | Unlike gcc, clang is not smart enough to infer the alignment of structure fields, so add some alignment hints to the code. * libpam/include/pam_cc_compat.h (PAM_ATTRIBUTE_ALIGNED): New macro. * modules/pam_namespace/md5.h: Include "pam_cc_compat.h". (struct MD5Context): Add PAM_ATTRIBUTE_ALIGNED to "in" field. * modules/pam_namespace/md5.c [!(__i386__ || __x86_64__)] (uint8_aligned): New type. [!(__i386__ || __x86_64__)] (byteReverse): Use it instead of unsigned char. * modules/pam_timestamp/sha1.h: Include "pam_cc_compat.h". (struct sha1_context): Add PAM_ATTRIBUTE_ALIGNED to pending field. * modules/pam_unix/md5.h: Include "pam_cc_compat.h". (struct MD5Context): Add PAM_ATTRIBUTE_ALIGNED to "in" field. * modules/pam_unix/md5.c [!HIGHFIRST] (uint8_aligned): New type. [!HIGHFIRST] (byteReverse): Use it instead of unsigned char.
* pam_get_authtok: fix i18n of default promptsDmitry V. Levin2020-03-111-20/+34
| | | | | | | | | | | | | | | Change formatting of default prompts, making them translatable to those languages that use a different word order. From non-i18n perspective this change is essentially a no-op. * libpam/pam_get_authtok.c (PROMPTCURRENT): Replace with PROMPT_CURRENT_ARG and PROMPT_CURRENT_NOARG. (PROMPT1): Replace with PROMPT_NEW_ARG and PROMPT_NEW_NOARG. (PROMPT2): Replace with PROMPT_RETYPE_ARG and PROMPT_RETYPE_NOARG. (pam_get_authtok_internal, pam_get_authtok_verify): Use new macros. * po/Linux-PAM.pot: Regenerated. Resolves: https://github.com/linux-pam/linux-pam/issues/29
* New API call pam_start_confdir()Tomas Mraz2020-03-066-7/+62
| | | | To load PAM stack configurations from specified directory
* pam_modutil_sanitize_helper_fds: fix SIGPIPE effect of PAM_MODUTIL_PIPE_FDDmitry V. Levin2020-02-261-29/+1
| | | | | | | | | | | | | | | | When pam_modutil_sanitize_helper_fds() is invoked with PAM_MODUTIL_PIPE_FD to provide a dummy pipe descriptor for stdout or stderr, it closes the read end of the newly created dummy pipe. The negative side effect of this approach is that any write to such descriptor triggers a SIGPIPE. Avoid this by closing the write end of the dummy pipe and using its read end as a dummy pipe descriptor for output. Any read from such descriptor returns 0, and any write just fails with EBADF, which should work better with unprepared writers. * libpam/pam_modutil_sanitize.c (redirect_out_pipe): Remove. (redirect_out): Call redirect_in_pipe instead of redirect_out_pipe. Fixes: b0ec5d1e ("Introduce pam_modutil_sanitize_helper_fds")
* Fix remaining -Wcast-qual compilation warningsDmitry V. Levin2020-01-202-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new internal header file with definitions of DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL macros, use them to temporary silence -Wcast-qual compilation warnings in various modules. * libpam/include/pam_cc_compat.h: New file. * libpam/Makefile.am (noinst_HEADERS): Add include/pam_cc_compat.h. * modules/pam_mkhomedir/pam_mkhomedir.c: Include "pam_cc_compat.h". (create_homedir): Wrap execve invocation in DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL. * modules/pam_namespace/pam_namespace.c: Include "pam_cc_compat.h". (pam_sm_close_session): Wrap the cast that discards ‘const’ qualifier in DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL. * modules/pam_tty_audit/pam_tty_audit.c: Include "pam_cc_compat.h". (nl_send): Wrap the cast that discards ‘const’ qualifier in DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL. * modules/pam_unix/pam_unix_acct.c: Include "pam_cc_compat.h". (_unix_run_verify_binary): Wrap execve invocation in DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL. * modules/pam_unix/pam_unix_passwd.c: Include "pam_cc_compat.h". (_unix_run_update_binary): Wrap execve invocation in DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL. * modules/pam_unix/passverify.c: Include "pam_cc_compat.h". (unix_update_shadow): Wrap the cast that discards ‘const’ qualifier in DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL. * modules/pam_unix/support.c: Include "pam_cc_compat.h". (_unix_run_helper_binary): Wrap execve invocation in DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL. * modules/pam_xauth/pam_xauth.c: Include "pam_cc_compat.h". (run_coprocess): Wrap execv invocation in DIAG_PUSH_IGNORE_CAST_QUAL and DIAG_POP_IGNORE_CAST_QUAL.
* _pam_mkargv: add const qualifier to the first argumentDmitry V. Levin2020-01-202-2/+2
| | | | | | | | | | | | | | | Also fix the following compilation warning: tests/tst-pam_mkargv.c:21:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] char *argvstring = "user = XENDT\\userα user=XENDT\\user1"; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * libpam/pam_misc.c (_pam_mkargv): Add const qualifier to the first argument. * libpam/pam_private.h (_pam_mkargv): Likewise. * tests/tst-pam_mkargv.c (main): Convert argvstring from a pointer into a static const string, make argvresult array static const.
* Fix miscellaneous const issuesTomas Mraz2020-01-201-1/+1
| | | | | | | | | | * libpam/pam_modutil_searchkey.c: Avoid assigning empty string literal to non-const char *. * modules/pam_filter/pam_filter.c: Avoid using const char **. * modules/pam_mkhomedir/pam_mkhomedir.c: Properly cast out const for execve(). * modules/pam_namespace/pam_namespace.c: Properly cast out const from pam data. * modules/pam_tally2/pam_tally2.c: String literal must be assigned to const char *.
* Do not use CFLAGS for warning flags set from configureTomas Mraz2019-12-181-1/+2
| | | | | | | | To be able to set CFLAGS from make command-line but not to lose the warning flags. * configure.ac: Put warning flags to WARN_CFLAGS instead of CFLAGS. * */Makefile.am: Apply WARN_CFLAGS to AM_CFLAGS.
* Optimize the checkgrouplist functionTomas Mraz2019-11-041-11/+14
| | | | | | | | There is no point in rising the allocation size by doubling when we can allocate required memory size at once in the second pass. * libpam/pam_modutil_ingroup.c (checkgrouplist): Allocate some reasonable default size in first pass and required size in the second pass.
* Add support for a vendor directory and libeconf (#136)Thorsten Kukuk2019-09-164-27/+70
| | | | | | | | | | With this, it is possible for Linux distributors to store their supplied default configuration files somewhere below /usr, while /etc only contains the changes made by the user. The new option --enable-vendordir defines where Linux-PAM should additional look for pam.d/*, login.defs and securetty if this files are not in /etc. libeconf is a key/value configuration file reading library, which handles the split of configuration files in different locations and merges them transparently for the application.
* Update a function commentlifecrisis2019-09-061-3/+5
| | | | | | | The function comment for "_pam_await_timer()" does not mention the intended behavior of prioritizing the "PAM_FAIL_DELAY" item. I updated the comment to make this intention clear.
* libpam/pam_modutil_sanitize.c: optimize the way to close fdsChristophe Besson2019-08-261-14/+59
|
* pam_get_authtok_verify: Avoid duplicate password verificationTomas Mraz2019-08-073-0/+12
| | | | | | | | | | | | If password was already verified by previous modules in the stack it does not need to be verified by pam_get_authtok_verify either. * libpam/pam_get_authtok.c (pam_get_authtok_internal): Set the authtok_verified appropriately. (pam_get_authtok_verify): Do not prompt if authtok_verified is set and set it when the password is verified. * libpam/pam_private.h: Add authtok_verified to the pam handle struct. * libpam/pam_start.c (pam_start): Initialize authtok_verified.
* Move the duplicated search_key function to pam_modutil.Tomas Mraz2018-12-114-1/+103
| | | | | | | | | | | * libpam/pam_modutil_searchkey.c: New source file with pam_modutil_search_key(). * libpam/Makefile.am: Add the pam_modutil_searchkey.c. * libpam/include/security/pam_modutil.h: Add the pam_modutil_search_key() prototype. * libpam/libpam.map: Add the pam_modutil_search_key() into a new version. * modules/pam_faildelay/pam_faildelay.c: Drop search_key() and use pam_modutil_search_key(). * modules/pam_umask/pam_umask.c: Likewise. * modules/pam_unix/support.c: Likewise.
* Fix grammar of messages printed via pam_promptDmitry V. Levin2018-06-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Turn into proper sentences those messages that are printed without further modifications using pam_prompt in contexts where proper sentences are expected. * libpam/pam_get_authtok.c (pam_get_authtok_internal): Fix grammar of the message passed to pam_error. * modules/pam_limits/pam_limits.c (pam_sm_open_session): Likewise. * modules/pam_cracklib/pam_cracklib.c (_pam_unix_approve_pass): Fix grammar of error messages passed to pam_error. * modules/pam_mail/pam_mail.c (report_mail): Fix grammar of a message passed to pam_info. * modules/pam_timestamp/pam_timestamp.c (verbose_success): Likewise. * modules/pam_selinux/pam_selinux.c (config_context, send_text): Fix grammar of messages passed to pam_prompt. * modules/pam_tally/pam_tally.c (tally_check): Fix grammar of messages passed to pam_info. * modules/pam_tally2/pam_tally2.c (tally_check): Likewise. * modules/pam_unix/pam_unix_acct.c (pam_sm_acct_mgmt): Fix grammar of messages passed to _make_remark. * modules/pam_unix/pam_unix_passwd.c (_pam_unix_approve_pass, pam_sm_chauthtok): Likewise. * po/Linux-PAM.pot: Regenerate.
* Unification and cleanup of syslog log levels.Tomas Mraz2016-06-302-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libpam/pam_handlers.c: Make memory allocation failures LOG_CRIT. * libpam/pam_modutil_priv.c: Make memory allocation failures LOG_CRIT. * modules/pam_echo/pam_echo.c: Make memory allocation failures LOG_CRIT. * modules/pam_env/pam_env.c: Make memory allocation failures LOG_CRIT. * modules/pam_exec/pam_exec.c: Make memory allocation failures LOG_CRIT. * modules/pam_filter/pam_filter.c: Make all non-memory call errors LOG_ERR. * modules/pam_group/pam_group.c: Make memory allocation failures LOG_CRIT. * modules/pam_issue/pam_issue.c: Make memory allocation failures LOG_CRIT. * modules/pam_lastlog/pam_lastlog.c: The lastlog file creation is syslogged with LOG_NOTICE, memory allocation errors with LOG_CRIT, other errors with LOG_ERR. * modules/pam_limits/pam_limits.c: User login limit messages are syslogged with LOG_NOTICE, stale utmp entry with LOG_INFO, non-memory errors with LOG_ERR. * modules/pam_listfile/pam_listfile.c: Rejection of user is syslogged with LOG_NOTICE. * modules/pam_namespace/pam_namespace.c: Make memory allocation failures LOG_CRIT. * modules/pam_nologin/pam_nologin.c: Make memory allocation failures LOG_CRIT, other errors LOG_ERR. * modules/pam_securetty/pam_securetty.c: Rejection of access is syslogged with LOG_NOTICE, non-memory errors with LOG_ERR. * modules/pam_selinux/pam_selinux.c: Make memory allocation failures LOG_CRIT. * modules/pam_succeed_if/pam_succeed_if.c: Make all non-memory call errors LOG_ERR. * modules/pam_time/pam_time.c: Make memory allocation failures LOG_CRIT. * modules/pam_timestamp/pam_timestamp.c: Make memory allocation failures LOG_CRIT. * modules/pam_unix/pam_unix_acct.c: Make all non-memory call errors LOG_ERR. * modules/pam_unix/pam_unix_passwd.c: Make memory allocation failures LOG_CRIT, other errors LOG_ERR. * modules/pam_unix/pam_unix_sess.c: Make all non-memory call errors LOG_ERR. * modules/pam_unix/passverify.c: Unknown user is syslogged with LOG_NOTICE. * modules/pam_unix/support.c: Unknown user is syslogged with LOG_NOTICE and max retries ignorance by application likewise. * modules/pam_unix/unix_chkpwd.c: Make all non-memory call errors LOG_ERR. * modules/pam_userdb/pam_userdb.c: Password authentication error is syslogged with LOG_NOTICE. * modules/pam_xauth/pam_xauth.c: Make memory allocation failures LOG_CRIT.
* Release version 1.3.0Thorsten Kukuk2016-04-281-1/+1
| | | | | | * NEWS: add changes for 1.3.0. * configure.ac: bump version number. * libpam/Makefile.am: bump revision of libpam.so version.
* pam_get_authtok(): Add authtok_type support to current password prompt.Tomas Mraz2016-04-061-5/+13
| | | | | | * libpam/pam_get_authtok.c (pam_get_authtok_internal): When changing password, use different prompt for current password allowing for authtok_type to be displayed to the user.
* Fix whitespace issuesDmitry V. Levin2016-04-011-1/+0
| | | | | | | | | | | | | | | | Remove blank lines at EOF introduced by commit a684595c0bbd88df71285f43fb27630e3829121e, making the project free of warnings reported by git diff --check 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD * libpam/pam_dynamic.c: Remove blank line at EOF. * modules/pam_echo/pam_echo.c: Likewise. * modules/pam_keyinit/pam_keyinit.c: Likewise. * modules/pam_mkhomedir/pam_mkhomedir.c: Likewise. * modules/pam_pwhistory/pam_pwhistory.c: Likewise. * modules/pam_rhosts/pam_rhosts.c: Likewise. * modules/pam_sepermit/pam_sepermit.c: Likewise. * modules/pam_stress/pam_stress.c: Likewise.
* PAM_EXTERN isn't needed anymore, but don't remove it to not break lot ofThorsten Kukuk2016-03-291-0/+3
| | | | | | external code using it. * libpam/include/security/pam_modules.h: Readd PAM_EXTERN for compatibility
* Remove "--enable-static-modules" option and support fromThorsten Kukuk2016-03-297-414/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux-PAM. It was never official supported and was broken since years. * configure.ac: Remove --enable-static-modules option. * doc/man/pam_sm_acct_mgmt.3.xml: Remove PAM_EXTERN. * doc/man/pam_sm_authenticate.3.xml: Likewise. * doc/man/pam_sm_chauthtok.3.xml: Likewise. * doc/man/pam_sm_close_session.3.xml: Likewise. * doc/man/pam_sm_open_session.3.xml: Likewise. * doc/man/pam_sm_setcred.3.xml: Likewise. * libpam/Makefile.am: Remove STATIC_MODULES cases. * libpam/include/security/pam_modules.h: Remove PAM_STATIC parts. * libpam/pam_dynamic.c: Likewise. * libpam/pam_handlers.c: Likewise. * libpam/pam_private.h: Likewise. * libpam/pam_static.c: Remove file. * libpam/pam_static_modules.h: Remove header file. * modules/pam_access/pam_access.c: Remove PAM_EXTERN and PAM_STATIC parts. * modules/pam_cracklib/pam_cracklib.c: Likewise. * modules/pam_debug/pam_debug.c: Likewise. * modules/pam_deny/pam_deny.c: Likewise. * modules/pam_echo/pam_echo.c: Likewise. * modules/pam_env/pam_env.c: Likewise. * modules/pam_exec/pam_exec.c: Likewise. * modules/pam_faildelay/pam_faildelay.c: Likewise. * modules/pam_filter/pam_filter.c: Likewise. * modules/pam_ftp/pam_ftp.c: Likewise. * modules/pam_group/pam_group.c: Likewise. * modules/pam_issue/pam_issue.c: Likewise. * modules/pam_keyinit/pam_keyinit.c: Likewise. * modules/pam_lastlog/pam_lastlog.c: Likewise. * modules/pam_limits/pam_limits.c: Likewise. * modules/pam_listfile/pam_listfile.c: Likewise. * modules/pam_localuser/pam_localuser.c: Likewise. * modules/pam_loginuid/pam_loginuid.c: Likewise. * modules/pam_mail/pam_mail.c: Likewise. * modules/pam_mkhomedir/pam_mkhomedir.c: Likewise. * modules/pam_motd/pam_motd.c: Likewise. * modules/pam_namespace/pam_namespace.c: Likewise. * modules/pam_nologin/pam_nologin.c: Likewise. * modules/pam_permit/pam_permit.c: Likewise. * modules/pam_pwhistory/pam_pwhistory.c: Likewise. * modules/pam_rhosts/pam_rhosts.c: Likewise. * modules/pam_rootok/pam_rootok.c: Likewise. * modules/pam_securetty/pam_securetty.c: Likewise. * modules/pam_selinux/pam_selinux.c: Likewise. * modules/pam_sepermit/pam_sepermit.c: Likewise. * modules/pam_shells/pam_shells.c: Likewise. * modules/pam_stress/pam_stress.c: Likewise. * modules/pam_succeed_if/pam_succeed_if.c: Likewise. * modules/pam_tally/pam_tally.c: Likewise. * modules/pam_tally2/pam_tally2.c: Likewise. * modules/pam_time/pam_time.c: Likewise. * modules/pam_timestamp/pam_timestamp.c: Likewise. * modules/pam_tty_audit/pam_tty_audit.c: Likewise. * modules/pam_umask/pam_umask.c: Likewise. * modules/pam_userdb/pam_userdb.c: Likewise. * modules/pam_warn/pam_warn.c: Likewise. * modules/pam_wheel/pam_wheel.c: Likewise. * modules/pam_xauth/pam_xauth.c: Likewise. * modules/pam_unix/Makefile.am: Remove STATIC_MODULES part. * modules/pam_unix/pam_unix_acct.c: Remove PAM_STATIC part. * modules/pam_unix/pam_unix_auth.c: Likewise. * modules/pam_unix/pam_unix_passwd.c: Likewise. * modules/pam_unix/pam_unix_sess.c: Likewise. * modules/pam_unix/pam_unix_static.c: Removed. * modules/pam_unix/pam_unix_static.h: Removed. * po/POTFILES.in: Remove removed files. * tests/tst-dlopen.c: Remove PAM_STATIC part.
* Relax the conditions for fatal failure on auditing.Tomas Mraz2015-12-171-1/+1
| | | | | | | The PAM library calls will not fail anymore for any uid if the return value from the libaudit call is -EPERM. * libpam/pam_audit.c (_pam_audit_writelog): Remove check for uid != 0.
* Release version 1.2.0Thorsten Kukuk2015-04-271-1/+1
| | | | | | | | * NEWS: Update * configure.ac: Bump version * libpam/Makefile.am: Bump version of libpam * libpam_misc/Makefile.am: Bump version of libpam_misc * po/*: Regenerate po files
* Support alternative "vendor configuration" files as fallback to /etcThorsten Kukuk2015-03-252-46/+87
| | | | | | | | (Ticket#34, patch from ay Sievers <kay@vrfy.org>) * doc/man/pam.8.xml: document additonal config directory * libpam/pam_handlers.c: add /usr/lib/pam.d as config file fallback directory * libpam/pam_private.h: adjust defines
* Adjust documentation (Ticket#36)Thorsten Kukuk2015-03-241-1/+1
| | | | | * libpam/pam_delay.c: Change 25% in comment to 50% as used in code. * doc/man/pam_fail_delay.3.xml: Change 25% to 50%
* libpam: Only print "Password change aborted" when it's true.Luke Shumaker2015-01-021-2/+3
| | | | | | | | | | | | | | | | pam_get_authtok() may be used any time that a password needs to be entered, unlike pam_get_authtok_{no,}verify(), which may only be used when changing a password; yet when the user aborts, it prints "Password change aborted." whether or not that was the operation being performed. This bug was non-obvious because none of the modules distributed with Linux-PAM use it for anything but changing passwords; pam_unix has its own utility function that it uses instead. As an example, the nss-pam-ldapd package uses it in pam_sm_authenticate(). libpam/pam_get_authtok.c (pam_get_authtok_internal): check that the password is trying to be changed before printing a message about the password change being aborted.
* Add grantor field to audit records of libpam.Tomas Mraz2014-09-058-46/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | The grantor field gives audit trail of PAM modules which granted access for successful return from libpam calls. In case of failed return the grantor field is set to '?'. libpam/pam_account.c (pam_acct_mgmt): Remove _pam_auditlog() call. libpam/pam_auth.c (pam_authenticate, pam_setcred): Likewise. libpam/pam_password.c (pam_chauthtok): Likewise. libpam/pam_session.c (pam_open_session, pam_close_session): Likewise. libpam/pam_audit.c (_pam_audit_writelog): Add grantors parameter, add grantor= field to the message if grantors is set. (_pam_list_grantors): New function creating the string with grantors list. (_pam_auditlog): Add struct handler pointer parameter, call _pam_list_grantors() to list the grantors from the handler list. (_pam_audit_end): Add NULL handler parameter to _pam_auditlog() call. (pam_modutil_audit_write): Add NULL grantors parameter to _pam_audit_writelog(). libpam/pam_dispatch.c (_pam_dispatch_aux): Set h->grantor where appropriate. (_pam_clear_grantors): New function to clear grantor field of handler. (_pam_dispatch): Call _pam_clear_grantors() before executing the stack. Call _pam_auditlog() when appropriate. libpam/pam_handlers.c (extract_modulename): Do not allow empty module name or just "?" to avoid confusing audit trail. (_pam_add_handler): Test for NULL return from extract_modulename(). Clear grantor field of handler. libpam/pam_private.h: Add grantor field to struct handler, add handler pointer parameter to _pam_auditlog().