X-Recipient: archive-cygwin@delorie.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=d/JiPhkymQueac5N1pHE1Fps+2maq3fLKg04ojr2KCn
	syrY+EmSNv80LA7rBjkhNIV5lqshh/l/JOslu/acX+7zH90vKwfru0BJQ3+pgeq4
	W1x5TKnAxXsZTrLHNGjocKocjTjgNlA0hNi6zAgaMVCpiVdrbEXg/4TvV6n+cuHQ
	=
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=7yTkZgjWLo0y/tS1wWtB++Mz6PQ=; b=STD0hICNL4IYkjWgf
	O3QHcneRp3LeO4PYrTuuUokBaVUr6kL0Q+rwwdX4OEcRI7sbxAmk4Hon9wEcEMcC
	2989Up7+GQUSVEdbkhUMj/K+UT9dqj3YEC4y1sB1CT/iJsWrC4ujf4bT42ZU8ZH3
	T3mH5Z1YcTi2k83jZaAx+zDPss=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: mailout06.t-online.de
Message-ID: <5424259D.2090304@t-online.de>
Date: Thu, 25 Sep 2014 16:24:29 +0200
From: Christian Franke <Christian.Franke@t-online.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@cygwin.com
Subject: Re: connect() hangs on a listen()ing AF_UNIX socket
References: <53F61B70.2020600@t-online.de> <20140821164402.GB21065@calimero.vinschen.de> <53F6450C.3070007@t-online.de> <20140822093923.GA12878@calimero.vinschen.de> <53F78CB1.9080406@t-online.de> <20140822201622.GM32314@calimero.vinschen.de> <53FCD9EC.1080703@t-online.de> <20140826205643.GD5740@calimero.vinschen.de>
In-Reply-To: <20140826205643.GD5740@calimero.vinschen.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Corinna Vinschen wrote:
> On Aug 26 21:03, Christian Franke wrote:
>> Corinna Vinschen wrote:
>>> Sounds like a nice idea.  We should try that.  I'm just not sure how
>>> much time I have left to work on this before my vaca next month.  Do you
>>> have fun to look into that?  We have waited so long for postfix, I guess
>>> a couple more weeks won't really hurt.
>> OK, will try that
> Cool!  Don't hesitate to discuss implementation details on the
> cygwin-developers list.

Unfortunately, a very first prototype did not work. If receiving of 
secret+cred is delayed until first send()/recv(), postfix hangs in first 
send() after the connect(). During startup, the postfix master calls 
connect() and first client send() before corresponding server accept() 
is called.

So I decided to provide a intermediate solution for now, see:
https://cygwin.com/ml/cygwin-patches/2014-q3/msg00015.html

For the long term, this approach may work or not:
Remove the complete handshake over TCP. Maintain a table of current TCP 
connections in the socket "file". The table contains pid, TCP port and 
credentials for the server which did the (first) listen() call and for 
all connected clients. Some hashes could be added to check for validity.


>> Postfix apparently pushes Cygwin to its limits. With a test cygwin1.dll
>> where the secret+cred exchange is fully disabled, postfix starts up but
>> queuing of mail fails.
>>
>> This is because fchmod() is called on a file rename()d after open():
>>
>> fd = open("tempfile", ., 0600);
>> // use fd's inode number and current time to create unique "queuefile".
>> rename("tempfile", "queuefile");
>> write(fd, "SOME MAIL....", .);
>> fchmod(fd, 0700); // fails with ENOENT on Cygwin (because it does a
>> chmod("tempfile",.)?)
>> close(fd);
> I fixed that in CVS (and I'm just generating a snapshot).

Works with postfix.

Thanks,
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

