delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/07/20/18:18:25

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: "Peter Kabal" <kabal AT ece DOT mcgill DOT ca>
To: <cygwin AT sources DOT redhat DOT com>
Subject: Default User ID can be misleading
Date: Thu, 20 Jul 2000 18:17:08 -0400
Message-ID: <NBBBLLFBIFMBFFKCDPGFCEHLCIAA.kabal@ECE.McGill.CA>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700

I am using the following snippet of C-code to get the name of the current
user.

  pwd = getpwuid (getuid ());
  if (pwd != NULL)
   /* pwd->pw_name */
  else
   /* get the user name from the environment */
      Windows 2000 sets USERNAME
      Many Unix systems set LOGNAME
      Cygwin sets USER (sometimes inappropriately, see below)

Default installation:
cygwin installed by domain administrator on Windows 2000.  The default
installation procedure creates /etc/passwd with only local entries.

When cygwin is run by an ordinary domain user (not in the password file),
getuid returns the uid for the local Administrator.  (The environment
variable
USER is also set to "Administrator".)

Updated installation:
Domain administrator runs "mkpasswd -d -l > /etc/passwd".  Now all domain
domain users in the password table are also correctly recognized.

--------------------
The system works properly when the currently logged in user is in the
password table.  But the question is what uid to return if a user is not
in the password table.  It seems to me that in that case getuid should
return a uid that is not in the password table and not fall back to the
Administrator uid.  Better to have a blank user name than a misleading
one.

Peter Kabal     Kabal AT ECE DOT McGill DOT CA (514) 398-7130
Electrical & Computer Engineering   (514) 398-4470 (FAX)
McGill University
3480 University, Montreal, Quebec, Canada  H3A 2A7



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019