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

Commitc13ef1a

Browse files
committed
My patch to fe-connect.c introduced a new bug which is triggered only, if
Kerberos is being used (attempt to free static memory).The error was caused by a confusing doublespeak of fe_getauthname():Returns a pointer to static memory, if you authenticate via Kerberos,a pointer to dynamic memory otherwise.Submitted by: Erich Stamberger <eberger@gewi.kfunigraz.ac.at>
1 parent1a675fe commitc13ef1a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.2 1996/07/23 03:35:11 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.3 1996/07/27 02:27:55 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -500,14 +500,15 @@ fe_getauthsvc(char* PQerrormsg)
500500
}
501501

502502
/*
503-
* fe_getauthname -- returns a pointer tostatic space containing whatever
503+
* fe_getauthname -- returns a pointer todynamic space containing whatever
504504
* name the user has authenticated to the system
505505
* if there is an error, return the error message in PQerrormsg
506506
*/
507507
char*
508508
fe_getauthname(char*PQerrormsg)
509509
{
510510
char*name= (char*)NULL;
511+
char*authn= (char*)NULL;
511512
MsgTypeauthsvc;
512513

513514
authsvc=fe_getauthsvc(PQerrormsg);
@@ -525,11 +526,7 @@ fe_getauthname(char* PQerrormsg)
525526
caseSTARTUP_MSG:
526527
{
527528
structpasswd*pw=getpwuid(geteuid());
528-
if (pw&&
529-
pw->pw_name&&
530-
(name= (char*)malloc(strlen(pw->pw_name)+1))) {
531-
(void)strcpy(name,pw->pw_name);
532-
}
529+
if (pw)name=pw->pw_name;
533530
}
534531
break;
535532
default:
@@ -538,7 +535,10 @@ fe_getauthname(char* PQerrormsg)
538535
authsvc);
539536
break;
540537
}
541-
return(name);
538+
539+
if(name&& (authn= (char*)malloc(strlen(name)+1)))
540+
(void)strcpy(authn,name);
541+
return(authn);
542542
}
543543

544544

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp