delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/08/22/20:13:36

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Date: Wed, 22 Aug 2001 20:13:18 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Re: serious problem with cygwin and winsock?
Message-ID: <20010822201318.A6016@redhat.com>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: cygwin-developers AT cygwin DOT com
References: <20010821221717 DOT A27371 AT redhat DOT com> <20010822090825 DOT H17561 AT cygbert DOT vinschen DOT de> <20010822141628 DOT A3643 AT redhat DOT com> <20010822235336 DOT B17930 AT cygbert DOT vinschen DOT de>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <20010822235336.B17930@cygbert.vinschen.de>; from vinschen@redhat.com on Wed, Aug 22, 2001 at 11:53:36PM +0200

On Wed, Aug 22, 2001 at 11:53:36PM +0200, Corinna Vinschen wrote:
>On Wed, Aug 22, 2001 at 02:16:28PM -0400, Christopher Faylor wrote:
>> On Wed, Aug 22, 2001 at 09:08:25AM +0200, Corinna Vinschen wrote:
>> >On Tue, Aug 21, 2001 at 10:17:17PM -0400, Christopher Faylor wrote:
>> >> I've been going crazy this last week trying to figure out a problem
>> >> with cygwin and rshd.  It is one of those problems that disappear if
>> >> you run strace or single step in gdb.
>> >> 
>> >> What happens is that rshd sometimes ends up passing a 0 as the first
>> >> argument to execle when it is supposed to be something like:
>> >> 
>> >> "bash", "-c", "ls", 0
>> >> 
>> >> or whatever.  In my scenario the "bash" is sometimes NULL.
>> >> 
>> >> One thing I noticed is that rshd uses the structure returned by getpwnam
>> >> after calling endpwent.  Anyone know if that is a valid thing to do?
>> >> After calling endpwent, rshd uses the pw_shell part of the structure.
>> >
>> >It's valid. endpwent() isn't defined to destroy some allocated
>> >datastructure. However, the latest developer snapshots could
>> >behave that way if /etc/passwd has changed in the meantime. :-(
>> >The problem is that the getpwXXX functions use the genuine
>> >datastructures allocated by read_etc_passwd() instead of copying
>> >the result into a save static buffer.  Two solutions:
>> >
>> >- Revert the `recognize changes to /etc/passwd (/etc/group)' patch.
>> >
>> >- Let all getpwXXX()/getgrXXX() functions copy their stuff into
>> >  a local static buffer. It could even be exactly one buffer per
>> >  file since SUSv2 states:
>> >  
>> >    "The return value may point to a static area which
>> >     is overwritten by a subsequent call to getpwent(),
>> >     getpwnam() or getpwuid()."
>> 
>> I don't want to revert your change or implement a static buffer right
>> now.
>> 
>> I don't see any reason to reread the passwd file on a call to endpwent,
>> though.  Is there any reason to do this?  Would liminating the
>> 
>>   if (passwd_state  <= initializing)
>>     read_etc_passwd ();
>> 
>> "solve" any potential problem like this?
>
>I removed the above call from setpwent(), endpwent(), setpassent() and
>getpwduid() (which is trash anyway).

Cool!  Thanks.

cgf

- Raw text -


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