delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2002/07/13/12:54:14

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Date: Sat, 13 Jul 2002 12:54:15 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Corinna or Pierre please comment? [jason AT tishler DOT net: Re: setuid() problem when disconnected from PDC under 1.3.12-2]
Message-ID: <20020713165415.GB30143@redhat.com>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: cygwin-developers AT cygwin DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.3.23.1i

----- Forwarded message from Jason Tishler <jason AT tishler DOT net> -----

From: Jason Tishler <jason AT tishler DOT net>
To: cygwin AT cygwin DOT com
Subject: Re: setuid() problem when disconnected from PDC under 1.3.12-2
Date: Sat, 13 Jul 2002 10:58:23 -0400
Mail-Followup-To: cygwin AT cygwin DOT com
In-reply-to: <20020712120736 DOT GA2372 AT tishler DOT net>
Mail-followup-to: cygwin AT cygwin DOT com

On Fri, Jul 12, 2002 at 08:07:36AM -0400, Jason Tishler wrote:
> On Tue, Jul 09, 2002 at 11:44:33PM -0400, Matt Swift wrote:
> > A recent upgarde of openssh has broken incoming ssh service.  When I
> > debug the sshd, I see the error below in the Event Viewer...
> > [snip]
> > fatal: setuid 1006: Permission denied.
> 
> I am experiencing a possibly related problem with sshd under 1.3.12-2.
> If I ssh to my laptop when disconnected from my PDC, then key exchange
> fails with the above error.

The following is a snippet from a strace (of the attached setuid.cc
running under the LocalSystem account) that shows what is happening in
the above case:

  123  148512 [main] setuid 2672 seteuid32: uid: 19695 myself->gid: 18
  192  148704 [main] setuid 2672 seteuid32: Process token not verified
 1659  150363 [main] setuid 2672 set_process_privilege: 0 = set_process_privilege (SeCreateTokenPrivilege, 1)
 1438  151801 [main] setuid 2672 extract_nt_dom_user: pw_gecos = A011350 (Jason Tishler,U-PALO-ALTO\JATIS,S-1-5-21-136257377-364972176-1563891627-119695)
2305210 2457011 [main] setuid 2672 seterrno_from_win_error: ../../../../src/winsup/cygwin/security.cc:278 windows error 2453
                                        ^^^^
                                        ****
  384 2457395 [main] setuid 2672 geterrno_from_win_error: unknown windows error 2453, setting errno to 13

Note that the Windows error 2453 corresponds to NERR_DCNotFound.

The corresponding code from the Cygwin DLL is:

BOOL
get_logon_server (const char *domain, char *server, WCHAR *wserver)
{
  ...
  /* Try to get the primary domain controller for the domain */
  sys_mbstowcs (wdomain, domain, INTERNET_MAX_HOST_NAME_LENGTH + 1);
  if ((ret = NetGetDCName (NULL, wdomain, (LPBYTE *) &buf)) == STATUS_SUCCESS)
    {
      ...
    }
  __seterrno_from_win_error (ret);
  return FALSE;
}

So, it seems that get_logon_server() will always fail for domain users
when they are disconnected from their PDC.

I haven't figured out how to fix the above yet but at least I have
better characterized the problem.

Jason

#include <stdio.h>
#include <sys/errno.h>
#include <unistd.h>
#include <stdlib.h>

int
main(int argc, char* argv[])
{
	int uid = 500;
	if (argc > 1)
		uid = atoi(argv[1]);
	int s = setuid(uid);
	if (s == -1)
		printf("setuid failed with errno = %d\n", errno);

	return 33;
}


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

----- End forwarded message -----

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019