summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-02-25 20:07:33 +0000
committerBruce Momjian <bruce@momjian.us>2002-02-25 20:07:33 +0000
commit5eab1f1bcda11837eb259e60089f8f935df12f22 (patch)
tree334afd3a87b7baf53717d843e7245b1b8bc2723e /src
parente6dbc1733880737cdd3d7b64e2074b7b00e11a43 (diff)
Fix for PAM error message display:
> and that the right fix is to make each of the subsequent calls be in > this same pattern, not to try to emulate their nonsensical style. Dominic J. Eidson
Diffstat (limited to 'src')
-rw-r--r--src/backend/libpq/auth.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index df9091e9b46..9c04e840a35 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.72 2001/11/05 17:46:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.72.2.1 2002/02/25 20:07:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -752,9 +752,9 @@ CheckPAMAuth(Port *port, char *user, char *password)
return STATUS_ERROR;
}
- if (retval == PAM_SUCCESS)
- retval = pam_set_item(pamh, PAM_USER, user);
- else
+ retval = pam_set_item(pamh, PAM_USER, user);
+
+ if (retval != PAM_SUCCESS)
{
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"CheckPAMAuth: pam_set_item(PAM_USER) failed: '%s'\n",
@@ -764,9 +764,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */
return STATUS_ERROR;
}
- if (retval == PAM_SUCCESS)
- retval = pam_set_item(pamh, PAM_CONV, &pam_passw_conv);
- else
+
+ retval = pam_set_item(pamh, PAM_CONV, &pam_passw_conv);
+
+ if (retval != PAM_SUCCESS)
{
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"CheckPAMAuth: pam_set_item(PAM_CONV) failed: '%s'\n",
@@ -776,9 +777,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */
return STATUS_ERROR;
}
- if (retval == PAM_SUCCESS)
- retval = pam_authenticate(pamh, 0);
- else
+
+ retval = pam_authenticate(pamh, 0);
+
+ if (retval != PAM_SUCCESS)
{
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"CheckPAMAuth: pam_authenticate failed: '%s'\n",
@@ -788,9 +790,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */
return STATUS_ERROR;
}
- if (retval == PAM_SUCCESS)
- retval = pam_acct_mgmt(pamh, 0);
- else
+
+ retval = pam_acct_mgmt(pamh, 0);
+
+ if (retval != PAM_SUCCESS)
{
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"CheckPAMAuth: pam_acct_mgmt failed: '%s'\n",
@@ -800,24 +803,21 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */
return STATUS_ERROR;
}
- if (retval == PAM_SUCCESS)
- {
- retval = pam_end(pamh, retval);
- if (retval != PAM_SUCCESS)
- {
- snprintf(PQerrormsg, PQERRORMSG_LENGTH,
- "CheckPAMAuth: Failed to release PAM authenticator: '%s'\n",
- pam_strerror(pamh, retval));
- fputs(PQerrormsg, stderr);
- pqdebug("%s", PQerrormsg);
- }
- pam_passwd = NULL; /* Unset pam_passwd */
+ retval = pam_end(pamh, retval);
- return (retval == PAM_SUCCESS ? STATUS_OK : STATUS_ERROR);
+ if (retval != PAM_SUCCESS)
+ {
+ snprintf(PQerrormsg, PQERRORMSG_LENGTH,
+ "CheckPAMAuth: Failed to release PAM authenticator: '%s'\n",
+ pam_strerror(pamh, retval));
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
}
- else
- return STATUS_ERROR;
+
+ pam_passwd = NULL; /* Unset pam_passwd */
+
+ return (retval == PAM_SUCCESS ? STATUS_OK : STATUS_ERROR);
}
#endif /* USE_PAM */