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-1638 Updated DC Locator
 Includes work by: matt.barden@nexenta.com, kevin.crowe@nexenta.com
SMB-108 Should have comments to relate types with their XDR functions
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/uts/common/smbsrv/smb_door.h
          +++ new/usr/src/uts/common/smbsrv/smb_door.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  
    | 
      ↓ 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 2014 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
  25   25  
  26   26  #ifndef _SMBSRV_SMB_DOOR_H
  27   27  #define _SMBSRV_SMB_DOOR_H
  28   28  
  29   29  #include <sys/door.h>
  30      -#include <smbsrv/wintypes.h>
       30 +#include <smb/wintypes.h>
  31   31  #include <smbsrv/smb_xdr.h>
  32   32  #include <smbsrv/smb_token.h>
  33   33  
  34   34  #ifdef __cplusplus
  35   35  extern "C" {
  36   36  #endif
  37   37  
  38   38  #define SMBD_DOOR_NAME                  "/var/run/smbd_door"
  39   39  
  40   40  #define SMB_DOOR_CALL_RETRIES           3
  41   41  
  42   42  /*
  43   43   * Opcodes for smbd door.
  44   44   *
  45   45   * SMB_DR_NULL is the equivalent of the NULL RPC.  It ensures that an
  46   46   * opcode of zero is not misinterpreted as an operational door call
  47   47   * and it is available as a test interface.
  48   48   *
  49   49   * SMB_DR_ASYNC_RESPONSE delivers the response part of an asynchronous
  50   50   * request and must be processed as a synchronous request.
  51   51   *
  52   52   * See also: smb_doorhdr_opname()
  53   53   */
  54   54  typedef enum smb_dopcode {
  55   55          SMB_DR_NULL = 0,
  56   56          SMB_DR_ASYNC_RESPONSE,
  57   57          SMB_DR_USER_AUTH_LOGON,
  58   58          SMB_DR_USER_NONAUTH_LOGON,
  59   59          SMB_DR_USER_AUTH_LOGOFF,
  60   60          SMB_DR_LOOKUP_SID,
  61   61          SMB_DR_LOOKUP_NAME,
  62   62          SMB_DR_JOIN,
  
    | 
      ↓ open down ↓ | 
    22 lines elided | 
    
      ↑ open up ↑ | 
  
  63   63          SMB_DR_GET_DCINFO,
  64   64          SMB_DR_VSS_GET_COUNT,
  65   65          SMB_DR_VSS_GET_SNAPSHOTS,
  66   66          SMB_DR_VSS_MAP_GMTTOKEN,
  67   67          SMB_DR_ADS_FIND_HOST,
  68   68          SMB_DR_QUOTA_QUERY,
  69   69          SMB_DR_QUOTA_SET,
  70   70          SMB_DR_DFS_GET_REFERRALS,
  71   71          SMB_DR_SHR_HOSTACCESS,
  72   72          SMB_DR_SHR_EXEC,
  73      -        SMB_DR_NOTIFY_DC_CHANGED
       73 +        SMB_DR_NOTIFY_DC_CHANGED,
       74 +        SMB_DR_LOOKUP_LSID,
       75 +        SMB_DR_LOOKUP_LNAME
  74   76  } smb_dopcode_t;
  75   77  
  76   78  struct smb_event;
  77   79  
  78   80  typedef struct smb_doorarg {
  79   81          smb_doorhdr_t           da_hdr;
  80   82          door_arg_t              da_arg;
  81   83          xdrproc_t               da_req_xdr;
  82   84          xdrproc_t               da_rsp_xdr;
  83   85          void                    *da_req_data;
  84   86          void                    *da_rsp_data;
  85   87          smb_dopcode_t           da_opcode;
  86   88          const char              *da_opname;
  87   89          struct smb_event        *da_event;
  88   90          uint32_t                da_flags;
  89   91  } smb_doorarg_t;
  90   92  
  91   93  /*
  92   94   * Door call return codes.
  93   95   */
  94   96  #define SMB_DOP_SUCCESS                 0
  95   97  #define SMB_DOP_NOT_CALLED              1
  96   98  #define SMB_DOP_DECODE_ERROR            2
  97   99  #define SMB_DOP_ENCODE_ERROR            3
  98  100  #define SMB_DOP_EMPTYBUF                4
  99  101  
 100  102  #if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
 101  103  char *smb_common_encode(void *, xdrproc_t, size_t *);
 102  104  int smb_common_decode(char *, size_t, xdrproc_t, void *);
 103  105  char *smb_string_encode(char *, size_t *);
 104  106  int smb_string_decode(smb_string_t *, char *, size_t);
 105  107  #endif /* !_KERNEL */
 106  108  
 107  109  /* libfksmbsrv "kdoor" callback to smbd-d */
 108  110  typedef int fksmb_kdoor_disp_func_t(smb_doorarg_t *);
 109  111  
 110  112  /* libfksmbsrv "opipe" callback to smbd-d */
 111  113  typedef int fksmb_opipe_disp_func_t(door_arg_t *);
 112  114  
 113  115  /*
 114  116   * Legacy door interface
 115  117   */
 116  118  #define SMB_SHARE_DNAME         "/var/run/smb_share_door"
 117  119  #define SMB_SHARE_DSIZE         (65 * 1024)
 118  120  
 119  121  /*
 120  122   * door operations
 121  123   */
 122  124  #define SMB_SHROP_NUM_SHARES            1
 123  125  #define SMB_SHROP_DELETE                2
 124  126  #define SMB_SHROP_RENAME                3
 125  127  #define SMB_SHROP_ADD                   4
 126  128  #define SMB_SHROP_MODIFY                5
 127  129  #define SMB_SHROP_LIST                  6
 128  130  
 129  131  /*
 130  132   * Door server status
 131  133   *
 132  134   * SMB_SHARE_DERROR is returned by the door server if there is problem
 133  135   * with marshalling/unmarshalling. Otherwise, SMB_SHARE_DSUCCESS is
 134  136   * returned.
 135  137   *
 136  138   */
 137  139  #define SMB_SHARE_DSUCCESS              0
 138  140  #define SMB_SHARE_DERROR                -1
 139  141  
 140  142  typedef struct smb_dr_ctx {
 141  143          char *ptr;
 142  144          char *start_ptr;
 143  145          char *end_ptr;
 144  146          int status;
 145  147  } smb_dr_ctx_t;
 146  148  
 147  149  smb_dr_ctx_t *smb_dr_decode_start(char *, int);
 148  150  int smb_dr_decode_finish(smb_dr_ctx_t *);
 149  151  
 150  152  smb_dr_ctx_t *smb_dr_encode_start(char *, int);
 151  153  int smb_dr_encode_finish(smb_dr_ctx_t *, unsigned int *);
 152  154  
 153  155  int32_t smb_dr_get_int32(smb_dr_ctx_t *);
 154  156  DWORD smb_dr_get_dword(smb_dr_ctx_t *);
 155  157  uint32_t smb_dr_get_uint32(smb_dr_ctx_t *);
 156  158  int64_t smb_dr_get_int64(smb_dr_ctx_t *);
 157  159  uint64_t smb_dr_get_uint64(smb_dr_ctx_t *);
 158  160  unsigned short smb_dr_get_ushort(smb_dr_ctx_t *);
 159  161  
 160  162  void smb_dr_put_int32(smb_dr_ctx_t *, int32_t);
 161  163  void smb_dr_put_dword(smb_dr_ctx_t *, DWORD);
 162  164  void smb_dr_put_uint32(smb_dr_ctx_t *, uint32_t);
 163  165  void smb_dr_put_int64(smb_dr_ctx_t *, int64_t);
 164  166  void smb_dr_put_uint64(smb_dr_ctx_t *, uint64_t);
 165  167  void smb_dr_put_ushort(smb_dr_ctx_t *, unsigned short);
 166  168  
 167  169  char *smb_dr_get_string(smb_dr_ctx_t *);
 168  170  void smb_dr_put_string(smb_dr_ctx_t *, const char *);
 169  171  void smb_dr_free_string(char *);
 170  172  
 171  173  void smb_dr_put_word(smb_dr_ctx_t *, WORD);
 172  174  WORD smb_dr_get_word(smb_dr_ctx_t *);
 173  175  
 174  176  void smb_dr_put_BYTE(smb_dr_ctx_t *, BYTE);
 175  177  BYTE smb_dr_get_BYTE(smb_dr_ctx_t *);
 176  178  
 177  179  void smb_dr_put_buf(smb_dr_ctx_t *, unsigned char *, int);
 178  180  int smb_dr_get_buf(smb_dr_ctx_t *, unsigned char *, int);
 179  181  
 180  182  void smb_dr_get_share(smb_dr_ctx_t *, smb_share_t *);
 181  183  void smb_dr_put_share(smb_dr_ctx_t *, smb_share_t *);
 182  184  
 183  185  void smb_share_door_clnt_init(void);
 184  186  void smb_share_door_clnt_fini(void);
 185  187  
 186  188  #ifdef __cplusplus
 187  189  }
 188  190  #endif
 189  191  
 190  192  #endif  /* _SMBSRV_SMB_DOOR_H */
  
    | 
      ↓ open down ↓ | 
    107 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX