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)
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-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>
re #12435 rb3958 r10 is added 2 times to panic info
re #12393 rb3935 Kerberos and smbd disagree about who is our AD server

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/smbsrv/libmlsvc/common/lsar_clnt.c
          +++ new/usr/src/lib/smbsrv/libmlsvc/common/lsar_clnt.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  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  /*
  23   23   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24      - * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       24 + * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  25   25   */
  26   26  
  27   27  /*
  28   28   * Local Security Authority RPC (LSAR) client-side interface.
  29   29   */
  30   30  
  31   31  #include <sys/errno.h>
  32   32  #include <stdio.h>
  33   33  #include <stdlib.h>
  34   34  #include <strings.h>
  35   35  
  36   36  #include <smbsrv/libsmb.h>
  37   37  #include <smbsrv/libmlsvc.h>
  38   38  #include <smbsrv/smbinfo.h>
  39      -#include <smbsrv/ntaccess.h>
       39 +#include <smb/ntaccess.h>
  40   40  #include <smbsrv/ntlocale.h>
  41   41  #include <smbsrv/string.h>
  42   42  #include <lsalib.h>
  43   43  
  44   44  /*
  45   45   * The maximum number of bytes we are prepared to deal with in a
  46   46   * response.
  47   47   */
  48   48  #define MLSVC_MAX_RESPONSE_LEN          1024
  49   49  
↓ open down ↓ 326 lines elided ↑ open up ↑
 376  376   */
 377  377  uint32_t
 378  378  lsar_lookup_names(mlsvc_handle_t *lsa_handle, char *name, smb_account_t *info)
 379  379  {
 380  380          static lsar_nameop_t ops[] = {
 381  381                  lsar_lookup_names3,
 382  382                  lsar_lookup_names2,
 383  383                  lsar_lookup_names1
 384  384          };
 385  385  
 386      -        const srvsvc_server_info_t      *svinfo;
 387  386          lsa_names_t     names;
 388  387          char            *p;
 389  388          uint32_t        length;
 390  389          uint32_t        status = NT_STATUS_INVALID_PARAMETER;
 391  390          int             n_op = (sizeof (ops) / sizeof (ops[0]));
 392  391          int             i;
 393  392  
 394  393          if (lsa_handle == NULL || name == NULL || info == NULL)
 395  394                  return (NT_STATUS_INVALID_PARAMETER);
 396  395  
 397  396          bzero(info, sizeof (smb_account_t));
 398  397  
 399      -        svinfo = ndr_rpc_server_info(lsa_handle);
 400      -        if (svinfo->sv_os == NATIVE_OS_WIN2000 &&
 401      -            svinfo->sv_version_major == 5 && svinfo->sv_version_minor == 0) {
 402      -                /*
 403      -                 * Windows 2000 doesn't like an LSA lookup for
 404      -                 * DOMAIN\Administrator.
 405      -                 */
 406      -                if ((p = strchr(name, '\\')) != 0) {
 407      -                        ++p;
      398 +        /*
      399 +         * Windows 2000 (or later) doesn't like an LSA lookup for
      400 +         * DOMAIN\Administrator.
      401 +         */
      402 +        if ((p = strchr(name, '\\')) != 0) {
      403 +                ++p;
 408  404  
 409      -                        if (strcasecmp(p, "administrator") == 0)
 410      -                                name = p;
 411      -                }
 412      -
      405 +                if (strcasecmp(p, "administrator") == 0)
      406 +                        name = p;
 413  407          }
 414  408  
 415  409          length = smb_wcequiv_strlen(name);
 416  410          names.name[0].length = length;
 417  411          names.name[0].allosize = length;
 418  412          names.name[0].str = (unsigned char *)name;
 419  413          names.n_entry = 1;
 420  414  
 421      -        if (ndr_rpc_server_os(lsa_handle) == NATIVE_OS_WIN2000) {
 422      -                for (i = 0; i < n_op; ++i) {
 423      -                        ndr_rpc_set_nonull(lsa_handle);
 424      -                        status = (*ops[i])(lsa_handle, &names, info);
 425      -
 426      -                        if (status != NT_STATUS_INVALID_PARAMETER)
 427      -                                break;
 428      -                }
 429      -        } else {
      415 +        for (i = 0; i < n_op; ++i) {
 430  416                  ndr_rpc_set_nonull(lsa_handle);
 431      -                status = lsar_lookup_names1(lsa_handle, &names, info);
      417 +                status = (*ops[i])(lsa_handle, &names, info);
      418 +
      419 +                if (status != NT_STATUS_INVALID_PARAMETER)
      420 +                        break;
 432  421          }
 433  422  
 434  423          if (status == NT_STATUS_SUCCESS) {
 435  424                  info->a_name = lsar_get_username(name);
 436  425  
 437  426                  if (!smb_account_validate(info)) {
 438  427                          smb_account_free(info);
 439  428                          status = NT_STATUS_NO_MEMORY;
 440  429                  } else {
 441  430                          smb_account_trace(info);
↓ open down ↓ 277 lines elided ↑ open up ↑
 719  708          uint32_t        status;
 720  709  
 721  710          if (lsa_handle == NULL || sid == NULL || account == NULL)
 722  711                  return (NT_STATUS_INVALID_PARAMETER);
 723  712  
 724  713          bzero(account, sizeof (smb_account_t));
 725  714          bzero(sidbuf, SMB_SID_STRSZ);
 726  715          smb_sid_tostr(sid, sidbuf);
 727  716          smb_tracef("%s", sidbuf);
 728  717  
 729      -        if (ndr_rpc_server_os(lsa_handle) == NATIVE_OS_WIN2000)
 730      -                status = lsar_lookup_sids2(lsa_handle, (lsa_sid_t *)sid,
 731      -                    account);
 732      -        else
      718 +        status = lsar_lookup_sids2(lsa_handle, (lsa_sid_t *)sid, account);
      719 +        if (status == RPC_NT_PROCNUM_OUT_OF_RANGE)
 733  720                  status = lsar_lookup_sids1(lsa_handle, (lsa_sid_t *)sid,
 734  721                      account);
 735  722  
 736  723          if (status == NT_STATUS_SUCCESS) {
 737  724                  if (!smb_account_validate(account)) {
 738  725                          smb_account_free(account);
 739  726                          status = NT_STATUS_NO_MEMORY;
 740  727                  } else {
 741  728                          smb_account_trace(account);
 742  729                  }
↓ open down ↓ 417 lines elided ↑ open up ↑
1160 1147  
1161 1148          if (lsa_handle == NULL || name == NULL || luid == NULL)
1162 1149                  return (-1);
1163 1150  
1164 1151          opnum = LSARPC_OPNUM_LookupPrivValue;
1165 1152  
1166 1153          bzero(&arg, sizeof (struct mslsa_LookupPrivValue));
1167 1154          (void) memcpy(&arg.handle, lsa_handle, sizeof (mslsa_handle_t));
1168 1155  
1169 1156          length = smb_wcequiv_strlen(name);
1170      -        if (ndr_rpc_server_os(lsa_handle) == NATIVE_OS_WIN2000)
1171      -                length += sizeof (smb_wchar_t);
     1157 +        length += sizeof (smb_wchar_t);
1172 1158  
1173 1159          arg.name.length = length;
1174 1160          arg.name.allosize = length;
1175 1161          arg.name.str = (unsigned char *)name;
1176 1162  
1177 1163          rc = ndr_rpc_call(lsa_handle, opnum, &arg);
1178 1164          if (rc == 0) {
1179 1165                  if (arg.status != 0)
1180 1166                          rc = -1;
1181 1167                  else
↓ open down ↓ 167 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX