Article View: news.software.nntp
Article #6400INN inews bug for Solaris 2.x
From: Mark Crother
Date: Mon, 08 Apr 1996 00:00
Date: Mon, 08 Apr 1996 00:00
44 lines
2073 bytes
2073 bytes
I am running inn1.4-unoff-4 on a 2.4 solaris box. While hacking
inews, I found that multiple calls to the getpw family will not work
the same as one would expect. For example, in inews.c, the first time
this is called is in main, line 1204...
/* Find out who we are. */
if ((i = geteuid()) < 0)
PerrorExit(TRUE, "Can't get your user ID");
if ((pwp = getpwuid((UID_T)i)) == NULL)
PerrorExit(TRUE, "Can't get your password entry");
The next time it is in AnAdministrator, line 388
/* Find out who we are. */
if ((pwp = getpwnam(NEWSUSER)) == NULL)
/* Silent falure; clients might not have the group. */
return FALSE;
The call in AnAdministrator will overwrite the data from the
first call, which in esence will make inews think the caller of
inews is NEWSUSER and AnAdministrator will always return true.
This "feature" is documented in a Solaris 2.x's man page for the
getpw family.
To fix this I used getpwuid_r, where r is for reentrant, in main's call.
char pwp_buff[1024];
/* Find out who we are. */
pwp=(struct passwd *)malloc(sizeof(struct passwd));
if ((i = geteuid()) < 0)
PerrorExit(TRUE, "Can't get your user ID");
if ((pwp = getpwuid_r((UID_T)i, pwp, pwp_buff, 1024) ) == NULL)
PerrorExit(TRUE, "Can't get your password entry");
--
Mark Crother mark@calstate.edu--All opinions are mine, not my employer's.
"Don't mind me.... I just spent the last hour in alt.beer!!!"
Technical Details
Message-ID:
<4kbhi6$jf@mugwort.calstate.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <4kbhi6$jf@mugwort.calstate.edu> Subject: INN inews bug for Solaris 2.x Date: Mon, 08 Apr 1996 00:00:00 +0000 From: mark@mugwort.calstate.edu (Mark Crother) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 146384517 Organization: CSUnet Reply-to: mark@calstate.edu (Mark Crother) Newsgroups: news.software.nntp