Exemple #1
0
static void
print_tokinf (PLSA_TOKEN_INFORMATION_V2 ptok, size_t size,
	       PVOID got_start, PVOID gotinf_start, PVOID gotinf_end)
{
  if (fh == INVALID_HANDLE_VALUE)
    return;

  cyglsa_printf ("INCOMING: start: 0x%08x infstart: 0x%08x infend: 0x%08x\n",
	  (INT_PTR) got_start, (INT_PTR) gotinf_start,
	  (INT_PTR) gotinf_end);

  cyglsa_printf ("LSA_TOKEN_INFORMATION_V2: 0x%08x - 0x%08x\n",
	  (INT_PTR) ptok, (INT_PTR) ptok + size);

  /* User SID */
  cyglsa_printf ("User: (attr: 0x%lx)", ptok->User.User.Attributes);
  print_sid (" ", -1, (PISID) ptok->User.User.Sid);

  /* Groups */
  print_groups (ptok->Groups);

  /* Primary Group SID */
  print_sid ("Primary Group: ", -1, (PISID)ptok->PrimaryGroup.PrimaryGroup);

  /* Privileges */
  print_privs (ptok->Privileges);

  /* Owner */
  print_sid ("Owner: ", -1, (PISID) ptok->Owner.Owner);

  /* Default DACL */
  print_dacl (ptok->DefaultDacl.DefaultDacl);

  // CloseHandle (fh);
}
Exemple #2
0
static void
print_dacl (PACL dacl)
{
  DWORD i;

  cyglsa_printf ("DefaultDacl: (0x%08x) ", (INT_PTR) dacl);
  if (!dacl)
    cyglsa_printf ("NULL\n");
  else if (IsBadReadPtr (dacl, sizeof (ACL)))
    cyglsa_printf ("INVALID POINTER\n");
  else if (IsBadReadPtr (dacl, dacl->AclSize))
    cyglsa_printf ("INVALID POINTER SPACE\n");
  else
    {
      cyglsa_printf ("Rev: %d, Count: %d\n", dacl->AclRevision, dacl->AceCount);
      for (i = 0; i < dacl->AceCount; ++i)
        {
	  PVOID vace;
	  PACCESS_ALLOWED_ACE ace;
	  NTSTATUS stat;

	  stat = RtlGetAce (dacl, i, &vace);
	  if (!NT_SUCCESS (stat))
	    cyglsa_printf ("[%lu] RtlGetAce status 0x%08lx\n", i, stat);
	  else
	    {
	      ace = (PACCESS_ALLOWED_ACE) vace;
	      cyglsa_printf ("Type: %x, Flags: %x, Access: %lx,",
		      ace->Header.AceType, ace->Header.AceFlags, (DWORD) ace->Mask);
	      print_sid (" ", i, (PISID) &ace->SidStart);
	    }
	}
    }
}
Exemple #3
0
static int
parse_sid(struct wbcDomainSid *psid, char *end_of_acl, char *title, int raw)
{
	if (end_of_acl < (char *)psid + 8)
		return -EINVAL;

	if (title)
		printf("%s:", title);
	print_sid((struct wbcDomainSid *)psid, raw);
	printf("\n");

	return 0;
}
Exemple #4
0
static void
print_groups (PTOKEN_GROUPS grps)
{
  DWORD i;

  cyglsa_printf ("Groups: (0x%08x) ", (INT_PTR) grps);
  if (!grps)
    cyglsa_printf ("NULL\n");
  else if (IsBadReadPtr (grps, sizeof (DWORD)))
    cyglsa_printf ("INVALID POINTER\n");
  else if (IsBadReadPtr (grps, sizeof (DWORD) + sizeof (SID_AND_ATTRIBUTES)
  						* grps->GroupCount))
    cyglsa_printf ("INVALID POINTER SPACE\n");
  else
    {
      cyglsa_printf ("Count: %lu\n", grps->GroupCount);
      for (i = 0; i < grps->GroupCount; ++i)
        {
	  cyglsa_printf ("(attr: 0x%lx)", grps->Groups[i].Attributes);
	  print_sid (" ", i, (PISID) grps->Groups[i].Sid);
	}
    }
}
Exemple #5
0
static void
print_ace(struct cifs_ace *pace, char *end_of_acl, int raw)
{
	/* validate that we do not go past end of acl */

	if (le16toh(pace->size) < 16)
		return;

	if (end_of_acl < (char *)pace + le16toh(pace->size))
		return;

	printf("ACL:");
	print_sid((struct wbcDomainSid *)&pace->sid, raw);
	printf(":");
	print_ace_type(pace->type, raw);
	printf("/");
	print_ace_flags(pace->flags, raw);
	printf("/");
	print_ace_mask(pace->access_req, raw);


	return;
}