2002-03-15 Corinna Vinschen <corinna@vinschen.de>

* mkgroup.c (main): When generating group 513, check for computer's
	primary domain instead of current user's domain.

2002-03-14  Corinna Vinschen  <corinna@vinschen.de>

	* mkgroup.c (main): When generating group 513, check for domain SID
	if computer name isn't mapped to a SID.
This commit is contained in:
Corinna Vinschen 2002-03-15 14:53:55 +00:00
parent 2f26318784
commit eeec2a4835
2 changed files with 54 additions and 16 deletions

View File

@ -1,3 +1,13 @@
2002-03-15 Corinna Vinschen <corinna@vinschen.de>
* mkgroup.c (main): When generating group 513, check for computer's
primary domain instead of current user's domain.
2002-03-14 Corinna Vinschen <corinna@vinschen.de>
* mkgroup.c (main): When generating group 513, check for domain SID
if computer name isn't mapped to a SID.
2001-03-11 Joshua Daniel Franklin <joshuadfranklin@yahoo.com> 2001-03-11 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* kill.cc (usage): Move to top of file. * kill.cc (usage): Move to top of file.

View File

@ -17,6 +17,8 @@
#include <getopt.h> #include <getopt.h>
#include <lmaccess.h> #include <lmaccess.h>
#include <lmapibuf.h> #include <lmapibuf.h>
#include <ntsecapi.h>
#include <ntdef.h>
SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY}; SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
@ -447,9 +449,15 @@ main (int argc, char **argv)
char name[256], dom[256]; char name[256], dom[256];
DWORD len, len2; DWORD len, len2;
PSID csid; char buf[1024];
PSID psid = NULL;
SID_NAME_USE use; SID_NAME_USE use;
LSA_OBJECT_ATTRIBUTES oa = { 0, 0, 0, 0, 0, 0 };
LSA_HANDLE lsa = INVALID_HANDLE_VALUE;
NTSTATUS ret;
PPOLICY_PRIMARY_DOMAIN_INFO pdi;
if (GetVersion () < 0x80000000) if (GetVersion () < 0x80000000)
{ {
if (argc == 1) if (argc == 1)
@ -530,23 +538,43 @@ main (int argc, char **argv)
*/ */
len = 256; len = 256;
GetComputerName (name, &len); GetComputerName (name, &len);
csid = (PSID) malloc (1024);
len = 1024; len = 1024;
len2 = 256; len2 = 256;
LookupAccountName (NULL, name, if (LookupAccountName (NULL, name, (PSID) buf, &len, dom, &len, &use))
csid, &len, psid = (PSID) buf;
dom, &len, else
&use); {
print_special (print_sids, GetSidIdentifierAuthority (csid), 5, ret = LsaOpenPolicy(NULL, &oa, POLICY_VIEW_LOCAL_INFORMATION, &lsa);
*GetSidSubAuthority (csid, 0), if (ret == STATUS_SUCCESS && lsa != INVALID_HANDLE_VALUE)
*GetSidSubAuthority (csid, 1), {
*GetSidSubAuthority (csid, 2), ret = LsaQueryInformationPolicy (lsa,
*GetSidSubAuthority (csid, 3), PolicyPrimaryDomainInformation,
513, (PVOID *) &pdi);
0, if (ret == STATUS_SUCCESS)
0, {
0); if (pdi->Sid)
free (csid); {
CopySid (1024, (PSID) buf, pdi->Sid);
psid = (PSID) buf;
}
LsaFreeMemory (pdi);
}
LsaClose (lsa);
}
}
if (!psid)
fprintf (stderr,
"WARNING: Group 513 couldn't get retrieved. Try mkgroup -d\n");
else
print_special (print_sids, GetSidIdentifierAuthority (psid), 5,
*GetSidSubAuthority (psid, 0),
*GetSidSubAuthority (psid, 1),
*GetSidSubAuthority (psid, 2),
*GetSidSubAuthority (psid, 3),
513,
0,
0,
0);
} }
if (print_domain) if (print_domain)