aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-auth.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-03-22 18:06:35 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-03-22 18:06:35 +0000
commit727ffa1d1ebaa9c6094a7398d317aa1e89eb404b (patch)
tree896cd1c56211974c70b6b6a4015b3aa33d63f29c /src/interfaces/libpq/fe-auth.c
parent5698f6b925ae1a9f3739c372410442ffdcd04d18 (diff)
downloadpostgresql-727ffa1d1ebaa9c6094a7398d317aa1e89eb404b.tar.gz
postgresql-727ffa1d1ebaa9c6094a7398d317aa1e89eb404b.zip
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.
Diffstat (limited to 'src/interfaces/libpq/fe-auth.c')
-rw-r--r--src/interfaces/libpq/fe-auth.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 85e3ff79cfc..dd0023a64f7 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.140 2009/01/13 10:43:21 mha Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.141 2009/03/22 18:06:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -472,13 +472,13 @@ pg_GSS_startup(PGconn *conn)
*/
static void
-pg_SSPI_error(PGconn *conn, char *mprefix, SECURITY_STATUS r)
+pg_SSPI_error(PGconn *conn, const char *mprefix, SECURITY_STATUS r)
{
char sysmsg[256];
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, r, 0,
sysmsg, sizeof(sysmsg), NULL) == 0)
- printfPQExpBuffer(&conn->errorMessage, "%s: sspi error %x",
+ printfPQExpBuffer(&conn->errorMessage, "%s: SSPI error %x",
mprefix, (unsigned int) r);
else
printfPQExpBuffer(&conn->errorMessage, "%s: %s (%x)",
@@ -623,10 +623,18 @@ pg_SSPI_startup(PGconn *conn, int use_negotiate)
return STATUS_ERROR;
}
- r = AcquireCredentialsHandle(NULL, use_negotiate ? "negotiate" : "kerberos", SECPKG_CRED_OUTBOUND, NULL, NULL, NULL, NULL, conn->sspicred, &expire);
+ r = AcquireCredentialsHandle(NULL,
+ use_negotiate ? "negotiate" : "kerberos",
+ SECPKG_CRED_OUTBOUND,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ conn->sspicred,
+ &expire);
if (r != SEC_E_OK)
{
- pg_SSPI_error(conn, "acquire credentials failed", r);
+ pg_SSPI_error(conn, libpq_gettext("could not acquire SSPI credentials"), r);
free(conn->sspicred);
conn->sspicred = NULL;
return STATUS_ERROR;