]> granicus.if.org Git - linux-pam/log
linux-pam
7 years agopam_tty_audit: Support matching users by uid range.
Tomas Mraz [Wed, 28 Jun 2017 13:52:16 +0000 (15:52 +0200)]
pam_tty_audit: Support matching users by uid range.

* modules/pam_tty_audit/pam_tty_audit.c (parse_uid_range): New function to
parse the uid range.
(pam_sm_open_session): Call parse_uid_range() and behave according to its result.
* modules/pam_tty_audit/pam_tty_audit.8.xml: Document the uid range matching.

7 years agopam_access: support parsing files in /etc/security/access.d/*.conf
Tomas Mraz [Wed, 31 May 2017 08:27:28 +0000 (10:27 +0200)]
pam_access: support parsing files in /etc/security/access.d/*.conf

* modules/pam_access/pam_access.c (login_access): Return NOMATCH if
there was no match in the parsed file.
(pam_sm_authenticate): Add glob() call to go through the ACCESS_CONF_GLOB
subdirectory and call login_access() on the individual files matched.
* modules/pam_access/pam_access.8.xml: Document the addition.
* modules/pam_access/Makefile.am: Add ACCESS_CONF_GLOB definition.

7 years agopam_localuser: Correct the example in documentation.
Tomas Mraz [Tue, 11 Apr 2017 10:13:59 +0000 (12:13 +0200)]
pam_localuser: Correct the example in documentation.

* modules/pam_localuser/pam_localuser.8.xml: The example configuration
  does something different.

7 years agopam_localuser: Correct documentation of return value.
Tomas Mraz [Tue, 11 Apr 2017 10:10:27 +0000 (12:10 +0200)]
pam_localuser: Correct documentation of return value.

* modules/pam_localuser/pam_localuser.8.xml: The module returns
  PAM_PERM_DENIED when the user is not listed.

7 years agoMake maxclassrepeat=1 behavior consistent with docs (#9)
Saul Johnson [Fri, 10 Mar 2017 13:03:03 +0000 (13:03 +0000)]
Make maxclassrepeat=1 behavior consistent with docs (#9)

* modules/pam_cracklib/pam_cracklib.c (simple): Apply the maxclassrepeat when greater than 0.

7 years agoProperly test for strtol() failure to find any digits.
Josef Moellers [Thu, 9 Feb 2017 11:27:59 +0000 (12:27 +0100)]
Properly test for strtol() failure to find any digits.

* modules/pam_access/pam_access.c (network_netmask_match): Test for endptr set
to beginning and not NULL.

7 years agopam_exec: fix a potential null pointer dereference
Daniel Abrecht [Thu, 19 Jan 2017 10:35:04 +0000 (11:35 +0100)]
pam_exec: fix a potential null pointer dereference

Fix a null pointer dereference when pam_prompt returns PAM_SUCCESS
but the response is set to NULL.

* modules/pam_exec/pam_exec.c (call_exec): Do not invoke strndupa
with a null pointer.

Closes: https://github.com/linux-pam/linux-pam/pull/2
7 years agoAdd missing comma in the limits.conf.5 manpage.
Antonio Ospite [Wed, 7 Dec 2016 07:52:54 +0000 (08:52 +0100)]
Add missing comma in the limits.conf.5 manpage.

* modules/pam_limits/limits.conf.5.xml: add a missing comma

7 years agoRegular links doesn't work with -no-numbering -no-references.
Tomas Mraz [Mon, 14 Nov 2016 10:43:12 +0000 (11:43 +0100)]
Regular links doesn't work with -no-numbering -no-references.

* configure.ac: Use elinks instead of links.

8 years agopam_access: First check for the (group) match.
Tomas Mraz [Tue, 1 Nov 2016 14:17:54 +0000 (15:17 +0100)]
pam_access: First check for the (group) match.

The (group) match is performed first to allow for groups
containing '@'.

* modules/pam_access/pam_access.c (user_match): First check for the (group) match.

8 years agopam_ftp: Properly use the first name from the supplied list
Tomas Mraz [Mon, 17 Oct 2016 12:18:24 +0000 (14:18 +0200)]
pam_ftp: Properly use the first name from the supplied list

* modules/pam_ftp/pam_ftp.c (lookup): Return first user from the list
of anonymous users if user name matches.
(pam_sm_authenticate): Free the returned value allocated in lookup().

8 years agopam_issue: Fix no prompting in parse escape codes mode.
Bartos-Elekes Zsolt [Mon, 12 Sep 2016 09:33:57 +0000 (11:33 +0200)]
pam_issue: Fix no prompting in parse escape codes mode.

* modules/pam_issue/pam_issue.c (read_issue_quoted): Fix misplaced strcat().

8 years agoxtests: remove bash dependency
Maxin B. John [Tue, 24 May 2016 14:43:33 +0000 (17:43 +0300)]
xtests: remove bash dependency

There are no bash specific syntax in the xtest scripts. So, remove
the bash dependency.

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Maxin B. John <maxin.john@intel.com>
8 years agoUnification and cleanup of syslog log levels.
Tomas Mraz [Thu, 30 Jun 2016 12:29:40 +0000 (14:29 +0200)]
Unification and cleanup of syslog log levels.

* 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.

8 years agopam_timestamp: fix typo in strncmp usage
Dmitry V. Levin [Tue, 14 Jun 2016 23:03:13 +0000 (23:03 +0000)]
pam_timestamp: fix typo in strncmp usage

Before this fix, a typo in check_login_time resulted to ruser and
struct utmp.ut_user being compared by the first character only,
which in turn could lead to a too low timestamp value being assigned
to oldest_login, effectively causing bypass of check_login_time.

* modules/pam_timestamp/pam_timestamp.c (check_login_time): Fix typo
in strncmp usage.

Patch-by: Anton V. Boyarshinov <boyarsh@altlinux.org>
8 years agoCorrect the examples in pam_fail_delay(3) man page.
Tomas Mraz [Mon, 30 May 2016 10:06:46 +0000 (12:06 +0200)]
Correct the examples in pam_fail_delay(3) man page.

doc/man/pam_fail_delay.3.xml: Correct the examples.

8 years agoRemove spaces in examples for access.conf.
Tomas Mraz [Wed, 11 May 2016 13:22:33 +0000 (15:22 +0200)]
Remove spaces in examples for access.conf.

The spaces are ignored only with the default listsep. To remove confusion
if non-default listsep is used they are removed from the examples.

* modules/pam_access/access.conf: Remove all spaces around ':' in examples.
* modules/pam_access/access.conf.5.xml: Likewise.

8 years agobuild: avoid non-portable == with "test" (ticket #60)
Mike Frysinger [Thu, 5 May 2016 10:05:26 +0000 (10:05 +0000)]
build: avoid non-portable == with "test" (ticket #60)

POSIX says test only accepts =. Some shells (including bash) accept ==,
but we should still stick to = for portability.

* configure.ac: Replace == with = in "test" invocations.

8 years agoRelease version 1.3.0 Linux-PAM-1.3.0
Thorsten Kukuk [Thu, 28 Apr 2016 11:54:30 +0000 (13:54 +0200)]
Release version 1.3.0

* NEWS: add changes for 1.3.0.
* configure.ac: bump version number.
* libpam/Makefile.am: bump revision of libpam.so version.

8 years agoUpdated translations from Zanata.
Tomas Mraz [Thu, 28 Apr 2016 09:59:08 +0000 (11:59 +0200)]
Updated translations from Zanata.

* po/*.po: Updated translations from Zanata.

8 years agopam_wheel: Correct the documentation of the root_only option.
Tomas Mraz [Tue, 19 Apr 2016 09:02:58 +0000 (11:02 +0200)]
pam_wheel: Correct the documentation of the root_only option.

* modules/pam_wheel/pam_wheel.8.xml: Correct the documentation of the
root_only option.

8 years agopam_unix: Document that MD5 password hash is used to store old passwords.
Tomas Mraz [Tue, 19 Apr 2016 08:48:31 +0000 (10:48 +0200)]
pam_unix: Document that MD5 password hash is used to store old passwords.

modules/pam_unix/pam_unix.8.xml: Document that the MD5 password hash is used
to store the old passwords when remember option is set.

8 years agoProject registered at Zanata (fedora.zanata.org) for translations.
Tomas Mraz [Thu, 14 Apr 2016 15:48:03 +0000 (17:48 +0200)]
Project registered at Zanata (fedora.zanata.org) for translations.

* zanata.xml: Configuration file for zanata client.
* po/LINGUAS: Update languages as supported by Zanata.
* po/Linux-PAM.pot: Updated from sources.
* po/*.po: Updated from sources.

8 years agopam_unix: Use pam_get_authtok() instead of direct pam_prompt() calls.
Tomas Mraz [Wed, 6 Apr 2016 12:27:07 +0000 (14:27 +0200)]
pam_unix: Use pam_get_authtok() instead of direct pam_prompt() calls.

We have to drop support for not_set_pass option which is not much useful
anyway. Instead we get proper support for authtok_type option.

* modules/pam_unix/pam_unix.8.xml: Removed not_set_pass option, added authtok_ty
pe
option.
* modules/pam_unix/pam_unix_auth.c (pam_sm_authenticate): Replace _unix_read_pas
sword()
call with equivalent pam_get_authtok() call.
* modules/pam_unix/pam_unix_passwd.c (pam_sm_chauthtok): Likewise and also drop
support for not_set_pass.
* modules/pam_unix/support.c (_unix_read_password): Remove.
* modules/pam_unix/support.h: Remove UNIX_NOT_SET_PASS add UNIX_AUTHTOK_TYPE.

8 years agopam_get_authtok(): Add authtok_type support to current password prompt.
Tomas Mraz [Wed, 6 Apr 2016 11:52:21 +0000 (13:52 +0200)]
pam_get_authtok(): Add authtok_type support to current password prompt.

* 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.

8 years agopam_unix: Make password expiration messages more user-friendly.
Tomas Mraz [Mon, 4 Apr 2016 12:23:22 +0000 (14:23 +0200)]
pam_unix: Make password expiration messages more user-friendly.

* modules/pam_unix/pam_unix_acct.c (pam_sm_acct_mgmt): Make password
expiration messages more user-friendly.

8 years agoinnetgr may not be there so make sure that when innetgr is not present
Thorsten Kukuk [Mon, 4 Apr 2016 09:39:45 +0000 (11:39 +0200)]
innetgr may not be there so make sure that when innetgr is not present
then we inform about it and not use it. [ticket#46]

* modules/pam_group/pam_group.c: ditto
* modules/pam_succeed_if/pam_succeed_if.c: ditto
* modules/pam_time/pam_time.c: ditto

Signed-off-by: Khem Raj <raj.khem at gmail.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
8 years agobuild: fix build when crypt() is not part of crypt_libs [ticket#46]
Thorsten Kukuk [Mon, 4 Apr 2016 09:35:57 +0000 (11:35 +0200)]
build: fix build when crypt() is not part of crypt_libs [ticket#46]

* configure.ac: Don't set empty -l option in crypt check

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
8 years agobuild: use $host_cpu for lib64 directory handling [ticket#46]
Thorsten Kukuk [Mon, 4 Apr 2016 09:33:11 +0000 (11:33 +0200)]
build: use $host_cpu for lib64 directory handling [ticket#46]

* configure.ac: use $host_cpu for lib64 directory handling.

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
8 years agoFix whitespace issues
Dmitry V. Levin [Fri, 1 Apr 2016 17:07:44 +0000 (17:07 +0000)]
Fix whitespace issues

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.

8 years agoUse TI-RPC functions if we compile and link against libtirpc.
Thorsten Kukuk [Fri, 1 Apr 2016 13:28:09 +0000 (15:28 +0200)]
Use TI-RPC functions if we compile and link against libtirpc.
The old SunRPC functions don't work with IPv6.

* configure.ac: Set and restore CPPFLAGS
* modules/pam_unix/pam_unix_passwd.c: Replace getrpcport with
  rpcb_getaddr if available.

8 years agoPAM_EXTERN isn't needed anymore, but don't remove it to not break lot of
Thorsten Kukuk [Tue, 29 Mar 2016 12:17:34 +0000 (14:17 +0200)]
PAM_EXTERN isn't needed anymore, but don't remove it to not break lot of
external code using it.

* libpam/include/security/pam_modules.h: Readd PAM_EXTERN for compatibility

8 years agoRemove "--enable-static-modules" option and support from
Thorsten Kukuk [Tue, 29 Mar 2016 12:14:03 +0000 (14:14 +0200)]
Remove "--enable-static-modules" option and support from
 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.

8 years agoFix check for libtirpc and enhance check for libnsl to include
Thorsten Kukuk [Thu, 24 Mar 2016 11:46:29 +0000 (12:46 +0100)]
Fix check for libtirpc and enhance check for libnsl to include
new libnsl.

* configure.ac: fix setting of CFLAGS/LIBS, enhance libnsl check
* modules/pam_unix/Makefile.am: replace NIS_* with TIRPC_* and NSL_*

8 years agoRemove YP dependencies from pam_access, they were never used
Thorsten Kukuk [Wed, 23 Mar 2016 10:16:55 +0000 (11:16 +0100)]
Remove YP dependencies from pam_access, they were never used
and such not needed.

* modules/pam_access/Makefile.am: Remove NIS_CFLAGS and NIS_LIBS
* modules/pam_access/pam_access.c: Remove yp_get_default_domain case,
  it will never be used.

8 years agoAdd checks for localtime() returning NULL.
Tomas Mraz [Fri, 4 Mar 2016 13:19:01 +0000 (14:19 +0100)]
Add checks for localtime() returning NULL.

* modules/pam_lastlog/pam_lastlog.c (last_login_read): Check for localtime_r
returning NULL.
* modules/pam_tally2/pam_tally2.c (print_one): Check for localtime returning
NULL.

8 years agopam_unix: Silence warnings and fix a minor bug.
Tomas Mraz [Fri, 4 Mar 2016 13:15:31 +0000 (14:15 +0100)]
pam_unix: Silence warnings and fix a minor bug.

Fixes a minor bug in behavior when is_selinux_enabled()
returned negative value.

* modules/pam_unix/passverify.c: Add parentheses to SELINUX_ENABLED macro.
(unix_update_shadow): Safe cast forwho to non-const char *.
* modules/pam_unix/support.c: Remove unused SELINUX_ENABLED macro.

8 years agopam_env: Document the /etc/environment file.
Tomas Mraz [Wed, 17 Feb 2016 13:57:15 +0000 (14:57 +0100)]
pam_env: Document the /etc/environment file.

* modules/pam_env/Makefile.am: Add the environment.5 soelim stub.
* modules/pam_env/pam_env.8.xml: Add environ(7) reference.
* modules/pam_env/pam_env.conf.5.xml: Add environment alias name.
Add a paragraph about /etc/environment. Add environ(7) reference.

8 years agopam_unix: Add no_pass_expiry option to ignore password expiration.
Tomas Mraz [Wed, 17 Feb 2016 13:21:41 +0000 (14:21 +0100)]
pam_unix: Add no_pass_expiry option to ignore password expiration.

* modules/pam_unix/pam_unix.8.xml: Document the no_pass_expiry option.
* modules/pam_unix/pam_unix_acct.c (pam_sm_acct_mgmt): If no_pass_expiry
is on and return value data is not set to PAM_SUCCESS then ignore
PAM_NEW_AUTHTOK_REQD and PAM_AUTHTOK_EXPIRED returns.
* modules/pam_unix/pam_unix_auth.c (pam_sm_authenticate): Always set the
return value data.
(pam_sm_setcred): Test for likeauth option and use the return value data
only if set.
* modules/pam_unix/support.h: Add the no_pass_expiry option.

8 years agopam_unix: Change the salt length for new hashes to 16 characters
Tomas Mraz [Mon, 25 Jan 2016 15:50:00 +0000 (16:50 +0100)]
pam_unix: Change the salt length for new hashes to 16 characters

* modules/pam_unix/passverify.c (create_password_hash): Change the
salt length for new hashes to 16 characters.

8 years agoRelax the conditions for fatal failure on auditing.
Tomas Mraz [Thu, 17 Dec 2015 16:43:27 +0000 (17:43 +0100)]
Relax the conditions for fatal failure on auditing.

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.

8 years agopam_tally2: Optionally log the tally count when checking.
Tomas Mraz [Wed, 16 Dec 2015 08:33:47 +0000 (09:33 +0100)]
pam_tally2: Optionally log the tally count when checking.

* modules/pam_tally2/pam_tally2.c (tally_parse_args): Add debug option.
(tally_check): Always log the tally count with debug option.

9 years agoDocfix: pam handle is const in pam_syslog() and pam_vsyslog()
Jakub Hrozek [Fri, 2 Oct 2015 08:12:22 +0000 (10:12 +0200)]
Docfix: pam handle is const in pam_syslog() and pam_vsyslog()

* doc/man/pam_syslog.3.xml: Add const to pam handle in pam_syslog() and pam_vsyslog().

9 years agopam_loginuid: Add syslog message if required auditd is not detected.
Tomas Mraz [Thu, 24 Sep 2015 11:21:40 +0000 (13:21 +0200)]
pam_loginuid: Add syslog message if required auditd is not detected.

* modules/pam_loginuid/pam_loginuid.c (_pam_loginuid): Add syslog message
if required auditd is not detected.

9 years agoAllow links to be used instead of w3m for documentation regeneration.
Tomas Mraz [Fri, 4 Sep 2015 08:35:45 +0000 (10:35 +0200)]
Allow links to be used instead of w3m for documentation regeneration.

* configure.ac: If w3m is not found check for links.

9 years agoAdd missing space in pam_misc_setenv man page.
Tomas Mraz [Fri, 4 Sep 2015 07:58:59 +0000 (09:58 +0200)]
Add missing space in pam_misc_setenv man page.

* doc/man/pam_misc_setenv.3.xml: Add a missing space.

9 years agopam_rootok: use rootok permission instead of passwd permission in SELinux check.
Tomas Mraz [Wed, 12 Aug 2015 15:04:00 +0000 (17:04 +0200)]
pam_rootok: use rootok permission instead of passwd permission in SELinux check.

* modules/pam_rootok/pam_rootok.c (selinux_check_root): Use rootok instead of
passwd permission.

9 years agopam_timestamp: Avoid leaking file descriptor.
Amarnath Valluri [Wed, 5 Aug 2015 13:16:51 +0000 (15:16 +0200)]
pam_timestamp: Avoid leaking file descriptor.

* modules/pam_timestamp/hmacsha1.c(hmac_key_create):
    close 'keyfd' when failed to own it.

Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
9 years agoRelease version 1.2.1 Linux-PAM-1_2_1
Thorsten Kukuk [Mon, 22 Jun 2015 12:53:01 +0000 (14:53 +0200)]
Release version 1.2.1

Security fix: CVE-2015-3238

If the process executing pam_sm_authenticate or pam_sm_chauthtok method
of pam_unix is not privileged enough to check the password, e.g.
if selinux is enabled, the _unix_run_helper_binary function is called.
When a long enough password is supplied (16 pages or more, i.e. 65536+
bytes on a system with 4K pages), this helper function hangs
indefinitely, blocked in the write(2) call while writing to a blocking
pipe that has a limited capacity.
With this fix, the verifiable password length will be limited to
PAM_MAX_RESP_SIZE bytes (i.e. 512 bytes) for pam_exec and pam_unix.

* NEWS: Update
* configure.ac: Bump version
* modules/pam_exec/pam_exec.8.xml: document limitation of password length
* modules/pam_exec/pam_exec.c: limit password length to PAM_MAX_RESP_SIZE
* modules/pam_unix/pam_unix.8.xml: document limitation of password length
* modules/pam_unix/pam_unix_passwd.c: limit password length
* modules/pam_unix/passverify.c: Likewise
* modules/pam_unix/passverify.h: Likewise
* modules/pam_unix/support.c: Likewise

9 years agoUpdate NEWS file Linux-PAM-1_2_0
Thorsten Kukuk [Mon, 27 Apr 2015 14:57:39 +0000 (16:57 +0200)]
Update NEWS file

9 years agoRelease version 1.2.0
Thorsten Kukuk [Mon, 27 Apr 2015 14:50:32 +0000 (16:50 +0200)]
Release version 1.2.0

* 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

9 years agoFix some grammatical errors in documentation.
Thorsten Kukuk [Mon, 27 Apr 2015 14:39:24 +0000 (16:39 +0200)]
Fix some grammatical errors in documentation.
Patch by Louis Sautier

* doc/adg/Linux-PAM_ADG.xml: Fix gramatical errors.
* doc/man/pam.3.xml: Likewise.
* doc/man/pam_acct_mgmt.3.xml: Likewise.
* doc/man/pam_chauthtok.3.xml: Likewise.
* doc/man/pam_sm_chauthtok.3.xml: Likewise.
* modules/pam_limits/limits.conf.5.xml: Likewise.
* modules/pam_mail/pam_mail.8.xml: Likewise.
* modules/pam_rhosts/pam_rhosts.c: Likewise.
* modules/pam_shells/pam_shells.8.xml: Likewise.
* modules/pam_tally/pam_tally.8.xml: Likewise.
* modules/pam_tally2/pam_tally2.8.xml: Likewise.
* modules/pam_unix/pam_unix.8.xml: Likewise.

9 years agoAdd "quiet" option to pam_unix to suppress informential info
Thorsten Kukuk [Thu, 23 Apr 2015 14:04:32 +0000 (16:04 +0200)]
Add "quiet" option to pam_unix to suppress informential info
messages from session.

* modules/pam_unix/pam_unix.8.xml: Document new option.
* modules/pam_unix/support.h: Add quiet option.
* modules/pam_unix/pam_unix_sess.c: Don't print LOG_INFO messages if
 'quiet' option is set.

9 years agoUse crypt_r if available in pam_userdb and in pam_unix.
Tomas Mraz [Tue, 7 Apr 2015 08:52:16 +0000 (10:52 +0200)]
Use crypt_r if available in pam_userdb and in pam_unix.

* modules/pam_unix/passverify.c (create_password_hash): Call crypt_r()
instead of crypt() if available.
* modules/pam_userdb/pam_userdb.c (user_lookup): Call crypt_r()
instead of crypt() if available.

9 years agoSupport alternative "vendor configuration" files as fallback to /etc
Thorsten Kukuk [Wed, 25 Mar 2015 14:00:38 +0000 (15:00 +0100)]
Support alternative "vendor configuration" files as fallback to /etc
(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

9 years agopam_env: expand @{HOME} and @{SHELL} and enhance documentation
Thorsten Kukuk [Wed, 25 Mar 2015 13:49:46 +0000 (14:49 +0100)]
pam_env: expand @{HOME} and @{SHELL} and enhance documentation
(Ticket#24 and #29)

* modules/pam_env/pam_env.c: Replace @{HOME} and @{SHELL} with passwd entries
* modules/pam_env/pam_env.conf.5.xml: Document @{HOME} and @{SHELL}
* modules/pam_env/pam_env.8.xml: Enhance documentation

9 years agoClarify pam_access docs re PAM service names and X $DISPLAY value testing.
Thorsten Kukuk [Tue, 24 Mar 2015 15:57:14 +0000 (16:57 +0100)]
Clarify pam_access docs re PAM service names and X $DISPLAY value testing.
(Ticket #39)

* modules/pam_access/access.conf.5.xml
* modules/pam_access/pam_access.8.xml

Signed-off-by: Karl O. Pinc <kop at meme.com>
9 years agoDon't use sudo directory, the timestamp format is different (Ticket#32)
Thorsten Kukuk [Tue, 24 Mar 2015 13:39:41 +0000 (14:39 +0100)]
Don't use sudo directory, the timestamp format is different (Ticket#32)

* modules/pam_timestamp/pam_timestamp.c: Change default timestamp directory.

9 years agoEnhance group.conf examples (Ticket#35)
Thorsten Kukuk [Tue, 24 Mar 2015 13:34:58 +0000 (14:34 +0100)]
Enhance group.conf examples (Ticket#35)

* modules/pam_group/group.conf.5.xml: Enhance example by logic group entry.

9 years agoDocument timestampdir option (Ticket#33)
Thorsten Kukuk [Tue, 24 Mar 2015 13:22:02 +0000 (14:22 +0100)]
Document timestampdir option (Ticket#33)

* modules/pam_timestamp/pam_timestamp.8.xml: Add timestampdir option.

9 years agoAdjust documentation (Ticket#36)
Thorsten Kukuk [Tue, 24 Mar 2015 12:03:06 +0000 (13:03 +0100)]
Adjust documentation (Ticket#36)

* 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%

9 years agoUpdated translations from Transifex.
Tomas Mraz [Wed, 18 Feb 2015 15:18:24 +0000 (16:18 +0100)]
Updated translations from Transifex.

* po/*.po: Updated translations from Transifex.

9 years agobuild: raise gettext version requirement
Dmitry V. Levin [Tue, 6 Jan 2015 22:29:11 +0000 (22:29 +0000)]
build: raise gettext version requirement

Raise gettext requirement to the latest oldstable version 0.18.3.
This fixes the following automake warning:

configure.ac:581: warning: The 'AM_PROG_MKDIR_P' macro is deprecated, and its use is discouraged.
configure.ac:581: You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
configure.ac:581: and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.

* configure.ac (AM_GNU_GETTEXT_VERSION): Raise from 0.15 to 0.18.3.
* po/Makevars: Update from gettext-0.18.3.

9 years agobuild: adjust automake warning flags
Ronny Chevalier [Thu, 11 Dec 2014 15:14:42 +0000 (16:14 +0100)]
build: adjust automake warning flags

Enable all automake warning flags except for the portability issues,
since non portable features are used among the makefiles.

* configure.ac (AM_INIT_AUTOMAKE): Add -Wall -Wno-portability.

9 years agobuild: rename configure.in to configure.ac
Dmitry V. Levin [Tue, 6 Jan 2015 21:13:54 +0000 (21:13 +0000)]
build: rename configure.in to configure.ac

This fixes the following automake warning:
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'

* configure.in: Rename to configure.ac.

9 years agoRemove unmodified GNU gettext files installed by autopoint
Dmitry V. Levin [Tue, 6 Jan 2015 22:58:27 +0000 (22:58 +0000)]
Remove unmodified GNU gettext files installed by autopoint

These files are part of GNU gettext; we have not modified them, they are
installed by autopoint which is called by autoreconf, so they had to be
removed from this repository along with ABOUT-NLS, config.rpath, and
mkinstalldirs files that were removed by commit
Linux-PAM-1_1_5-7-g542ec8b.

* po/Makefile.in.in: Remove.
* po/Rules-quot: Likewise.
* po/boldquot.sed: Likewise.
* po/en@boldquot.header: Likewise.
* po/en@quot.header: Likewise.
* po/insert-header.sin: Likewise.
* po/quot.sed: Likewise.
* po/remove-potcdate.sin: Likewise.
* po/.gitignore: Ignore these files.

9 years agoUpdate .gitignore
Ronny Chevalier [Thu, 11 Dec 2014 15:14:43 +0000 (16:14 +0100)]
Update .gitignore

* .gitignore: Ignore *.log and *.trs files.

9 years agolibpam: Only print "Password change aborted" when it's true.
Luke Shumaker [Mon, 22 Dec 2014 20:46:43 +0000 (15:46 -0500)]
libpam: Only print "Password change aborted" when it's true.

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.

9 years agobuild: extend cross compiling check to cover CPPFLAGS (ticket #21)
Dmitry V. Levin [Tue, 9 Dec 2014 21:47:40 +0000 (21:47 +0000)]
build: extend cross compiling check to cover CPPFLAGS (ticket #21)

Use BUILD_CPPFLAGS variable to override CPPFLAGS where necessary in
case of cross compiling, in addition to CC_FOR_BUILD, BUILD_CFLAGS,
and BUILD_LDFLAGS variables introduced earlier to override CC,
CFLAGS, and LDFLAGS, respectively.

* configure.in (BUILD_CPPFLAGS): Define.
* doc/specs/Makefile.am (CPPFLAGS): Define to @BUILD_CPPFLAGS@.

9 years agoDo not use yywrap (ticket #42)
Dmitry V. Levin [Tue, 9 Dec 2014 01:21:48 +0000 (01:21 +0000)]
Do not use yywrap (ticket #42)

Our scanners do not really use yywrap.  Explicitly disable yywrap
so that no references to yywrap will be generated and no LEXLIB
would be needed.

* conf/pam_conv1/Makefile.am (pam_conv1_LDADD): Remove.
* conf/pam_conv1/pam_conv_l.l: Enable noyywrap option.
* doc/specs/Makefile.am (padout_LDADD): Remove.
* doc/specs/parse_l.l: Enable noyywrap option.

9 years agodoc: fix a trivial typo in pam_authenticate return values (ticket #38)
Kyle Manna [Fri, 26 Sep 2014 04:37:49 +0000 (21:37 -0700)]
doc: fix a trivial typo in pam_authenticate return values (ticket #38)

* doc/man/pam_authenticate.3.xml: Fix a typo in PAM_AUTHINFO_UNAVAIL.

9 years agodoc: fix typo in pam_authenticate.3.xml
Ronny Chevalier [Mon, 11 Aug 2014 14:36:21 +0000 (16:36 +0200)]
doc: fix typo in pam_authenticate.3.xml

* doc/man/pam_authenticate.3.xml: Fix typo.

10 years agopam_succeed_if: Fix copy&paste error in rhost and tty values.
Tomas Mraz [Fri, 17 Oct 2014 06:39:58 +0000 (08:39 +0200)]
pam_succeed_if: Fix copy&paste error in rhost and tty values.

modules/pam_succeed_if/pam_succeed_if.c (evaluate): Use PAM_RHOST
and PAM_TTY properly for the rhost and tty values.

10 years agopam_succeed_if: Use long long type for numeric values
Tomas Mraz [Fri, 17 Oct 2014 06:34:24 +0000 (08:34 +0200)]
pam_succeed_if: Use long long type for numeric values

The currently used long with additional conversion to int is
too small for uids and gids.

modules/pam_succeed_if/pam_succeed_if.c (evaluate_num): Replace
strtol() with strtoll() and int with long long in the parameters
of comparison functions.

10 years agoAdd grantor field to audit records of libpam.
Tomas Mraz [Fri, 5 Sep 2014 07:09:37 +0000 (09:09 +0200)]
Add grantor field to audit records of libpam.

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().

10 years agopam_mkhomedir: Drop superfluous stat() call.
Tomas Mraz [Tue, 26 Aug 2014 12:08:28 +0000 (14:08 +0200)]
pam_mkhomedir: Drop superfluous stat() call.

modules/pam_mkhomedir/mkhomedir_helper.c (create_homedir): Drop superfluous
stat() call.

10 years agopam_exec: Do not depend on open() returning STDOUT_FILENO.
Tomas Mraz [Tue, 26 Aug 2014 12:04:02 +0000 (14:04 +0200)]
pam_exec: Do not depend on open() returning STDOUT_FILENO.

modules/pam_exec/pam_exec.c (call_exec): Move the descriptor to
STDOUT_FILENO if needed.

10 years agopam_keyinit: Check return value of setregid.
Robin Hack [Mon, 25 Aug 2014 15:33:21 +0000 (17:33 +0200)]
pam_keyinit: Check return value of setregid.

modules/pam_keyinit/pam_keyinit.c (pam_sm_open_session): Log if setregid() fails.

10 years agopam_filter: Avoid leaking descriptors when fork() fails.
Robin Hack [Mon, 25 Aug 2014 15:30:01 +0000 (17:30 +0200)]
pam_filter: Avoid leaking descriptors when fork() fails.

modules/pam_filter/pam_filter.c (set_filter): Close descriptors when fork() fails.

10 years agopam_echo: Avoid leaking file descriptor.
Robin Hack [Thu, 14 Aug 2014 11:33:56 +0000 (13:33 +0200)]
pam_echo: Avoid leaking file descriptor.

modules/pam_echo/pam_echo.c (pam_echo): Close fd in error cases.

10 years agopam_tty_audit: Silence Coverity reporting uninitialized use.
Robin Hack [Wed, 13 Aug 2014 13:12:13 +0000 (15:12 +0200)]
pam_tty_audit: Silence Coverity reporting uninitialized use.

modules/pam_tty_audit/pam_tty_audit.c (nl_recv): Initialize also
msg_flags.

10 years agopam_tally2: Avoid uninitialized use of fileinfo.
Tomas Mraz [Wed, 13 Aug 2014 13:01:32 +0000 (15:01 +0200)]
pam_tally2: Avoid uninitialized use of fileinfo.

Problem found by Robin Hack <rhack@redhat.com>.
modules/pam_tally2/pam_tally2.c (get_tally): Do not depend on file size
just try to read it.

10 years agopam_access: Avoid uninitialized access of line.
Tomas Mraz [Wed, 13 Aug 2014 12:45:05 +0000 (14:45 +0200)]
pam_access: Avoid uninitialized access of line.

* modules/pam_access/pam_access.c (login_access): Reorder condition
so line is not accessed when uninitialized.

10 years agopam_lastlog: Properly clean up last_login structure before use.
Tomas Mraz [Tue, 5 Aug 2014 14:26:01 +0000 (16:26 +0200)]
pam_lastlog: Properly clean up last_login structure before use.

modules/pam_lastlog/pam_lastlog.c (last_login_write): Properly clean up last_login
structure before use.

10 years agoMake pam_pwhistory and pam_unix tolerant of corrupted opasswd file.
Tomas Mraz [Mon, 21 Jul 2014 14:31:38 +0000 (16:31 +0200)]
Make pam_pwhistory and pam_unix tolerant of corrupted opasswd file.

* modules/pam_pwhistory/opasswd.c (parse_entry): Test for missing fields
in opasswd entry and return error.
* modules/pam_unix/passverify.c (save_old_password): Test for missing fields
in opasswd entry and skip it.

10 years agodoc: add missing build dependencies for soelim stubs
Dmitry V. Levin [Mon, 30 Jun 2014 21:53:26 +0000 (21:53 +0000)]
doc: add missing build dependencies for soelim stubs

* doc/man/Makefile.am [ENABLE_REGENERATE_MAN]: Add dependencies for
pam_verror.3, pam_vinfo.3, pam_vprompt.3, and pam_vsyslog.3 soelim stubs.

10 years agodoc: fix install in case of out of tree build (ticket #31)
Dmitry V. Levin [Thu, 8 May 2014 23:36:58 +0000 (23:36 +0000)]
doc: fix install in case of out of tree build (ticket #31)

* doc/adg/Makefile.am (install-data-local, releasedocs): Fall back
to srcdir if documentation files haven't been found in builddir.
(releasedocs): Treat missing documentation files as an error.
* doc/mwg/Makefile.am: Likewise.
* doc/sag/Makefile.am: Likewise.

10 years agodoc: fix installation of adg-*.html and mwg-*.html files (ticket #31)
Dmitry V. Levin [Thu, 8 May 2014 23:36:58 +0000 (23:36 +0000)]
doc: fix installation of adg-*.html and mwg-*.html files (ticket #31)

Fix a typo due to which sag-*.html files might be installed instead of
adg-*.html and mwg-*.html files.

* doc/adg/Makefile.am (install-data-local): Install adg-*.html instead
of sag-*.html.
* doc/mwg/Makefile.am (install-data-local): Install mwg-*.html instead
of sag-*.html.

Patch-by: Mike Frysinger <vapier@gentoo.org>
10 years agopam_limits: nofile refers to file descriptors not files
Tomas Mraz [Thu, 19 Jun 2014 13:32:08 +0000 (15:32 +0200)]
pam_limits: nofile refers to file descriptors not files

modules/pam_limits/limits.conf.5.xml: Correct documentation of nofile limit.
modules/pam_limits/limits.conf: Likewise.

10 years agopam_limits: clarify documentation of maxlogins and maxsyslogins limits.
Tomas Mraz [Thu, 19 Jun 2014 12:41:50 +0000 (14:41 +0200)]
pam_limits: clarify documentation of maxlogins and maxsyslogins limits.

modules/pam_limits/limits.conf.5.xml: clarify documentation of
maxlogins and maxsyslogins limits.

10 years agopam_unix: Check for NULL return from Goodcrypt_md5().
Tomas Mraz [Thu, 19 Jun 2014 11:51:20 +0000 (13:51 +0200)]
pam_unix: Check for NULL return from Goodcrypt_md5().

modules/pam_unix/pam_unix_passwd.c (check_old_password): Check for
NULL return from Goodcrypt_md5().

10 years agopam_unix: check for NULL return from malloc()
Tomas Mraz [Thu, 19 Jun 2014 11:43:26 +0000 (13:43 +0200)]
pam_unix: check for NULL return from malloc()

* modules/pam_unix/md5_crypt.c (crypt_md5): Check for NULL return from malloc().

10 years agopam_loginuid: Document one more possible case of PAM_IGNORE return.
Tomas Mraz [Thu, 22 May 2014 09:33:21 +0000 (11:33 +0200)]
pam_loginuid: Document one more possible case of PAM_IGNORE return.

modules/pam_loginuid/pam_loginuid.8.xml: Document one more possible case
of PAM_IGNORE return value.

10 years agopam_loginuid: Document other possible return values.
Tomas Mraz [Thu, 22 May 2014 09:25:13 +0000 (11:25 +0200)]
pam_loginuid: Document other possible return values.

modules/pam_loginuid/pam_loginuid.8.xml: Document the possible return
values.

10 years agopam_timestamp: fix potential directory traversal issue (ticket #27)
Dmitry V. Levin [Wed, 26 Mar 2014 22:17:23 +0000 (22:17 +0000)]
pam_timestamp: fix potential directory traversal issue (ticket #27)

pam_timestamp uses values of PAM_RUSER and PAM_TTY as components of
the timestamp pathname it creates, so extra care should be taken to
avoid potential directory traversal issues.

* modules/pam_timestamp/pam_timestamp.c (check_tty): Treat
"." and ".." tty values as invalid.
(get_ruser): Treat "." and ".." ruser values, as well as any ruser
value containing '/', as invalid.

Fixes CVE-2014-2583.

Reported-by: Sebastian Krahmer <krahmer@suse.de>
10 years agopam_userdb: document that .db suffix should not be used
Tomas Mraz [Thu, 20 Mar 2014 09:46:13 +0000 (10:46 +0100)]
pam_userdb: document that .db suffix should not be used

modules/pam_userdb/pam_userdb.8.xml: Document that .db suffix
should not be used and correct the example.

10 years agopam_selinux: canonicalize user name
Tomas Mraz [Tue, 11 Mar 2014 08:59:12 +0000 (09:59 +0100)]
pam_selinux: canonicalize user name

SELinux expects canonical user name for example without domain component.

* modules/pam_selinux/pam_selinux.c (compute_exec_context): Canonicalize user name with pam_modutil_getpwnam().

10 years agoChange tarball name back to "Linux-PAM"
Dmitry V. Levin [Tue, 28 Jan 2014 15:01:24 +0000 (15:01 +0000)]
Change tarball name back to "Linux-PAM"

As a side effect of commit Linux-PAM-1_1_8-11-g3fa23ce, tarball name
changed accidentally from "Linux-PAM" to "linux-pam".
This change brings it back to "Linux-PAM".

* configure.in (AC_INIT): Explicitly specify TARNAME argument.

10 years agoIntroduce pam_modutil_sanitize_helper_fds
Dmitry V. Levin [Fri, 24 Jan 2014 15:32:08 +0000 (15:32 +0000)]
Introduce pam_modutil_sanitize_helper_fds

This change introduces pam_modutil_sanitize_helper_fds - a new function
that redirects standard descriptors and closes all other descriptors.

pam_modutil_sanitize_helper_fds supports three types of input and output
redirection:
- PAM_MODUTIL_IGNORE_FD: do not redirect at all.
- PAM_MODUTIL_PIPE_FD: redirect to a pipe.  For stdin, it is implemented
  by creating a pipe, closing its write end, and redirecting stdin to
  its read end.  Likewise, for stdout/stderr it is implemented by
  creating a pipe, closing its read end, and redirecting to its write
  end.  Unlike stdin redirection, stdout/stderr redirection to a pipe
  has a side effect that a process writing to such descriptor should be
  prepared to handle SIGPIPE appropriately.
- PAM_MODUTIL_NULL_FD: redirect to /dev/null.  For stdin, it is
  implemented via PAM_MODUTIL_PIPE_FD because there is no functional
  difference.  For stdout/stderr, it is classic redirection to
  /dev/null.

PAM_MODUTIL_PIPE_FD is usually more suitable due to linux kernel
security restrictions, but when the helper process might be writing to
the corresponding descriptor and termination of the helper process by
SIGPIPE is not desirable, one should choose PAM_MODUTIL_NULL_FD.

* libpam/pam_modutil_sanitize.c: New file.
* libpam/Makefile.am (libpam_la_SOURCES): Add it.
* libpam/include/security/pam_modutil.h (pam_modutil_redirect_fd,
pam_modutil_sanitize_helper_fds): New declarations.
* libpam/libpam.map (LIBPAM_MODUTIL_1.1.9): New interface.
* modules/pam_exec/pam_exec.c (call_exec): Use
pam_modutil_sanitize_helper_fds.
* modules/pam_mkhomedir/pam_mkhomedir.c (create_homedir): Likewise.
* modules/pam_unix/pam_unix_acct.c (_unix_run_verify_binary): Likewise.
* modules/pam_unix/pam_unix_passwd.c (_unix_run_update_binary):
Likewise.
* modules/pam_unix/support.c (_unix_run_helper_binary): Likewise.
* modules/pam_xauth/pam_xauth.c (run_coprocess): Likewise.
* modules/pam_unix/support.h (MAX_FD_NO): Remove.

10 years agopam_xauth: avoid potential SIGPIPE when writing to xauth process
Dmitry V. Levin [Fri, 24 Jan 2014 13:38:38 +0000 (13:38 +0000)]
pam_xauth: avoid potential SIGPIPE when writing to xauth process

Similar issue in pam_unix was fixed by commit Linux-PAM-0-73~8.

* modules/pam_xauth/pam_xauth.c (run_coprocess): In the parent process,
close the read end of input pipe after writing to its write end.