Path: utzoo!utstat!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!dutrun!dutlru1!ge From: ge@dutlru1.tudelft.nl (Ge van Geldorp) Newsgroups: news.software.nntp Subject: environ and myenviron Summary: what's myenviron for? Keywords: posting, C-News anne.jones, environment Message-ID: <1990Nov20.124248.13617@dutlru1.tudelft.nl> Date: 20 Nov 90 12:42:48 GMT Organization: Delft Univ. of Technology, Fac. of Aerospace Engineering Lines: 29 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