mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Make the location of the Kerberos server key file run time configurable
(rather than compile time). For libpq, even when Kerberos support is compiled in, the default user name should still fall back to geteuid() if it can't be determined via the Kerberos system. A couple of fixes for string type configuration parameters, now that there is one.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.43 2000/06/17 00:10:09 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.44 2000/08/25 10:00:35 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -565,41 +565,37 @@ fe_getauthname(char *PQerrormsg)
|
||||
MsgType authsvc;
|
||||
|
||||
authsvc = fe_getauthsvc(PQerrormsg);
|
||||
switch ((int) authsvc)
|
||||
{
|
||||
|
||||
#ifdef KRB4
|
||||
case STARTUP_KRB4_MSG:
|
||||
name = pg_krb4_authname(PQerrormsg);
|
||||
break;
|
||||
if (authsvc == STARTUP_KRB4_MSG)
|
||||
name = pg_krb4_authname(PQerrormsg);
|
||||
#endif
|
||||
#ifdef KRB5
|
||||
case STARTUP_KRB5_MSG:
|
||||
name = pg_krb5_authname(PQerrormsg);
|
||||
break;
|
||||
if (authsvc == STARTUP_KRB5_MSG)
|
||||
name = pg_krb5_authname(PQerrormsg);
|
||||
#endif
|
||||
case STARTUP_MSG:
|
||||
{
|
||||
|
||||
if (authsvc == STARTUP_MSG
|
||||
|| (authsvc == STARTUP_KRB4_MSG && !name)
|
||||
|| (authsvc == STARTUP_KRB5_MSG && !name))
|
||||
{
|
||||
#ifdef WIN32
|
||||
char username[128];
|
||||
DWORD namesize = sizeof(username) - 1;
|
||||
char username[128];
|
||||
DWORD namesize = sizeof(username) - 1;
|
||||
|
||||
if (GetUserName(username, &namesize))
|
||||
name = username;
|
||||
if (GetUserName(username, &namesize))
|
||||
name = username;
|
||||
#else
|
||||
struct passwd *pw = getpwuid(geteuid());
|
||||
struct passwd *pw = getpwuid(geteuid());
|
||||
|
||||
if (pw)
|
||||
name = pw->pw_name;
|
||||
if (pw)
|
||||
name = pw->pw_name;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
(void) sprintf(PQerrormsg,
|
||||
"fe_getauthname: invalid authentication system: %d\n",
|
||||
authsvc);
|
||||
break;
|
||||
}
|
||||
|
||||
if (authsvc != STARTUP_MSG && authsvc != STARTUP_KRB4_MSG && authsvc != STARTUP_KRB5_MSG)
|
||||
sprintf(PQerrormsg,"fe_getauthname: invalid authentication system: %d\n", authsvc);
|
||||
|
||||
if (name && (authn = (char *) malloc(strlen(name) + 1)))
|
||||
strcpy(authn, name);
|
||||
return authn;
|
||||
|
Reference in New Issue
Block a user