* fhandler.h (enum query_state): Drop redundant query_stat_control.
* fhandler.cc (fhandler_base::open): Ditto. Add READ_CONTROL to access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening for writing. Always set security attributes to avoid calling has_acls. * fhandler_disk_file.cc (fhandler_base::fstat_fs): Don't try to open file twice.
This commit is contained in:
		| @@ -1,3 +1,13 @@ | |||||||
|  | 2007-07-27  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	* fhandler.h (enum query_state): Drop redundant query_stat_control. | ||||||
|  | 	* fhandler.cc (fhandler_base::open): Ditto.  Add READ_CONTROL to | ||||||
|  | 	access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening | ||||||
|  | 	for writing.  Always set security attributes to avoid calling | ||||||
|  | 	has_acls. | ||||||
|  | 	* fhandler_disk_file.cc (fhandler_base::fstat_fs): Don't try to | ||||||
|  | 	open file twice. | ||||||
|  |  | ||||||
| 2007-07-26  Corinna Vinschen  <corinna@vinschen.de> | 2007-07-26  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
| 	* dir.cc (readdir_worker): Drop dir parameter from call to | 	* dir.cc (readdir_worker): Drop dir parameter from call to | ||||||
|   | |||||||
| @@ -483,10 +483,6 @@ fhandler_base::open (int flags, mode_t mode) | |||||||
| 	access = READ_CONTROL | FILE_READ_ATTRIBUTES; | 	access = READ_CONTROL | FILE_READ_ATTRIBUTES; | ||||||
| 	create_options = FILE_OPEN_FOR_BACKUP_INTENT; | 	create_options = FILE_OPEN_FOR_BACKUP_INTENT; | ||||||
| 	break; | 	break; | ||||||
|       case query_stat_control: |  | ||||||
| 	access = READ_CONTROL | FILE_READ_ATTRIBUTES; |  | ||||||
| 	create_options = FILE_OPEN_FOR_BACKUP_INTENT; |  | ||||||
| 	break; |  | ||||||
|       case query_write_control: |       case query_write_control: | ||||||
| 	access = READ_CONTROL | WRITE_OWNER | WRITE_DAC | FILE_WRITE_ATTRIBUTES; | 	access = READ_CONTROL | WRITE_OWNER | WRITE_DAC | FILE_WRITE_ATTRIBUTES; | ||||||
| 	create_options = FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_FOR_RECOVERY; | 	create_options = FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_FOR_RECOVERY; | ||||||
| @@ -503,8 +499,9 @@ fhandler_base::open (int flags, mode_t mode) | |||||||
| 	  } | 	  } | ||||||
| 	else if ((flags & O_ACCMODE) == O_WRONLY) | 	else if ((flags & O_ACCMODE) == O_WRONLY) | ||||||
| 	  { | 	  { | ||||||
| 	    access = GENERIC_WRITE | FILE_READ_ATTRIBUTES; | 	    access = GENERIC_WRITE | READ_CONTROL | FILE_READ_ATTRIBUTES; | ||||||
| 	    create_options = FILE_OPEN_FOR_RECOVERY; | 	    create_options = FILE_OPEN_FOR_BACKUP_INTENT | ||||||
|  | 			     | FILE_OPEN_FOR_RECOVERY; | ||||||
| 	  } | 	  } | ||||||
| 	else | 	else | ||||||
| 	  { | 	  { | ||||||
| @@ -560,7 +557,7 @@ fhandler_base::open (int flags, mode_t mode) | |||||||
|  |  | ||||||
|       /* If the file should actually be created and ntsec is on, |       /* If the file should actually be created and ntsec is on, | ||||||
| 	 set files attributes. */ | 	 set files attributes. */ | ||||||
|       if (allow_ntsec && has_acls ()) |       if (allow_ntsec) | ||||||
| 	{ | 	{ | ||||||
| 	  set_security_attribute (mode, &sa, sd); | 	  set_security_attribute (mode, &sa, sd); | ||||||
| 	  attr.SecurityDescriptor = sa.lpSecurityDescriptor; | 	  attr.SecurityDescriptor = sa.lpSecurityDescriptor; | ||||||
|   | |||||||
| @@ -86,9 +86,8 @@ enum query_state { | |||||||
|   no_query = 0, |   no_query = 0, | ||||||
|   query_read_control = 1, |   query_read_control = 1, | ||||||
|   query_read_attributes = 2, |   query_read_attributes = 2, | ||||||
|   query_stat_control = 3, |   query_write_control = 3, | ||||||
|   query_write_control = 4, |   query_write_attributes = 4 | ||||||
|   query_write_attributes = 5 |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| class fhandler_base | class fhandler_base | ||||||
|   | |||||||
| @@ -425,16 +425,8 @@ fhandler_base::fstat_fs (struct __stat64 *buf) | |||||||
| 	res = fstat_by_name (buf); | 	res = fstat_by_name (buf); | ||||||
|       return res; |       return res; | ||||||
|     } |     } | ||||||
|   query_open (query_stat_control); |   query_open (query_read_attributes); | ||||||
|   if (!(oret = open_fs (open_flags, 0)) && get_errno () == EACCES) |   oret = open_fs (open_flags, 0); | ||||||
|     { |  | ||||||
|       /* If we couldn't open the file, try a query open with no permissions. |  | ||||||
| 	 This allows us to determine *some* things about the file, at least. */ |  | ||||||
|       pc.set_exec (0); |  | ||||||
|       query_open (query_read_attributes); |  | ||||||
|       oret = open_fs (open_flags, 0); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|   if (oret) |   if (oret) | ||||||
|     { |     { | ||||||
|       /* We now have a valid handle, regardless of the "nohandle" state. |       /* We now have a valid handle, regardless of the "nohandle" state. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user