symlink: open handles embedded symlinks
returns symlink_embedded=TRUE when the symlink isn't the last component, which gets passed to RxPrepareToReparseSymbolicLink() Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
a92fb8930e
commit
e27299d066
3 changed files with 22 additions and 4 deletions
|
|
@ -236,6 +236,17 @@ int handle_open(nfs41_upcall *upcall)
|
|||
status = nfs41_lookup(args->root, nfs41_root_session(args->root),
|
||||
&state->path, &state->parent, &state->file, &info, &state->session);
|
||||
|
||||
if (status == ERROR_REPARSE) {
|
||||
/* one of the parent components was a symlink */
|
||||
upcall->last_error = ERROR_REPARSE;
|
||||
args->symlink_embedded = TRUE;
|
||||
|
||||
/* replace the path with the symlink target */
|
||||
status = nfs41_symlink_follow(state->session,
|
||||
&state->parent, &args->symlink);
|
||||
goto out_free_state;
|
||||
}
|
||||
|
||||
// now if file/dir exists, use type returned by lookup
|
||||
if (status == NO_ERROR) {
|
||||
if (info.type == NF4DIR) {
|
||||
|
|
@ -263,10 +274,11 @@ int handle_open(nfs41_upcall *upcall)
|
|||
} else {
|
||||
/* tell the driver to call RxPrepareToReparseSymbolicLink() */
|
||||
upcall->last_error = ERROR_REPARSE;
|
||||
args->symlink_embedded = FALSE;
|
||||
|
||||
/* replace the path with the symlink target */
|
||||
status = nfs41_symlink_follow(state->session,
|
||||
&state->parent, &state->file, &args->symlink);
|
||||
&state->file, &args->symlink);
|
||||
goto out_free_state;
|
||||
}
|
||||
} else
|
||||
|
|
@ -375,6 +387,8 @@ int marshall_open(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
|
|||
if (status) goto out;
|
||||
if (upcall->last_error == ERROR_REPARSE) {
|
||||
unsigned short len = (args->symlink.len + 1) * sizeof(WCHAR);
|
||||
status = safe_write(&buffer, length, &args->symlink_embedded, sizeof(BOOLEAN));
|
||||
if (status) goto out;
|
||||
status = safe_write(&buffer, length, &len, sizeof(len));
|
||||
if (status) goto out;
|
||||
/* convert args->symlink to wchar */
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ typedef struct __open_upcall_args {
|
|||
DWORD mode;
|
||||
LONGLONG changeattr;
|
||||
BOOLEAN created;
|
||||
BOOLEAN symlink_embedded;
|
||||
} open_upcall_args;
|
||||
|
||||
typedef struct __close_upcall_args {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue