[1600] in Moira
getenv("USER") in blanche...
daemon@ATHENA.MIT.EDU (Danilo Almeida)
Tue Jul 11 17:34:02 2000
From: "Danilo Almeida" <dalmeida@MIT.EDU>
To: <moiradev@mit.edu>
Cc: <pismere-team@mit.edu>
Date: Tue, 11 Jul 2000 17:33:43 -0400
Message-ID: <DIEILAKKMPNAOBPOMHLBCEBNCBAA.dalmeida@mit.edu>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
There are 4 places in blanche where we do a getenv("USER"). 3 are as
arguments to strcmp(). If USER is undefined, blanche crashes. The other
place is when setting the owner to the current user when creating a list. I
haven't checked to see if that code path will also result in a crash if USER
is not defined, but my guess is probably.
At the very least, we should make blanche terminate gracefully if USER is
not defined. We should have a routine that uses getenv("USER") if possible
and falls back to other stuff if that fails, bottoming out at getting the
username from the OS. On NT, the standard place for the username is the
USERNAME environment variable. For Win32, blanche should look there if USER
is undefined. If we cannot get any username from the OS, blanche should not
crash. The code should see that it got nothing and do something
appropriate, whether that is to terminate gracefully or simply ignore the
error.
I can modify blanche and submit a patch, but I'd like to get some feedback
before I put any cycles in here. If someone else wants to go ahead and fix
this up, feel free. I can fill in any Win32-specific stuff into the routine
that gets the username later.
- Danilo