/dev/ptmx fails with Azure accounts

Duncan Roe duncan_roe@acslink.net.au
Mon Aug 8 12:42:00 GMT 2016


On Mon, Aug 08, 2016 at 09:05:27AM +0200, Corinna Vinschen wrote:
> On Aug  7 13:27, Duncan Roe wrote:
> > 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@aboutgolf.com wrote:
> > > > > [...]
> > > > > Unknown+User@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@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?
> > >[...]
> > Hi Corrina,
>
> s/rr/in/rinn/ :)
>
> > I've been trying your tests out of interest (no Axure accounts here), and they all worked except this last one which segfaults:
>
> That you, I think I see where I made the mistake.  Can you try the
> attached?
>
>
> Thanks,
> Corinna
>
> --
> Corinna Vinschen                  Please, send mails regarding Cygwin to
> Cygwin Maintainer                 cygwin AT cygwin DOT com
> Red Hat

> #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 = (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 = 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)
>     {
>       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;
> }

Runs to completion again,

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



More information about the Cygwin mailing list