From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) by sourceware.org (Postfix) with ESMTPS id 914BF3858031 for ; Thu, 6 May 2021 08:35:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 914BF3858031 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=corinna-cygwin@cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MkpOZ-1lGTHN3Aq7-00mKxD for ; Thu, 06 May 2021 10:35:34 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id AE1D1A80DBD; Thu, 6 May 2021 10:35:33 +0200 (CEST) Date: Thu, 6 May 2021 10:35:33 +0200 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: python > 3.5: Issue with unix domain sockets Message-ID: Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: <1620046759893.5340@bmw.de> <2cde4128-6a3d-7431-6608-a2184d23964a@cornell.edu> <134fa003-836f-1184-79eb-e31dfd852a64@maxrnd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:KD9kZZhyxJJHHvy6X9Hc4eu1ZCOYlq5EuoWoDThyermeUFI+YXV gYr6cy6dELDEOdN9T9PJMcTGbUyT+BlDa2AbNpOK8PAOr/X2ustHTjjSFcpqjaHYuO3LVs7 3fhdhk9pqgbk+SVzd8druL3LjipTAZV/mKIU8IgAp2IUcMPy94+5iK9WALroN721jM0zbI/ iuwYTDJY9yLm+h6zX2MHw== X-UI-Out-Filterresults: notjunk:1;V03:K0:dY8WLAQNFGY=:CEmMbPXqZa0FA8TURYQt1i KaRtGfAyHSp9jm22phDNVh2mJInTqinXFSDUt+0qnEaaeAt5zX4pV96rnpd58+xJ4aaltCElC pWTTBEn+MRwYa4dKYoU9hkn1UWhzpwGoS9q9fRStXyschQP9gq/0IrL+vD4LQmi3OqrT/VZdR 95zv9eUKBd4/puMS7ZJJi+q37ms2GhDtrci6g7FbA0aLKVDaxl0Ca20SsKqL9rQD6aDW1ArTG lf13A8FTaWVkcYKLk2BJDQVXDeXn5mptnSlSbU/eSCo4MI2vUmsdVFBnQqtJ3Fkyb4RU9wpT9 FE1qOdm3f2qORbSNBzU3RnuPGO8l4tG0DzwdrbbwYh20Cxmd0DgvxGxqBC967HLJgy3/20h4f PKG3YXJEebVwrELh0J0iKd7c7kn1SxlbGElIKDbvBb6pyL8U/h+8JWbaGSr2ux2BfEpLbirYF PVdnJeEaNd7jnsPdqH32RMm1yLdb5FBgWHWbi7EnVksqhRWoYVO1Z+Dz0rNqX4qsZm8Of1PtX 02sD5nHyus2JXv6FWraxkc= X-Spam-Status: No, score=-100.3 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 08:35:38 -0000 On May 4 22:04, Mark Geisert wrote: > Corinna Vinschen wrote: > > On May 4 02:45, Mark Geisert wrote: > > > [blah blah...] > > You're supposed to call the special setsockopt(SO_PEERCRED) on the > > accepting socket. The no_getpeereid property is inherited by the > > accepted socket. > > Ah, of course. Well, I couldn't figure out a way to do the setsockopt() > call some times but not others, because Python can't reach into the Cygwin > DLL. Nor should it. > > Since this Python patch is supposed to be a temporary workaround, I took the > tack that it should just ignore an error return from > setsockopt(SO_PEERCRED). In this fashion the handshake will be turned off > when it can be, and when it can't (on the accepted socket) the attempt will > error but that error will be ignored. Sorry Mark, but I don't understand how you concluded that ignoring the error from setsockopt(SO_PEERCRED) is the solution I pointed out above. The right thing to do is to call setsockopt(SO_PEERCRED) (and check its return value) before calling listen() on the accepting socket. The no_getpeereid property gets propagated to the accepted sockets and thus there's no need to call it again for these sockets. Corinna