summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Crowe <kevin.crowe@nexenta.com>2015-01-14 09:59:07 -0500
committerGordon Ross <gwr@nexenta.com>2015-06-13 13:27:15 -0400
commit5a48565528ab0659af6d43ebe1659bfff8074e8f (patch)
tree8fa15513ba8c72bd96dd38a4a1bb7a67996ebf8d
parentb6f078ed90209a1b0e143e0abd10e14a6a2a7397 (diff)
downloadillumos-joyent-5a48565528ab0659af6d43ebe1659bfff8074e8f.tar.gz
5994 Access Based Enumeration not working after 1527
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com> Reviewed by: Steve Ping <steve.ping@nexenta.com> Reviewed by: Gordon Ross <gordon.ross@nexenta.com> Reviewed by: Rob Gittins <rob.gittins@nexenta.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_odir.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb_odir.c b/usr/src/uts/common/fs/smbsrv/smb_odir.c
index 8d246ae3c6..279a2cc7ef 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_odir.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_odir.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -1216,6 +1216,7 @@ smb_odir_wildcard_fileinfo(smb_request_t *sr, smb_odir_t *od,
smb_odirent_t *odirent, smb_fileinfo_t *fileinfo)
{
int rc;
+ cred_t *cr;
smb_node_t *fnode, *tgt_node;
smb_attr_t attr;
char *name;
@@ -1247,9 +1248,24 @@ smb_odir_wildcard_fileinfo(smb_request_t *sr, smb_odir_t *od,
return (ENOENT);
}
+ /*
+ * Windows directory listings return not only names, but
+ * also some attributes. In Unix, you need some access to
+ * get those attributes. Which credential should we use to
+ * get those? If we're doing Access Based Enumeration (ABE)
+ * we want this getattr to fail, which will cause the caller
+ * to skip this entry. If we're NOT doing ABE, we normally
+ * want to show all the directory entries (including their
+ * attributes) so we want this getattr to succeed!
+ */
+ if (smb_tree_has_feature(od->d_tree, SMB_TREE_ABE))
+ cr = od->d_cred;
+ else
+ cr = zone_kcred();
+
bzero(&attr, sizeof (attr));
attr.sa_mask = SMB_AT_ALL;
- rc = smb_node_getattr(sr, fnode, zone_kcred(), NULL, &attr);
+ rc = smb_node_getattr(NULL, fnode, cr, NULL, &attr);
if (rc != 0) {
smb_node_release(fnode);
return (rc);