Use existing srv_name_slash.
authorGünther Deschner <gd@samba.org>
Wed, 12 Mar 2008 15:35:41 +0000 (16:35 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 12 Mar 2008 15:35:41 +0000 (16:35 +0100)
Guenther

source/rpc_client/cli_lsarpc.c
source/rpc_client/cli_samr.c
source/rpcclient/cmd_srvsvc.c

index 0b89488a21f47e471b6b478ebba83d2434cce1e8..3d57e22f426da8555638b6d5853b1b6bd12d26ea 100644 (file)
@@ -87,7 +87,6 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
 {
        struct lsa_ObjectAttribute attr;
        struct lsa_QosInfo qos;
-       char *srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", cli->cli->desthost);
 
        if (sec_qos) {
                init_lsa_sec_qos(&qos, 0xc, 2, 1, 0);
@@ -109,7 +108,7 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
        }
 
        return rpccli_lsa_OpenPolicy2(cli, mem_ctx,
-                                     srv_name_slash,
+                                     cli->cli->srv_name_slash,
                                      &attr,
                                      des_access,
                                      pol);
index 62a5c72d81dcace043b2bd9888e5033df55349e5..f0763cce1fec2d4f89ca2e545b36c2afcd27077d 100644 (file)
@@ -42,18 +42,12 @@ NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
        uchar new_nt_hash[16];
        uchar new_lanman_hash[16];
        struct lsa_String server, account;
-       char *srv_name_slash = NULL;
 
        DEBUG(10,("rpccli_samr_chgpasswd_user\n"));
 
-       init_lsa_String(&server, srv_name_slash);
+       init_lsa_String(&server, cli->cli->srv_name_slash);
        init_lsa_String(&account, username);
 
-       srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", cli->cli->desthost);
-       if (!srv_name_slash) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
        /* Calculate the MD4 hash (NT compatible) of the password */
        E_md4hash(oldpassword, old_nt_hash);
        E_md4hash(newpassword, new_nt_hash);
@@ -108,16 +102,10 @@ NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
        struct samr_Password old_nt_hash_enc;
        struct samr_Password old_lm_hash_enc;
        struct lsa_String server, account;
-       char *srv_name_slash = NULL;
 
        DEBUG(10,("rpccli_samr_chng_pswd_auth_crap\n"));
 
-       srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", cli->cli->desthost);
-       if (!srv_name_slash) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       init_lsa_String(&server, srv_name_slash);
+       init_lsa_String(&server, cli->cli->srv_name_slash);
        init_lsa_String(&account, username);
 
        memcpy(&new_nt_password.data, new_nt_password_blob.data, 516);
@@ -160,16 +148,10 @@ NTSTATUS rpccli_samr_chgpasswd3(struct rpc_pipe_client *cli,
        uchar new_lanman_hash[16];
 
        struct lsa_String server, account;
-       char *srv_name_slash = NULL;
 
        DEBUG(10,("rpccli_samr_chgpasswd_user3\n"));
 
-       srv_name_slash = talloc_asprintf(mem_ctx, "\\\\%s", cli->cli->desthost);
-       if (!srv_name_slash) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       init_lsa_String(&server, srv_name_slash);
+       init_lsa_String(&server, cli->cli->srv_name_slash);
        init_lsa_String(&account, username);
 
        /* Calculate the MD4 hash (NT compatible) of the password */
index 0c447e030627678cf2fb666c4eb41d46a79a14af..fc00f8a178c0ec75d6ff5ec4cf5590b2e099c82c 100644 (file)
@@ -516,7 +516,6 @@ static WERROR cmd_srvsvc_net_remote_tod(struct rpc_pipe_client *cli,
                                           int argc, const char **argv)
 {
        struct srvsvc_NetRemoteTODInfo *tod = NULL;
-       fstring srv_name_slash;
        WERROR result;
        NTSTATUS status;
 
@@ -525,9 +524,8 @@ static WERROR cmd_srvsvc_net_remote_tod(struct rpc_pipe_client *cli,
                return WERR_OK;
        }
 
-       fstr_sprintf(srv_name_slash, "\\\\%s", cli->cli->desthost);
        status = rpccli_srvsvc_NetRemoteTOD(cli, mem_ctx,
-                                           srv_name_slash,
+                                           cli->cli->srv_name_slash,
                                            &tod,
                                            &result);
        if (!NT_STATUS_IS_OK(status)) {