Print this page
1575 untangle libmlrpc ... pre2:
 Get rid of ndr_rpc_server_{info,os}

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 ↓ 375 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