Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jan 2012 18:34:19 +0100
From:      =?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?= <dumbbell@FreeBSD.org>
To:        Gleb Kurtsou <gleb.kurtsou@gmail.com>, freebsd-current@freebsd.org
Cc:        Pierre-Gilles Mialon <pierre-gilles@yakaz.com>, Romain Vrignaud <romain@yakaz.com>
Subject:   Re: [patch] pam_exec: use program exit code instead of PAM_SYSTEM_ERR
Message-ID:  <4F22E01B.3010204@FreeBSD.org>
In-Reply-To: <20120126100745.GA62071@reks>
References:  <4F1EBF42.4050307@FreeBSD.org> <20120126100745.GA62071@reks>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020208080603040400090703
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 26.01.2012 11:07, Gleb Kurtsou wrote:
> On (24/01/2012 15:25), Jean-Sébastien Pédron wrote:
>> Attached is a patch that changes the behaviour to always return
>> the program exit code as-is.
> 
> Please consider making it optional.  It will break for generic 
> applications because pam_sm_chauthtok error codes are documented
> and standardized.

You're right, thanks. I attached a new patch with the following changes:

    o  Instead of making it optionnal, I preferred to check the exit
       code for each pam_sm_* functions supported. Here are the rules:
           - If the code is allowed, it's returned as is.
           - If the exit code is 1 (not an allowed PAM code here),
             PAM_PERM_DENIED is returned. I added this because 1 is a
             common exit code for errors.
           - For any other codes, a message is logged about this
             invalid value and PAM_SERVICE_ERR is returned.

    o  I changed return code from PAM_SYSTEM_ERR to PAM_SERVICE_ERR for
       the WIFSIGNALED(status) and !WIFEXITED(status) cases.
       PAM_SYSTEM_ERR is still returned if a syscall fails.

    o  A new environment variable is set before calling the program:
       PAM_SM_FUNC. It contains the name of the pam_sm_* function. The
       program can use it to determine which exit codes are allowed.

    o  The pam_sm_* function name is also added to messages logged from
       _pam_exec().

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

I expanded the man page with these informations.

Again, thanks for your comments! If you have more, they're welcome :)

- -- 
Jean-Sébastien Pédron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8i4BsACgkQa+xGJsFYOlN/EQCg0D3uHsJC2y9jO/Sk9LHTg/xf
POcAnjUUjLwWd035bHqg4o4Ry/htfEkJ
=l4+1
-----END PGP SIGNATURE-----

--------------020208080603040400090703
Content-Type: text/plain;
 name="pam_exec-return-exit-code-e.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="pam_exec-return-exit-code-e.patch"

ZGlmZiAtLWdpdCBhL2xpYi9saWJwYW0vbW9kdWxlcy9wYW1fZXhlYy9wYW1fZXhlYy44IGIv
bGliL2xpYnBhbS9tb2R1bGVzL3BhbV9leGVjL3BhbV9leGVjLjgKaW5kZXggMzExZDY0Yy4u
OTI5N2IxZTAgMTAwNjQ0Ci0tLSBhL2xpYi9saWJwYW0vbW9kdWxlcy9wYW1fZXhlYy9wYW1f
ZXhlYy44CisrKyBiL2xpYi9saWJwYW0vbW9kdWxlcy9wYW1fZXhlYy9wYW1fZXhlYy44CkBA
IC0zMiw3ICszMiw3IEBACiAuXCIKIC5cIiAkRnJlZUJTRCQKIC5cIgotLkRkIEZlYnJ1YXJ5
IDEsIDIwMDUKKy5EZCBKYW51YXJ5IDI3LCAyMDEyCiAuRHQgUEFNX0VYRUMgOAogLk9zCiAu
U2ggTkFNRQpAQCAtNTYsMTMgKzU2LDUxIEBAIHZhcmlhYmxlczoKIC5FdiBQQU1fUkhPU1Qg
LAogLkV2IFBBTV9SVVNFUiAsCiAuRXYgUEFNX1NFUlZJQ0UgLAotLkV2IFBBTV9UVFkgLAor
LkV2IFBBTV9TTV9GVU5DICwKKy5FdiBQQU1fVFRZCiBhbmQKIC5FdiBQQU1fVVN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9LX0xP
Q0tfQlVTWToKKwljYXNlIFBBTV9BVVRIVE9LX1JFQ09WRVJZX0VSUjoKKwljYXNlIFBBTV9C
VUZfRVJSOgorCWNhc2UgUEFNX0NPTlZfRVJSOgorCWNhc2UgUEFNX0lHTk9SRToKKwljYXNl
IFBBTV9QRVJNX0RFTklFRDoKKwljYXNlIFBBTV9TRVJWSUNFX0VSUjoKKwljYXNlIFBBTV9T
WVNURU1fRVJSOgorCWNhc2UgUEFNX1RSWV9BR0FJTjoKKwkJYnJlYWs7CisJY2FzZSAxOgor
CQlyZXQgPSBQQU1fUEVSTV9ERU5JRUQ7CisJCWJyZWFrOworCWRlZmF1bHQ6CisJCW9wZW5w
YW1fbG9nKFBBTV9MT0dfRVJST1IsICIlcyByZXR1cm5lZCBpbnZhbGlkIGNvZGUgJWQiLAor
CQkgICAgYXJndlswXSwgcmV0KTsKKwkJcmV0ID0gUEFNX1NFUlZJQ0VfRVJSOworCX0KIAot
CXJldHVybiAoX3BhbV9leGVjKHBhbWgsIGZsYWdzLCBhcmdjLCBhcmd2KSk7CisJcmV0dXJu
IChyZXQpOwogfQogCiBQQU1fTU9EVUxFX0VOVFJZKCJwYW1fZXhlYyIpOwo=
--------------020208080603040400090703--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F22E01B.3010204>