Print this page
NEX-19057 All zfs/nfs/smb threads in door calls to idle idmap
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-4083 Upstream changes from illumos 5917 and 5995
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-2225 Unable to join NexentaStor to 2008 AD
NEX-2286 smbadm join error messages are uninformative
NEX-1638 Updated DC Locator
 Includes work by: matt.barden@nexenta.com, kevin.crowe@nexenta.com
SMB-149 mount.cifs RedHat\Centos 6 doesn't work with default security options (fix lint)
SMB-149 mount.cifs RedHat\Centos 6 doesn't work with default security options
SMB-136 Snapshots not visible in Windows previous versions
SMB-39 Use AF_UNIX pipes for RPC
SMB-50 User-mode SMB server
 Includes work by these authors:
 Thomas Keiser <thomas.keiser@nexenta.com>
 Albert Lee <trisk@nexenta.com>

@@ -18,11 +18,11 @@
  *
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <sys/list.h>
 #include <assert.h>
 #include <alloca.h>

@@ -101,11 +101,13 @@
         { SMB_DR_QUOTA_QUERY,           smbd_dop_quota_query },
         { SMB_DR_QUOTA_SET,             smbd_dop_quota_set },
         { SMB_DR_DFS_GET_REFERRALS,     smbd_dop_dfs_get_referrals },
         { SMB_DR_SHR_HOSTACCESS,        smbd_dop_shr_hostaccess },
         { SMB_DR_SHR_EXEC,              smbd_dop_shr_exec },
-        { SMB_DR_NOTIFY_DC_CHANGED,     smbd_dop_notify_dc_changed }
+        { SMB_DR_NOTIFY_DC_CHANGED,     smbd_dop_notify_dc_changed },
+        { SMB_DR_LOOKUP_LSID,           smbd_dop_lookup_sid },
+        { SMB_DR_LOOKUP_LNAME,          smbd_dop_lookup_name }
 };
 
 static int smbd_ndoorop = (sizeof (smbd_doorops) / sizeof (smbd_doorops[0]));
 
 static smbd_doorsvc_t smbd_doorsvc;

@@ -579,10 +581,14 @@
 
         /* No longer used */
         return (SMB_DOP_EMPTYBUF);
 }
 
+/*
+ * SMB_DR_LOOKUP_NAME,
+ * SMB_DR_LOOKUP_LNAME (local-only, for idmap)
+ */
 static int
 smbd_dop_lookup_name(smbd_arg_t *arg)
 {
         smb_domain_t    dinfo;
         smb_account_t   ainfo;

@@ -602,11 +608,28 @@
                     acct.a_domain);
         else
                 (void) snprintf(buf, MAXNAMELEN, "%s\\%s", acct.a_domain,
                     acct.a_name);
 
+        switch (arg->hdr.dh_op) {
+        case SMB_DR_LOOKUP_NAME:
         acct.a_status = lsa_lookup_name(buf, acct.a_sidtype, &ainfo);
+                break;
+
+        case SMB_DR_LOOKUP_LNAME:
+                /*
+                 * Basically for idmap.  Don't call out to AD.
+                 */
+                acct.a_status = lsa_lookup_lname(buf, acct.a_sidtype, &ainfo);
+                break;
+
+        default:
+                assert(!"arg->hdr.dh_op");
+                acct.a_status = NT_STATUS_INTERNAL_ERROR;
+                break;
+        }
+
         if (acct.a_status == NT_STATUS_SUCCESS) {
                 acct.a_sidtype = ainfo.a_type;
                 smb_sid_tostr(ainfo.a_sid, acct.a_sid);
                 (void) strlcpy(acct.a_name, ainfo.a_name, MAXNAMELEN);
 

@@ -624,10 +647,14 @@
         if (arg->rbuf == NULL)
                 return (SMB_DOP_ENCODE_ERROR);
         return (SMB_DOP_SUCCESS);
 }
 
+/*
+ * SMB_DR_LOOKUP_SID,
+ * SMB_DR_LOOKUP_LSID (local-only, for idmap)
+ */
 static int
 smbd_dop_lookup_sid(smbd_arg_t *arg)
 {
         smb_domain_t    dinfo;
         smb_account_t   ainfo;

@@ -639,11 +666,29 @@
         if (smb_common_decode(arg->data, arg->datalen,
             lsa_account_xdr, &acct) != 0)
                 return (SMB_DOP_DECODE_ERROR);
 
         sid = smb_sid_fromstr(acct.a_sid);
+
+        switch (arg->hdr.dh_op) {
+        case SMB_DR_LOOKUP_SID:
         acct.a_status = lsa_lookup_sid(sid, &ainfo);
+                break;
+
+        case SMB_DR_LOOKUP_LSID:
+                /*
+                 * Basically for idmap.  Don't call out to AD.
+                 */
+                acct.a_status = lsa_lookup_lsid(sid, &ainfo);
+                break;
+
+        default:
+                assert(!"arg->hdr.dh_op");
+                acct.a_status = NT_STATUS_INTERNAL_ERROR;
+                break;
+        }
+
         smb_sid_free(sid);
 
         if (acct.a_status == NT_STATUS_SUCCESS) {
                 acct.a_sidtype = ainfo.a_type;
                 smb_sid_tostr(ainfo.a_sid, acct.a_sid);