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-15558 SMB logon fails during 1st second after service start
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15558 SMB logon fails during 1st second after service start
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-6309 Update NT status codes
Update ntstatus.h from [MS-ERREF] October 2015
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <matt.barden@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-2225 Unable to join NexentaStor to 2008 AD
NEX-2286 smbadm join error messages are uninformative
NEX-1810 extended security Kerberos (inbound)
NEX-1638 Updated DC Locator
 Includes work by: matt.barden@nexenta.com, kevin.crowe@nexenta.com
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/lib/smbsrv/libmlsvc/common/libmlsvc.h
          +++ new/usr/src/lib/smbsrv/libmlsvc/common/libmlsvc.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 2015 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
  25   25  
  26   26  #ifndef _LIBMLSVC_H
  27   27  #define _LIBMLSVC_H
  28   28  
  29      -#include <uuid/uuid.h>
  30   29  #include <sys/param.h>
  31   30  #include <sys/types.h>
  32   31  #include <sys/uio.h>
  33   32  #include <sys/ksynch.h>
       33 +#include <uuid/uuid.h>
       34 +
  34   35  #include <time.h>
  35   36  #include <stdio.h>
  36   37  #include <string.h>
       38 +#include <syslog.h>
  37   39  #include <netdb.h>
  38   40  #include <libuutil.h>
  39      -#include <smbsrv/wintypes.h>
       41 +
       42 +#include <smb/wintypes.h>
       43 +#include <libmlrpc/libmlrpc.h>
       44 +
  40   45  #include <smbsrv/hash_table.h>
  41   46  #include <smbsrv/smb_token.h>
  42   47  #include <smbsrv/smb_privilege.h>
  43   48  #include <smbsrv/smb_share.h>
  44   49  #include <smbsrv/smb_xdr.h>
  45   50  #include <smbsrv/smb_dfs.h>
  46   51  #include <smbsrv/libsmb.h>
  47      -#include <smbsrv/libmlrpc.h>
  48      -#include <smbsrv/ndl/lsarpc.ndl>
  49   52  
       53 +/*
       54 + * XXX: Some temporary left-overs from the old ntstatus.h
       55 + * Should eliminate uses of these macros when convenient.
       56 + */
       57 +/* This used to OR in the severity bits. */
       58 +#define NT_SC_ERROR(S)          (S)
       59 +/* This used to mask off the severity bits. */
       60 +#define NT_SC_VALUE(S)          (S)
       61 +/* XXX end of temporary left-overs. */
       62 +
  50   63  #ifdef  __cplusplus
  51   64  extern "C" {
  52   65  #endif
  53   66  
  54   67  uint32_t lsa_lookup_name(char *, uint16_t, smb_account_t *);
       68 +uint32_t lsa_lookup_lname(char *, uint16_t, smb_account_t *);
  55   69  uint32_t lsa_lookup_sid(smb_sid_t *, smb_account_t *);
       70 +uint32_t lsa_lookup_lsid(smb_sid_t *, smb_account_t *);
  56   71  
  57   72  /*
  58   73   * SMB domain API to discover a domain controller and obtain domain
  59   74   * information.
  60   75   */
  61   76  
  62   77  extern boolean_t smb_locate_dc(char *, smb_domainex_t *);
  63   78  uint32_t smb_ddiscover_dns(char *, smb_domainex_t *);
  64   79  extern void smb_ddiscover_bad_dc(char *);
  65   80  extern void smb_ddiscover_refresh(void);
  66      -extern int smb_ddiscover_wait(void);
  67   81  
  68   82  extern int dssetup_check_service(void);
  69   83  extern void dssetup_clear_domain_info(void);
  70   84  extern void mlsvc_disconnect(const char *);
  71   85  extern int mlsvc_init(void);
  72   86  extern void mlsvc_fini(void);
  73   87  extern DWORD mlsvc_netlogon(char *, char *);
  74   88  extern void mlsvc_join(smb_joininfo_t *, smb_joinres_t *);
  75   89  
  76   90  extern void smb_logon_domain(smb_logon_t *, smb_token_t *);
  77   91  extern uint32_t smb_decode_krb5_pac(smb_token_t *, char *, uint_t);
  78   92  extern boolean_t smb_token_setup_common(smb_token_t *);
  79   93  
  80   94  
  81   95  /*
  82   96   * The maximum number of domains (NT limit).
  83   97   */
  84   98  #define MLSVC_DOMAIN_MAX                32
  85   99  
  86  100  #define MLSVC_ANON_USER                 "IPC$"
  87  101  
  88  102  char *mlsvc_ipc_name(int ipc_type, char *username);
  89  103  
  90  104  /*
  91  105   * Passthrough negotiation and authentication interface.
  92  106   *
  93  107   * NT supports two forms of password: a Lanman (case-insensitive)
  94  108   * password and an NT (case-sensitive) password. If either of the
  95  109   * passwords is not available its pointer and length should be set
  96  110   * to zero. The session key and vc number are required to validate
  97  111   * the encrypted passwords.
  98  112   */
  99  113  
 100  114  void mlsvc_nt_password_hash(char *result, char *password);
 101  115  int mlsvc_encrypt_nt_password(char *password, char *key, int keylen, char *out,
 102  116      int outmax);
 103  117  
 104  118  #define SMB_AUTOHOME_FILE       "smbautohome"
 105  119  #define SMB_AUTOHOME_PATH       "/etc"
 106  120  
 107  121  typedef struct smb_autohome {
 108  122          struct smb_autohome *ah_next;
 109  123          uint32_t ah_hits;
 110  124          time_t ah_timestamp;
 111  125          char *ah_name;          /* User account name */
 112  126          char *ah_path;          /* Home directory path */
 113  127          char *ah_container;     /* ADS container distinguished name */
 114  128  } smb_autohome_t;
 115  129  
 116  130  extern void smb_autohome_add(const smb_token_t *);
 117  131  extern void smb_autohome_remove(const char *);
 118  132  
 119  133  /*
 120  134   * A local unique id (LUID) is an opaque id used by servers to identify
  
    | 
      ↓ open down ↓ | 
    44 lines elided | 
    
      ↑ open up ↑ | 
  
 121  135   * local resources, such as privileges.  A client will use lookup
 122  136   * functions to translate the LUID to a more general, machine independent
 123  137   * form; such as a string.
 124  138   */
 125  139  typedef struct ms_luid {
 126  140          uint32_t low_part;
 127  141          uint32_t high_part;
 128  142  } ms_luid_t;
 129  143  
 130  144  /*
 131      - * Information about a server as reported by NetServerGetInfo.
 132      - * The SV_PLATFORM and SV_TYPE definitions are in srvsvc.ndl.
 133      - */
 134      -typedef struct srvsvc_server_info {
 135      -        uint32_t        sv_platform_id;
 136      -        char            *sv_name;
 137      -        uint32_t        sv_version_major;
 138      -        uint32_t        sv_version_minor;
 139      -        uint32_t        sv_type;
 140      -        char            *sv_comment;
 141      -        uint32_t        sv_os;
 142      -} srvsvc_server_info_t;
 143      -
 144      -int srvsvc_net_server_getinfo(char *, char *, srvsvc_server_info_t *);
 145      -int srvsvc_net_remote_tod(char *, char *, struct timeval *, struct tm *);
 146      -
 147      -
 148      -/*
 149  145   * A client_t is created while binding a client connection to hold the
 150  146   * context for calls made using that connection.
 151  147   *
 152  148   * Handles are RPC call specific and we use an inheritance mechanism to
 153  149   * ensure that each handle has a pointer to the client_t.  When the top
 154  150   * level (bind) handle is released, we close the connection.
 155  151   */
 156      -typedef struct mlsvc_handle {
 157      -        ndr_hdid_t                      handle;
 158      -        ndr_client_t                    *clnt;
 159      -        srvsvc_server_info_t            svinfo;
 160      -} mlsvc_handle_t;
      152 +typedef struct mlrpc_handle mlsvc_handle_t;
 161  153  
      154 +/* mlsvc_client.c */
 162  155  void ndr_rpc_init(void);
 163  156  void ndr_rpc_fini(void);
 164  157  uint32_t ndr_rpc_bind(mlsvc_handle_t *, char *, char *, char *, const char *);
 165  158  void ndr_rpc_unbind(mlsvc_handle_t *);
 166      -int ndr_rpc_call(mlsvc_handle_t *, int, void *);
 167      -void ndr_rpc_set_nonull(mlsvc_handle_t *);
 168      -const srvsvc_server_info_t *ndr_rpc_server_info(mlsvc_handle_t *);
 169      -uint32_t ndr_rpc_server_os(mlsvc_handle_t *);
 170      -int ndr_rpc_get_ssnkey(mlsvc_handle_t *, unsigned char *, size_t);
 171      -void *ndr_rpc_malloc(mlsvc_handle_t *, size_t);
 172      -ndr_heap_t *ndr_rpc_get_heap(mlsvc_handle_t *);
 173      -void ndr_rpc_release(mlsvc_handle_t *);
 174      -boolean_t ndr_is_null_handle(mlsvc_handle_t *);
 175      -boolean_t ndr_is_bind_handle(mlsvc_handle_t *);
 176      -void ndr_inherit_handle(mlsvc_handle_t *, mlsvc_handle_t *);
 177  159  void ndr_rpc_status(mlsvc_handle_t *, int, uint32_t);
 178  160  
      161 +/* These three get info about the connected client. */
      162 +boolean_t ndr_is_admin(ndr_xa_t *);
      163 +boolean_t ndr_is_poweruser(ndr_xa_t *);
      164 +int32_t ndr_native_os(ndr_xa_t *);
      165 +
      166 +/* SRVSVC */
      167 +int srvsvc_net_remote_tod(char *, char *, struct timeval *, struct tm *);
      168 +
 179  169  /* SVCCTL service */
 180  170  /*
 181  171   * Calculate the wide-char equivalent string length required to
 182  172   * store a string - including the terminating null wide-char.
 183  173   */
 184  174  #define SVCCTL_WNSTRLEN(S)      ((strlen((S)) + 1) * sizeof (smb_wchar_t))
 185  175  
 186  176  /* An AVL-storable node representing each service in the SCM database. */
 187  177  typedef struct svcctl_svc_node {
 188  178          uu_avl_node_t           sn_node;
 189  179          char                    *sn_name;       /* Service Name (Key) */
 190  180          char                    *sn_fmri;       /* Display Name (FMRI) */
 191  181          char                    *sn_desc;       /* Description */
 192  182          char                    *sn_state;      /* State */
 193  183  } svcctl_svc_node_t;
 194  184  
 195  185  /* This structure provides context for each svcctl_s_OpenManager call. */
 196  186  typedef struct svcctl_manager_context {
 197  187          scf_handle_t            *mc_scf_hdl;      /* SCF handle */
 198  188          scf_propertygroup_t     *mc_scf_gpg;      /* Property group */
 199  189          scf_property_t          *mc_scf_gprop;    /* Property */
 200  190          scf_value_t             *mc_scf_gval;     /* Value */
 201  191          uint32_t                mc_scf_numsvcs;   /* Number of SMF services */
 202  192          ssize_t                 mc_scf_max_fmri_len;  /* Max FMRI length */
 203  193          ssize_t                 mc_scf_max_value_len; /* Max Value length */
 204  194          uint32_t                mc_bytes_needed;  /* Number of bytes needed */
 205  195          uu_avl_pool_t           *mc_svcs_pool;    /* AVL pool */
 206  196          uu_avl_t                *mc_svcs;         /* AVL tree of SMF services */
 207  197  } svcctl_manager_context_t;
 208  198  
 209  199  /* This structure provides context for each svcctl_s_OpenService call. */
 210  200  typedef struct svcctl_service_context {
 211  201          ndr_hdid_t              *sc_mgrid;      /* Manager ID */
 212  202          char                    *sc_svcname;    /* Service Name */
 213  203  } svcctl_service_context_t;
 214  204  
 215  205  typedef enum {
 216  206          SVCCTL_MANAGER_CONTEXT = 0,
 217  207          SVCCTL_SERVICE_CONTEXT
 218  208  } svcctl_context_type_t;
 219  209  
 220  210  /* This structure provides abstraction for service and manager context call. */
 221  211  typedef struct svcctl_context {
 222  212          svcctl_context_type_t   c_type;
 223  213          union {
 224  214                  svcctl_manager_context_t *uc_mgr;
 225  215                  svcctl_service_context_t *uc_svc;
 226  216                  void *uc_cp;
 227  217          } c_ctx;
 228  218  } svcctl_context_t;
 229  219  
 230  220  /* Service Control Manager (SCM) functions */
 231  221  void svcctl_init(void);
 232  222  void svcctl_fini(void);
 233  223  int svcctl_scm_init(svcctl_manager_context_t *);
 234  224  void svcctl_scm_fini(svcctl_manager_context_t *);
 235  225  int svcctl_scm_scf_handle_init(svcctl_manager_context_t *);
 236  226  void svcctl_scm_scf_handle_fini(svcctl_manager_context_t *);
 237  227  int svcctl_scm_refresh(svcctl_manager_context_t *);
 238  228  uint32_t svcctl_scm_enum_services(svcctl_manager_context_t *, uint8_t *,
 239  229      size_t, uint32_t *, boolean_t);
 240  230  uint32_t svcctl_scm_validate_service(svcctl_manager_context_t *, char *);
 241  231  svcctl_svc_node_t *svcctl_scm_find_service(svcctl_manager_context_t *, char *);
 242  232  uint32_t svcctl_scm_map_status(const char *);
 243  233  
 244  234  /* LOGR service */
 245  235  #define LOGR_APPLICATION_LOG            "Application"
 246  236  #define LOGR_SECURITY_LOG               "Security"
 247  237  #define LOGR_SYSTEM_LOG                 "System"
 248  238  #define LOGR_NMSGMASK                   1023
 249  239  #define LOGR_MAXMSGLEN                  800
 250  240  
 251  241  typedef struct logr_entry {
 252  242          struct timeval  le_timestamp;                   /* Time of log entry */
 253  243          int             le_pri;                         /* Message priority */
 254  244          char            le_hostname[MAXHOSTNAMELEN];    /* Log hostname */
 255  245          char            le_msg[LOGR_MAXMSGLEN];         /* Log message text */
 256  246  } logr_entry_t;
 257  247  
 258  248  typedef struct logr_info {
 259  249          logr_entry_t    li_entry[LOGR_NMSGMASK+1];      /* Array of log entry */
 260  250          int             li_idx;                         /* Index */
 261  251  } logr_info_t;
 262  252  
 263  253  typedef struct logr_read_data {
 264  254          int             rd_tot_recnum;          /* Total no. of record read */
 265  255          int             rd_last_sentrec;        /* Last sentence read */
 266  256          char            rd_first_read;          /* First sentence read */
 267  257          logr_info_t     *rd_log;                /* Log information read */
 268  258  } logr_read_data_t;
 269  259  
 270  260  /* This structure provides the context for eventlog calls from clients. */
 271  261  typedef struct logr_context {
 272  262          logr_read_data_t *lc_cached_read_data;
 273  263          char *lc_source_name;
 274  264  } logr_context_t;
 275  265  
 276  266  void logr_init(void);
 277  267  void logr_fini(void);
 278  268  boolean_t logr_is_supported(char *);
 279  269  int logr_get_snapshot(logr_context_t *);
 280  270  
 281  271  /* User and Group quotas */
 282  272  uint32_t smb_quota_query(smb_quota_query_t *, smb_quota_response_t *);
 283  273  uint32_t smb_quota_set(smb_quota_set_t *);
 284  274  void smb_quota_free(smb_quota_response_t *);
 285  275  
 286  276  uint32_t dfs_get_referrals(const char *, dfs_reftype_t, dfs_info_t *);
 287  277  void dfs_info_free(dfs_info_t *);
 288  278  
 289  279  /*
 290  280   * The spoolss installable copyfile API.
 291  281   */
 292  282  typedef void (*spoolss_copyfile_t)(smb_inaddr_t *, char *, char *, char *);
 293  283  void spoolss_register_copyfile(spoolss_copyfile_t);
 294  284  
 295  285  #ifdef  __cplusplus
 296  286  }
 297  287  #endif
 298  288  
 299  289  #endif  /* _LIBMLSVC_H */
  
    | 
      ↓ open down ↓ | 
    111 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX