Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6458022

Browse files
committed
Remove special-handling of usernames with Kerberos authentication. We will
now always use the system username as the default, and not try to pick it up from the kerberos ticket. This fixes the spurious error messages that show up on kerberos-enabled builds when not actually using kerberos, and puts it in line with how other authentication methods work.
1 parent afe8ac2 commit 6458022

File tree

1 file changed

+2
-45
lines changed

1 file changed

+2
-45
lines changed

src/interfaces/libpq/fe-auth.c

Lines changed: 2 additions & 45 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.139 2009/01/01 17:24:03 momjian Exp $
10+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.140 2009/01/13 10:43:21 mha Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -190,28 +190,6 @@ pg_krb5_destroy(struct krb5_info * info)
190190
}
191191

192192

193-
194-
/*
195-
* pg_krb5_authname -- returns a copy of whatever name the user
196-
* has authenticated to the system, or NULL
197-
*/
198-
static char *
199-
pg_krb5_authname(PQExpBuffer errorMessage)
200-
{
201-
char *tmp_name;
202-
struct krb5_info info;
203-
204-
info.pg_krb5_initialised = 0;
205-
206-
if (pg_krb5_init(errorMessage, &info) != STATUS_OK)
207-
return NULL;
208-
tmp_name = strdup(info.pg_krb5_name);
209-
pg_krb5_destroy(&info);
210-
211-
return tmp_name;
212-
}
213-
214-
215193
/*
216194
* pg_krb5_sendauth -- client routine to send authentication information to
217195
* the server
@@ -972,9 +950,6 @@ pg_fe_sendauth(AuthRequest areq, PGconn *conn)
972950
char *
973951
pg_fe_getauthname(PQExpBuffer errorMessage)
974952
{
975-
#ifdef KRB5
976-
char *krb5_name = NULL;
977-
#endif
978953
const char *name = NULL;
979954
char *authn;
980955

@@ -988,8 +963,7 @@ pg_fe_getauthname(PQExpBuffer errorMessage)
988963
#endif
989964

990965
/*
991-
* pglock_thread() really only needs to be called around
992-
* pg_krb5_authname(), but some users are using configure
966+
* Some users are using configure
993967
* --enable-thread-safety-force, so we might as well do the locking within
994968
* our library to protect pqGetpwuid(). In fact, application developers
995969
* can use getpwuid() in their application if they use the locking call we
@@ -998,17 +972,6 @@ pg_fe_getauthname(PQExpBuffer errorMessage)
998972
*/
999973
pglock_thread();
1000974

1001-
#ifdef KRB5
1002-
1003-
/*
1004-
* pg_krb5_authname gives us a strdup'd value that we need to free later,
1005-
* however, we don't want to free 'name' directly in case it's *not* a
1006-
* Kerberos login and we fall through to name = pw->pw_name;
1007-
*/
1008-
krb5_name = pg_krb5_authname(errorMessage);
1009-
name = krb5_name;
1010-
#endif
1011-
1012975
if (!name)
1013976
{
1014977
#ifdef WIN32
@@ -1022,12 +985,6 @@ pg_fe_getauthname(PQExpBuffer errorMessage)
1022985

1023986
authn = name ? strdup(name) : NULL;
1024987

1025-
#ifdef KRB5
1026-
/* Free the strdup'd string from pg_krb5_authname, if we got one */
1027-
if (krb5_name)
1028-
free(krb5_name);
1029-
#endif
1030-
1031988
pgunlock_thread();
1032989

1033990
return authn;

0 commit comments

Comments
 (0)