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

Commit727ffa1

Browse files
committed
Clean up pg_SSPI_error() coding a little bit: make the messages more
consistent, translate where intended, const-ify declarations.Resolves a gripe from Alvaro as well as some stuff I didn't like.
1 parent5698f6b commit727ffa1

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

‎src/backend/libpq/auth.c

Lines changed: 7 additions & 7 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.178 2009/01/09 10:13:18 mha Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.179 2009/03/22 18:06:35 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1084,11 +1084,12 @@ pg_GSS_recvauth(Port *port)
10841084
*/
10851085
#ifdefENABLE_SSPI
10861086
staticvoid
1087-
pg_SSPI_error(intseverity,char*errmsg,SECURITY_STATUSr)
1087+
pg_SSPI_error(intseverity,constchar*errmsg,SECURITY_STATUSr)
10881088
{
10891089
charsysmsg[256];
10901090

1091-
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,r,0,sysmsg,sizeof(sysmsg),NULL)==0)
1091+
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,r,0,
1092+
sysmsg,sizeof(sysmsg),NULL)==0)
10921093
ereport(severity,
10931094
(errmsg_internal("%s",errmsg),
10941095
errdetail("SSPI error %x", (unsignedint)r)));
@@ -1150,8 +1151,7 @@ pg_SSPI_recvauth(Port *port)
11501151
&sspicred,
11511152
&expiry);
11521153
if (r!=SEC_E_OK)
1153-
pg_SSPI_error(ERROR,
1154-
gettext_noop("could not acquire SSPI credentials handle"),r);
1154+
pg_SSPI_error(ERROR,_("could not acquire SSPI credentials"),r);
11551155

11561156
/*
11571157
* Loop through SSPI message exchange. This exchange can consist of
@@ -1240,7 +1240,7 @@ pg_SSPI_recvauth(Port *port)
12401240
}
12411241
FreeCredentialsHandle(&sspicred);
12421242
pg_SSPI_error(ERROR,
1243-
gettext_noop("could not accept SSPI security context"),r);
1243+
_("could not accept SSPI security context"),r);
12441244
}
12451245

12461246
if (sspictx==NULL)
@@ -1296,7 +1296,7 @@ pg_SSPI_recvauth(Port *port)
12961296
{
12971297
FreeLibrary(secur32);
12981298
pg_SSPI_error(ERROR,
1299-
gettext_noop("could not getsecuritytoken from context"),r);
1299+
_("could not get token from SSPI security context"),r);
13001300
}
13011301

13021302
FreeLibrary(secur32);

‎src/interfaces/libpq/fe-auth.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.140 2009/01/13 10:43:21 mha Exp $
10+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.141 2009/03/22 18:06:35 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -472,13 +472,13 @@ pg_GSS_startup(PGconn *conn)
472472
*/
473473

474474
staticvoid
475-
pg_SSPI_error(PGconn*conn,char*mprefix,SECURITY_STATUSr)
475+
pg_SSPI_error(PGconn*conn,constchar*mprefix,SECURITY_STATUSr)
476476
{
477477
charsysmsg[256];
478478

479479
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,r,0,
480480
sysmsg,sizeof(sysmsg),NULL)==0)
481-
printfPQExpBuffer(&conn->errorMessage,"%s:sspi error %x",
481+
printfPQExpBuffer(&conn->errorMessage,"%s:SSPI error %x",
482482
mprefix, (unsignedint)r);
483483
else
484484
printfPQExpBuffer(&conn->errorMessage,"%s: %s (%x)",
@@ -623,10 +623,18 @@ pg_SSPI_startup(PGconn *conn, int use_negotiate)
623623
returnSTATUS_ERROR;
624624
}
625625

626-
r=AcquireCredentialsHandle(NULL,use_negotiate ?"negotiate" :"kerberos",SECPKG_CRED_OUTBOUND,NULL,NULL,NULL,NULL,conn->sspicred,&expire);
626+
r=AcquireCredentialsHandle(NULL,
627+
use_negotiate ?"negotiate" :"kerberos",
628+
SECPKG_CRED_OUTBOUND,
629+
NULL,
630+
NULL,
631+
NULL,
632+
NULL,
633+
conn->sspicred,
634+
&expire);
627635
if (r!=SEC_E_OK)
628636
{
629-
pg_SSPI_error(conn,"acquirecredentials failed",r);
637+
pg_SSPI_error(conn,libpq_gettext("could notacquireSSPI credentials"),r);
630638
free(conn->sspicred);
631639
conn->sspicred=NULL;
632640
returnSTATUS_ERROR;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp