[1602] in Moira
Re: getenv("USER") in blanche...
daemon@ATHENA.MIT.EDU (Paul B. Hill)
Tue Jul 11 18:02:19 2000
Message-Id: <4.2.0.58.20000711175023.01e72138@po12.mit.edu>
Date: Tue, 11 Jul 2000 18:02:02 -0400
To: "Danilo Almeida" <dalmeida@mit.edu>, <moiradev@mit.edu>
From: "Paul B. Hill" <pbh@MIT.EDU>
Cc: <pismere-team@mit.edu>
In-Reply-To: <DIEILAKKMPNAOBPOMHLBCEBNCBAA.dalmeida@mit.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
I don't have USER defined in my environment but I haven't had any problems
using Blanche on Windows 2000. Including doing some list maintenance today.
Outside of the pismere environment there is not a strong mapping between
the USERNAME and the MIT Kerberos principal name. However, I assume that
Moira related utilities are usually concerned about the current principal
name. It seems to me that blanche should use the environment variable USER
if it is present. But if it is not, then it should use the Kerberos
principal name. This would enable someone using a root instance, or other
administrative instance, to set the USER environment variable as
appropriate, without affecting the USERNAME that is used by Microsoft
related subsystems.
Paul
At 05:33 PM 7/11/2000 -0400, Danilo Almeida wrote:
>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