symlink: handle_open() detects symlink creation

added check in handle_open() to avoid calling CREATE/OPEN when we're creating a symlink:

if (args->disposition == FILE_CREATE &&
    args->access_mask == (FILE_WRITE_ATTRIBUTES | SYNCHRONIZE | DELETE) &&
    args->access_mode == 0 &&
    args->create_opts & FILE_OPEN_REPARSE_POINT)

these are the open arguments we get from the CreateSymbolicLink() syscall.  by avoiding the call to CREATE/OPEN on handle_open(), we save ourselves from having to REMOVE the file before creating the symlink

added a check to handle_symlink() in case the file was actually created on open (an application could open the file with different arguments, and send the FSCTL_SET_REPARSE_POINT manually), and removes the file first

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-09-23 12:59:26 -04:00 committed by unknown
parent 62fa6176be
commit ccdaa169eb
4 changed files with 42 additions and 6 deletions

View file

@ -3638,6 +3638,7 @@ static NTSTATUS map_setfile_error(DWORD error)
case ERROR_FILE_NOT_FOUND: return STATUS_OBJECT_NAME_NOT_FOUND;
case ERROR_PATH_NOT_FOUND: return STATUS_OBJECT_PATH_NOT_FOUND;
case ERROR_ACCESS_DENIED: return STATUS_ACCESS_DENIED;
case ERROR_FILE_INVALID: return STATUS_FILE_INVALID;
case ERROR_NOT_SAME_DEVICE: return STATUS_NOT_SAME_DEVICE;
case ERROR_NOT_SUPPORTED: return STATUS_NOT_IMPLEMENTED;
case ERROR_NETWORK_ACCESS_DENIED: return STATUS_NETWORK_ACCESS_DENIED;