Skip to content

Commit f75e16d

Browse files
committed
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
1 parent 9694a41 commit f75e16d

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/backend/libpq/auth.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.74 2002/02/23 04:17:46 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.75 2002/02/25 20:07:02 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -766,9 +766,9 @@ CheckPAMAuth(Port *port, char *user, char *password)
766766
return STATUS_ERROR;
767767
}
768768

769-
if (retval == PAM_SUCCESS)
770-
retval = pam_set_item(pamh, PAM_USER, user);
771-
else
769+
retval = pam_set_item(pamh, PAM_USER, user);
770+
771+
if (retval != PAM_SUCCESS)
772772
{
773773
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
774774
"CheckPAMAuth: pam_set_item(PAM_USER) failed: '%s'\n",
@@ -778,9 +778,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
778778
pam_passwd = NULL; /* Unset pam_passwd */
779779
return STATUS_ERROR;
780780
}
781-
if (retval == PAM_SUCCESS)
782-
retval = pam_set_item(pamh, PAM_CONV, &pam_passw_conv);
783-
else
781+
782+
retval = pam_set_item(pamh, PAM_CONV, &pam_passw_conv);
783+
784+
if (retval != PAM_SUCCESS)
784785
{
785786
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
786787
"CheckPAMAuth: pam_set_item(PAM_CONV) failed: '%s'\n",
@@ -790,9 +791,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
790791
pam_passwd = NULL; /* Unset pam_passwd */
791792
return STATUS_ERROR;
792793
}
793-
if (retval == PAM_SUCCESS)
794-
retval = pam_authenticate(pamh, 0);
795-
else
794+
795+
retval = pam_authenticate(pamh, 0);
796+
797+
if (retval != PAM_SUCCESS)
796798
{
797799
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
798800
"CheckPAMAuth: pam_authenticate failed: '%s'\n",
@@ -802,9 +804,10 @@ CheckPAMAuth(Port *port, char *user, char *password)
802804
pam_passwd = NULL; /* Unset pam_passwd */
803805
return STATUS_ERROR;
804806
}
805-
if (retval == PAM_SUCCESS)
806-
retval = pam_acct_mgmt(pamh, 0);
807-
else
807+
808+
retval = pam_acct_mgmt(pamh, 0);
809+
810+
if (retval != PAM_SUCCESS)
808811
{
809812
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
810813
"CheckPAMAuth: pam_acct_mgmt failed: '%s'\n",
@@ -814,24 +817,21 @@ CheckPAMAuth(Port *port, char *user, char *password)
814817
pam_passwd = NULL; /* Unset pam_passwd */
815818
return STATUS_ERROR;
816819
}
817-
if (retval == PAM_SUCCESS)
818-
{
819-
retval = pam_end(pamh, retval);
820-
if (retval != PAM_SUCCESS)
821-
{
822-
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
823-
"CheckPAMAuth: Failed to release PAM authenticator: '%s'\n",
824-
pam_strerror(pamh, retval));
825-
fputs(PQerrormsg, stderr);
826-
pqdebug("%s", PQerrormsg);
827-
}
828820

829-
pam_passwd = NULL; /* Unset pam_passwd */
821+
retval = pam_end(pamh, retval);
830822

831-
return (retval == PAM_SUCCESS ? STATUS_OK : STATUS_ERROR);
823+
if (retval != PAM_SUCCESS)
824+
{
825+
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
826+
"CheckPAMAuth: Failed to release PAM authenticator: '%s'\n",
827+
pam_strerror(pamh, retval));
828+
fputs(PQerrormsg, stderr);
829+
pqdebug("%s", PQerrormsg);
832830
}
833-
else
834-
return STATUS_ERROR;
831+
832+
pam_passwd = NULL; /* Unset pam_passwd */
833+
834+
return (retval == PAM_SUCCESS ? STATUS_OK : STATUS_ERROR);
835835
}
836836
#endif /* USE_PAM */
837837

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy