[net.news.b] news 2.10 expire.c owner

teus@mcvax.UUCP (07/14/83)

As some crontab entry, super user sometimes does not work correctly
the history file is changed to the owner root. This causes many error
mailings to the sending sites.
To overcome this problem please add in expire.c right in the main()-routine
the following:
	extern struct passwd *getpwnam();
	struct passwd *pwd;

	if( (pwd = getpwnam(NEWSU) ) != NULL ) {
		setuid( pwd->pw_uid ); setgid( pwd->pw_gid );
	}
No "su news"-line in crontab or worse a setuid news bits is needed now.

chris@umcp-cs.UUCP (07/19/83)

[anti-flame notice: I read *all* of the net.news.b list before posting
this.  If someone else has already said the same thing, it hasn't
gotten here yet.]

Careful!  This won't be a problem for most sites, but the order should
be

		setgid (pwd -> pw_gid); setuid (pwd -> pw_uid);

*not* the other way around.  Otherwise, on most systems you'll be left
with the wrong group ID.  That won't be a problem unless you use groups
for something special, though.

				- Chris
-- 
In-Real-Life:	Chris Torek, Univ of MD Comp Sci
UUCP:		{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:		chris@umcp-cs
ARPA:		chris.umcp-cs@UDel-Relay