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:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=KCfh YBrMKWKooGZ8t56iqLz0KsBAUEqePxcp/u7xbhMuPTs9Hmyko6DQc4bQ0FCqnwnB UzVdNZBSjppcrskkXT16ZuNVVN3nqLnI6Gljs4cBvxn4Jf49+FoLYqZr+LH1WKFQ GkUqGRCnT0V8whgO9wP6GMC5FWLyFfHUZw4JRHE= 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:references :mime-version:content-type:in-reply-to; s=default; bh=PmQCo+Ky8h jOSYLOJYegIBWv02I=; b=pKX6odzoGSjM7kra2Cw3q5nvA24eETeA6TGE9Pa2p1 ZpjewruOJS6lszdAkQhCPuzRlj2ZxYwMTjJBDBJRcy0wSHMIODsX6hEmo1qKJLH4 RWL2WSTx5b75/NX6m5cbblyLYVZ+kwQEez4XqrqzyQCo+t1kEKUVGmE+JXaKipo6 Y= 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-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*F:D*net.au, r13, accounts, H*F:D*au X-HELO: mail108.syd.optusnet.com.au Date: Sun, 7 Aug 2016 13:27:11 +1000 From: Duncan Roe To: cygwin AT cygwin DOT com Subject: Re: /dev/ptmx fails with Azure accounts Message-ID: <20160807032711.GC31990@dimstar.local.net> 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> <20160805102751 DOT GK25811 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160805102751.GK25811@calimero.vinschen.de> User-Agent: Mutt/1.6.1 (2016-04-27) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=VIkg5I7X c=1 sm=1 tr=0 a=/xIuaNGu1NPzt0yKkvdCVQ==:117 a=/xIuaNGu1NPzt0yKkvdCVQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=7z1cN_iqozsA:10 a=EUPAZwX8AAAA:8 a=ycJivO2szCIlMT4d_koA:9 a=CjuIK1q_8ugA:10 a=1V7zw6amHxaEWGzIHHk6:22 X-IsSubscribed: yes On Fri, Aug 05, 2016 at 12:27:51PM +0200, Corinna Vinschen wrote: > 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 > > > > > > Unknown+User AT Lenovo-PC /cygdrive/c/cygwin64 > > > $ > > > > > > (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.....) > > > > Good thinking :) > > > > 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 > > -- > Corinna Vinschen Please, send mails regarding Cygwin to > Cygwin Maintainer cygwin AT cygwin DOT com > Red Hat > #include > #include > #define _WIN32_WINNT 0x0a00 > #define WINVER 0x0a00 > #include > #include > #include > #include > > int > main () > { > HANDLE tok; > PTOKEN_USER tp = (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 = dlen = 256; > if (LookupAccountSidW (NULL, tp->User.Sid, name, &nlen, > dom, &dlen, &type)) > printf ("Dom\\Name: %ls\\%ls\n", dom, name); > else > printf ("LookupAccountSidW: %u\n", GetLastError ()); > > ret = DsGetDcNameW (NULL, dom, NULL, NULL, > DS_IS_FLAT_NAME | DS_RETURN_DNS_NAME, &pci); > if (ret != ERROR_SUCCESS) > { > printf ("DsGetDcNameW: %u\n", status); > pci->DomainControllerName = NULL; > } > > status = NetUserGetInfo (NULL, name, 3, (PBYTE *) &ui3); > if (status != 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 = NetUserGetInfo (NULL, name, 24, (PBYTE *) &ui24); > if (status != 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_name); > ConvertSidToStringSidA (ui24->usri24_user_sid, &str); > printf (" Sid: %s\n", str); > LocalFree (str); > NetApiBufferFree (ui24); > } > > if (pci->DomainControllerName) > { > status = NetUserGetInfo (pci->DomainControllerName, name, > 3, (PBYTE *) &ui3); > if (status != 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 = NetUserGetInfo (pci->DomainControllerName, name, > 24, (PBYTE *) &ui24); > if (status != 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; > } Hi Corrina, I've been trying your tests out of interest (no Axure accounts here), and they all worked except this last one which segfaults: 13:24:12$ gcc -g -o azure-check2 azure-check2.c -lnetapi32 13:24:21$ ./azure-check2 Sid: S-1-5-21-3870155988-15194067-1289216332-1002 Dom\Name: ROCKSTAR\Duncan DsGetDcNameW: 0 Segmentation fault (core dumped) 13:24:28$ cat azure-check2.exe.stackdump Exception: STATUS_ACCESS_VIOLATION at rip=001004012D6 rax=000000018027AB4C rbx=00000000FFFFCC60 rcx=0000000600000060 rdx=0000000000000000 rsi=000000018034A4D0 rdi=00000000FFFFCDF0 r8 =00000000FFFFC4AC r9 =00000001801523B0 r10=0000000100000000 r11=00000001004012D2 r12=0000000000000000 r13=0000000000000000 r14=0000000000000000 r15=0000000000000000 rbp=00000000FFFFC7F0 rsp=00000000FFFFC770 program=C:\cygwin64\home\dunc\tests\azure-check2.exe, pid 5824, thread main cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B Stack trace: Frame Function Args 000FFFFC7F0 001004012D6 (00000000020, 30001000000FF00, 00180047B61, 000FFFFD680) 000FFFFCCC0 00180047BD2 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 0018004591C (00000000000, 00000000000, 00000000000, 00000000000) 000FFFFFFF0 001800459B4 (00000000000, 00000000000, 00000000000, 00000000000) End of stack trace Cheers ... Duncan. -- 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