cyglsa: Drop code handling Windows 2000 and earlier
* cyglsa.c (must_create_logon_sid): Remove. (LsaApInitializePackage): Drop checking version and setting must_create_logon_sid accordingly. (LsaApLogonUserEx): Drop code setting login SID only required on Windows 2000 and earlier. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
		| @@ -20,7 +20,6 @@ Cygwin license.  Please consult the file "CYGWIN_LICENSE" for details. */ | |||||||
| #include "../cygwin/include/cygwin/version.h" | #include "../cygwin/include/cygwin/version.h" | ||||||
|  |  | ||||||
| static PLSA_SECPKG_FUNCS funcs; | static PLSA_SECPKG_FUNCS funcs; | ||||||
| static BOOL must_create_logon_sid; |  | ||||||
|  |  | ||||||
| BOOL APIENTRY | BOOL APIENTRY | ||||||
| DllMain (HINSTANCE inst, DWORD reason, LPVOID res) | DllMain (HINSTANCE inst, DWORD reason, LPVOID res) | ||||||
| @@ -252,7 +251,6 @@ LsaApInitializePackage (ULONG authp_id, PLSA_SECPKG_FUNCS dpt, | |||||||
| 			PLSA_STRING *authp_name) | 			PLSA_STRING *authp_name) | ||||||
| { | { | ||||||
|   PLSA_STRING name = NULL; |   PLSA_STRING name = NULL; | ||||||
|   DWORD vers, major, minor; |  | ||||||
|  |  | ||||||
|   /* Set global pointer to lsa helper function table. */ |   /* Set global pointer to lsa helper function table. */ | ||||||
|   funcs = dpt; |   funcs = dpt; | ||||||
| @@ -271,14 +269,6 @@ LsaApInitializePackage (ULONG authp_id, PLSA_SECPKG_FUNCS dpt, | |||||||
|   strcpy (name->Buffer, CYG_LSA_PKGNAME); |   strcpy (name->Buffer, CYG_LSA_PKGNAME); | ||||||
|   (*authp_name) = name; |   (*authp_name) = name; | ||||||
|  |  | ||||||
|   vers = GetVersion (); |  | ||||||
|   major = LOBYTE (LOWORD (vers)); |  | ||||||
|   minor = HIBYTE (LOWORD (vers)); |  | ||||||
|   /* Check if we're running on Windows 2000 or lower.  If so, we must create |  | ||||||
|      the logon sid in the group list by ourselves. */ |  | ||||||
|   if (major < 5 || (major == 5 && minor == 0)) |  | ||||||
|     must_create_logon_sid = TRUE; |  | ||||||
|  |  | ||||||
| #ifdef DEBUGGING | #ifdef DEBUGGING | ||||||
|   fh = CreateFile ("C:\\cyglsa.dbgout", GENERIC_WRITE, |   fh = CreateFile ("C:\\cyglsa.dbgout", GENERIC_WRITE, | ||||||
| 		   FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, | 		   FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, | ||||||
| @@ -540,14 +530,6 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type, | |||||||
|     { |     { | ||||||
|       /* ...on 32 bit systems we just allocate tokinf with the same size as |       /* ...on 32 bit systems we just allocate tokinf with the same size as | ||||||
|          we get, copy the whole structure and convert offsets into pointers. */ |          we get, copy the whole structure and convert offsets into pointers. */ | ||||||
|  |  | ||||||
|       /* Allocate LUID for usage in the logon SID on Windows 2000.  This is |  | ||||||
| 	 not done in the 64 bit code above for hopefully obvious reasons... */ |  | ||||||
|       LUID logon_sid_id; |  | ||||||
|  |  | ||||||
|       if (must_create_logon_sid && !AllocateLocallyUniqueId (&logon_sid_id)) |  | ||||||
| 	return STATUS_INSUFFICIENT_RESOURCES; |  | ||||||
|  |  | ||||||
|       if (!(tokinf = funcs->AllocateLsaHeap (authinf->inf_size))) |       if (!(tokinf = funcs->AllocateLsaHeap (authinf->inf_size))) | ||||||
| 	return STATUS_NO_MEMORY; | 	return STATUS_NO_MEMORY; | ||||||
|       memcpy (tokinf, &authinf->inf, authinf->inf_size); |       memcpy (tokinf, &authinf->inf, authinf->inf_size); | ||||||
| @@ -560,22 +542,8 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type, | |||||||
| 	      ((PBYTE) tokinf + (LONG_PTR) tokinf->Groups); | 	      ((PBYTE) tokinf + (LONG_PTR) tokinf->Groups); | ||||||
|       /* Group SIDs */ |       /* Group SIDs */ | ||||||
|       for (i = 0; i < tokinf->Groups->GroupCount; ++i) |       for (i = 0; i < tokinf->Groups->GroupCount; ++i) | ||||||
| 	{ | 	tokinf->Groups->Groups[i].Sid = (PSID) | ||||||
| 	  tokinf->Groups->Groups[i].Sid = (PSID) | 	      ((PBYTE) tokinf + (LONG_PTR) tokinf->Groups->Groups[i].Sid); | ||||||
| 		((PBYTE) tokinf + (LONG_PTR) tokinf->Groups->Groups[i].Sid); |  | ||||||
| 	  if (must_create_logon_sid |  | ||||||
| 	      && tokinf->Groups->Groups[i].Attributes & SE_GROUP_LOGON_ID |  | ||||||
| 	      && *GetSidSubAuthorityCount (tokinf->Groups->Groups[i].Sid) == 3 |  | ||||||
| 	      && *GetSidSubAuthority (tokinf->Groups->Groups[i].Sid, 0) |  | ||||||
| 		 == SECURITY_LOGON_IDS_RID) |  | ||||||
| 	    { |  | ||||||
| 	      *GetSidSubAuthority (tokinf->Groups->Groups[i].Sid, 1) |  | ||||||
| 	      = logon_sid_id.HighPart; |  | ||||||
| 	      *GetSidSubAuthority (tokinf->Groups->Groups[i].Sid, 2) |  | ||||||
| 	      = logon_sid_id.LowPart; |  | ||||||
| 	    } |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
|       /* Primary Group SID */ |       /* Primary Group SID */ | ||||||
|       tokinf->PrimaryGroup.PrimaryGroup = (PSID) |       tokinf->PrimaryGroup.PrimaryGroup = (PSID) | ||||||
| 	      ((PBYTE) tokinf + (LONG_PTR) tokinf->PrimaryGroup.PrimaryGroup); | 	      ((PBYTE) tokinf + (LONG_PTR) tokinf->PrimaryGroup.PrimaryGroup); | ||||||
| @@ -587,7 +555,6 @@ LsaApLogonUserEx (PLSA_CLIENT_REQUEST request, SECURITY_LOGON_TYPE logon_type, | |||||||
|       /* Default DACL */ |       /* Default DACL */ | ||||||
|       tokinf->DefaultDacl.DefaultDacl = (PACL) |       tokinf->DefaultDacl.DefaultDacl = (PACL) | ||||||
| 	      ((PBYTE) tokinf + (LONG_PTR) tokinf->DefaultDacl.DefaultDacl); | 	      ((PBYTE) tokinf + (LONG_PTR) tokinf->DefaultDacl.DefaultDacl); | ||||||
|  |  | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user