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/mlsvc_client.c
          +++ new/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_client.c
↓ open down ↓ 78 lines elided ↑ open up ↑
  79   79   *      NT_STATUS_INTERNAL_ERROR        (bad args etc)
  80   80   *      NT_STATUS_NO_MEMORY
  81   81   */
  82   82  DWORD
  83   83  ndr_rpc_bind(mlsvc_handle_t *handle, char *server, char *domain,
  84   84      char *username, const char *service)
  85   85  {
  86   86          struct smb_ctx          *ctx = NULL;
  87   87          ndr_client_t            *clnt = NULL;
  88   88          ndr_service_t           *svc;
  89      -        srvsvc_server_info_t    svinfo;
  90   89          DWORD                   status;
  91   90          int                     fd = -1;
  92   91          int                     rc;
  93   92  
  94   93          if (handle == NULL || server == NULL || server[0] == '\0' ||
  95   94              domain == NULL || username == NULL)
  96   95                  return (NT_STATUS_INTERNAL_ERROR);
  97   96  
  98   97          /* In case the service was not registered... */
  99   98          if ((svc = ndr_svc_lookup_name(service)) == NULL)
 100   99                  return (NT_STATUS_INTERNAL_ERROR);
 101  100  
 102  101          /*
 103      -         * Set the default based on the assumption that most
 104      -         * servers will be Windows 2000 or later.  This used to
 105      -         * try to get the actual server version, but that RPC
 106      -         * is not necessarily allowed anymore, so don't bother.
 107      -         */
 108      -        bzero(&svinfo, sizeof (srvsvc_server_info_t));
 109      -        svinfo.sv_platform_id = SV_PLATFORM_ID_NT;
 110      -        svinfo.sv_version_major = 5;
 111      -        svinfo.sv_version_minor = 0;
 112      -        svinfo.sv_type = SV_TYPE_DEFAULT;
 113      -        svinfo.sv_os = NATIVE_OS_WIN2000;
 114      -
 115      -        /*
 116  102           * Some callers pass this when they want a NULL session.
 117  103           * Todo: have callers pass an empty string for that.
 118  104           */
 119  105          if (strcmp(username, MLSVC_ANON_USER) == 0)
 120  106                  username = "";
 121  107  
 122  108          /*
 123  109           * Setup smbfs library handle, authenticate, connect to
 124  110           * the IPC$ share.  This will reuse an existing connection
 125  111           * if the driver already has one for this combination of
↓ open down ↓ 58 lines elided ↑ open up ↑
 184  170          if ((clnt->heap = ndr_heap_create()) == NULL) {
 185  171                  status = NT_STATUS_NO_MEMORY;
 186  172                  goto errout;
 187  173          }
 188  174  
 189  175          /*
 190  176           * Fill in the caller's handle.
 191  177           */
 192  178          bzero(&handle->handle, sizeof (ndr_hdid_t));
 193  179          handle->clnt = clnt;
 194      -        bcopy(&svinfo, &handle->svinfo, sizeof (srvsvc_server_info_t));
 195  180  
 196  181          /*
 197  182           * Do the OtW RPC bind.
 198  183           */
 199  184          rc = ndr_clnt_bind(clnt, service, &clnt->binding);
 200  185          switch (rc) {
 201  186          case NDR_DRC_FAULT_OUT_OF_MEMORY:
 202  187                  status = NT_STATUS_NO_MEMORY;
 203  188                  break;
 204  189          case NDR_DRC_FAULT_API_SERVICE_INVALID: /* not registered */
↓ open down ↓ 91 lines elided ↑ open up ↑
 296  281  /*
 297  282   * Outgoing strings should not be null terminated.
 298  283   */
 299  284  void
 300  285  ndr_rpc_set_nonull(mlsvc_handle_t *handle)
 301  286  {
 302  287          handle->clnt->nonull = B_TRUE;
 303  288  }
 304  289  
 305  290  /*
 306      - * Return a reference to the server info.
 307      - */
 308      -const srvsvc_server_info_t *
 309      -ndr_rpc_server_info(mlsvc_handle_t *handle)
 310      -{
 311      -        return (&handle->svinfo);
 312      -}
 313      -
 314      -/*
 315      - * Return the RPC server OS level.
 316      - */
 317      -uint32_t
 318      -ndr_rpc_server_os(mlsvc_handle_t *handle)
 319      -{
 320      -        return (handle->svinfo.sv_os);
 321      -}
 322      -
 323      -/*
 324  291   * Get the session key from a bound RPC client handle.
 325  292   *
 326  293   * The key returned is the 16-byte "user session key"
 327  294   * established by the underlying authentication protocol
 328  295   * (either Kerberos or NTLM).  This key is needed for
 329  296   * SAM RPC calls such as SamrSetInformationUser, etc.
 330  297   * See [MS-SAMR] sections: 2.2.3.3, 2.2.7.21, 2.2.7.25.
 331  298   *
 332  299   * Returns zero (success) or an errno.
 333  300   */
↓ open down ↓ 80 lines elided ↑ open up ↑
 414  381          return (handle->clnt->handle == &handle->handle);
 415  382  }
 416  383  
 417  384  /*
 418  385   * Pass the client reference from parent to child.
 419  386   */
 420  387  void
 421  388  ndr_inherit_handle(mlsvc_handle_t *child, mlsvc_handle_t *parent)
 422  389  {
 423  390          child->clnt = parent->clnt;
 424      -        bcopy(&parent->svinfo, &child->svinfo, sizeof (srvsvc_server_info_t));
 425  391  }
 426  392  
 427  393  void
 428  394  ndr_rpc_status(mlsvc_handle_t *handle, int opnum, DWORD status)
 429  395  {
 430  396          ndr_service_t *svc;
 431  397          char *name = "NDR RPC";
 432  398          char *s = "unknown";
 433  399  
 434  400          switch (NT_SC_SEVERITY(status)) {
↓ open down ↓ 169 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX