Commit graph

586 commits

Author SHA1 Message Date
Casey Bodley
1ad1c0f262 symlink: rename and link handle ERROR_REPARSE
when rename or link call nfs41_lookup() for the destination directory, they need to be able to handle ERROR_REPARSE and find the real dest dir

open now does the same thing when it sees ERROR_REPARSE; previously, it was only replacing the first symlink in the path, and could require multiple reparses on a path

modified nfs41_symlink_target() to support the case where the source and destination paths are the same (used by rename/link)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-15 14:56:06 -04:00
unknown
e37b33a4df fixing memory mngmt of symlink name on open 2010-10-15 12:06:16 -04:00
Casey Bodley
eb9d9bbd4c symlink: nfs41_symlink_follow() for readdir and open
added nfs41_file_info.symlink_dir to replace readdir's info.cansettime hack.  when nfs_file_info_to_attributes() finds info.type==NF4LNK, it adds the FILE_ATTRIBUTE_DIRECTORY flag if info.symlink_dir is set

renamed nfs41_symlink_follow() to nfs41_symlink_target()
generalized lookup_symlink() into nfs41_symlink_follow(), which is called by readdir and open (also avoids an extra lookup)

added queries for symlink target type when doing normal GETATTRs (getattr.c) and opens with OPEN_REPARSE_POINT set (open.c)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 16:57:53 -04:00
unknown
a8f66804d5 [cosmetic] adding DbgEn/Ex to symlink functions 2010-10-14 13:46:14 -04:00
unknown
c414d5b84e fixing license in symlink.c 2010-10-14 13:23:48 -04:00
unknown
e535711acf fixing DbgP in marshal_nfs41_link 2010-10-14 13:23:25 -04:00
unknown
0be2b4e495 adding symlink.c to sources 2010-10-14 12:44:20 -04:00
Casey Bodley
f8d92d5894 symlink: bug fix for garbage characters in reparse path
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:39 -04:00
Casey Bodley
4bc7853cd6 symlink: driver uses vnetroot name for reparse path
instead of using the netroot name, use the vnetroot name (which includes \;Y:\) so that reparse requests go to the same vnetroot.  was seeing it create new vnetroots otherwise

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:39 -04:00
Casey Bodley
e27299d066 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>
2010-10-14 12:42:38 -04:00
Casey Bodley
a92fb8930e symlink: lookup handles ERR_SYMLINK
modified nfs41_lookup() to handle NFS4ERR_SYMLINK by setting parent=symlink and returning ERROR_REPARSE

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:38 -04:00
Casey Bodley
5748d17934 cosmetic: map_lookup_error()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:37 -04:00
Casey Bodley
30cc2e1d32 symlink: readdir and directory symlinks
windows differentiates between directory and file symlinks because a file can have both FILE_ATTRIBUTE_DIRECTORY and FILE_ATTRIBUTE_REPARSE_POINT flags.  nfs can only be one of NF4REG/DIR/LNK, so we have to do a readlink and look up the target file for symlinks to know whether or not to set the directory attribute flag.  this is done recursively when we encounter links to links

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:37 -04:00
Casey Bodley
ccdaa169eb 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>
2010-10-14 12:42:36 -04:00
Casey Bodley
62fa6176be symlink: FSCTL_SET_REPARSE_POINT
driver handles FSCTL_SET_REPARSE_POINT by sending a symlink set upcall
daemon handles symlink set upcall by calling nfs41_create()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:36 -04:00
Casey Bodley
8c4c98b669 symlink: nfs41_create() can create symlinks
added optional symlink argument to nfs41_create(), used when type is NF4LNK
changed createttype4.u.lnk.linkdata from char[] to const char* and updated encoding in nfs41_xdr.c

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:35 -04:00
Casey Bodley
08c2618551 symlink: FSCTL_GET_REPARSE_POINT
driver handles FSCTL_GET_REPARSE_POINT by sending a symlink query upcall
daemon handles symlink query upcall by calling nfs41_readlink()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:34 -04:00
Casey Bodley
8ea0ca1893 symlink: generalized follow_link()
no longer depends on nfs41_open_state or open_upcall_args
renamed to nfs41_symlink_follow() and added prototype to nfs41_ops.h

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:34 -04:00
Casey Bodley
dd48ca17c3 symlink: moved follow_link() to symlink.c [cosmetic]
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:33 -04:00
Casey Bodley
0db42ed126 symlink: daemon parses SYMLINK upcall
added symlink.c for parse_symlink() and marshall_symlink()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:33 -04:00
Casey Bodley
80d979ace6 symlink: driver marshalls new SYMLINK upcall
new NFS41_SYMLINK upcall and associated data in nfs41_updowncall_entry.u.Symlink
supports both setting and querying the symlink target.  if Symlink.set is TRUE, Symlink.target is marshalled into the upcall.  if Symlink.set is FALSE, Symlink.target is read from the downcall

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:32 -04:00
Casey Bodley
b51bd2f9d1 symlink: set reparse tag for symlinks
getattr upcall for FileAttributeTagInformation sets ReparseTag=IO_REPARSE_TAG_SYMLINK

