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:message-id:from:reply-to:to:subject :references:in-reply-to:content-type; q=dns; s=default; b=yQkwwt HxW1ca1YXwBnWEi2OzGU40rLKqNJ6URzc7nxZ/5fI3e3G2wzYfyYR7olzSbJZ+8R jMIdRDZTvF26wFYOUWbq68E+5yoyFNmJS2vvMrW92bMopbLrhq5EtfO4oxssWVS5 DNnirZtfXNYN4MIK7KrPz9L1ON8FaLF15pjo8= 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:message-id:from:reply-to:to:subject :references:in-reply-to:content-type; s=default; bh=wyoR5mRcS0uq i2j0DfR5zTxCLMg=; b=nip8gX8USJ160QG2ibELR6j8cPShKwPQevNH/loFnTVK ld0xxhtZiqYXVK6pzG71DiniRSch97h6JkU3Q0GWjt5w0Zy6z/RIatzq76bSHP0y eMsxgneHeRA84ruLtn/zVyvxmDyqI4bMDDbJ7z4mTb8yz4dduC2ZVjL+7m7M6vU= 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=-2.1 required=5.0 tests=AWL,BAYES_00,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=huh, disposal, do, it! X-HELO: lb2-smtp-cloud7.xs4all.net Date: Fri, 15 Mar 2019 20:39:20 +0100 Message-ID: <7dcabfa538edb7ed869b8b26205aeee9@smtp-cloud7.xs4all.net> From: Houder Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: Re: sshd: fatal: seteuid XXX : No such device or address References: <011a01d4da5a$96247330$c26d5990$@giraudbtp.com> <20190314172918 DOT GJ3785 AT calimero DOT vinschen DOT de> <20190315134247 DOT GR3785 AT calimero DOT vinschen DOT de> In-Reply-to: <20190315134247.GR3785@calimero.vinschen.de> Content-Type: text/plain; charset=UTF-8; format=fixed User-Agent: mua.awk 0.99 Note-from-DJ: This may be spam On Fri, 15 Mar 2019 14:42:47, Corinna Vinschen wrote: > On Mar 15 14:06, Houder wrote: > > One is forced to create the exact same environment (system) as the > > person who is complaining, fire up the debugger (like sticking > > a thermometer in a patient's rear end) in order to find out where > > the code failed ... > > > > Meaning, within the context of the recent sshd problems, possibly only ^^^^ > > you know where the error ERROR_FILE_INVALID (resulting in the error ^^^ strace, yes. But only if one has the exact same "network" at one's disposal as the one where the problem occurred (like you have at your place; while I only have one simple computer) ... That is decisive. > > message "No such device or address") was generated ... (and by which > > Windows function). > > The only interface an application has is by checking the POSIX > errno value. This is what Cygwin is about :) > > If you need more details what's going on under the hood, you have > to use strace. > > > Oh well, this cannot be helped ... > > Well, there *is* a solution by using strace. And hey, we now know what > ENXIO returned from seteuid means, don't we? It's not all bad :) You do! I do not :-) (as I do not have the machinery at my disposal that is required to provoke this error). A simple STC to emphasize my statement (i.e. a problem that I can strace on my computer). int main() { errno = 0; if (seteuid( (uid_t)1004) != 0) { // 1004, not being me :-) printf("seteuid: errno = %d, errstr = %s\n", errno, strerror(errno) ); // seteuid: errno = 13, errstr = Permission denied => EACCES // ... while only EPERM en EINVAL are documented ... } else printf("1004, OK\n"); } 64-@@ ./seteuid seteuid: errno = 13, errstr = Permission denied ... huh? On Linux this simple "Simple Test Case" will result in: seteuid: errno = 1, errstr = Operation not permitted ... Got it! Fortunately, I have now have the strace output at my disposal: ... studying the strace output and the source code, I am now able to tell what is going on ... see below: seteuid (syscalls.cc) .lsaprivkeyauth (sec_auth.cc) <==== fails; as result NULL (token) is returned by lsaprivkeyauth ... ...lsa_open_policy (sec_auth.cc) <==== fails; as result NULL (lsa) is returned by lsa_open_policy ... # errno, set by lsa_open_policy, is ignored # seteuid() chooses NOT to bail out, but # to attempt "Service For User Logon" (s4u) ... .s4uauth (sec_auth.cc) <==== fails (because LsaRegisterLogonProcess fails), returning the status (0xC0000041) to seteuid() # /usr/include/w32api/ntstatus.h: # defines STATUS_PORT_CONNECTION_REFUSED ((NTSTATUS)0xC0000041) # now seteuid chooses to bail out (i.e. setuid() fails) Q: errno? s4uauth calls __seterrno_from_nt_status (0xC0000041), which in turn calls RtlNtStatusToDosError(0xC0000041), which in turn calls geterrno_from_win_error(5,...): 0xC0000041 is mapped to 5, which in turn is mapped to 13 (EACCES). Henri -- 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