Print this page
NEX-14666 Need to provide SMB 2.1 Client
NEX-17187 panic in smbfs_acl_store
NEX-17231 smbfs create xattr files finds wrong file
NEX-17224 smbfs lookup EINVAL should be ENOENT
NEX-17260 SMB1 client fails to list directory after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
and: (cleanup)
4295 libshare sa_get_proto_status sometimes returns unallocated strings
Reviewed by: Marcel Telka <marcel@telka.sk>
Approved by: Garrett D'Amore <garrett@damore.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libshare/smbfs/libshare_smbfs.c
          +++ new/usr/src/lib/libshare/smbfs/libshare_smbfs.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + *
       26 + * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  25   27   */
  26   28  
  27   29  /*
  28   30   * SMB specific functions
  29   31   */
  30   32  #include <stdio.h>
  31   33  #include <string.h>
  32   34  #include <ctype.h>
  33   35  #include <stdlib.h>
  34   36  #include <unistd.h>
↓ open down ↓ 28 lines elided ↑ open up ↑
  63   65  static char *smbfs_get_status();
  64   66  static int smbfs_delete_section(char *);
  65   67  static int smbfs_delete_property_group(char *);
  66   68  
  67   69  static int range_check_validator(int, char *, char *);
  68   70  static int string_length_check_validator(int, char *, char *);
  69   71  static int yes_no_validator(int, char *, char *);
  70   72  static int ip_address_validator(int, char *, char *);
  71   73  static int minauth_validator(int, char *, char *);
  72   74  static int password_validator(int, char *, char *);
       75 +static int protocol_validator(int, char *, char *);
  73   76  static int signing_validator(int, char *, char *);
  74   77  
  75   78  int propset_changed = 0;
  76   79  
  77   80  /*
  78   81   * ops vector that provides the protocol specific info and operations
  79   82   * for share management.
  80   83   */
  81   84  
  82   85  struct sa_plugin_ops sa_plugin_ops = {
↓ open down ↓ 92 lines elided ↑ open up ↑
 175  178              string_length_check_validator},
 176  179          { "domain", NULL, PROTO_OPT_DOMAIN,
 177  180              0, 0, MAX_VALUE_BUFLEN,
 178  181              string_length_check_validator},
 179  182          { "workgroup", NULL, PROTO_OPT_WORKGROUP,
 180  183              0, 0, MAX_VALUE_BUFLEN,
 181  184              string_length_check_validator},
 182  185          { "signing", NULL, PROTO_OPT_SIGNING,
 183  186              0, 0, MAX_VALUE_BUFLEN,
 184  187              signing_validator},
      188 +        { "min_protocol", NULL, PROTO_OPT_MIN_PROTOCOL,
      189 +            0, 0, MAX_VALUE_BUFLEN,
      190 +            protocol_validator},
      191 +        { "max_protocol", NULL, PROTO_OPT_MAX_PROTOCOL,
      192 +            0, 0, MAX_VALUE_BUFLEN,
      193 +            protocol_validator},
 185  194          {NULL}
 186  195  };
 187  196  
 188  197  /*
 189  198   * Check the range of value as int range.
 190  199   */
 191  200  /*ARGSUSED*/
 192  201  static int
 193  202  range_check_validator(int index, char *section, char *value)
 194  203  {
↓ open down ↓ 68 lines elided ↑ open up ↑
 263  272                  return (SA_OK);
 264  273          if (len > MAX_VALUE_BUFLEN)
 265  274                  return (SA_BAD_VALUE);
 266  275          return (SA_OK);
 267  276  }
 268  277  
 269  278  /*ARGSUSED*/
 270  279  static int
 271  280  minauth_validator(int index, char *section, char *value)
 272  281  {
      282 +        int ival;
      283 +
 273  284          if (value == NULL)
 274  285                  return (SA_BAD_VALUE);
 275      -        if (strlen(value) == 0)
 276      -                return (SA_OK);
 277      -        if (strcmp(value, "kerberos") == 0 ||
 278      -            strcmp(value, "ntlmv2") == 0 ||
 279      -            strcmp(value, "ntlm") == 0 ||
 280      -            strcmp(value, "lm") == 0 ||
 281      -            strcmp(value, "none") == 0)
 282      -                return (SA_OK);
 283      -        else
      286 +        ival = smb_cf_minauth_from_str(value);
      287 +        if (ival == -1)
 284  288                  return (SA_BAD_VALUE);
      289 +
      290 +        return (SA_OK);
 285  291  }
 286  292  
      293 +/*ARGSUSED*/
      294 +static int
      295 +protocol_validator(int index, char *section, char *value)
      296 +{
      297 +        int ival;
      298 +
      299 +        if (value == NULL)
      300 +                return (SA_BAD_VALUE);
      301 +        ival = smb_cf_version_from_str(value);
      302 +        if (ival == -1)
      303 +                return (SA_BAD_VALUE);
      304 +
      305 +        return (SA_OK);
      306 +}
      307 +
 287  308  /*ARGSUSED*/
 288  309  static int
 289  310  signing_validator(int index, char *section, char *value)
 290  311  {
 291  312          if (value == NULL)
 292  313                  return (SA_BAD_VALUE);
 293  314          if (strlen(value) == 0)
 294  315                  return (SA_OK);
 295  316          if (strcmp(value, "disabled") == 0 ||
 296  317              strcmp(value, "enabled") == 0 ||
↓ open down ↓ 448 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX