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>
1575 untangle libmlrpc from SMB server
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
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-2667 Wrong error when join domain with wrong password
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
NEX-2286 smbadm join error messages are uninformative
NEX-1638 Updated DC Locator
 Includes work by: matt.barden@nexenta.com, kevin.crowe@nexenta.com
NEX-816 smbadm dumps core during first join attempt
SMB-50 User-mode SMB server
 Includes work by these authors:
 Thomas Keiser <thomas.keiser@nexenta.com>
 Albert Lee <trisk@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/smbsrv/libsmb/common/smb_doorclnt.c
          +++ new/usr/src/lib/smbsrv/libsmb/common/smb_doorclnt.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
  25   25  
  26   26  #include <assert.h>
  27   27  #include <syslog.h>
  28   28  #include <door.h>
  29   29  #include <fcntl.h>
  30   30  #include <string.h>
  31   31  #include <strings.h>
  32   32  #include <stdlib.h>
  33   33  #include <unistd.h>
  34   34  #include <errno.h>
  35   35  #include <sys/mman.h>
       36 +#include <smb/wintypes.h>
  36   37  #include <smbsrv/libsmb.h>
  37      -#include <smbsrv/wintypes.h>
  38   38  #include <smbsrv/smb_door.h>
  39   39  
  40   40  static int smb_door_call(uint32_t, void *, xdrproc_t, void *, xdrproc_t);
  41   41  static int smb_door_call_private(int, smb_doorarg_t *);
  42   42  static int smb_door_encode(smb_doorarg_t *, uint32_t);
  43   43  static int smb_door_decode(smb_doorarg_t *);
  44   44  static void smb_door_sethdr(smb_doorhdr_t *, uint32_t, uint32_t);
  45   45  static boolean_t smb_door_chkhdr(smb_doorarg_t *, smb_doorhdr_t *);
  46   46  static void smb_door_free(door_arg_t *arg);
       47 +static int smb_lookup_name_int(const char *name, sid_type_t sidtype,
       48 +    lsa_account_t *acct, int);
       49 +static int smb_lookup_sid_int(const char *sid, lsa_account_t *acct, int);
  47   50  
  48   51  /*
  49   52   * Given a SID, make a door call to get  the associated name.
  50   53   *
  51   54   * Returns 0 if the door call is successful, otherwise -1.
  52   55   *
  53   56   * If 0 is returned, the lookup result will be available in a_status.
  54   57   * NT_STATUS_SUCCESS            The SID was mapped to a name.
  55   58   * NT_STATUS_NONE_MAPPED        The SID could not be mapped to a name.
  56   59   */
  57   60  int
  58   61  smb_lookup_sid(const char *sid, lsa_account_t *acct)
  59   62  {
       63 +        return (smb_lookup_sid_int(sid, acct, SMB_DR_LOOKUP_SID));
       64 +}
       65 +/*
       66 + * Variant of smb_lookup_sid to do a "local-only" lookup.
       67 + */
       68 +int
       69 +smb_lookup_lsid(const char *sid, lsa_account_t *acct)
       70 +{
       71 +        return (smb_lookup_sid_int(sid, acct, SMB_DR_LOOKUP_LSID));
       72 +}
       73 +
       74 +static int
       75 +smb_lookup_sid_int(const char *sid, lsa_account_t *acct, int dop)
       76 +{
  60   77          int     rc;
  61   78  
  62   79          assert((sid != NULL) && (acct != NULL));
  63   80  
  64   81          bzero(acct, sizeof (lsa_account_t));
  65   82          (void) strlcpy(acct->a_sid, sid, SMB_SID_STRSZ);
  66   83  
  67      -        rc = smb_door_call(SMB_DR_LOOKUP_SID, acct, lsa_account_xdr,
       84 +        rc = smb_door_call(dop, acct, lsa_account_xdr,
  68   85              acct, lsa_account_xdr);
  69   86  
  70   87          if (rc != 0)
  71   88                  syslog(LOG_DEBUG, "smb_lookup_sid: %m");
  72   89          return (rc);
  73   90  }
  74   91  
  75   92  /*
  76   93   * Given a name, make a door call to get the associated SID.
  77   94   *
  78   95   * Returns 0 if the door call is successful, otherwise -1.
  79   96   *
  80   97   * If 0 is returned, the lookup result will be available in a_status.
  81   98   * NT_STATUS_SUCCESS            The name was mapped to a SID.
  82   99   * NT_STATUS_NONE_MAPPED        The name could not be mapped to a SID.
  83  100   */
  84  101  int
  85  102  smb_lookup_name(const char *name, sid_type_t sidtype, lsa_account_t *acct)
  86  103  {
      104 +        return (smb_lookup_name_int(name, sidtype, acct, SMB_DR_LOOKUP_NAME));
      105 +}
      106 +
      107 +int
      108 +smb_lookup_lname(const char *name, sid_type_t sidtype, lsa_account_t *acct)
      109 +{
      110 +        return (smb_lookup_name_int(name, sidtype, acct, SMB_DR_LOOKUP_LNAME));
      111 +}
      112 +
      113 +static int
      114 +smb_lookup_name_int(const char *name, sid_type_t sidtype, lsa_account_t *acct,
      115 +    int dop)
      116 +{
  87  117          char            tmp[MAXNAMELEN];
  88  118          char            *dp = NULL;
  89  119          char            *np = NULL;
  90  120          int             rc;
  91  121  
  92  122          assert((name != NULL) && (acct != NULL));
  93  123  
  94  124          (void) strlcpy(tmp, name, MAXNAMELEN);
  95  125          smb_name_parse(tmp, &np, &dp);
  96  126  
  97  127          bzero(acct, sizeof (lsa_account_t));
  98  128          acct->a_sidtype = sidtype;
  99  129  
 100  130          if (dp != NULL && np != NULL) {
 101  131                  (void) strlcpy(acct->a_domain, dp, MAXNAMELEN);
 102  132                  (void) strlcpy(acct->a_name, np, MAXNAMELEN);
 103  133          } else {
 104  134                  (void) strlcpy(acct->a_name, name, MAXNAMELEN);
 105  135          }
 106  136  
 107      -        rc = smb_door_call(SMB_DR_LOOKUP_NAME, acct, lsa_account_xdr,
      137 +        rc = smb_door_call(dop, acct, lsa_account_xdr,
 108  138              acct, lsa_account_xdr);
 109  139  
 110  140          if (rc != 0)
 111  141                  syslog(LOG_DEBUG, "smb_lookup_name: %m");
 112  142          return (rc);
 113  143  }
 114  144  
 115  145  int
 116  146  smb_join(smb_joininfo_t *jdi, smb_joinres_t *jres)
 117  147  {
↓ open down ↓ 392 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX