www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/06/08/13:13:05

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
From: Chris Faylor <cgf AT cygnus DOT com>
Date: Tue, 8 Jun 1999 13:13:46 -0400
To: Egor Duda <deo AT logos-m DOT ru>
Cc: cygwin-developers <cygwin-developers AT sourceware DOT cygnus DOT com>
Subject: Re: default /etc/passwd contents
Message-ID: <19990608131346.A1137@cygnus.com>
References: <0873 DOT 990608 AT logos-m DOT ru>
Mime-Version: 1.0
X-Mailer: Mutt 0.95.3i
In-Reply-To: <0873.990608@logos-m.ru>; from Egor Duda on Tue, Jun 08, 1999 at 08:57:50PM +0400

Hopefully Corinna will respond to this.  I don't know how it impacts
her security changes.

If we are going to add a dummy line, why not actually make it meaningful
and have it default to the current users's name, uid and gid?

-chris

On Tue, Jun 08, 1999 at 08:57:50PM +0400, Egor Duda wrote:
>  What do you think about changing cygwin behavior in case when
>/etc/passwd file isn't found? I think that it would be ok to create
>single entry in passwd_buf of some "default user", who cannot own any
>files and does not belong to any existing group. Something like
>
> "cygwin_default::<DEFAULT_UID>:<DEFAULT_GID>::<value of $HOME>:none"
>
>Just like it's done for groups?
>
>I feel that it would be quite safe, if <DEFAULT_UID> and <DEFAULT_GID>
>will be assigned to some "reserved" values, i.e. not to be equal to
>any of real Windows UIDs and GIDs. I've made such patch and it saves
>me a lot of time while adopting cygwin port of ssh to be run on any
>machine even without cygwin installed.
>
>Egor.            mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19
>
>Index: passwd.cc
>===================================================================
>RCS file: /usr/local/src/cvs/cygnus/cygwin/winsup/passwd.cc,v
>retrieving revision 1.1.1.1
>diff -u -2 -r1.1.1.1 passwd.cc
>--- passwd.cc   1999/04/10 14:55:02     1.1.1.1
>+++ passwd.cc   1999/06/08 16:52:53
>@@ -106,10 +106,9 @@
> read_etc_passwd ()
> {
>+    char linebuf[1024];
>     FILE *f = fopen ("/etc/passwd", "r");
>
>     if (f)
>-    {
>-       char linebuf[1024];
>-
>+      {
>        while (fgets (linebuf, sizeof (linebuf), f) != NULL)
>          {
>@@ -119,5 +118,10 @@
>
>        fclose (f);
>-    }
>+      }
>+    else
>+      {
>+        snprintf ( linebuf , sizeof ( linebuf ) , "cygwin_default::500:500::%s:none" , getenv ( "HOME" ) ) ;
>+        add_pwd_line ( linebuf ) ;
>+      }
>     passwd_in_memory_p = 1;
> }
>
>

-- 
cgf AT cygnus DOT com
http://www.cygnus.com/

- Raw text -


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