* spawn.cc (spawn_guts): Move call to set_process_privilege()
to load_registry_hive(). * registry.cc (load_registry_hive): ditto. * fork.cc (fork_parent): Call sec_user_nih() only once.
This commit is contained in:
		| @@ -1,4 +1,11 @@ | ||||
| 2002-05-24  Christopher January <chris@atomice.net> | ||||
| 2002-05-05  Pierre Humblet <pierre.humblet@ieee.org> | ||||
|  | ||||
| 	* spawn.cc (spawn_guts): Move call to set_process_privilege() | ||||
| 	to load_registry_hive(). | ||||
| 	* registry.cc (load_registry_hive): ditto. | ||||
| 	* fork.cc (fork_parent): Call sec_user_nih() only once. | ||||
|  | ||||
| 2002-05-04  Christopher January <chris@atomice.net> | ||||
|  | ||||
| 	* path.h (path_conv::path_conv): Initialise normalized_path to NULL. | ||||
|  | ||||
|   | ||||
| @@ -466,6 +466,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll, | ||||
| #endif | ||||
|  | ||||
|   char sa_buf[1024]; | ||||
|   PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf); | ||||
|   syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %x, 0, 0, %p, %p)", | ||||
| 		  myself->progname, myself->progname, c_flags, &si, &pi); | ||||
|   __malloc_lock (_reent_clib ()); | ||||
| @@ -473,8 +474,8 @@ fork_parent (HANDLE& hParent, dll *&first_dll, | ||||
|   newheap = cygheap_setup_for_child (&ch,cygheap->fdtab.need_fixup_before ()); | ||||
|   rc = CreateProcess (myself->progname, /* image to run */ | ||||
| 		      myself->progname, /* what we send in arg0 */ | ||||
| 		      sec_user_nih (sa_buf), | ||||
| 		      sec_user_nih (sa_buf), | ||||
| 		      sec_attribs, | ||||
| 		      sec_attribs, | ||||
| 		      TRUE,	  /* inherit handles from parent */ | ||||
| 		      c_flags, | ||||
| 		      NULL,	  /* environment filled in later */ | ||||
|   | ||||
| @@ -235,12 +235,13 @@ load_registry_hive (PSID psid) | ||||
|   /* Check if user hive is already loaded. */ | ||||
|   cygsid csid (psid); | ||||
|   csid.string (sid); | ||||
|   if (!RegOpenKeyExA (HKEY_USERS, csid.string (sid), 0, KEY_READ, &hkey)) | ||||
|   if (!RegOpenKeyExA (HKEY_USERS, sid, 0, KEY_READ, &hkey)) | ||||
|     { | ||||
|       debug_printf ("User registry hive for %s already exists", sid); | ||||
|       RegCloseKey (hkey); | ||||
|       return; | ||||
|     } | ||||
|   set_process_privilege (SE_RESTORE_NAME); | ||||
|   if (get_registry_hive_path (psid, path)) | ||||
|     { | ||||
|       strcat (path, "\\NTUSER.DAT"); | ||||
|   | ||||
| @@ -665,13 +665,6 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv, | ||||
| 	  && cygheap->user.token != INVALID_HANDLE_VALUE) | ||||
| 	RevertToSelf (); | ||||
|  | ||||
|       static BOOL first_time = TRUE; | ||||
|       if (first_time) | ||||
| 	{ | ||||
| 	  set_process_privilege (SE_RESTORE_NAME); | ||||
| 	  first_time = FALSE; | ||||
| 	} | ||||
|  | ||||
|       /* Load users registry hive. */ | ||||
|       load_registry_hive (sid); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user