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:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=mmnGw KmsF/azkC+FUKnbxQkWtj8XEcKtEIOQyMg0uKVVuw9r5VSK8aaC3/VKOeLKk9AIl L3z8i8fv1jeDtgyvvUWoo1cP9CGi13ZzI65CGgUHecZm7DNGwct04gyNns1Pc9LA rEeIlhsnBMLzpa2xN9I2qvCLlYjmZnwEm0XxvU= 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:in-reply-to :references:mime-version:content-type; s=default; bh=1Stbk81Y/zh 7lz4QCFYMVA0Q4wo=; b=k3DpFvzo7Wy8CmRDkJNu9PANtHEdTtLy3if3GtbUkC2 5P8d5wfsI++QU9558M6s/JGbUix+c+kxt8JiF4u2h+cyZRVkI7Y67GNVd2Z0828n xdtpB7NYcjkTGEPgAP0Iu/GGNXOpDDWgXbQs/Y8hPLzPYqIkjOmltNgrt6Scpr/c = 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-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=Repin, andrey, repin, Andrey X-HELO: conssluserg-06.nifty.com DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com x28E1WWH028408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1552053694; bh=DX7oC1VOOBpRsANefAb8miz+eHh8jzqNTHd3mbVbCRY=; h=Date:From:To:Subject:In-Reply-To:References:From; b=YVXXt4tC1zEql0nb7PuQE0AQa69qXtg8ai8us2XRaCiBc8VWnPW15Sc3DJ+oApipQ g2UIPSmWISGL917c3QQLCsrlPZMRGc5rBIrx3/gKhay+1I5kDXobxkVcSMiFC9VD6C r8JbaksS6a3J3RWJnMYUgnXtMnGPuMAbif40yaAfWpvEOCuW2a6Zen5nKfAB9j7OOk FWwiM6WTgbXynsCfeLFWE5SR+kLeEbrOA5PCmPjrhARNo8Cow3tNv7e951sn4kWYtZ L9WJScmTOI3CLC/0cSyJ0o53WlXH9HBvp+ARLNIYICrwM0EHhmnNWuUZdjXmFIP6nh rtwKi8n4kYU2g== Date: Fri, 8 Mar 2019 23:01:38 +0900 From: Takashi Yano To: cygwin AT cygwin DOT com Subject: Re: Logging-in using ssh elevates the user privilege. Message-Id: <20190308230138.b7f6b5ac90c9a14cde2647c1@nifty.ne.jp> In-Reply-To: <51233666.20190307182445@yandex.ru> References: <20190307010000 DOT fc28b73739c2dd66e609982b AT nifty DOT ne DOT jp> <381052629 DOT 20190307141955 AT yandex DOT ru> <51233666 DOT 20190307182445 AT yandex DOT ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Fri__8_Mar_2019_23_01_38_+0900_rK2uvNdCkxncHjZu" X-IsSubscribed: yes --Multipart=_Fri__8_Mar_2019_23_01_38_+0900_rK2uvNdCkxncHjZu Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello, Thank you for the information. On Thu, 7 Mar 2019 18:24:45 +0300 Andrey Repin wrote: > > GNU screen freeze without much of an effort under Cygwin. > > Try detaching from running screen and then running screen -ls. > > Past discussion > http://sourceware.org/ml/cygwin/2017-05/msg00448.html > mid:16810313565 DOT 20170527142723 AT yandex DOT ru I looked into this problem of GNU screen and found the cause is very different from that of the problem I had reported. The problem I had reported is due to the failure of sending signal, which is caused by mismatch of tokens between ssh session and mintty session. On the other hand, the problem you mentioned is due to the difference in the behaviour of socket API. In Linux, connect() in the client returns befor the server calls accept(). However, in cygwin, connect() does not return until the server calls accept(). Attached test code clarifies the difference. [Result in Linux] Server: Created. Server: Binded. Server: Listened. Client: Created. Client: Connected. Client: Written. Server: Accepted. 10: 1234567890 Server: Read. [Result in Cygwin] Server: Created. Server: Binded. Server: Listened. Client: Created. Server: Accepted. Client: Connected. Client: Written. 10: 1234567890 Server: Read. I am not sure why cygwin behaves differently from linux. -- Takashi Yano --Multipart=_Fri__8_Mar_2019_23_01_38_+0900_rK2uvNdCkxncHjZu Content-Type: text/x-csrc; name="sockunix.c" Content-Disposition: attachment; filename="sockunix.c" Content-Transfer-Encoding: 7bit #include #include #include #include #include #include #include #include #include #include #define SOCKNAME "sock_unix_test" int main() { int fd; struct sockaddr_un sunx; pid_t pid; ssize_t len; char buf[BUFSIZ]; memset(&sunx, 0, sizeof(sunx)); sunx.sun_family = AF_UNIX; strncpy (sunx.sun_path, SOCKNAME, sizeof(sunx.sun_path) -1 ); pid = fork(); if (pid) { int fd1; fd = socket(AF_UNIX, SOCK_STREAM, 0); printf("Server: Created.\n"); if (fd < 0) { perror("socket"); goto end_server; } if (bind(fd, (struct sockaddr *)&sunx, sizeof(sunx)) < 0) { perror("bind"); goto end_server; } printf("Server: Binded.\n"); if (listen(fd, 1) < 0) { perror("listen"); goto end_server; } printf("Server: Listened.\n"); usleep(2000000); fd1 = accept(fd, 0, 0); if (fd1 < 0) { perror("accept"); goto end_server; } printf("Server: Accepted.\n"); while ((len = read(fd1, buf, sizeof(buf))) > 0) { buf[len] = '\0'; printf("%d: %s\n", len, buf); } printf("Server: Read.\n"); close(fd1); end_server: close(fd); kill(pid, SIGTERM); wait(NULL); if (unlink(SOCKNAME) < 0) { perror("unlink"); } } else { usleep(1000000); fd = socket(AF_UNIX, SOCK_STREAM, 0); printf("Client: Created.\n"); if (fd < 0) { perror("socket"); goto end_client; } if (connect(fd, (struct sockaddr *)&sunx, sizeof(sunx)) < 0) { perror("connect"); goto end_client; } printf("Client: Connected.\n"); write(fd, "1234567890", 10); printf("Client: Written.\n"); end_client: close(fd); } return 0; } --Multipart=_Fri__8_Mar_2019_23_01_38_+0900_rK2uvNdCkxncHjZu Content-Type: text/plain; charset=us-ascii -- 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 --Multipart=_Fri__8_Mar_2019_23_01_38_+0900_rK2uvNdCkxncHjZu--