Commit graph

169 commits

Author SHA1 Message Date
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
Casey Bodley
27d764710e dll: printing username and passwd in AddConnection3 2010-10-12 10:36:02 -04:00
Casey Bodley
04047a9b53 handling NFS4ERR_OPENMODE on read
if read fails with NFS4ERR_OPENMODE, retry th read with a special stateid.
2010-10-12 10:36:01 -04:00
Casey Bodley
3b7c04e136 driver: turning write-only caching on
let's try write-only caching again but only because of the next patch that will use a special stateid for reads when file is opened write-only.
2010-10-12 10:36:00 -04:00
Casey Bodley
06fa6934cb readdir: view broken referrals as directories
if readdir fails to look up a referred entry, set its type to NF4DIR so windows explorer shows it as a directory.  when you double-click on the directory, it gives a message saying that it "refers to a location that is unavailable"

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:00 -04:00
Casey Bodley
680e415104 readdir: look up attributes for referral entries
handle rdattr_error == NFS4ERR_MOVED by calling nfs41_lookup() for attributes

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:35:59 -04:00
Casey Bodley
0d3af99159 cosmetic: moved lookup_entry()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:35:59 -04:00
Casey Bodley
30decd1af7 readdir: generalized lookup_entry() for use with referrals
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:35:58 -04:00
Casey Bodley
827a1b7368 volume: cache volume attr results with vnetroot
moved the FileSystemName definition back down to the kernel, so the daemon is no longer responsible for setting it.  the driver uses the string length to calculate the buffer size needed for NFS41_V_NET_ROOT_EXTENSION.FsAttrs, and copies in the FileSystemName after the first successful volume attributes upcall

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:58 -04:00
Casey Bodley
25ef4d25bb mount: make persist optional on mount, default to false
added -p argument to nfs_mount.exe to make the mount persist over reboots

when -p is specified, we pass the flag CONNECT_UPDATE_PROFILE to WNetUseConnection(): "If this bit flag is set, the registry will store the connection information and make it available when the system reboots."

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:57 -04:00
Casey Bodley
62fa60a83a mount: nfs_mount -d removes persistent connections
bug: connections created through 'net use' or 'map network drive' are not fully removed by 'nfs_mount -d'.  the UNMOUNT upcall completes successfully, but the mount remains visible in net use and windows explorer; the next attempted use of the drive will send a new MOUNT and continue normally

solution: added flag CONNECT_UPDATE_PROFILE to WNetCancelConnection2(): "The system updates the user profile with the information that the connection is no longer a persistent one."

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:56 -04:00
Casey Bodley
4731a97973 mount: use empty mount path when no EAs are present
adds support for mounting with 'net use' and 'Map Network Drive'
if we don't have extended attributes on mount (i.e. not using nfs_mount), don't fail!  instead, use SrvName=SrvCallName and MntPt=""
updated nfs41_MountConfig_InitDefaults() to initialize SrvName and MntPt with Length=0

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:56 -04:00
Casey Bodley
81f05b1cb8 mount: mount config as a local variable
removed the Config field from NFS41_NETROOT_EXTENSION and NFS41_V_NET_ROOT_EXTENSION and made it local to CreateVNetRoot(), as that's the only place it's accessed and we no longer rely on storing Config.Initialized with the NET_ROOT

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:55 -04:00
Casey Bodley
5861659162 mount: check for existing session instead of config.initialized
removed NFS41_MOUNT_CONFIG.Initialized field, and replaced checks for Config.Initialized with session != NULL

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:55 -04:00
Casey Bodley
f612321571 mount: use NULL to indicate no existing session
was previously setting pNetRootContext->session to INVALID_HANDLE_VALUE on error, and required checking for both that and NULL.  since it starts initialized to NULL, keep it that way

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:54 -04:00
Casey Bodley
8172b5f581 timestamps: setattr uses attributes cansettime,time_delta
added time_delta argument to xdr_settime4().  if the normal 'time' argument is within time_delta of the current time (get_nfs_time()), it uses time_how=SET_TO_SERVER_TIME4.  otherwise, it uses SET_TO_CLIENT_TIME4 and encodes the time as usual

handle_nfs41_setattr() ignores times if superblock->cansettime==0.  otherwise, it passes in superblock->time_delta (via info.time_delta) along with the other time attributes, for use with xdr_settime4()

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:54 -04:00
Casey Bodley
a8eca1ca7b timestamps: nfstime4 helper functions
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:35:53 -04:00
Casey Bodley
e67560fd4a timestamps: superblock stores attributes cansettime,time_delta
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:35:52 -04:00