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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=P1wf+bcdki2Cdwzynu/x9GdF0gvAGGIZVJfUBT2SzkVMHyhbDp0yD WfXaryXIamua9bHuQ20QIOaLRhNGtJDx+S1mw1t+/xlY8uZojfUNyeeifFpZCnXZ c299d/YRKmr8puwB0u4ZFnLiSGKIwRSnzYJ6sW12m7reRirwTcUmdU= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=cPjTQ830qR183lSkeCROZGx9Svo=; b=Tzttzzai7F/cN9kwu01vbeLBkI1O nW2pXzYNENEJKAAp8JzvSVHdjbwcS4U/lALSTmB8TjkvGj+eKWm0+crurff3s9oS 1CJfhuaTzmNT+gsdBBU9inS7dlVSXP+KNkJoeAq/cJl+D+63N583keWFkKli7TZ6 fwlyuGWfbYPcyoc= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Date: Thu, 21 Aug 2014 18:44:02 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: connect() hangs on a listen()ing AF_UNIX socket Message-ID: <20140821164402.GB21065@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <53F61B70 DOT 2020600 AT t-online DOT de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="R3G7APHDIzY6R/pk" Content-Disposition: inline In-Reply-To: <53F61B70.2020600@t-online.de> User-Agent: Mutt/1.5.23 (2014-03-12) --R3G7APHDIzY6R/pk Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. ... >=20 > Due to the following problem, Postfix hangs during startup (and blocks any > possible "[ITP] postfix ..."): >=20 > 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. >=20 > Testcase: >=20 > #include > #include > #include > #include >=20 > int main() > { > sockaddr_un sa =3D {AF_UNIX, "testsocket"}; > unlink(sa.sun_path); >=20 > int sd1 =3D socket(AF_UNIX, SOCK_STREAM, 0); > if (sd1 < 0) { > perror("socket"); return 1; > } > if (bind(sd1, (sockaddr*) &sa, sizeof(sa))) { > perror("bind"); return 1; > } > if (listen(sd1, 10) < 0) { > perror("listen"); return 1; > } >=20 > int sd2 =3D socket(AF_UNIX, SOCK_STREAM, 0); > if (sd2 < 0) { > perror("socket"); return 1; > } > printf("connecting to %s ...\n", sa.sun_path); >=20 > // Cygwin hangs here: > if (connect(sd2, (sockaddr*) &sa, sizeof(sa))) { > perror("connect"); return 1; > } >=20 > // Linux & friends arrive here: > printf("connected\n"); > return 0; > } >=20 >=20 > 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. >=20 > 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 :( 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. Would it help to patch postfix for Cygwin to use a local-only AF_INET socket at this point instead? Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --R3G7APHDIzY6R/pk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJT9iHSAAoJEPU2Bp2uRE+gcakP/iXz/xCABiKluoXEtLoK2vqZ /fowabzx3wst9dDd7tqbyXt/q+6kD9MJOY2vtvpTDCcZ+AZfC/UaLpzx229SEr5T 4nUC4NzXZCihmB3zv6sznEOBh2EZxfvRvYzODGooUpyL8CiRD5+xtqrkHorTCFvM QmMdyP1OJeJnGbApWGT1St5GQTcX689aix5fRqJwoN4Mv1mhfU1MhLTZ2JX1RH4T Ie5j1S/gVZqQV+u15ZwmdG3O4EoM/PpXQfHGDlGOeSgl6pojPH18i4iwYleYLNzm 2kttK11dhXq+U4JHT/JhMH51UhgoNlfnW2lkN16MbGBFN0w5sg/G/lxu0RPUxs5c 4SXJs1VaruLsVWLXKEp7ihsxdNmpyakldf0SRvWxEpP84RnmScpdKsxClgRK5cOP WHKfpFIWE9P1xFndpA9BQOF6AMt18vz6xqDxBcp86JKgZKvW7GJicb2Nh96gYqI+ kn+uTx2KOE2FHLfiN7pcBIsZpRjSzi8MhnEeNNG/c/I/aR09PApUuGTEhq/qbjs+ jwPS/69x6rB1IIZciB+Tgc/22S2zhZtVA0JVEker+ARRQ1yk4n8464zbzF2xgcge 6KlfCWvzblfm/G9/VIzbimiEb5lqyYcBfuleLKbOKqT1nAImWzDsKEheZtNTNFbB plxNmIRdTb1Ke5tV5k3d =99Lu -----END PGP SIGNATURE----- --R3G7APHDIzY6R/pk--