summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/smbsrv/smb_fsops.c
diff options
context:
space:
mode:
authorJordan Brown <Jordan.Brown@Sun.COM>2009-11-05 14:34:36 -0800
committerJordan Brown <Jordan.Brown@Sun.COM>2009-11-05 14:34:36 -0800
commitbbf6f00c25b6a2bed23c35eac6d62998ecdb338c (patch)
tree8cf72fd47362b5b0da2ffe9be7fe7726a3d24426 /usr/src/uts/common/fs/smbsrv/smb_fsops.c
parentd95ac3ffcdcc13296bb4c53f621f72c0535f32c3 (diff)
downloadillumos-joyent-bbf6f00c25b6a2bed23c35eac6d62998ecdb338c.tar.gz
6747532 ns_lookup_bypid spams syslog with too many messages
6888836 Not listing all files in a directory of a CIFS share in Windows XP 6812570 Trans2 is missing pass-through levels: FILE_RENAME_INFORMATION (and others) 6888827 Add Unicode codepage support 6865488 libadutils: leak in ldap_lookup_domains_in_forest() 6888708 idmapd crashing periodically. Need cores analyzed. 6891342 invalid, redundant SQL in rule WHERE expressions 6891767 minor cleanups in idmap 6892544 Panic occurred at smb_node_ref+0x7f(ffffffd612297310) --HG-- rename : usr/src/uts/common/smbsrv/cifs.h => usr/src/uts/common/smbsrv/smb.h
Diffstat (limited to 'usr/src/uts/common/fs/smbsrv/smb_fsops.c')
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_fsops.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb_fsops.c b/usr/src/uts/common/fs/smbsrv/smb_fsops.c
index c427df5632..e78a5c1a8a 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_fsops.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_fsops.c
@@ -27,9 +27,6 @@
#include <sys/nbmlock.h>
#include <smbsrv/smb_fsops.h>
#include <smbsrv/smb_kproto.h>
-#include <smbsrv/ntstatus.h>
-#include <smbsrv/ntaccess.h>
-#include <smbsrv/smb_incl.h>
#include <acl/acl_common.h>
#include <sys/fcntl.h>
#include <sys/flock.h>
@@ -972,8 +969,8 @@ smb_fsop_getattr(smb_request_t *sr, cred_t *cr, smb_node_t *snode,
* into this routine.
*/
int
-smb_fsop_link(smb_request_t *sr, cred_t *cr, smb_node_t *to_dnode,
- smb_node_t *from_fnode, char *to_name)
+smb_fsop_link(smb_request_t *sr, cred_t *cr, smb_node_t *from_fnode,
+ smb_node_t *to_dnode, char *to_name)
{
char *longname = NULL;
int flags = 0;
@@ -1102,6 +1099,28 @@ smb_fsop_rename(
(ACE_DELETE | ACE_ADD_FILE)))
return (EACCES);
+ /*
+ * SMB checks access on open and retains an access granted
+ * mask for use while the file is open. ACL changes should
+ * not affect access to an open file.
+ *
+ * If the rename is being performed on an ofile:
+ * - Check the ofile's access granted mask to see if the
+ * rename is permitted - requires DELETE access.
+ * - If the file system does access checking, set the
+ * ATTR_NOACLCHECK flag to ensure that the file system
+ * does not check permissions on subsequent calls.
+ */
+ if (sr && sr->fid_ofile) {
+ rc = smb_ofile_access(sr->fid_ofile, cr, DELETE);
+ if (rc != NT_STATUS_SUCCESS)
+ return (EACCES);
+
+ if (smb_tree_has_feature(sr->tid_tree,
+ SMB_TREE_ACEMASKONACCESS))
+ flags = ATTR_NOACLCHECK;
+ }
+
rc = smb_vop_rename(from_dnode->vp, from_name, to_dnode->vp,
to_name, flags, cr);
@@ -1648,6 +1667,13 @@ smb_fsop_lookup_name(
*
* Other smb_fsop_* routines will call SMB_TREE_CONTAINS_NODE() to prevent
* operations on files not in the parent mount.
+ *
+ * Case sensitivity flags (SMB_IGNORE_CASE, SMB_CASE_SENSITIVE):
+ * if SMB_CASE_SENSITIVE is set, the SMB_IGNORE_CASE flag will NOT be set
+ * based on the tree's case sensitivity. However, if the SMB_IGNORE_CASE
+ * flag is set in the flags value passed as a parameter, a case insensitive
+ * lookup WILL be done (regardless of whether SMB_CASE_SENSITIVE is set
+ * or not).
*/
int
smb_fsop_lookup(
@@ -1678,8 +1704,10 @@ smb_fsop_lookup(
if (SMB_TREE_CONTAINS_NODE(sr, dnode) == 0)
return (EACCES);
- if (SMB_TREE_IS_CASEINSENSITIVE(sr))
- flags |= SMB_IGNORE_CASE;
+ if (!(flags & SMB_CASE_SENSITIVE)) {
+ if (SMB_TREE_IS_CASEINSENSITIVE(sr))
+ flags |= SMB_IGNORE_CASE;
+ }
if (SMB_TREE_SUPPORTS_CATIA(sr))
flags |= SMB_CATIA;
if (SMB_TREE_SUPPORTS_ABE(sr))