cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2003/03/07/10:44:56

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
Date: Fri, 7 Mar 2003 16:44:50 +0100
From: Corinna Vinschen <vinschen AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Re: Winsock closesocket() problem
Message-ID: <20030307154450.GF20194@cygbert.vinschen.de>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: cygwin-developers AT cygwin DOT com
References: <20030306144658 DOT GB2008 AT tishler DOT net> <3E6762CA DOT 8EF5B6A8 AT ieee DOT org> <20030306154047 DOT GC2008 AT tishler DOT net> <20030307131445 DOT GC20194 AT cygbert DOT vinschen DOT de> <3E68ADBF DOT 77EF953F AT ieee DOT org>
Mime-Version: 1.0
In-Reply-To: <3E68ADBF.77EF953F@ieee.org>
User-Agent: Mutt/1.4i

On Fri, Mar 07, 2003 at 09:33:35AM -0500, Pierre A. Humblet wrote:
> Corinna Vinschen wrote:
> > I even tried reverting the uid/gid to SYSTEM but it still fails in the
> > same way.
> 
> Where in the code did you revert? Did you try setting the gid to Admins?

Everywhere.  I tried

  revert_ids
  close(fd2)
  close(fd)

  close(fd2)
  revert_ids
  close(fd)

  revert_ids
  close(fd)
  close(fd2)

  close(fd)
  revert_ids
  close(fd2)

Reverting means, setting back to the original uid/gid pair system/admins.

> > And as you wrote, running under gdb or strace, everything's fine. 
> 
> My hypothesis about that is that strace starts everyting fresh from
> Windows. Otherwise we start from (ba)sh (or cygrunsrv), which may have
> setup/opened "things" for us. 

Might be but what "things"?  The both sockets are also "fresh" and not
shared with any other application.

> > Removing the setgroups() call doesn't change anything.  But removing
> > one of setuid/setgid let the error disappear.
> 
> That's strange because in Jason's environment 4.10 works fine. The main
> difference is that there is no setgroups() in 4.10. Also the close order
> is reversed, but that doesn't seem to matter.

Removing setgroups() is one of the things I did to reduce the code to the
absolutely necessary.  Just FYI, in my environment I used 1004/513 as ids
which is sshd and, obviously, None.  I also tried setting the group to 545
(Users) and 547 (Power Users) which didn't change anything.  sshd is not a
member of any other group besides the inevitable None and Users.

So the situation as I can see (but not understand) is that creating and
using a nonpriv'd token "somehow" disturbs WinSock.  Calling RevertToSelf
(I checked that it gets called) doesn't help.  Waiting a while doesn't help.  

But as you guessed, calling the test application from a plain Win app *does*
help.  I started a ssh session under system account, switched to cmd.exe
and called the test app and the error disappears.

Baffled,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

- Raw text -


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