Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit92f5bfc

Browse files
committed
Fix invalid use of #if within a macro, per Laurenz Albe. Also try to
make the LDAP code's error messages look like they were written by someonewho had heard of our style guidelines.
1 parent2316013 commit92f5bfc

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

‎src/backend/libpq/auth.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.135 2006/03/06 17:41:43 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.136 2006/03/16 18:11:17 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -712,6 +712,7 @@ CheckPAMAuth(Port *port, char *user, char *password)
712712

713713

714714
#ifdefUSE_LDAP
715+
715716
staticint
716717
CheckLDAPAuth(Port*port)
717718
{
@@ -774,7 +775,8 @@ CheckLDAPAuth(Port *port)
774775
if (r<2)
775776
{
776777
ereport(LOG,
777-
(errmsg("Invalid LDAP url: '%s'",port->auth_arg)));
778+
(errmsg("invalid LDAP URL: \"%s\"",
779+
port->auth_arg)));
778780
returnSTATUS_ERROR;
779781
}
780782

@@ -783,26 +785,26 @@ CheckLDAPAuth(Port *port)
783785
passwd=recv_password_packet(port);
784786
if (passwd==NULL)
785787
returnSTATUS_EOF;/* client wouldn't send password */
786-
787788

788789
ldap=ldap_init(server,ldapport);
789790
if (!ldap)
790791
{
791-
ereport(LOG,
792-
(errmsg("Failed to initialize LDAP: %i",
793792
#ifndefWIN32
794-
errno
793+
ereport(LOG,
794+
(errmsg("could not initialize LDAP: error %d",
795+
errno)));
795796
#else
796-
(int)LdapGetLastError()
797+
ereport(LOG,
798+
(errmsg("could not initialize LDAP: error %d",
799+
(int)LdapGetLastError())));
797800
#endif
798-
)));
799801
returnSTATUS_ERROR;
800802
}
801803

802804
if ((r=ldap_set_option(ldap,LDAP_OPT_PROTOCOL_VERSION,&ldapversion))!=LDAP_SUCCESS)
803805
{
804806
ereport(LOG,
805-
(errmsg("Failed to set LDAP version:%i",r)));
807+
(errmsg("could not set LDAPprotocolversion:error %d",r)));
806808
returnSTATUS_ERROR;
807809
}
808810

@@ -815,12 +817,13 @@ CheckLDAPAuth(Port *port)
815817
#endif
816818
{
817819
ereport(LOG,
818-
(errmsg("Failed to start LDAP TLS session:%i",r)));
820+
(errmsg("could not start LDAP TLS session:error %d",r)));
819821
returnSTATUS_ERROR;
820822
}
821823
}
822824

823-
snprintf(fulluser,sizeof(fulluser)-1,"%s%s%s",prefix,port->user_name,suffix);
825+
snprintf(fulluser,sizeof(fulluser)-1,"%s%s%s",
826+
prefix,port->user_name,suffix);
824827
fulluser[sizeof(fulluser)-1]='\0';
825828

826829
r=ldap_simple_bind_s(ldap,fulluser,passwd);
@@ -829,12 +832,14 @@ CheckLDAPAuth(Port *port)
829832
if (r!=LDAP_SUCCESS)
830833
{
831834
ereport(LOG,
832-
(errmsg("LDAP login failed for user '%s' on server '%s': %i",fulluser,server,r)));
835+
(errmsg("LDAP login failed for user \"%s\" on server \"%s\": error %d",
836+
fulluser,server,r)));
833837
returnSTATUS_ERROR;
834838
}
835839

836840
returnSTATUS_OK;
837841
}
842+
838843
#endif/* USE_LDAP */
839844

840845
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp