delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/08/05/06:28:22

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:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=CsD7SgpcZk+L4GN7yQc4OzZgcCBjBS0G5nMgctdFG52fmUsnWqKax
6IJGRDeVZJ1D1X0sERH35RqP/M3+fWJcGrTuSBHzOJcFwZc2VI0Mfw4sC7/3EhQ3
xbxTF/lYXvtrsEr/d2jWmuI2GxHT5BBBed2FGKEyjBdXMEuILGbvx8=
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:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=Ln4lU92YkFZdZ5BMG6RwL98uxHY=; b=RWlXrfdNKtIunj+DdOR4b+0o+phG
8kA5obw/vOpnTjvHipgTptWC8FluD87766Fb3CNwXdYAx8RzjDdnzCzF5LidfD/y
IswDBOYjcRmpfsXrRqyPEAkxrMw7jGxVrOColX6KyS9RfyYkC+hiMp7kr1qHr3t+
z6CjMb5qlpxqFWQ=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=-95.0 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_BRBL_LASTEXT,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=accounts
X-HELO: calimero.vinschen.de
Date: Fri, 5 Aug 2016 12:27:51 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: /dev/ptmx fails with Azure accounts
Message-ID: <20160805102751.GK25811@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <1470156870 DOT 684316691 AT apps DOT rackspace DOT com> <20160803143207 DOT GB17526 AT calimero DOT vinschen DOT de> <1470243211 DOT 01868925 AT apps DOT rackspace DOT com> <20160803180012 DOT GC25811 AT calimero DOT vinschen DOT de> <20160803181649 DOT GD25811 AT calimero DOT vinschen DOT de> <1470251109 DOT 311822327 AT apps DOT rackspace DOT com> <20160804070058 DOT GA2333 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20160804070058.GA2333@calimero.vinschen.de>
User-Agent: Mutt/1.6.2 (2016-07-01)

--RNGrj7vazCqBHNw7
Content-Type: multipart/mixed; boundary="kswDJesP0akhmDn8"
Content-Disposition: inline


--kswDJesP0akhmDn8
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Aug  4 09:00, Corinna Vinschen wrote:
> On Aug  3 15:05, rmora AT aboutgolf DOT com wrote:
> > [...]
> > Unknown+User AT Lenovo-PC /cygdrive/c/cygwin64
> > $ ./azure-check2
> >   Sid: S-1-12-1-2043906341-1249388050-2635137163-399631282
> > Dom\Name: AzureAD\RussellMora
> > Primary Group:
> >   Sid: S-1-12-1-2043906341-1249388050-2635137163-399631282
> >   Dom\Name: AzureAD\RussellMora
> > NetUserGetInfo: 53
> >=20
> > Unknown+User AT Lenovo-PC /cygdrive/c/cygwin64
> > $
> >=20
> > (As an aside, I assume that the fact that the permissions on the
> > compiled executable are totally messed up, and thus the executable
> > won't run until I fix them via Windows, is incidental to the fact that
> > I am running under "Unknown+User" and thus you don't want any
> > information on that as well.....)
>=20
> Good thinking :)
>=20
> Can you please try the attached testcase?  Probably my last straw.  If
> that doesn't work as desired, support for AzureAD accounts will be very
> limited.

I guess you're already on vacation, but never mind.

I improved my testcase a bit and attached it to this mail.  Can you please
try this one when you're back?


Thanks a lot,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--kswDJesP0akhmDn8
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="azure-check2.c"
Content-Transfer-Encoding: quoted-printable

#include <stdio.h>
#include <wchar.h>
#define _WIN32_WINNT 0x0a00
#define WINVER 0x0a00
#include <windows.h>
#include <lm.h>
#include <dsgetdc.h>
#include <sddl.h>

