]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r233507:
authordumbbell <dumbbell@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 30 Apr 2012 13:34:15 +0000 (13:34 +0000)
committerdumbbell <dumbbell@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 30 Apr 2012 13:34:15 +0000 (13:34 +0000)
commit4a5989acc1c21c2cfcebce640f7e0050286a0252
treed6c036374425b2b961830628502ee304162c3f0f
parent80482127f652ef8b4b3044620ab49189f46f81e4
MFC r233507:
Use program exit status as pam_exec return code (optional)

pam_exec(8) now accepts a new option "return_prog_exit_status". When
set, the program exit status is used as the pam_exec return code. It
allows the program to tell why the step failed (eg. user unknown).
However, if it exits with a code not allowed by the calling PAM service
module function (see $PAM_SM_FUNC below), a warning is logged and
PAM_SERVICE_ERR is returned.

The following changes are related to this new feature but they apply no
matter if the "return_prog_exit_status" option is set or not.

The environment passed to the program is extended:
    o  $PAM_SM_FUNC contains the name of the PAM service module function
       (eg. pam_sm_authenticate).
    o  All valid PAM return codes' numerical values are available
       through variables named after the return code name. For instance,
       $PAM_SUCCESS, $PAM_USER_UNKNOWN or $PAM_PERM_DENIED.

pam_exec return code better reflects what went on:
    o  If the program exits with !0, the return code is now
       PAM_PERM_DENIED, not PAM_SYSTEM_ERR.
    o  If the program fails because of a signal (WIFSIGNALED) or doesn't
       terminate normally (!WIFEXITED), the return code is now
       PAM_SERVICE_ERR, not PAM_SYSTEM_ERR.
    o  If a syscall in pam_exec fails, the return code remains
       PAM_SYSTEM_ERR.

waitpid(2) is called in a loop. If it returns because of EINTR, do it
again. Before, it would return PAM_SYSTEM_ERR without waiting for the
child to exit.

Several log messages now include the PAM service module function name.

The man page is updated accordingly.

Reviewed by: des@
Sponsored by: Yakaz (http://www.yakaz.com)

MFC r234184:
Fix error messages containing the executed command name

Before, we took the first argument to pam_exec(8). With the addition of
options in front of the command, this could be wrong.

Now, options are parsed before calling _pam_exec() and messages contain
the proper command name.

While here, fix a warning.

Sponsored by: Yakaz (http://www.yakaz.com)

git-svn-id: svn://svn.freebsd.org/base/stable/9@234842 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libpam/modules/pam_exec/pam_exec.8
lib/libpam/modules/pam_exec/pam_exec.c