From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2742 invoked by alias); 21 Aug 2014 16:44:07 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 2728 invoked by uid 89); 21 Aug 2014 16:44:06 -0000 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 Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Aug 2014 16:44:05 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id ECB6E8E0789; Thu, 21 Aug 2014 18:44:02 +0200 (CEST) Date: Thu, 21 Aug 2014 16:44:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: connect() hangs on a listen()ing AF_UNIX socket Message-ID: <20140821164402.GB21065@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <53F61B70.2020600@t-online.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) X-SW-Source: 2014-08/txt/msg00422.txt.bz2 --R3G7APHDIzY6R/pk Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2141 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 Content-length: 819 -----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--