delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/08/21/15:14:48

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=wgQ6/sYJhenz6dpuKdLdBs6gV2buUk0xE0TdwCDCzen
KF6p/4q68nObyfESKhqLZAyfnn/q3uAeunfp2CYkHx1a3mi+9ORhNuOaQDmVXaAj
hXJetLTCW9aEnX39PyBVS/D36KZa+DIW7yaoQt06rQpPYlto2l2f2zSqFfjEEHJE
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=lafJeOmKeIM3htNWZIpzc0lmvYE=; b=AmrxTHMBgLvT5OMvt
6R1UAnwdcwzlAGxn4bEOD4NSog2ENADUzhXFOxSwgHnWvHMRPuqYDxFJUM0H/hhz
l58v4WE3I3eR56UnS5GK/gF1i4f72B2qfmEszxFdSBVbo2vVOLZx5XVm/Jblmi5Y
3Wy2QjhHxr0domczw9ngcq9d+4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=no version=3.3.2
X-HELO: mailout12.t-online.de
Message-ID: <53F6450C.3070007@t-online.de>
Date: Thu, 21 Aug 2014 21:14:20 +0200
From: Christian Franke <Christian DOT Franke AT t-online DOT de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 SeaMonkey/2.26.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: connect() hangs on a listen()ing AF_UNIX socket
References: <53F61B70 DOT 2020600 AT t-online DOT de> <20140821164402 DOT GB21065 AT calimero DOT vinschen DOT de>
In-Reply-To: <20140821164402.GB21065@calimero.vinschen.de>
X-IsSubscribed: yes

Corinna Vinschen wrote:
> On Aug 21 18:16, Christian Franke wrote:
>> Corinna Vinschen wrote (in thread "[ITP] libsuexec 1.0"):
>>> Postfix for Cygwin would be *so* nice.  Sigh.  ...
>> Due to the following problem, Postfix hangs during startup (and blocks any
>> possible "[ITP] postfix ..."):
>>
>> If a AF_UNIX socket is in listen()ing state, a client connect() should
>> succeed immediately. On Cygwin, connect() waits until the server site
>> accept()s the connection.
>>
>> Testcase:
>> ...
>>
>>
>> This is likely because fhandler_socket::af_local_connect() waits for some
>> secret. Sending it in af_local_accept() is too late in this case.
>>
>> Unfortunately the event handling of postfix relies on the correct behavior
>> and there is possibly no easy workaround.
> Off the top of my head I don't see one inside the Cygwin DLL :(

Complex but may work: A fhandler_socket::listen() on a 
AF_UNIX/SOCK_STREAM socket starts a thread which accept()s connections, 
performs the handshake and puts the new socket descs in a queue. 
fhandler_socket::accept4() then no longer calls accept() but waits for 
the next entry in the queue.


> The problem is that the package exchange at the start of an
> accept/connect is required to be able to exchange credentials.  This in
> turn is required for getpeereid and the SO_PEERCRED socket option which
> is utilized at least by sshd.

Easier and may work for Postfix: Add a Cygwin specific socket option 
like SO_DONT_NEED_PEERCRED which is set immediately after Postfix calls 
socket(AF_UNIX, SOCK_STREAM). If set, no handshake occurs on 
connect()/accept(). getpeerid()/SO_PEERCRED should fail then.


> Would it help to patch postfix for Cygwin to use a local-only AF_INET
> socket at this point instead?

Postfix heavily relies on unix domain sockets (see master.cf) so this 
would possibly be complex. Such a patch would likely not be accepted 
upstream.

Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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