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 To: cygwin-developers AT sourceware DOT cygnus DOT com Subject: /etc/passwd emulation Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII From: Kazuhiro Fujieda Date: 10 Sep 1999 04:50:29 +0900 Message-ID: Lines: 44 X-Mailer: Gnus v5.3/Emacs 19.34 /etc/passwd emulation in passwd.cc generates an invalid entry of which uid is always 513 for any user on WinNT. Then, it use `Administrator' as the user name when GetUserNameA() fails. It seems a bit strange on Win9x. Fri Sep 10 03:49:22 1999 Kazuhiro Fujieda (fujieda AT jaist DOT ac DOT jp) * passwd.cc (read_etc_passwd): /etc/passwd emulation use the proper uid, and use `unknown' as the user name for an unknown user. --- passwd.cc- Tue Aug 10 12:45:57 1999 +++ passwd.cc Fri Sep 10 03:49:22 1999 @@ -11,6 +11,7 @@ details. */ #include #include #include +#include #include #include "winsup.h" @@ -121,15 +122,9 @@ read_etc_passwd () else { debug_printf ("Emulating /etc/passwd"); - char user_name [ MAX_USER_NAME ]; - DWORD user_name_len = MAX_USER_NAME; - if (! GetUserNameA (user_name, &user_name_len)) - { - strncpy (user_name, "Administrator", MAX_USER_NAME); - debug_printf ("Failed to get current user name. %E"); - } - snprintf (linebuf, sizeof (linebuf), "%s::%u:%u::%s:/bin/sh", user_name, - DEFAULT_UID, DEFAULT_GID, getenv ("HOME") ?: "/"); + snprintf (linebuf, sizeof (linebuf), "%s::%u:%u::%s:/bin/sh", + getlogin (), getuid (), DEFAULT_GID, + getenv ("HOME") ?: "/"); add_pwd_line (linebuf); } passwd_in_memory_p = 1; ____ | AIST Kazuhiro Fujieda | HOKURIKU School of Information Science o_/ 1990 Japan Advanced Institute of Science and Technology