From 1ec14224e7c041756118d3c5a32eb3385d720e27 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 25 Apr 2008 16:34:30 +0200 Subject: [PATCH] Revert "Move srv_name_slash from cli_state to rpc_pipe_client" This reverts commit a9061e52e1ff8e31aa480f4a30cda64c9d93214e. --- source/include/client.h | 2 +- source/libsmb/cliconnect.c | 2 ++ source/rpc_client/cli_lsarpc.c | 2 +- source/rpc_client/cli_pipe.c | 7 ------- source/rpc_client/cli_samr.c | 12 ++++++------ source/rpcclient/cmd_srvsvc.c | 2 +- source/utils/net_rpc_service.c | 12 ++++++------ 7 files changed, 17 insertions(+), 22 deletions(-) diff --git a/source/include/client.h b/source/include/client.h index af03e2bb608..02575e41095 100644 --- a/source/include/client.h +++ b/source/include/client.h @@ -67,7 +67,6 @@ struct rpc_pipe_client { uint16 fnum; const char *desthost; - const char *srv_name_slash; const char *domain; const char *user_name; @@ -124,6 +123,7 @@ struct cli_state { int privileges; fstring desthost; + fstring srv_name_slash; /* The credentials used to open the cli_state connection. */ fstring domain; diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c index 7d3d246da50..949bca747d9 100644 --- a/source/libsmb/cliconnect.c +++ b/source/libsmb/cliconnect.c @@ -1492,6 +1492,8 @@ 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, '#'))) { diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c index a799f9221da..37387a04dd8 100644 --- a/source/rpc_client/cli_lsarpc.c +++ b/source/rpc_client/cli_lsarpc.c @@ -108,7 +108,7 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli, } return rpccli_lsa_OpenPolicy2(cli, mem_ctx, - cli->srv_name_slash, + cli->cli->srv_name_slash, &attr, des_access, pol); diff --git a/source/rpc_client/cli_pipe.c b/source/rpc_client/cli_pipe.c index 3ef3f05cc6b..6465228f185 100644 --- a/source/rpc_client/cli_pipe.c +++ b/source/rpc_client/cli_pipe.c @@ -2234,13 +2234,6 @@ 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); diff --git a/source/rpc_client/cli_samr.c b/source/rpc_client/cli_samr.c index 21fecc41963..fd4fbfc9f41 100644 --- a/source/rpc_client/cli_samr.c +++ b/source/rpc_client/cli_samr.c @@ -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->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 */ @@ -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->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); @@ -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->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 */ @@ -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->srv_name_slash, + cli->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->srv_name_slash, + cli->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->srv_name_slash, + cli->cli->srv_name_slash, access_mask, connect_pol); return status; diff --git a/source/rpcclient/cmd_srvsvc.c b/source/rpcclient/cmd_srvsvc.c index 9efd4c97929..7709d47e49a 100644 --- a/source/rpcclient/cmd_srvsvc.c +++ b/source/rpcclient/cmd_srvsvc.c @@ -525,7 +525,7 @@ static WERROR cmd_srvsvc_net_remote_tod(struct rpc_pipe_client *cli, } status = rpccli_srvsvc_NetRemoteTOD(cli, mem_ctx, - cli->srv_name_slash, + cli->cli->srv_name_slash, &tod, &result); if (!NT_STATUS_IS_OK(status)) { diff --git a/source/utils/net_rpc_service.c b/source/utils/net_rpc_service.c index b886283adce..1b12bd31148 100644 --- a/source/utils/net_rpc_service.c +++ b/source/utils/net_rpc_service.c @@ -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->srv_name_slash, + pipe_hnd->cli->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->srv_name_slash, + pipe_hnd->cli->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->srv_name_slash, + pipe_hnd->cli->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->srv_name_slash, + pipe_hnd->cli->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->srv_name_slash, + pipe_hnd->cli->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->srv_name_slash, + pipe_hnd->cli->srv_name_slash, NULL, SC_RIGHT_MGR_ENUMERATE_SERVICE, &hSCM, -- 2.47.3