Commit f75e16d4 authored by Bruce Momjian's avatar Bruce Momjian

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
parent 9694a41a
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.74 2002/02/23 04:17:46 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.75 2002/02/25 20:07:02 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -766,9 +766,9 @@ CheckPAMAuth(Port *port, char *user, char *password) ...@@ -766,9 +766,9 @@ CheckPAMAuth(Port *port, char *user, char *password)
return STATUS_ERROR; return STATUS_ERROR;
} }
if (retval == PAM_SUCCESS)
retval = pam_set_item(pamh, PAM_USER, user); retval = pam_set_item(pamh, PAM_USER, user);
else
if (retval != PAM_SUCCESS)
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"CheckPAMAuth: pam_set_item(PAM_USER) failed: '%s'\n", "CheckPAMAuth: pam_set_item(PAM_USER) failed: '%s'\n",
...@@ -778,9 +778,10 @@ CheckPAMAuth(Port *port, char *user, char *password) ...@@ -778,9 +778,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */ pam_passwd = NULL; /* Unset pam_passwd */
return STATUS_ERROR; return STATUS_ERROR;
} }
if (retval == PAM_SUCCESS)
retval = pam_set_item(pamh, PAM_CONV, &pam_passw_conv); retval = pam_set_item(pamh, PAM_CONV, &pam_passw_conv);
else
if (retval != PAM_SUCCESS)
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"CheckPAMAuth: pam_set_item(PAM_CONV) failed: '%s'\n", "CheckPAMAuth: pam_set_item(PAM_CONV) failed: '%s'\n",
...@@ -790,9 +791,10 @@ CheckPAMAuth(Port *port, char *user, char *password) ...@@ -790,9 +791,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */ pam_passwd = NULL; /* Unset pam_passwd */
return STATUS_ERROR; return STATUS_ERROR;
} }
if (retval == PAM_SUCCESS)
retval = pam_authenticate(pamh, 0); retval = pam_authenticate(pamh, 0);
else
if (retval != PAM_SUCCESS)
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"CheckPAMAuth: pam_authenticate failed: '%s'\n", "CheckPAMAuth: pam_authenticate failed: '%s'\n",
...@@ -802,9 +804,10 @@ CheckPAMAuth(Port *port, char *user, char *password) ...@@ -802,9 +804,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */ pam_passwd = NULL; /* Unset pam_passwd */
return STATUS_ERROR; return STATUS_ERROR;
} }
if (retval == PAM_SUCCESS)
retval = pam_acct_mgmt(pamh, 0); retval = pam_acct_mgmt(pamh, 0);
else
if (retval != PAM_SUCCESS)
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"CheckPAMAuth: pam_acct_mgmt failed: '%s'\n", "CheckPAMAuth: pam_acct_mgmt failed: '%s'\n",
...@@ -814,9 +817,9 @@ CheckPAMAuth(Port *port, char *user, char *password) ...@@ -814,9 +817,9 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */ pam_passwd = NULL; /* Unset pam_passwd */
return STATUS_ERROR; return STATUS_ERROR;
} }
if (retval == PAM_SUCCESS)
{
retval = pam_end(pamh, retval); retval = pam_end(pamh, retval);
if (retval != PAM_SUCCESS) if (retval != PAM_SUCCESS)
{ {
snprintf(PQerrormsg, PQERRORMSG_LENGTH, snprintf(PQerrormsg, PQERRORMSG_LENGTH,
...@@ -829,9 +832,6 @@ CheckPAMAuth(Port *port, char *user, char *password) ...@@ -829,9 +832,6 @@ CheckPAMAuth(Port *port, char *user, char *password)
pam_passwd = NULL; /* Unset pam_passwd */ pam_passwd = NULL; /* Unset pam_passwd */
return (retval == PAM_SUCCESS ? STATUS_OK : STATUS_ERROR); return (retval == PAM_SUCCESS ? STATUS_OK : STATUS_ERROR);
}
else
return STATUS_ERROR;
} }
#endif /* USE_PAM */ #endif /* USE_PAM */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment