Article View: news.software.nntp
Article #791environ and myenviron
From: Ge van Geldorp
Date: Tue, 20 Nov 1990 12:42
Date: Tue, 20 Nov 1990 12:42
30 lines
2424 bytes
2424 bytes
I'm running NNTP 1.5.10 and C-News on our main news hosts. Some of our other machines can post via this main news host using the NNTP-supplied mini-inews. When posting something using this method, a problem occurs when the C-News censor anne.jones gets its hands on the posted article. It can't figure out who it is running as (needed to put a Sender: header in). One of the first things anne.jones does to get the user name is look at the environment variable LOGNAME. Testing showed me that this environment variable was not set. This seemed strange since nntpd does a putenv(LOGNAME, ...) in serve.c, before inews is spawn()ed to handle the post. Digging a little further, I found that nntpd maintains two sets of environment variables, one pointed to by char **environ and the other pointed to by char **myenviron. It turns out that the putenv() updates the environ, but myenviron is used when spawning inews, therefore the environment passed to inews doesn't contain a LOGNAME variable. What I can't figure out is why these two seperate environments are present. The simplest solution to my problem would be to junk the myenviron and use environ exclusively, but somebody obviously put some effort in to keep the two environments separate. It seems to have something to do with SETPROCTITLE, but I just can't figure out what. (As a side note, when you #undef SETPROCTITLE in conf.h, myenviron is set equal to environ in main.c, however, when putenv() adds a new environment variable, e.g. LOGNAME, environ is realloc()ed, so myenviron which is not updated possibly points to garbage after this. Propably not the intended behaviour...) Any hints appreciated. Ge van Geldorp ge@dutlru2.tudelft.nl ..!uunet!hp4nl!dutlru2.tudelft.nl!ge
Technical Details
Message-ID:
<1990Nov20.124248.13617@dutlru1.tudelft.nl>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utstat!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!dutrun!dutlru1!geShow Full Headers
Complete Article Headers
Message-ID: <1990Nov20.124248.13617@dutlru1.tudelft.nl> Subject: environ and myenviron Date: Tue, 20 Nov 1990 12:42:48 +0000 From: ge@dutlru1.tudelft.nl (Ge van Geldorp) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utstat!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!dutrun!dutlru1!ge Newsgroups: news.software.nntp Summary: what's myenviron for? Keywords: posting, C-News anne.jones, environment Organization: Delft Univ. of Technology, Fac. of Aerospace Engineering Lines: 29