* security.cc (set_nt_attribute): Remove.
(set_file_attribute): Do it yourself instead of calling set_nt_attribute.
This commit is contained in:
		| @@ -1,3 +1,9 @@ | |||||||
|  | 2007-07-19  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	* security.cc (set_nt_attribute): Remove. | ||||||
|  | 	(set_file_attribute): Do it yourself instead of calling | ||||||
|  | 	set_nt_attribute. | ||||||
|  |  | ||||||
| 2007-07-19  Corinna Vinschen  <corinna@vinschen.de> | 2007-07-19  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
| 	* fhandler_disk_file.cc (fhandler_base::fstat_by_name): Use | 	* fhandler_disk_file.cc (fhandler_base::fstat_by_name): Use | ||||||
|   | |||||||
| @@ -1892,32 +1892,21 @@ set_security_attribute (int attribute, PSECURITY_ATTRIBUTES psa, | |||||||
| 					attribute, sd); | 					attribute, sd); | ||||||
| } | } | ||||||
|  |  | ||||||
| static int |  | ||||||
| set_nt_attribute (HANDLE handle, const char *file, |  | ||||||
| 		  __uid32_t uid, __gid32_t gid, int attribute) |  | ||||||
| { |  | ||||||
|   security_descriptor sd; |  | ||||||
|  |  | ||||||
|   if ((!handle || get_nt_object_security (handle, SE_FILE_OBJECT, sd)) |  | ||||||
|       && read_sd (file, sd) <= 0) |  | ||||||
|     { |  | ||||||
|       debug_printf ("read_sd %E"); |  | ||||||
|       return -1; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|   if (!alloc_sd (uid, gid, attribute, sd)) |  | ||||||
|     return -1; |  | ||||||
|  |  | ||||||
|   return write_sd (handle, file, sd); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int | int | ||||||
| set_file_attribute (bool use_ntsec, HANDLE handle, const char *file, | set_file_attribute (bool use_ntsec, HANDLE handle, const char *file, | ||||||
| 		    __uid32_t uid, __gid32_t gid, int attribute) | 		    __uid32_t uid, __gid32_t gid, int attribute) | ||||||
| { | { | ||||||
|   int ret; |   int ret = -1; | ||||||
|  |  | ||||||
|   if (use_ntsec && allow_ntsec) |   if (use_ntsec && allow_ntsec) | ||||||
|     ret = set_nt_attribute (handle, file, uid, gid, attribute); |     { | ||||||
|  |       security_descriptor sd; | ||||||
|  |  | ||||||
|  |       if (((handle && !get_nt_object_security (handle, SE_FILE_OBJECT, sd)) | ||||||
|  | 	   || read_sd (file, sd) > 0) | ||||||
|  | 	  && alloc_sd (uid, gid, attribute, sd)) | ||||||
|  | 	ret = write_sd (handle, file, sd); | ||||||
|  |     } | ||||||
|   else |   else | ||||||
|     ret = 0; |     ret = 0; | ||||||
|   syscall_printf ("%d = set_file_attribute (%s, %d, %d, %p)", |   syscall_printf ("%d = set_file_attribute (%s, %d, %d, %p)", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user