Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2010-12-12 23:22:28 +0100
committerArthur de Jong <arthur@arthurdejong.org>2010-12-12 23:22:28 +0100
commitf13d4d573a3cb241080434b1ded5b66fa91a4eec (patch)
tree5550c1f48c652a18f7798bf044aae78388a48cb2
parente961186ba74374ecd0de57acaba62d92082076dc (diff)
fallback to standard PAM error message if one wasn't returned by nslcd
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1326 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--pam/pam.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pam/pam.c b/pam/pam.c
index 3d30368..7481f59 100644
--- a/pam/pam.c
+++ b/pam/pam.c
@@ -433,6 +433,9 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh,int flags,int argc,const char **argv)
/* check the returned authorisation value */
if (ctx2.authz!=PAM_SUCCESS)
{
+ /* turn in to generic PAM error message if message is empty */
+ if ((ctx2.authzmsg==NULL)||(ctx2.authzmsg[0]=='\0'))
+ ctx2.authzmsg=(char *)pam_strerror(pamh,ctx2.authz);
pam_syslog(pamh,LOG_NOTICE,"%s; user=%s",ctx2.authzmsg,username);
rc=remap_pam_rc(ctx2.authz,&cfg);
if ((rc!=PAM_IGNORE)&&(!cfg.no_warn))
@@ -442,6 +445,8 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh,int flags,int argc,const char **argv)
/* check the original authorisation check from authentication */
if (ctx->authz!=PAM_SUCCESS)
{
+ if ((ctx->authzmsg==NULL)||(ctx->authzmsg[0]=='\0'))
+ ctx->authzmsg=(char *)pam_strerror(pamh,ctx->authz);
pam_syslog(pamh,LOG_NOTICE,"%s; user=%s",ctx->authzmsg,username);
rc=remap_pam_rc(ctx->authz,&cfg);
if ((rc!=PAM_IGNORE)&&(!cfg.no_warn))