Move srv_name_slash from cli_state to rpc_pipe_client
authorVolker Lendecke <vl@samba.org>
Sat, 19 Apr 2008 21:03:16 +0000 (23:03 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 19 Apr 2008 22:14:13 +0000 (00:14 +0200)
source/include/client.h
source/libsmb/cliconnect.c
source/rpc_client/cli_lsarpc.c
source/rpc_client/cli_pipe.c
source/rpc_client/cli_samr.c
source/rpcclient/cmd_srvsvc.c
source/utils/net_rpc_service.c

index 02575e41095c14f3570c656dd7e0cfbefd1b4020..af03e2bb60835d57b4272cc7691d5b938910accf 100644 (file)
@@ -67,6 +67,7 @@ struct rpc_pipe_client {
        uint16 fnum;
 
        const char *desthost;
+       const char *srv_name_slash;
 
        const char *domain;
        const char *user_name;
@@ -123,7 +124,6 @@ struct cli_state {
        int privileges;
 
        fstring desthost;
-       fstring srv_name_slash;
 
        /* The credentials used to open the cli_state connection. */
        fstring domain;
index 949bca747d98639de6c7caac06d15b2311fcaaaa..7d3d246da507dbce25fada49e21438d1d2ab1977 100644 (file)
@@ -1492,8 +1492,6 @@ NTSTATUS cli_connect(struct cli_state *cli,
        }
 
        fstrcpy(cli->desthost, host);
-       fstr_sprintf(cli->srv_name_slash, "\\\\%s", cli->desthost);
-       strupper_m(cli->srv_name_slash);
 
        /* allow hostnames of the form NAME#xx and do a netbios lookup */
        if ((p = strchr(cli->desthost, '#'))) {
index 37387a04dd89db8e73838a060b9259e22e4157d4..a799f9221daed458b31de79bfc896c57e05e2ad6 100644 (file)
@@ -108,7 +108,7 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
        }
 
        return rpccli_lsa_OpenPolicy2(cli, mem_ctx,
-                                     cli->cli->srv_name_slash,
+                                     cli->srv_name_slash,
                                      &attr,
                                      des_access,
                                      pol);
index 6465228f18521fda5be074197132d1119c1f7fc6..3ef3f05cc6bdb36e169fdd36624764689c8e95a0 100644 (file)
@@ -2234,6 +2234,13 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
                return NULL;
        }
 
+       result->srv_name_slash = talloc_asprintf_strupper_m(
+               result, "\\\\%s", result->desthost);
+       if (result->srv_name_slash == NULL) {
+               TALLOC_FREE(result);
+               return NULL;
+       }
+
        if (pipe_idx == PI_NETLOGON) {
                /* Set up a netlogon credential chain for a netlogon pipe. */
                result->dc = TALLOC_ZERO_P(result, struct dcinfo);
index fd4fbfc9f41e87977b2c90c2b33b704e2538380f..21fecc41963721490d5bd4f22767b51f78948543 100644 (file)
@@ -45,7 +45,7 @@ NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
 
        DEBUG(10,("rpccli_samr_chgpasswd_user\n"));
 
-       init_lsa_String(&server, cli->cli->srv_name_slash);
+       init_lsa_String(&server, cli->srv_name_slash);
        init_lsa_String(&account, username);
 
        /* Calculate the MD4 hash (NT compatible) of the password */
@@ -105,7 +105,7 @@ NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
 
        DEBUG(10,("rpccli_samr_chng_pswd_auth_crap\n"));
 
-       init_lsa_String(&server, cli->cli->srv_name_slash);
+       init_lsa_String(&server, cli->srv_name_slash);
        init_lsa_String(&account, username);
 
        memcpy(&new_nt_password.data, new_nt_password_blob.data, 516);
@@ -151,7 +151,7 @@ NTSTATUS rpccli_samr_chgpasswd3(struct rpc_pipe_client *cli,
 
        DEBUG(10,("rpccli_samr_chgpasswd_user3\n"));
 
-       init_lsa_String(&server, cli->cli->srv_name_slash);
+       init_lsa_String(&server, cli->srv_name_slash);
        init_lsa_String(&account, username);
 
        /* Calculate the MD4 hash (NT compatible) of the password */
@@ -242,7 +242,7 @@ NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli,
        info_in.info1 = info1;
 
        status = rpccli_samr_Connect5(cli, mem_ctx,
-                                     cli->cli->srv_name_slash,
+                                     cli->srv_name_slash,
                                      access_mask,
                                      1,
                                      &info_in,
@@ -254,7 +254,7 @@ NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli,
        }
 
        status = rpccli_samr_Connect4(cli, mem_ctx,
-                                     cli->cli->srv_name_slash,
+                                     cli->srv_name_slash,
                                      SAMR_CONNECT_W2K,
                                      access_mask,
                                      connect_pol);
@@ -263,7 +263,7 @@ NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli,
        }
 
        status = rpccli_samr_Connect2(cli, mem_ctx,
-                                     cli->cli->srv_name_slash,
+                                     cli->srv_name_slash,
                                      access_mask,
                                      connect_pol);
        return status;
index 7709d47e49a7d93c686d95cab70485211fe7d432..9efd4c979291807d9e3a50af5670b3d032987963 100644 (file)
@@ -525,7 +525,7 @@ static WERROR cmd_srvsvc_net_remote_tod(struct rpc_pipe_client *cli,
        }
 
        status = rpccli_srvsvc_NetRemoteTOD(cli, mem_ctx,
-                                           cli->cli->srv_name_slash,
+                                           cli->srv_name_slash,
                                            &tod,
                                            &result);
        if (!NT_STATUS_IS_OK(status)) {
index 1b12bd311485a9dd5e40d4c4020a679d32ef9383..b886283adce0aa11756c019e7f08bc46f85dfdb6 100644 (file)
@@ -213,7 +213,7 @@ static NTSTATUS rpc_service_list_internal(const DOM_SID *domain_sid,
        }
 
        status = rpccli_svcctl_OpenSCManagerW(pipe_hnd, mem_ctx,
-                                             pipe_hnd->cli->srv_name_slash,
+                                             pipe_hnd->srv_name_slash,
                                              NULL,
                                              SC_RIGHT_MGR_ENUMERATE_SERVICE,
                                              &hSCM,
@@ -272,7 +272,7 @@ static NTSTATUS rpc_service_status_internal(const DOM_SID *domain_sid,
 
        /* Open the Service Control Manager */
        status = rpccli_svcctl_OpenSCManagerW(pipe_hnd, mem_ctx,
-                                             pipe_hnd->cli->srv_name_slash,
+                                             pipe_hnd->srv_name_slash,
                                              NULL,
                                              SC_RIGHT_MGR_ENUMERATE_SERVICE,
                                              &hSCM,
@@ -384,7 +384,7 @@ static NTSTATUS rpc_service_stop_internal(const DOM_SID *domain_sid,
 
        /* Open the Service Control Manager */
        status = rpccli_svcctl_OpenSCManagerW(pipe_hnd, mem_ctx,
-                                             pipe_hnd->cli->srv_name_slash,
+                                             pipe_hnd->srv_name_slash,
                                              NULL,
                                              SC_RIGHT_MGR_ENUMERATE_SERVICE,
                                              &hSCM,
@@ -427,7 +427,7 @@ static NTSTATUS rpc_service_pause_internal(const DOM_SID *domain_sid,
 
        /* Open the Service Control Manager */
        status = rpccli_svcctl_OpenSCManagerW(pipe_hnd, mem_ctx,
-                                             pipe_hnd->cli->srv_name_slash,
+                                             pipe_hnd->srv_name_slash,
                                              NULL,
                                              SC_RIGHT_MGR_ENUMERATE_SERVICE,
                                              &hSCM,
@@ -470,7 +470,7 @@ static NTSTATUS rpc_service_resume_internal(const DOM_SID *domain_sid,
 
        /* Open the Service Control Manager */
        status = rpccli_svcctl_OpenSCManagerW(pipe_hnd, mem_ctx,
-                                             pipe_hnd->cli->srv_name_slash,
+                                             pipe_hnd->srv_name_slash,
                                              NULL,
                                              SC_RIGHT_MGR_ENUMERATE_SERVICE,
                                              &hSCM,
@@ -511,7 +511,7 @@ static NTSTATUS rpc_service_start_internal(const DOM_SID *domain_sid,
 
        /* Open the Service Control Manager */
        status = rpccli_svcctl_OpenSCManagerW(pipe_hnd, mem_ctx,
-                                             pipe_hnd->cli->srv_name_slash,
+                                             pipe_hnd->srv_name_slash,
                                              NULL,
                                              SC_RIGHT_MGR_ENUMERATE_SERVICE,
                                              &hSCM,