Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com Date: Fri, 10 Sep 1999 12:05:13 +0400 From: Egor Duda X-Mailer: The Bat! (v1.029) S/N A0F2A05A Reply-To: Egor Duda Organization: DEO Message-ID: <1503.990910@logos-m.ru> To: cygwin-developers CC: Kazuhiro Fujieda Subject: /etc/passwd emulation Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! KF> /etc/passwd emulation in passwd.cc generates an invalid entry of KF> which uid is always 513 for any user on WinNT. Then, it use KF> `Administrator' as the user name when GetUserNameA() fails. It KF> seems a bit strange on Win9x. KF> Fri Sep 10 03:49:22 1999 Kazuhiro Fujieda (fujieda AT jaist DOT ac DOT jp) KF> * passwd.cc (read_etc_passwd): /etc/passwd emulation use the KF> proper uid, and use `unknown' as the user name for an unknown user. KF> -!- passwd.cc- Tue Aug 10 12:45:57 1999 KF> +++ passwd.cc Fri Sep 10 03:49:22 1999 KF> @@ -11,6 +11,7 @@ details. */ KF> #include KF> #include KF> #include KF> +#include KF> #include KF> #include "winsup.h" KF> @@ -121,15 +122,9 @@ read_etc_passwd () KF> else KF> { KF> debug_printf ("Emulating /etc/passwd"); KF> - char user_name [ MAX_USER_NAME ]; KF> - DWORD user_name_len = MAX_USER_NAME; KF> - if (! GetUserNameA (user_name, &user_name_len)) KF> - { KF> - strncpy (user_name, "Administrator", MAX_USER_NAME); KF> - debug_printf ("Failed to get current user name. %E"); KF> - } KF> - snprintf (linebuf, sizeof (linebuf), "%s::%u:%u::%s:/bin/sh", KF> user_name, - DEFAULT_UID, DEFAULT_GID, getenv ("HOME") ?: KF> "/"); + snprintf (linebuf, sizeof (linebuf), KF> "%s::%u:%u::%s:/bin/sh", + getlogin (), getuid (), DEFAULT_GID, KF> + getenv ("HOME") ?: "/"); KF> add_pwd_line (linebuf); KF> } KF> passwd_in_memory_p = 1; hmm. calling getuid() in /etc/passwd emulation code seems to be rather strange, as long as getuid() use /etc/passwd to retrieve uid :) So, actually getuid() will always return DEFAULT_UID :) Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19