www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2002/11/12/12:02:46

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Message-ID: <3DD13433.D618DC4F@ieee.org>
Date: Tue, 12 Nov 2002 12:02:43 -0500
From: "Pierre A. Humblet" <Pierre DOT Humblet AT ieee DOT org>
X-Accept-Language: en,pdf
MIME-Version: 1.0
To: cygwin-developers AT cygwin DOT com
Subject: Re: ntsec patch #4: passwd and group
References: <3DCBD52C DOT A1F794FD AT ieee DOT org> <20021108171918 DOT P21920 AT cygbert DOT vinschen DOT de> <3DCBEFF5 DOT 850B999E AT ieee DOT org> <20021111145612 DOT T10395 AT cygbert DOT vinschen DOT de> <3DCFC6BB DOT 570DF472 AT ieee DOT org> <20021111174720 DOT X10395 AT cygbert DOT vinschen DOT de> <3DCFE314 DOT 3B5B45AB AT ieee DOT org> <20021111183423 DOT A10395 AT cygbert DOT vinschen DOT de> <3DCFF8AE DOT 66CBD751 AT ieee DOT org> <20021112144038 DOT F10395 AT cygbert DOT vinschen DOT de>

Corinna Vinschen wrote:
> 
> I'm not sure if we're talking about the same static buffer. 

Right, we were not. What you propose is fine, with two 
caveats:
1) Internal calls (from setuid, stat, etc... ) to getpwuid etc...
should not overwrite the static area 
2) The "maximum useful size" can be very large for the group 
entries. They can have a lot of names in the gr_mem field.

I have another suggestion that would allow keeping what we do now in the
non-reentrant  case (i.e. avoid doing the copying to the static buffer): 
simply never re-read the passwd file when called internally (from
setuid, stat, etc..). Only do it on application calls to pw/gr functions.
I think that's perfectly standard conformant and it won't break anything. 

> "The return value may point to a static area which is overwritten
>  by a subsequent call to getpwent(), getpwnam(), or getpwuid()."
I agree 100%, that's needed by my "other suggestion" above.

>  not required to be reentrant is not required to be thread-safe."
> 
> IMHO that means, we don't even have to care for the mutex thingy.
I agree, we only need a mutex for the thread-safe routines.

> It's ok as it is.  
We still need to do something, either the "copy everything" or the
"don't reread for internal calls". The advantage of the "don't reread" 
is that it's faster (important for internal loops) and requires 
fewer changes. If you don't object I will look further into it,
but not urgently.
The multi-threaded case also needs some work.

Pierre

- Raw text -


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