Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 23:53:36 +0200 From: Corinna Vinschen To: cygwin-developers AT cygwin DOT com Subject: Re: serious problem with cygwin and winsock? Message-ID: <20010822235336.B17930@cygbert.vinschen.de> Reply-To: cygdev 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010822141628.A3643@redhat.com>; from cgf@redhat.com on Wed, Aug 22, 2001 at 02:16:28PM -0400 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). Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc.