From 2a2188591b5ed922d09dc723adcf10f8b8f5e5a0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Apr 2008 21:56:43 +0200 Subject: Add "desthost" to rpc_pipe_client This reduces the dependency on cli_state (This used to be commit 783afab9c891dd7bcb78895b2a639b6f3a0edf5b) --- source3/rpcclient/cmd_lsarpc.c | 2 +- source3/rpcclient/cmd_netlogon.c | 30 ++++++++-------- source3/rpcclient/cmd_spoolss.c | 76 ++++++++++++++++++---------------------- source3/rpcclient/cmd_srvsvc.c | 28 +++++++-------- source3/rpcclient/cmd_wkssvc.c | 12 +++---- 5 files changed, 70 insertions(+), 78 deletions(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 0d530ceaf2..88e49546b1 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -1137,7 +1137,7 @@ static NTSTATUS cmd_lsa_get_username(struct rpc_pipe_client *cli, { POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - const char *servername = cli->cli->desthost; + const char *servername = cli->desthost; struct lsa_String *account_name = NULL; struct lsa_String *authority_name = NULL; diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 95d79b5825..a30dd740e2 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -28,7 +28,7 @@ static WERROR cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; WERROR werr; - const char *logon_server = cli->cli->desthost; + const char *logon_server = cli->desthost; enum netr_LogonControlCode function_code = NETLOGON_CONTROL_REDISCOVER; uint32_t level = 1; union netr_CONTROL_DATA_INFORMATION data; @@ -104,7 +104,7 @@ static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli, old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */ status = rpccli_netr_GetAnyDCName(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], &dcname, &werr); @@ -143,7 +143,7 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli, old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */ status = rpccli_netr_GetDcName(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], &dcname, &werr); @@ -171,7 +171,7 @@ static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, NTSTATUS result; WERROR werr = WERR_OK; uint32 flags = DS_RETURN_DNS_NAME; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; const char *domain_name; struct GUID domain_guid = GUID_zero(); struct GUID site_guid = GUID_zero(); @@ -231,7 +231,7 @@ static WERROR cmd_netlogon_dsr_getdcnameex(struct rpc_pipe_client *cli, WERROR result; NTSTATUS status; uint32_t flags = DS_RETURN_DNS_NAME; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; const char *domain_name; const char *site_name = NULL; struct GUID domain_guid = GUID_zero(); @@ -290,7 +290,7 @@ static WERROR cmd_netlogon_dsr_getdcnameex2(struct rpc_pipe_client *cli, WERROR result; NTSTATUS status; uint32_t flags = DS_RETURN_DNS_NAME; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; const char *domain_name = NULL; const char *client_account = NULL; uint32_t mask = 0; @@ -396,7 +396,7 @@ static WERROR cmd_netlogon_logon_ctrl(struct rpc_pipe_client *cli, { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; WERROR werr; - const char *logon_server = cli->cli->desthost; + const char *logon_server = cli->desthost; enum netr_LogonControlCode function_code = 1; uint32_t level = 1; union netr_CONTROL_QUERY_INFORMATION info; @@ -560,7 +560,7 @@ static NTSTATUS cmd_netlogon_sam_sync(struct rpc_pipe_client *cli, const char **argv) { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - const char *logon_server = cli->cli->desthost; + const char *logon_server = cli->desthost; const char *computername = global_myname(); struct netr_Authenticator credential; struct netr_Authenticator return_authenticator; @@ -625,7 +625,7 @@ static NTSTATUS cmd_netlogon_sam_deltas(struct rpc_pipe_client *cli, { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; uint32_t tmp; - const char *logon_server = cli->cli->desthost; + const char *logon_server = cli->desthost; const char *computername = global_myname(); struct netr_Authenticator credential; struct netr_Authenticator return_authenticator; @@ -759,7 +759,7 @@ static WERROR cmd_netlogon_gettrustrid(struct rpc_pipe_client *cli, { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; WERROR werr = WERR_GENERAL_FAILURE; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; const char *domain_name = lp_workgroup(); uint32_t rid = 0; @@ -799,7 +799,7 @@ static WERROR cmd_netlogon_dsr_enumtrustdom(struct rpc_pipe_client *cli, { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; WERROR werr = WERR_GENERAL_FAILURE; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; uint32_t trust_flags = NETR_TRUST_FLAG_IN_FOREST; struct netr_DomainTrustList trusts; @@ -847,7 +847,7 @@ static WERROR cmd_netlogon_deregisterdnsrecords(struct rpc_pipe_client *cli, { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; WERROR werr = WERR_GENERAL_FAILURE; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; const char *domain = lp_workgroup(); const char *dns_host = NULL; @@ -893,7 +893,7 @@ static WERROR cmd_netlogon_dsr_getforesttrustinfo(struct rpc_pipe_client *cli, { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; WERROR werr = WERR_GENERAL_FAILURE; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; const char *trusted_domain_name = NULL; struct lsa_ForestTrustInformation *info = NULL; uint32_t flags = 0; @@ -939,7 +939,7 @@ static WERROR cmd_netlogon_enumtrusteddomains(struct rpc_pipe_client *cli, { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; WERROR werr = WERR_GENERAL_FAILURE; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; struct netr_Blob blob; @@ -974,7 +974,7 @@ static WERROR cmd_netlogon_enumtrusteddomainsex(struct rpc_pipe_client *cli, { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; WERROR werr = WERR_GENERAL_FAILURE; - const char *server_name = cli->cli->desthost; + const char *server_name = cli->desthost; struct netr_DomainTrustList list; if (argc < 1 || argc > 3) { diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 7530ab1911..eb42836b6c 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -109,7 +109,7 @@ static WERROR cmd_spoolss_open_printer_ex(struct rpc_pipe_client *cli, if (!cli) return WERR_GENERAL_FAILURE; - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); fstrcpy(user, cli->user_name); fstrcpy(printername, argv[1]); @@ -317,7 +317,7 @@ static WERROR cmd_spoolss_enum_printers(struct rpc_pipe_client *cli, if (argc == 3) fstrcpy(name, argv[2]); else { - slprintf(name, sizeof(name)-1, "\\\\%s", cli->cli->desthost); + slprintf(name, sizeof(name)-1, "\\\\%s", cli->desthost); strupper_m(name); } @@ -488,7 +488,7 @@ static WERROR cmd_spoolss_setprinter(struct rpc_pipe_client *cli, fstrcpy(comment, argv[2]); } - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]); fstrcpy(user, cli->user_name); @@ -554,7 +554,7 @@ static WERROR cmd_spoolss_setprintername(struct rpc_pipe_client *cli, fstrcpy(new_printername, argv[2]); } - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]); fstrcpy(user, cli->user_name); @@ -617,7 +617,7 @@ static WERROR cmd_spoolss_getprinter(struct rpc_pipe_client *cli, info_level = atoi(argv[2]); } - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]); fstrcpy(user, cli->user_name); @@ -756,7 +756,7 @@ static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli, /* Open a printer handle */ - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); if (strncmp(argv[1], ".", sizeof(".")) == 0) fstrcpy(printername, servername); @@ -823,7 +823,7 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli, /* Open a printer handle */ - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); if (strncmp(argv[1], ".", sizeof(".")) == 0) fstrcpy(printername, servername); @@ -999,7 +999,7 @@ static WERROR cmd_spoolss_getdriver(struct rpc_pipe_client *cli, } /* get the arguments need to open the printer handle */ - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); fstrcpy(user, cli->user_name); slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]); @@ -1382,7 +1382,7 @@ static WERROR cmd_spoolss_addprinterex(struct rpc_pipe_client *cli, return WERR_OK; } - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); /* Fill in the DRIVER_INFO_2 struct */ @@ -1444,7 +1444,7 @@ static WERROR cmd_spoolss_setdriver(struct rpc_pipe_client *cli, return WERR_OK; } - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); slprintf(printername, sizeof(printername)-1, "%s\\%s", servername, argv[1]); fstrcpy(user, cli->user_name); @@ -1570,7 +1570,7 @@ static WERROR cmd_spoolss_deletedriver(struct rpc_pipe_client *cli, return WERR_OK; } - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); /* delete the driver for all architectures */ @@ -1611,7 +1611,7 @@ static WERROR cmd_spoolss_getprintprocdir(struct rpc_pipe_client *cli, return WERR_OK; } - if (asprintf(&servername, "\\\\%s", cli->cli->desthost) < 0) + if (asprintf(&servername, "\\\\%s", cli->desthost) < 0) return WERR_NOMEM; strupper_m(servername); @@ -1654,7 +1654,7 @@ static WERROR cmd_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* Get a printer handle */ - asprintf(&servername, "\\\\%s", cli->cli->desthost); + asprintf(&servername, "\\\\%s", cli->desthost); strupper_m(servername); asprintf(&printername, "%s\\%s", servername, argv[1]); @@ -1714,7 +1714,7 @@ static WERROR cmd_spoolss_setform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* Get a printer handle */ - asprintf(&servername, "\\\\%s", cli->cli->desthost); + asprintf(&servername, "\\\\%s", cli->desthost); strupper_m(servername); asprintf(&printername, "%s\\%s", servername, argv[1]); @@ -1811,7 +1811,7 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* Get a printer handle */ - asprintf(&servername, "\\\\%s", cli->cli->desthost); + asprintf(&servername, "\\\\%s", cli->desthost); strupper_m(servername); asprintf(&printername, "%s\\%s", servername, argv[1]); @@ -1864,7 +1864,7 @@ static WERROR cmd_spoolss_deleteform(struct rpc_pipe_client *cli, /* Get a printer handle */ - asprintf(&servername, "\\\\%s", cli->cli->desthost); + asprintf(&servername, "\\\\%s", cli->desthost); strupper_m(servername); asprintf(&printername, "%s\\%s", servername, argv[1]); @@ -1914,7 +1914,7 @@ static WERROR cmd_spoolss_enum_forms(struct rpc_pipe_client *cli, /* Get a printer handle */ - asprintf(&servername, "\\\\%s", cli->cli->desthost); + asprintf(&servername, "\\\\%s", cli->desthost); strupper_m(servername); asprintf(&printername, "%s\\%s", servername, argv[1]); @@ -1977,7 +1977,7 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli, goto done; } - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); slprintf(printername, sizeof(servername)-1, "%s\\%s", servername, argv[1]); fstrcpy(user, cli->user_name); @@ -2187,12 +2187,10 @@ static WERROR cmd_spoolss_enum_jobs(struct rpc_pipe_client *cli, /* Open printer handle */ - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); fstrcpy(user, cli->user_name); - printername = talloc_asprintf(mem_ctx, - "\\\\%s\\", - cli->cli->desthost); + printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost); if (!printername) { return WERR_NOMEM; } @@ -2261,12 +2259,10 @@ static WERROR cmd_spoolss_enum_data( struct rpc_pipe_client *cli, /* Open printer handle */ - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); fstrcpy(user, cli->user_name); - printername = talloc_asprintf(mem_ctx, - "\\\\%s\\", - cli->cli->desthost); + printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost); if (!printername) { return WERR_NOMEM; } @@ -2333,13 +2329,11 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli, /* Open printer handle */ - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); fstrcpy(user, cli->user_name); - printername = talloc_asprintf(mem_ctx, - "\\\\%s\\", - cli->cli->desthost); + printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost); if (!printername) { return WERR_NOMEM; } @@ -2408,13 +2402,11 @@ static WERROR cmd_spoolss_enum_printerkey( struct rpc_pipe_client *cli, /* Open printer handle */ - slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); strupper_m(servername); fstrcpy(user, cli->user_name); - printername = talloc_asprintf(mem_ctx, - "\\\\%s\\", - cli->cli->desthost); + printername = talloc_asprintf(mem_ctx, "\\\\%s\\", cli->desthost); if (!printername) { return WERR_NOMEM; } @@ -2484,11 +2476,11 @@ static WERROR cmd_spoolss_rffpcnex(struct rpc_pipe_client *cli, /* Open printer */ - slprintf(servername, sizeof(servername) - 1, "\\\\%s", cli->cli->desthost); + slprintf(servername, sizeof(servername) - 1, "\\\\%s", cli->desthost); strupper_m(servername); - slprintf(printername, sizeof(printername) - 1, "\\\\%s\\%s", cli->cli->desthost, - argv[1]); + slprintf(printername, sizeof(printername) - 1, "\\\\%s\\%s", + cli->desthost, argv[1]); strupper_m(printername); result = rpccli_spoolss_open_printer_ex( @@ -2558,7 +2550,7 @@ static bool compare_printer( struct rpc_pipe_client *cli1, POLICY_HND *hnd1, WERROR werror; TALLOC_CTX *mem_ctx = talloc_init("compare_printer"); - printf("Retrieving printer propertiesfor %s...", cli1->cli->desthost); + printf("Retrieving printer propertiesfor %s...", cli1->desthost); werror = rpccli_spoolss_getprinter( cli1, mem_ctx, hnd1, 2, &ctr1); if ( !W_ERROR_IS_OK(werror) ) { printf("failed (%s)\n", dos_errstr(werror)); @@ -2567,7 +2559,7 @@ static bool compare_printer( struct rpc_pipe_client *cli1, POLICY_HND *hnd1, } printf("ok\n"); - printf("Retrieving printer properties for %s...", cli2->cli->desthost); + printf("Retrieving printer properties for %s...", cli2->desthost); werror = rpccli_spoolss_getprinter( cli2, mem_ctx, hnd2, 2, &ctr2); if ( !W_ERROR_IS_OK(werror) ) { printf("failed (%s)\n", dos_errstr(werror)); @@ -2594,7 +2586,7 @@ static bool compare_printer_secdesc( struct rpc_pipe_client *cli1, POLICY_HND *h bool result = True; - printf("Retreiving printer security for %s...", cli1->cli->desthost); + printf("Retrieving printer security for %s...", cli1->desthost); werror = rpccli_spoolss_getprinter( cli1, mem_ctx, hnd1, 3, &ctr1); if ( !W_ERROR_IS_OK(werror) ) { printf("failed (%s)\n", dos_errstr(werror)); @@ -2603,7 +2595,7 @@ static bool compare_printer_secdesc( struct rpc_pipe_client *cli1, POLICY_HND *h } printf("ok\n"); - printf("Retrieving printer security for %s...", cli2->cli->desthost); + printf("Retrieving printer security for %s...", cli2->desthost); werror = rpccli_spoolss_getprinter( cli2, mem_ctx, hnd2, 3, &ctr2); if ( !W_ERROR_IS_OK(werror) ) { printf("failed (%s)\n", dos_errstr(werror)); @@ -2667,7 +2659,7 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli, fstrcpy( printername, argv[1] ); - fstrcpy( servername1, cli->cli->desthost ); + fstrcpy( servername1, cli->desthost ); fstrcpy( servername2, argv[2] ); strupper_m( servername1 ); strupper_m( servername2 ); diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c index 070fb36e30..7709d47e49 100644 --- a/source3/rpcclient/cmd_srvsvc.c +++ b/source3/rpcclient/cmd_srvsvc.c @@ -183,7 +183,7 @@ static WERROR cmd_srvsvc_srv_query_info(struct rpc_pipe_client *cli, info_level = atoi(argv[1]); server_name = talloc_asprintf_strupper_m(mem_ctx, "\\\\%s", - cli->cli->desthost); + cli->desthost); W_ERROR_HAVE_NO_MEMORY(server_name); status = rpccli_srvsvc_NetSrvGetInfo(cli, mem_ctx, @@ -336,7 +336,7 @@ static WERROR cmd_srvsvc_net_share_enum_int(struct rpc_pipe_client *cli, switch (opcode) { case NDR_SRVSVC_NETSHAREENUM: status = rpccli_srvsvc_NetShareEnum(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, &info_ctr, preferred_len, &totalentries, @@ -345,7 +345,7 @@ static WERROR cmd_srvsvc_net_share_enum_int(struct rpc_pipe_client *cli, break; case NDR_SRVSVC_NETSHAREENUMALL: status = rpccli_srvsvc_NetShareEnumAll(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, &info_ctr, preferred_len, &totalentries, @@ -420,7 +420,7 @@ static WERROR cmd_srvsvc_net_share_get_info(struct rpc_pipe_client *cli, info_level = atoi(argv[2]); status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], info_level, &info, @@ -468,7 +468,7 @@ static WERROR cmd_srvsvc_net_share_set_info(struct rpc_pipe_client *cli, /* retrieve share info */ status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], info_level, &info_get, @@ -482,7 +482,7 @@ static WERROR cmd_srvsvc_net_share_set_info(struct rpc_pipe_client *cli, /* set share info */ status = rpccli_srvsvc_NetShareSetInfo(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], info_level, &info_get, @@ -495,7 +495,7 @@ static WERROR cmd_srvsvc_net_share_set_info(struct rpc_pipe_client *cli, /* re-retrieve share info and display */ status = rpccli_srvsvc_NetShareGetInfo(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], info_level, &info_get, @@ -568,7 +568,7 @@ static WERROR cmd_srvsvc_net_file_enum(struct rpc_pipe_client *cli, info_ctr.ctr.ctr3 = &ctr3; status = rpccli_srvsvc_NetFileEnum(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, NULL, NULL, &info_ctr, @@ -603,7 +603,7 @@ static WERROR cmd_srvsvc_net_name_validate(struct rpc_pipe_client *cli, } status = rpccli_srvsvc_NetNameValidate(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], name_type, flags, @@ -630,7 +630,7 @@ static WERROR cmd_srvsvc_net_file_get_sec(struct rpc_pipe_client *cli, } status = rpccli_srvsvc_NetGetFileSecurity(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], argv[2], SECINFO_DACL, @@ -660,7 +660,7 @@ static WERROR cmd_srvsvc_net_sess_del(struct rpc_pipe_client *cli, } status = rpccli_srvsvc_NetSessDel(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, argv[1], argv[2], &result); @@ -744,7 +744,7 @@ static WERROR cmd_srvsvc_net_sess_enum(struct rpc_pipe_client *cli, } status = rpccli_srvsvc_NetSessEnum(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, client, user, &info_ctr, @@ -788,7 +788,7 @@ static WERROR cmd_srvsvc_net_disk_enum(struct rpc_pipe_client *cli, ZERO_STRUCT(info); status = rpccli_srvsvc_NetDiskEnum(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, level, &info, 0xffffffff, @@ -855,7 +855,7 @@ static WERROR cmd_srvsvc_net_conn_enum(struct rpc_pipe_client *cli, } status = rpccli_srvsvc_NetConnEnum(cli, mem_ctx, - cli->cli->desthost, + cli->desthost, path, &info_ctr, 0xffffffff, diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index 68f408cf48..fbf483bd2b 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -41,7 +41,7 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli, level = atoi(argv[1]); } - server_name = cli->cli->desthost; + server_name = cli->desthost; status = rpccli_wkssvc_NetWkstaGetInfo(cli, mem_ctx, server_name, @@ -66,7 +66,7 @@ static WERROR cmd_wkssvc_getjoininformation(struct rpc_pipe_client *cli, NTSTATUS status; WERROR werr; - server_name = cli->cli->desthost; + server_name = cli->desthost; name_buffer = ""; status = rpccli_wkssvc_NetrGetJoinInformation(cli, mem_ctx, @@ -90,9 +90,9 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, int argc, const char **argv) { - const char *server_name = cli->cli->desthost; - const char *message_name = cli->cli->desthost; - const char *message_sender_name = cli->cli->desthost; + const char *server_name = cli->desthost; + const char *message_name = cli->desthost; + const char *message_sender_name = cli->desthost; smb_ucs2_t *message_buffer = NULL; size_t message_size = 0; const char *message = "my message"; @@ -135,7 +135,7 @@ static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli, struct wkssvc_ComputerNamesCtr *ctr = NULL; WERROR werr; - server_name = cli->cli->desthost; + server_name = cli->desthost; if (argc >= 2) { name_type = atoi(argv[1]); -- cgit From 9048cafbeaf82d1916de6538024fd660612dd25f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Apr 2008 23:03:16 +0200 Subject: Move srv_name_slash from cli_state to rpc_pipe_client (This used to be commit a9061e52e1ff8e31aa480f4a30cda64c9d93214e) --- source3/rpcclient/cmd_srvsvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c index 7709d47e49..9efd4c9792 100644 --- a/source3/rpcclient/cmd_srvsvc.c +++ b/source3/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->cli->srv_name_slash, + cli->srv_name_slash, &tod, &result); if (!NT_STATUS_IS_OK(status)) { -- cgit From e1102b8f48aeebe7d4e730d2b432a1503b425210 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Apr 2008 23:27:35 +0200 Subject: Introduce rpccli_set_timeout() Reduce dependency on "cli" member of rpc_pipe_client struct (This used to be commit 2e4c1ba38963cffe4c3f25ab24bc28975f2fc291) --- source3/rpcclient/cmd_netlogon.c | 10 ++++++---- source3/rpcclient/cmd_samr.c | 5 +++-- source3/rpcclient/rpcclient.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index a30dd740e2..12d8cf3052 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -101,14 +101,15 @@ static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli, } /* Make sure to wait for our DC's reply */ - old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */ + old_timeout = rpccli_set_timeout(cli, 30000); /* 30 seconds. */ + rpccli_set_timeout(cli, MAX(old_timeout, 30000)); /* At least 30 sec */ status = rpccli_netr_GetAnyDCName(cli, mem_ctx, cli->desthost, argv[1], &dcname, &werr); - cli_set_timeout(cli->cli, old_timeout); + rpccli_set_timeout(cli, old_timeout); if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); @@ -140,14 +141,15 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli, } /* Make sure to wait for our DC's reply */ - old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */ + old_timeout = rpccli_set_timeout(cli, 30000); /* 30 seconds. */ + rpccli_set_timeout(cli, MAX(30000, old_timeout)); /* At least 30 sec */ status = rpccli_netr_GetDcName(cli, mem_ctx, cli->desthost, argv[1], &dcname, &werr); - cli_set_timeout(cli->cli, old_timeout); + rpccli_set_timeout(cli, old_timeout); if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index e58354d0d3..4a820cd618 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -735,13 +735,14 @@ static NTSTATUS cmd_samr_query_groupmem(struct rpc_pipe_client *cli, goto done; /* Make sure to wait for our DC's reply */ - old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */ + old_timeout = rpccli_set_timeout(cli, 30000); /* 30 seconds. */ + rpccli_set_timeout(cli, MAX(30000, old_timeout)); /* At least 30 sec */ result = rpccli_samr_QueryGroupMember(cli, mem_ctx, &group_pol, &rids); - cli_set_timeout(cli->cli, old_timeout); + rpccli_set_timeout(cli, old_timeout); if (!NT_STATUS_IS_OK(result)) goto done; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 52dba2291b..8592e0a3b6 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -420,7 +420,7 @@ static NTSTATUS cmd_timeout(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, continue; } - cli_set_timeout(tmp_set->rpc_pipe->cli, timeout); + rpccli_set_timeout(tmp_set->rpc_pipe, timeout); } } } -- cgit From e73e8297f5484b6c7f525917679414c09a145cf0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Apr 2008 13:51:46 +0200 Subject: Replace cli_rpc_pipe_close by a talloc destructor on rpc_pipe_struct (This used to be commit 99fc3283c4ecc791f5a242bd1983b4352ce3e6cf) --- source3/rpcclient/cmd_test.c | 4 ++-- source3/rpcclient/rpcclient.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_test.c b/source3/rpcclient/cmd_test.c index 089d7bcaa3..f9ea5c0fc2 100644 --- a/source3/rpcclient/cmd_test.c +++ b/source3/rpcclient/cmd_test.c @@ -48,8 +48,8 @@ static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, goto done; done: - if (lsa_pipe != NULL) cli_rpc_pipe_close(lsa_pipe); - if (samr_pipe != NULL) cli_rpc_pipe_close(samr_pipe); + TALLOC_FREE(lsa_pipe); + TALLOC_FREE(samr_pipe); return status; } diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 8592e0a3b6..ebd38044b8 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -169,7 +169,7 @@ static void fetch_machine_sid(struct cli_state *cli) sid_copy(&domain_sid, info->account_domain.sid); rpccli_lsa_Close(lsapipe, mem_ctx, &pol); - cli_rpc_pipe_close(lsapipe); + TALLOC_FREE(lsapipe); talloc_destroy(mem_ctx); return; @@ -177,7 +177,7 @@ static void fetch_machine_sid(struct cli_state *cli) error: if (lsapipe) { - cli_rpc_pipe_close(lsapipe); + TALLOC_FREE(lsapipe); } fprintf(stderr, "could not obtain sid for domain %s\n", cli->domain); @@ -336,7 +336,7 @@ static NTSTATUS cmd_set_ss_level(void) if (tmp_set->rpc_pipe->auth.auth_type != pipe_default_auth_type || tmp_set->rpc_pipe->auth.auth_level != pipe_default_auth_level) { - cli_rpc_pipe_close(tmp_set->rpc_pipe); + TALLOC_FREE(tmp_set->rpc_pipe); tmp_set->rpc_pipe = NULL; } } -- cgit From b9cc05506273e5ce3398a5912b9c9e5989717480 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Apr 2008 14:05:25 +0200 Subject: Introduce rpc_pipe_np_smb_conn() This abstracts away all references to rpc_pipe_client->cli, the only reference is now in cli_pipe.c. (This used to be commit c56e1c08cef107ff33a34346ceeca3475a102b19) --- source3/rpcclient/cmd_spoolss.c | 2 +- source3/rpcclient/cmd_test.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index eb42836b6c..c89f987446 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -2645,7 +2645,7 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli, { fstring printername, servername1, servername2; char *printername_path = NULL; - struct cli_state *cli_server1 = cli->cli; + struct cli_state *cli_server1 = rpc_pipe_np_smb_conn(cli); struct cli_state *cli_server2 = NULL; struct rpc_pipe_client *cli2 = NULL; POLICY_HND hPrinter1, hPrinter2; diff --git a/source3/rpcclient/cmd_test.c b/source3/rpcclient/cmd_test.c index f9ea5c0fc2..dd956604cc 100644 --- a/source3/rpcclient/cmd_test.c +++ b/source3/rpcclient/cmd_test.c @@ -30,10 +30,12 @@ static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, d_printf("testme\n"); - lsa_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_LSARPC, &status); + lsa_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli), + PI_LSARPC, &status); if (lsa_pipe == NULL) goto done; - samr_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_SAMR, &status); + samr_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli), + PI_SAMR, &status); if (samr_pipe == NULL) goto done; status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False, -- cgit