delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/08/03/14:00:44

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=joqM2o/FzatJ8peUSItNqMWQgh7drNhjdkXbG3zaY/8JNiplzVTBW
oYvhplOuJ7p8kdhyz5ZkWyE/t6myikdoupnFjCclTosLklPG3EIKjaF2QqGzN3Qd
P4b+pkDvIK6+nFK6WlrB+cp8lVyMQSH2WqyIpC9ZArSz2kbf8S7P6I=
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=pfkMpJZV0M/ijx8qbLPAvwo0aW8=; b=M2PNn4MCNZBhsyv6GUe2+Y76Vqlg
12mEUoE3gR+qmzMieHmRlxAxMDflfaAIcdQ2xAz+dJiQ02KaJVRFxb/prUYECQ3l
XWv4ZkNGMoaiSRd3VkI2pXvLBS1PX6dGLPl6uic7jdV0C9ZlbrgbfUmbNiY24dKH
2asfiT9YD7jhJ6Y=
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=Administrator, H*f:sk:1470243, H*MI:sk:1470243, H*i:sk:1470243
X-HELO: calimero.vinschen.de
Date: Wed, 3 Aug 2016 20:00:12 +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: <20160803180012.GC25811@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>
MIME-Version: 1.0
In-Reply-To: <1470243211.01868925@apps.rackspace.com>
User-Agent: Mutt/1.6.2 (2016-07-01)

--bajzpZikUji1w+G9
Content-Type: multipart/mixed; boundary="c3bfwLpm8qysLVxt"
Content-Disposition: inline


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

On Aug  3 12:53, rmora AT aboutgolf DOT com wrote:
>=20
>=20
> On Wednesday, August 3, 2016 10:32, "Corinna Vinschen" <corinna-cygwin AT cy=
gwin.com> said:
> >=20
> > In the meantime I prepared my test application.  Can you please fetch
> > the attached source and store it as, e.g., azure-check.c.  Then build
> > and run it like this:
> >=20
> >   $ gcc -g -o azure-check azure-check.c -lnetapi32
> >   $ ./azure-check
> >=20
> > Then run it and paste the complete output into your reply.
> >=20
> > I have an idea for an extension of this testcase, but I think I have
> > to see the output of this one first.
>=20
> The output is as below. This was without Run As Administrator - with
> it the Group 0 Sid changed to S-1-16-12288/High Mandatory Level, which
> *seems* appropriate....

It is.  Thanks for this test, the result is as horrifying as I imagined.
Can you please try the testcase attached to this mail, too?  It should
be built and run the same way:

  $ gcc -g -o azure-check2 azure-check2.c -lnetapi32
  $ ./azure-check2


Thanks,
Corinna

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

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

#include <stdio.h>
#define _WIN32_WINNT 0x0a00
#define WINVER 0x0a00
#include <windows.h>
#include <lm.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;
  NET_API_STATUS status;
  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 ());
  printf ("Attributes: 0x%08x\n", tp->User.Attributes);

  status =3D NetUserGetInfo (NULL, name, 24, (PBYTE *) &ui24);
  if (status !=3D NERR_Success)
    {
      status =3D NetUserGetInfo (dom, name, 24, (PBYTE *) &ui24);
      if (status !=3D NERR_Success)
	{
	  printf ("NetUserGetInfo: %u\n", status);
	  return 1;
	}
    }
  printf ("UserInfo:\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);

  return 0;
}

--c3bfwLpm8qysLVxt--

--bajzpZikUji1w+G9
Content-Type: application/pgp-signature; name="signature.asc"

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

iQIcBAEBCAAGBQJXojErAAoJEPU2Bp2uRE+g/TwQAIp/AfMNIBT3ZzJjT6bHRxZc
EBXUmv/Lb+NxdTqur/DC9vSXKGdCbm78iy7fjETfsehgwBqyRmxeAImDdv7NqYyx
dRugJdNZeac/JZM9A0BrXWjJIQO6DpZP7apkZDtC+sT0USmQMFqNm0QXkeFXFnsp
o2JxFqiVwVLTltgZshIudgxoqqx3lMGlDEBvEUkbImvdp+hXBLlfvniAqjPE6vgw
Tlzn961iEBsjuuK34mR4B4y2zFnrvLjV8oUXb/7uxERifq6FFOqGzTF69N3lHVRJ
Szrgix2iiuyehZWIWihS36gi4v0oepcE36OFpejffviIhWIyq1BkbZCGw05RZX5o
CWW8p3gUo6NETO/P/pW1kPf8d3iwOLBo6zqlp/82J0p9b13LMWd4l549ZkaAfqno
v/FiV9lFOnMXXxJNos6Bz0drUfpDu5p6sbYM2Diw/b5OVgoQBJvoYPWh1c23YVia
2Re9CMdJD1QDZcRrft2NcQTSJt3yEJP/XWLFaun1CVvsLO+2iq5GQ3Mw4Z9lRKov
DB4dW9TjMKvjUyucKBmKWNaA3tonSYcELqHuVSGiJQzb+4+67I7wmgg7ystuNNTl
RHd4DawXLvPxjcH0OFIzAeodkyZVcRPKDmBugFjwIycz+GXE9GUn+HT96qYezSDN
qQ4Mkpd6HSZq1+Gwcms7
=6WlV
-----END PGP SIGNATURE-----

--bajzpZikUji1w+G9--

- Raw text -


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