int
main ()
{
  HANDLE tok;
  PTOKEN_USER tp =3D (PTOKEN_USER) malloc (65536);
  DWORD ret;
  LPSTR str;
  WCHAR name[256];
  WCHAR dom[256];
  DWORD nlen, dlen;
  SID_NAME_USE type;
  PDOMAIN_CONTROLLER_INFOW pci;
  NET_API_STATUS status;
  PUSER_INFO_3 ui3;
  PUSER_INFO_24 ui24;

  if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &tok))
    {
      printf ("OpenProcessToken: %u\n", GetLastError ());
      return 1;
    }
  if (!GetTokenInformation (tok, TokenUser, tp, 65536, &ret))
    {
      printf ("GetTokenInformation(user): %u\n", GetLastError ());
      return 1;
    }
  ConvertSidToStringSidA (tp->User.Sid, &str);
  printf ("  Sid: %s\n", str);
  LocalFree (str);
  nlen =3D dlen =3D 256;
  if (LookupAccountSidW (NULL, tp->User.Sid, name, &nlen,=20
			 dom, &dlen, &type))
    printf ("Dom\\Name: %ls\\%ls\n", dom, name);
  else
    printf ("LookupAccountSidW: %u\n", GetLastError ());

  ret =3D DsGetDcNameW (NULL, dom, NULL, NULL,
		      DS_IS_FLAT_NAME | DS_RETURN_DNS_NAME, &pci);
  if (ret !=3D ERROR_SUCCESS)
    {
      printf ("DsGetDcNameW: %u\n", status);
      pci->DomainControllerName =3D NULL;
    }

  status =3D NetUserGetInfo (NULL, name, 3, (PBYTE *) &ui3);
  if (status !=3D NERR_Success)
    printf ("NetUserGetInfo(NULL, 3): %u\n", status);
  else
    {
      printf ("UserInfo NULL, 3:\n");
      printf ("  Name: %ls\n", ui3->usri3_name);
      NetApiBufferFree (ui3);
    }
  status =3D NetUserGetInfo (NULL, name, 24, (PBYTE *) &ui24);
  if (status !=3D NERR_Success)
    printf ("NetUserGetInfo(NULL, 24): %u\n", status);
  else
    {
      printf ("UserInfo NULL, 24:\n");
      printf ("  InternetIdentity: %d\n", ui24->usri24_internet_identity);
      printf ("  Flags: 0x%08x\n", ui24->usri24_flags);
      printf ("  ProviderName: %ls\n", ui24->usri24_internet_provider_name);
      printf ("  PrincipalName: %ls\n", ui24->usri24_internet_principal_nam=
e);
      ConvertSidToStringSidA (ui24->usri24_user_sid, &str);
      printf ("  Sid: %s\n", str);
      LocalFree (str);
      NetApiBufferFree (ui24);
    }

  if (pci->DomainControllerName)
    {
      status =3D NetUserGetInfo (pci->DomainControllerName, name,
			       3, (PBYTE *) &ui3);
      if (status !=3D NERR_Success)
	printf ("NetUserGetInfo(%ls, 3): %u\n", pci->DomainControllerName, status);
      else
	{
	  printf ("UserInfo %ls, 3:\n", pci->DomainControllerName);
	  printf ("  Name: %ls\n", ui3->usri3_name);
	  NetApiBufferFree (ui3);
	}

      status =3D NetUserGetInfo (pci->DomainControllerName, name,
			       24, (PBYTE *) &ui24);
      if (status !=3D NERR_Success)
	printf ("NetUserGetInfo(%ls, 24): %u\n",
		pci->DomainControllerName, status);
      else
	{
	  printf ("UserInfo %ls, 24:\n", pci->DomainControllerName);
	  printf ("  InternetIdentity: %d\n", ui24->usri24_internet_identity);
	  printf ("  Flags: 0x%08x\n", ui24->usri24_flags);
	  printf ("  ProviderName: %ls\n", ui24->usri24_internet_provider_name);
	  printf ("  PrincipalName: %ls\n", ui24->usri24_internet_principal_name);
	  ConvertSidToStringSidA (ui24->usri24_user_sid, &str);
	  printf ("  Sid: %s\n", str);
	  LocalFree (str);
	  NetApiBufferFree (ui24);
	}
    }

  return 0;
}

--kswDJesP0akhmDn8--

--RNGrj7vazCqBHNw7
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXpGonAAoJEPU2Bp2uRE+gMoIQAIXL+vV5dNrsGyL6Grm1IB7f
LmcHJmSQc+s3azRvIYZwDRt29lhXfrTLAMEn+qNk+56v/flLUtV81qPkAhuQGrDX
/OSh7YRoJMsKQJFT3hMFhQrhTdajGM57Sb0zgtGVmLxcjuK9EwcijXhBo81VCVl7
r3b6xRnFpfLiXMmMaInwlGFo84doNbHM0OyfYzgqb7kSxO4+DJ+fBunwfYYKllC8
kMGQCR5VdELaR4KrRyBgzWsxTmHgfV6eaKj6TSxsZeHLPdExu0ztRTP4iyZ+WjZ/
XoPGq0U41F2FVwzK/Cab6gJKzYDvhqpKyrB5YhjhbBIVab5MHNl6XNfUqioNg4zb
8wW/Q+B2wHLZkExrOnbEIIn0ucgfmCvLDPHwylyh52EN3MJN4K8jdw0hgBujPU2E
2tejn2Nr8AtMmBJw3MSsTYfp0Uw+oEEJRucHf6D647hWGcu1LFbnV2JoLL//CHZC
ThMJNAnXlLKdyw1qK+URs3rfHgOOyh0tkselcL5KTkPsStRLTCxrVb9mGjg1eQK9
gJZ57eNTxeHLWSkdTF3K9/0MqxsnBsOb4zNvCEXKKKDGZokQ/KIsrukbCEcs2SHW
jPErVurjZGqMdMk96h4y1N8T8CQxkpNTzgja2FU+dV3Wv4pLgBQ3Yr4Zs1JFpsN9
12Gj+2k052pazbf5bj9K
=RaOP
-----END PGP SIGNATURE-----

--RNGrj7vazCqBHNw7--

- Raw text -


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