readdir upcall sets EaSize=IO_REPARSE_TAG_SYMLINK; this makes the 'dir' command show files as <SYMLINK>, and causes a FSCTL_GET_REPARSE_POINT to query the symlink target

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-14 12:42:32 -04:00
unknown
bc0b161fc6 STANDALONE_NFSD enabled 2010-10-14 11:45:51 -04:00
unknown
0fc82009a5 adding env.props to libtirpc 2010-10-13 18:40:10 -04:00
U-fast\aglo
f01f1304da bumping seq if decoded successfully
before, we would not bump the sequence if we couldn't decode an
operation in the received compound.
2010-10-13 14:46:25 -04:00
U-fast\aglo
cf75520410 cb_args should be allocated
when we fork a thread to handle the callback, the arguments we got from
parsing the callback operations in the callback thread are on the stack.
we need to allocate memory for same-size data structure and copy them,
not just copy the pointer.
2010-10-13 14:46:02 -04:00
U-fast\aglo
ca596054f3 link asks for FSID attr 2010-10-13 14:45:55 -04:00
U-fast\aglo
7d7d641283 return file delegation on open
callback code is not up to handling recall of delegations via the
callback channel. thus return file delegation if it was returned on
open.
2010-10-13 14:45:48 -04:00
Casey Bodley
7d9b32cd78 xdr: another sanity check for operation count in reply
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 12:11:57 -04:00
Casey Bodley
9dcf4021ba pnfs: check status of pnfs_file_device_io_unit()
avoids crashing against misconfigured servers

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 12:11:49 -04:00
Casey Bodley
db5e8f9d34 ERR_STALE: skip recovery on NULL path
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 12:11:43 -04:00
Casey Bodley
bb73eec774 bug fix: avoid infinite loops by checking for len=0 on read/write
/* we shouldn't ever see this, but a buggy server could
 * send us into an infinite loop. return NFS4ERR_IO */

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 12:11:38 -04:00
Casey Bodley
e4b1bc6ccc pnfs: set stateid.seqid to 0 for data server io
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 12:11:27 -04:00
Casey Bodley
eefff7c222 max_path: raise MAX_PATH and UPCALL_BUF_SIZE
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:11 -04:00
Casey Bodley
66d4ea8e0b max_path: static buffer for symlink path
added nfs41_abs_path symlink to struct open_upcall_args. we can't write the symlink target back to args->path anymore, since it's a pointer into the upcall buffer

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:11 -04:00
Casey Bodley
6d2b631080 max_path: make an abs_path for lookup on mount
in handle_mount(), the call to nfs41_lookup() requires a mutable nfs41_abs_path because it can change on referrals, so make a copy for it

removed unused fields in struct nfs41_root and related arguments to nfs41_root_create()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:10 -04:00
Casey Bodley
f727a1e4b4 max_path: get_name() avoids copying from upcall buffer
because we no longer have to convert strings from unicode, we can avoid copying them out of the upcall buffer

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:10 -04:00
Casey Bodley
feb441ab4d path: driver marshalls upcall strings as ansi
marshall_unicode_as_ansi() calls RtlUnicodeStringToAnsiString() to convert the string directly into the upcall buffer

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:09 -04:00
Casey Bodley
95361423f3 upcall: set upcall.status on parse failure
when open parsing fails, we were still returning upcall.status==NO_ERROR, so the driver assumed the open succeeded.  other operations then sent up an open_state==NULL, and crashed the daemon.  when upcall_parse() returns an error, set upcall.status to notify the driver

upcall_parse() prints a 'parsing of upcall <name> failed with <error>.' message on failure, so i removed redundant messages from the individual upcall parsing functions

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:08 -04:00
Casey Bodley
a0cda354be first stab at impersonation 2010-10-12 10:36:08 -04:00
Casey Bodley
d136756272 symlink: driver calls RxPrepareToReparseSymbolicLink
on ERROR_REPARSE, nfs41_Create() generates an absolute path for the symlink target using the format "DeviceName+NetRootName+symlink", and calls RxPrepareToReparseSymbolicLink()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:07 -04:00
Casey Bodley
74a704120b symlink: open calls READLINK and updates the path
when handle_open() encounters a file of type NF4LNK and the FILE_OPEN_REPARSE_POINT flag is not present, it calls READLINK for the symlink's target path.  it then calls abs_path_link() to update the filename (args->path), whether the symlink target is an absolute or relative path.  abs_path_link() also takes into account the special characters . and .., though it doesn't allow traversing .. entries below the root of the server's namespace

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:07 -04:00
Casey Bodley
45a14a17ff symlink: open downcall passes symlink target
on last_error == ERROR_REPARSE, the daemon converts args->path back to wchar and passes it down to the driver

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:06 -04:00
Casey Bodley
374e7ad083 symlink: nfs41_readlink() takes buf,len instead of nfs41_abs_path
also changed nfs41_readlink_res.link from a buffer to a pointer to avoid the extra copy

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:06 -04:00
Casey Bodley
77dcd5bc02 symlink: file and volume attributes
handle_volume_attributes() adds FILE_SUPPORTS_REPARSE_POINTS
nfs_file_info_to_attributes() adds FILE_ATTRIBUTE_REPARSE_POINT for type==NF4LNK

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:05 -04:00
Casey Bodley
5dc1b43191 rmdir: use normal delete upcall instead of close
caused memory leaks of nfs41_open_state.  we have the FileDispositionInformation upcall for exactly this, so there's no need to complicate the close code path

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:04 -04:00
Casey Bodley
d1169b1f6b daemon: logging to files 2010-10-12 10:36:04 -04:00
Casey Bodley
c80946b258 first stab at nfsd as a service 2010-10-12 10:36:03 -04:00
Casey Bodley
88c28ec995 creating shared memory mutex in dll 2010-10-12 10:36:03 -04:00
Casey Bodley
86c16a7197 adding SID to upcall 2010-10-12 10:36:02 -04:00