summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2008-04-21 11:38:20 +0400
committerAlexander Bokovoy <ab@samba.org>2008-04-21 11:38:20 +0400
commitff615f232968979f57a31f43a4f668c2c4fd20df (patch)
tree8e4d6e1181001dd35e32008a3401020c013e288b /source3/utils
parent09caab9f37d6ecd4fd6fe9ce3c284730b232651a (diff)
parent0db7aba8af80a01150d1061a4192ab814e4234b7 (diff)
downloadsamba-ff615f232968979f57a31f43a4f668c2c4fd20df.tar.gz
samba-ff615f232968979f57a31f43a4f668c2c4fd20df.tar.bz2
samba-ff615f232968979f57a31f43a4f668c2c4fd20df.zip
Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test
(This used to be commit 2c3ffc1c53550c8e6feeca8fc0270ef9ac1ec70a)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net.c7
-rw-r--r--source3/utils/net.h2
-rw-r--r--source3/utils/net_ads.c13
-rw-r--r--source3/utils/net_dom.c3
-rw-r--r--source3/utils/net_rpc.c400
-rw-r--r--source3/utils/net_rpc_join.c10
-rw-r--r--source3/utils/net_rpc_printer.c9
-rw-r--r--source3/utils/net_rpc_samsync.c17
-rw-r--r--source3/utils/net_rpc_service.c12
-rw-r--r--source3/utils/net_rpc_sh_acct.c2
-rw-r--r--source3/utils/net_rpc_shell.c2
-rw-r--r--source3/utils/net_util.c2
-rw-r--r--source3/utils/smbcacls.c8
-rw-r--r--source3/utils/smbtree.c6
14 files changed, 149 insertions, 344 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 5706e336de..f6851f69da 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -1169,6 +1169,13 @@ static struct functable net_func[] = {
rc = net_run_function(argc_new-1, argv_new+1, net_func, net_help);
DEBUG(2,("return code = %d\n", rc));
+
+ {
+ struct libnetapi_ctx *ctx = NULL;
+ libnetapi_getctx(&ctx);
+ libnetapi_free(ctx);
+ }
+
TALLOC_FREE(frame);
return rc;
}
diff --git a/source3/utils/net.h b/source3/utils/net.h
index 3a4b1da7b0..00a818a606 100644
--- a/source3/utils/net.h
+++ b/source3/utils/net.h
@@ -22,6 +22,8 @@
* include
*/
+#include "lib/netapi/netapi.h"
+
typedef NTSTATUS (*rpc_command_fn)(const DOM_SID *,
const char *,
struct cli_state *cli,
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 88051ec4a1..c8bfc2630c 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1199,7 +1199,7 @@ int net_ads_join(int argc, const char **argv)
/* Check the short name of the domain */
- if (!strequal(lp_workgroup(), r->out.netbios_domain_name)) {
+ if (!modify_config && !strequal(lp_workgroup(), r->out.netbios_domain_name)) {
d_printf("The workgroup in %s does not match the short\n", get_dyn_CONFIGFILE());
d_printf("domain name obtained from the server.\n");
d_printf("Using the name [%s] from the server.\n", r->out.netbios_domain_name);
@@ -1209,11 +1209,16 @@ int net_ads_join(int argc, const char **argv)
d_printf("Using short domain name -- %s\n", r->out.netbios_domain_name);
- d_printf("Joined '%s' to realm '%s'\n", r->in.machine_name,
- r->out.dns_domain_name);
+ if (r->out.dns_domain_name) {
+ d_printf("Joined '%s' to realm '%s'\n", r->in.machine_name,
+ r->out.dns_domain_name);
+ } else {
+ d_printf("Joined '%s' to domain '%s'\n", r->in.machine_name,
+ r->out.netbios_domain_name);
+ }
#if defined(WITH_DNS_UPDATES)
- {
+ if (r->out.domain_is_ad) {
/* We enter this block with user creds */
ADS_STRUCT *ads_dns = NULL;
diff --git a/source3/utils/net_dom.c b/source3/utils/net_dom.c
index e88bbdb276..6e4bf14c84 100644
--- a/source3/utils/net_dom.c
+++ b/source3/utils/net_dom.c
@@ -19,7 +19,6 @@
#include "includes.h"
#include "utils/net.h"
-#include "lib/netapi/netapi.h"
static int net_dom_usage(int argc, const char **argv)
{
@@ -130,7 +129,6 @@ static int net_dom_unjoin(int argc, const char **argv)
cli_shutdown(cli);
}
- /* libnetapi_free(ctx); */
return ret;
}
@@ -244,7 +242,6 @@ static int net_dom_join(int argc, const char **argv)
cli_shutdown(cli);
}
- /* libnetapi_free(ctx); */
return ret;
}
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 5663680eb7..924398fc33 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -88,7 +88,7 @@ NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
*domain_sid = info->account_domain.sid;
rpccli_lsa_Close(lsa_pipe, mem_ctx, &pol);
- cli_rpc_pipe_close(lsa_pipe);
+ TALLOC_FREE(lsa_pipe);
return NT_STATUS_OK;
}
@@ -185,7 +185,7 @@ int run_rpc_command(struct cli_state *cli_arg,
if (!(conn_flags & NET_FLAGS_NO_PIPE)) {
if (pipe_hnd) {
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
}
}
@@ -451,7 +451,7 @@ NTSTATUS rpc_info_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -571,156 +571,6 @@ static int rpc_user_usage(int argc, const char **argv)
/**
* Add a new user to a remote RPC server
*
- * All parameters are provided by the run_rpc_command function, except for
- * argc, argv which are passes through.
- *
- * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
- * @param mem_ctx Talloc context, destoyed on completion of the function.
- * @param argc Standard main() style argc
- * @param argv Standard main() style argv. Initial components are already
- * stripped
- *
- * @return Normal NTSTATUS return.
- **/
-
-static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
- const char *domain_name,
- struct cli_state *cli,
- struct rpc_pipe_client *pipe_hnd,
- TALLOC_CTX *mem_ctx,
- int argc, const char **argv)
-{
-
- POLICY_HND connect_pol, domain_pol, user_pol;
- NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- const char *acct_name;
- struct lsa_String lsa_acct_name;
- uint32 acb_info;
- uint32 acct_flags, user_rid;
- uint32_t access_granted = 0;
- struct samr_Ids user_rids, name_types;
-
- if (argc < 1) {
- d_printf("User must be specified\n");
- rpc_user_usage(argc, argv);
- return NT_STATUS_OK;
- }
-
- acct_name = argv[0];
- init_lsa_String(&lsa_acct_name, acct_name);
-
- /* Get sam policy handle */
-
- result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
- MAXIMUM_ALLOWED_ACCESS,
- &connect_pol);
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
-
- /* Get domain policy handle */
-
- result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
- &connect_pol,
- MAXIMUM_ALLOWED_ACCESS,
- CONST_DISCARD(struct dom_sid2 *, domain_sid),
- &domain_pol);
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
-
- /* Create domain user */
-
- acb_info = ACB_NORMAL;
- acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
- SEC_STD_WRITE_DAC | SEC_STD_DELETE |
- SAMR_USER_ACCESS_SET_PASSWORD |
- SAMR_USER_ACCESS_GET_ATTRIBUTES |
- SAMR_USER_ACCESS_SET_ATTRIBUTES;
-
- result = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,
- &domain_pol,
- &lsa_acct_name,
- acb_info,
- acct_flags,
- &user_pol,
- &access_granted,
- &user_rid);
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
-
- if (argc == 2) {
-
- union samr_UserInfo info;
- uchar pwbuf[516];
-
- result = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,
- &domain_pol,
- 1,
- &lsa_acct_name,
- &user_rids,
- &name_types);
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
-
- result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
- &domain_pol,
- MAXIMUM_ALLOWED_ACCESS,
- user_rids.ids[0],
- &user_pol);
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
-
- /* Set password on account */
-
- encode_pw_buffer(pwbuf, argv[1], STR_UNICODE);
-
- init_samr_user_info24(&info.info24, pwbuf, 24);
-
- SamOEMhashBlob(info.info24.password.data, 516,
- &cli->user_session_key);
-
- result = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
- &user_pol,
- 24,
- &info);
-
- if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Failed to set password for user %s - %s\n",
- acct_name, nt_errstr(result));
-
- result = rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
- &user_pol);
-
- if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Failed to delete user %s - %s\n",
- acct_name, nt_errstr(result));
- return result;
- }
- }
-
- }
- done:
- if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Failed to add user '%s' with %s.\n",
- acct_name, nt_errstr(result));
- } else {
- d_printf("Added user '%s'.\n", acct_name);
- }
- return result;
-}
-
-/**
- * Add a new user to a remote RPC server
- *
* @param argc Standard main() style argc
* @param argv Standard main() style argv. Initial components are already
* stripped
@@ -730,115 +580,34 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
static int rpc_user_add(int argc, const char **argv)
{
- return run_rpc_command(NULL, PI_SAMR, 0, rpc_user_add_internals,
- argc, argv);
-}
-
-/**
- * Delete a user from a remote RPC server
- *
- * All parameters are provided by the run_rpc_command function, except for
- * argc, argv which are passes through.
- *
- * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
- * @param mem_ctx Talloc context, destoyed on completion of the function.
- * @param argc Standard main() style argc
- * @param argv Standard main() style argv. Initial components are already
- * stripped
- *
- * @return Normal NTSTATUS return.
- **/
-
-static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
- const char *domain_name,
- struct cli_state *cli,
- struct rpc_pipe_client *pipe_hnd,
- TALLOC_CTX *mem_ctx,
- int argc,
- const char **argv)
-{
- NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- POLICY_HND connect_pol, domain_pol, user_pol;
- const char *acct_name;
+ NET_API_STATUS status;
+ struct USER_INFO_1 info1;
+ uint32_t parm_error = 0;
if (argc < 1) {
d_printf("User must be specified\n");
rpc_user_usage(argc, argv);
- return NT_STATUS_OK;
- }
-
- acct_name = argv[0];
-
- /* Get sam policy and domain handles */
-
- result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
- MAXIMUM_ALLOWED_ACCESS,
- &connect_pol);
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
-
- result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
- &connect_pol,
- MAXIMUM_ALLOWED_ACCESS,
- CONST_DISCARD(struct dom_sid2 *, domain_sid),
- &domain_pol);
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
+ return 0;
}
- /* Get handle on user */
-
- {
- struct samr_Ids user_rids, name_types;
- struct lsa_String lsa_acct_name;
-
- init_lsa_String(&lsa_acct_name, acct_name);
-
- result = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,
- &domain_pol,
- 1,
- &lsa_acct_name,
- &user_rids,
- &name_types);
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
+ ZERO_STRUCT(info1);
- result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
- &domain_pol,
- MAXIMUM_ALLOWED_ACCESS,
- user_rids.ids[0],
- &user_pol);
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
+ info1.usri1_name = argv[0];
+ if (argc == 2) {
+ info1.usri1_password = argv[1];
}
- /* Delete user */
+ status = NetUserAdd(opt_host, 1, (uint8_t *)&info1, &parm_error);
- result = rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
- &user_pol);
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
+ if (status != 0) {
+ d_fprintf(stderr, "Failed to add user '%s' with: %s.\n",
+ argv[0], libnetapi_get_error_string(NULL, status));
+ return -1;
+ } else {
+ d_printf("Added user '%s'.\n", argv[0]);
}
- done:
- if (!NT_STATUS_IS_OK(result)) {
- d_fprintf(stderr, "Failed to delete user '%s' with %s.\n",
- acct_name, nt_errstr(result));
- } else {
- d_printf("Deleted user '%s'.\n", acct_name);
- }
-
- return result;
+ return 0;
}
/**
@@ -885,7 +654,7 @@ static NTSTATUS rpc_user_rename_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
@@ -987,8 +756,26 @@ static int rpc_user_rename(int argc, const char **argv)
static int rpc_user_delete(int argc, const char **argv)
{
- return run_rpc_command(NULL, PI_SAMR, 0, rpc_user_del_internals,
- argc, argv);
+ NET_API_STATUS status;
+
+ if (argc < 1) {
+ d_printf("User must be specified\n");
+ rpc_user_usage(argc, argv);
+ return 0;
+ }
+
+ status = NetUserDel(opt_host, argv[0]);
+
+ if (status != 0) {
+ d_fprintf(stderr, "Failed to delete user '%s' with: %s.\n",
+ argv[0],
+ libnetapi_get_error_string(NULL, status));
+ return -1;
+ } else {
+ d_printf("Deleted user '%s'.\n", argv[0]);
+ }
+
+ return 0;
}
/**
@@ -1042,7 +829,7 @@ static NTSTATUS rpc_user_password_internals(const DOM_SID *domain_sid,
/* Get sam policy and domain handles */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
@@ -1173,7 +960,7 @@ static NTSTATUS rpc_user_info_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) goto done;
@@ -1291,7 +1078,7 @@ static NTSTATUS rpc_user_list_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -1360,6 +1147,9 @@ static NTSTATUS rpc_user_list_internals(const DOM_SID *domain_sid,
int net_rpc_user(int argc, const char **argv)
{
+ struct libnetapi_ctx *ctx = NULL;
+ NET_API_STATUS status;
+
struct functable func[] = {
{"add", rpc_user_add},
{"info", rpc_user_info},
@@ -1368,7 +1158,14 @@ int net_rpc_user(int argc, const char **argv)
{"rename", rpc_user_rename},
{NULL, NULL}
};
-
+
+ status = libnetapi_init(&ctx);
+ if (status != 0) {
+ return -1;
+ }
+ libnetapi_set_username(ctx, opt_user_name);
+ libnetapi_set_password(ctx, opt_password);
+
if (argc == 0) {
return run_rpc_command(NULL,PI_SAMR, 0,
rpc_user_list_internals,
@@ -1424,8 +1221,8 @@ static NTSTATUS rpc_sh_handle_user(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(domain_pol);
ZERO_STRUCT(user_pol);
- result = net_rpc_lookup_name(mem_ctx, pipe_hnd->cli, argv[0],
- NULL, NULL, &sid, &type);
+ result = net_rpc_lookup_name(mem_ctx, rpc_pipe_np_smb_conn(pipe_hnd),
+ argv[0], NULL, NULL, &sid, &type);
if (!NT_STATUS_IS_OK(result)) {
d_fprintf(stderr, "Could not lookup %s: %s\n", argv[0],
nt_errstr(result));
@@ -1446,7 +1243,7 @@ static NTSTATUS rpc_sh_handle_user(TALLOC_CTX *mem_ctx,
}
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -1814,7 +1611,7 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid,
}
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
@@ -2012,7 +1809,7 @@ static NTSTATUS rpc_group_add_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) goto done;
@@ -2082,7 +1879,7 @@ static NTSTATUS rpc_alias_add_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) goto done;
@@ -2176,7 +1973,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli,
done:
if (pipe_hnd) {
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
}
if (!NT_STATUS_IS_OK(result) && (StrnCaseCmp(name, "S-", 2) == 0)) {
@@ -2218,7 +2015,7 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -2290,8 +2087,8 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
return NT_STATUS_UNSUCCESSFUL;
}
- result = get_sid_from_name(pipe_hnd->cli, mem_ctx, member,
- &member_sid, &member_type);
+ result = get_sid_from_name(rpc_pipe_np_smb_conn(pipe_hnd), mem_ctx,
+ member, &member_sid, &member_type);
if (!NT_STATUS_IS_OK(result)) {
d_fprintf(stderr, "Could not lookup up group member %s\n", member);
@@ -2300,7 +2097,7 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -2419,7 +2216,7 @@ static NTSTATUS rpc_del_groupmem(struct rpc_pipe_client *pipe_hnd,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result))
@@ -2485,8 +2282,8 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
if (!sid_split_rid(&sid, &alias_rid))
return NT_STATUS_UNSUCCESSFUL;
- result = get_sid_from_name(pipe_hnd->cli, mem_ctx, member,
- &member_sid, &member_type);
+ result = get_sid_from_name(rpc_pipe_np_smb_conn(pipe_hnd), mem_ctx,
+ member, &member_sid, &member_type);
if (!NT_STATUS_IS_OK(result)) {
d_fprintf(stderr, "Could not lookup up group member %s\n", member);
@@ -2495,7 +2292,7 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -2642,7 +2439,7 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -2939,7 +2736,8 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd,
return NT_STATUS_OK;
}
- lsa_pipe = cli_rpc_pipe_open_noauth(pipe_hnd->cli, PI_LSARPC, &result);
+ lsa_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(pipe_hnd),
+ PI_LSARPC, &result);
if (!lsa_pipe) {
d_fprintf(stderr, "Couldn't open LSA pipe. Error was %s\n",
nt_errstr(result) );
@@ -2951,14 +2749,14 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd,
if (!NT_STATUS_IS_OK(result)) {
d_fprintf(stderr, "Couldn't open LSA policy handle\n");
- cli_rpc_pipe_close(lsa_pipe);
+ TALLOC_FREE(lsa_pipe);
return result;
}
alias_sids = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, num_members);
if (!alias_sids) {
d_fprintf(stderr, "Out of memory\n");
- cli_rpc_pipe_close(lsa_pipe);
+ TALLOC_FREE(lsa_pipe);
return NT_STATUS_NO_MEMORY;
}
@@ -2973,7 +2771,7 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd,
if (!NT_STATUS_IS_OK(result) &&
!NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED)) {
d_fprintf(stderr, "Couldn't lookup SIDs\n");
- cli_rpc_pipe_close(lsa_pipe);
+ TALLOC_FREE(lsa_pipe);
return result;
}
@@ -2993,7 +2791,7 @@ static NTSTATUS rpc_list_alias_members(struct rpc_pipe_client *pipe_hnd,
}
}
- cli_rpc_pipe_close(lsa_pipe);
+ TALLOC_FREE(lsa_pipe);
return NT_STATUS_OK;
}
@@ -3013,7 +2811,7 @@ static NTSTATUS rpc_group_members_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
@@ -3126,7 +2924,7 @@ static NTSTATUS rpc_group_rename_internals(const DOM_SID *domain_sid,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
@@ -3287,7 +3085,7 @@ static NTSTATUS rpc_share_add_internals(const DOM_SID *domain_sid,
info.info2 = &info2;
status = rpccli_srvsvc_NetShareAdd(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
level,
&info,
&parm_error,
@@ -3332,7 +3130,7 @@ static NTSTATUS rpc_share_del_internals(const DOM_SID *domain_sid,
WERROR result;
return rpccli_srvsvc_NetShareDel(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
argv[0],
0,
&result);
@@ -3398,7 +3196,7 @@ static WERROR get_share_info(struct rpc_pipe_client *pipe_hnd,
info_ctr->level = level;
status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
info_ctr,
preferred_len,
&total_entries,
@@ -3409,7 +3207,7 @@ static WERROR get_share_info(struct rpc_pipe_client *pipe_hnd,
/* request just one share */
status = rpccli_srvsvc_NetShareGetInfo(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
argv[0],
level,
&info,
@@ -3628,7 +3426,7 @@ static NTSTATUS rpc_share_migrate_shares_internals(const DOM_SID *domain_sid,
info.info502 = &info502;
nt_status = rpccli_srvsvc_NetShareAdd(srvsvc_pipe, mem_ctx,
- srvsvc_pipe->cli->desthost,
+ srvsvc_pipe->desthost,
502,
&info,
&parm_error,
@@ -4051,7 +3849,7 @@ static NTSTATUS rpc_share_migrate_security_internals(const DOM_SID *domain_sid,
/* finally modify the share on the dst server */
nt_status = rpccli_srvsvc_NetShareSetInfo(srvsvc_pipe, mem_ctx,
- srvsvc_pipe->cli->desthost,
+ srvsvc_pipe->desthost,
info502.name,
level,
&info,
@@ -4344,7 +4142,7 @@ static NTSTATUS rpc_aliaslist_internals(const DOM_SID *domain_sid,
POLICY_HND connect_pol;
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
@@ -4683,7 +4481,7 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
int fnum;
SEC_DESC *share_sd = NULL;
SEC_DESC *root_sd = NULL;
- struct cli_state *cli = pipe_hnd->cli;
+ struct cli_state *cli = rpc_pipe_np_smb_conn(pipe_hnd);
int i;
union srvsvc_NetShareInfo info;
WERROR result;
@@ -4691,7 +4489,7 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
uint16 cnum;
status = rpccli_srvsvc_NetShareGetInfo(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
netname,
502,
&info,
@@ -5010,7 +4808,7 @@ static NTSTATUS rpc_sh_share_add(TALLOC_CTX *mem_ctx,
info.info2 = &info2;
status = rpccli_srvsvc_NetShareAdd(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
2,
&info,
&parm_err,
@@ -5033,7 +4831,7 @@ static NTSTATUS rpc_sh_share_delete(TALLOC_CTX *mem_ctx,
}
status = rpccli_srvsvc_NetShareDel(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
argv[0],
0,
&result);
@@ -5056,7 +4854,7 @@ static NTSTATUS rpc_sh_share_info(TALLOC_CTX *mem_ctx,
}
status = rpccli_srvsvc_NetShareGetInfo(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
argv[0],
2,
&info,
@@ -5128,7 +4926,7 @@ static NTSTATUS rpc_file_close_internals(const DOM_SID *domain_sid,
const char **argv)
{
return rpccli_srvsvc_NetFileClose(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
atoi(argv[0]), NULL);
}
@@ -5209,7 +5007,7 @@ static NTSTATUS rpc_file_list_internals(const DOM_SID *domain_sid,
info_ctr.ctr.ctr3 = &ctr3;
status = rpccli_srvsvc_NetFileEnum(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
NULL,
username,
&info_ctr,
@@ -5574,7 +5372,7 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid,
/* Get samr policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -5730,7 +5528,7 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid,
/* Get samr policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
@@ -5855,7 +5653,7 @@ static NTSTATUS rpc_trustdom_get_pdc(struct cli_state *cli,
domain_name,
&buffer,
NULL);
- cli_rpc_pipe_close(netr);
+ TALLOC_FREE(netr);
if (NT_STATUS_IS_OK(status)) {
return status;
@@ -6148,8 +5946,8 @@ static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd,
data = data_blob(info->password.password->data,
info->password.password->length);
- cleartextpwd = decrypt_trustdom_secret(pipe_hnd->cli->pwd.password,
- &data);
+ cleartextpwd = decrypt_trustdom_secret(
+ rpc_pipe_np_smb_conn(pipe_hnd)->pwd.password, &data);
if (cleartextpwd == NULL) {
DEBUG(0,("retrieved NULL password\n"));
@@ -6451,7 +6249,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
return -1;
};
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
/*
* Listing trusting domains (stored in passdb backend, if local)
@@ -6472,7 +6270,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
/* SamrConnect2 */
nt_status = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
SA_RIGHT_SAM_OPEN_DOMAIN,
&connect_hnd);
if (!NT_STATUS_IS_OK(nt_status)) {
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index ea3bb10c22..c94e9d1a40 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -221,7 +221,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
domain_sid = info->account_domain.sid;
rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol);
- cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */
+ TALLOC_FREE(pipe_hnd); /* Done with this pipe */
/* Bail out if domain didn't get set. */
if (!domain) {
@@ -238,7 +238,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
}
CHECK_RPC_ERR(rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
SEC_RIGHTS_MAXIMUM_ALLOWED,
&sam_pol),
"could not connect to SAM database");
@@ -368,7 +368,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
&set_info);
rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
- cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */
+ TALLOC_FREE(pipe_hnd); /* Done with this pipe */
/* Now check the whole process from top-to-bottom */
@@ -429,10 +429,10 @@ int net_rpc_join_newstyle(int argc, const char **argv)
goto done;
}
- cli_rpc_pipe_close(netlogon_schannel_pipe);
+ TALLOC_FREE(netlogon_schannel_pipe);
}
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
/* Now store the secret in the secrets database */
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index bcfb37713c..9dc409123e 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -721,7 +721,8 @@ static bool net_spoolss_open_printer_ex(struct rpc_pipe_client *pipe_hnd,
WERROR result;
fstring servername, printername2;
- slprintf(servername, sizeof(servername)-1, "\\\\%s", pipe_hnd->cli->desthost);
+ slprintf(servername, sizeof(servername)-1, "\\\\%s",
+ pipe_hnd->desthost);
fstrcpy(printername2, servername);
fstrcat(printername2, "\\");
@@ -993,7 +994,7 @@ static bool get_printer_info(struct rpc_pipe_client *pipe_hnd,
/* argument given, get a single printer by name */
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, argv[0],
- MAXIMUM_ALLOWED_ACCESS, pipe_hnd->cli->user_name, &hnd))
+ MAXIMUM_ALLOWED_ACCESS, pipe_hnd->user_name, &hnd))
return False;
if (!net_spoolss_getprinter(pipe_hnd, mem_ctx, &hnd, level, ctr)) {
@@ -1189,7 +1190,7 @@ static NTSTATUS rpc_printer_publish_internals_args(struct rpc_pipe_client *pipe_
/* open printer handle */
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
- PRINTER_ALL_ACCESS, pipe_hnd->cli->user_name, &hnd))
+ PRINTER_ALL_ACCESS, pipe_hnd->user_name, &hnd))
goto done;
got_hnd = True;
@@ -1837,7 +1838,7 @@ NTSTATUS rpc_printer_migrate_drivers_internals(const DOM_SID *domain_sid,
/* open src printer handle */
if (!net_spoolss_open_printer_ex(pipe_hnd, mem_ctx, sharename,
- MAXIMUM_ALLOWED_ACCESS, pipe_hnd->cli->user_name, &hnd_src))
+ MAXIMUM_ALLOWED_ACCESS, pipe_hnd->user_name, &hnd_src))
goto done;
got_hnd_src = True;
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index 986499731a..6ea0a2dcfc 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -330,7 +330,7 @@ static void dump_database(struct rpc_pipe_client *pipe_hnd,
NTSTATUS result;
int i;
TALLOC_CTX *mem_ctx;
- const char *logon_server = pipe_hnd->cli->desthost;
+ const char *logon_server = pipe_hnd->desthost;
const char *computername = global_myname();
struct netr_Authenticator credential;
struct netr_Authenticator return_authenticator;
@@ -1028,7 +1028,6 @@ static NTSTATUS fetch_domain_info(uint32_t rid,
struct netr_DELTA_DOMAIN *r)
{
time_t u_max_age, u_min_age, u_logout;
- time_t u_lockoutreset, u_lockouttime;
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
const char *domname;
struct netr_AcctLockStr *lockstr = NULL;
@@ -1046,11 +1045,6 @@ static NTSTATUS fetch_domain_info(uint32_t rid,
u_min_age = uint64s_nt_time_to_unix_abs((uint64 *)&r->min_password_age);
u_logout = uint64s_nt_time_to_unix_abs((uint64 *)&r->force_logoff_time);
- if (lockstr) {
- u_lockoutreset = uint64s_nt_time_to_unix_abs(&lockstr->reset_count);
- u_lockouttime = uint64s_nt_time_to_unix_abs((uint64_t *)&lockstr->lockout_duration);
- }
-
domname = r->domain_name.string;
if (!domname) {
return NT_STATUS_NO_MEMORY;
@@ -1081,6 +1075,11 @@ static NTSTATUS fetch_domain_info(uint32_t rid,
return nt_status;
if (lockstr) {
+ time_t u_lockoutreset, u_lockouttime;
+
+ u_lockoutreset = uint64s_nt_time_to_unix_abs(&lockstr->reset_count);
+ u_lockouttime = uint64s_nt_time_to_unix_abs((uint64_t *)&lockstr->lockout_duration);
+
if (!pdb_set_account_policy(AP_BAD_ATTEMPT_LOCKOUT,
lockstr->bad_attempt_lockout))
return nt_status;
@@ -1191,7 +1190,7 @@ static NTSTATUS fetch_database(struct rpc_pipe_client *pipe_hnd, uint32 db_type,
NTSTATUS result;
int i;
TALLOC_CTX *mem_ctx;
- const char *logon_server = pipe_hnd->cli->desthost;
+ const char *logon_server = pipe_hnd->desthost;
const char *computername = global_myname();
struct netr_Authenticator credential;
struct netr_Authenticator return_authenticator;
@@ -2012,7 +2011,7 @@ static NTSTATUS fetch_database_to_ldif(struct rpc_pipe_client *pipe_hnd,
uint32 num_deltas;
FILE *add_file = NULL, *mod_file = NULL, *ldif_file = NULL;
int num_alloced = 0, g_index = 0, a_index = 0;
- const char *logon_server = pipe_hnd->cli->desthost;
+ const char *logon_server = pipe_hnd->desthost;
const char *computername = global_myname();
struct netr_Authenticator credential;
struct netr_Authenticator return_authenticator;
diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c
index 1b12bd3114..b886283adc 100644
--- a/source3/utils/net_rpc_service.c
+++ b/source3/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->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,
diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c
index 57640ca3a8..00a7967f07 100644
--- a/source3/utils/net_rpc_sh_acct.c
+++ b/source3/utils/net_rpc_sh_acct.c
@@ -49,7 +49,7 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx,
/* Get sam policy handle */
result = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
MAXIMUM_ALLOWED_ACCESS,
&connect_pol);
if (!NT_STATUS_IS_OK(result)) {
diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c
index e6302b652e..7bd726e614 100644
--- a/source3/utils/net_rpc_shell.c
+++ b/source3/utils/net_rpc_shell.c
@@ -85,7 +85,7 @@ static NTSTATUS net_sh_run(struct rpc_sh_ctx *ctx, struct rpc_sh_cmd *cmd,
status = cmd->fn(mem_ctx, ctx, pipe_hnd, argc, argv);
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
talloc_destroy(mem_ctx);
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index f844992d56..576c2191b3 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -75,7 +75,7 @@ NTSTATUS net_rpc_lookup_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
if (is_valid_policy_hnd(&pol)) {
rpccli_lsa_Close(lsa_pipe, mem_ctx, &pol);
}
- cli_rpc_pipe_close(lsa_pipe);
+ TALLOC_FREE(lsa_pipe);
return result;
}
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 134f561760..af14c622dc 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -103,9 +103,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli,
status = NT_STATUS_OK;
fail:
- if (p != NULL) {
- cli_rpc_pipe_close(p);
- }
+ TALLOC_FREE(p);
cli_tdis(cli);
cli->cnum = orig_cnum;
TALLOC_FREE(frame);
@@ -151,9 +149,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli,
status = NT_STATUS_OK;
fail:
- if (p != NULL) {
- cli_rpc_pipe_close(p);
- }
+ TALLOC_FREE(p);
cli_tdis(cli);
cli->cnum = orig_cnum;
TALLOC_FREE(frame);
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index 48eae5ac5c..c2b364d1e9 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -179,7 +179,7 @@ static bool get_rpc_shares(struct cli_state *cli,
info_ctr.ctr.ctr1 = &ctr1;
status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, mem_ctx,
- pipe_hnd->cli->desthost,
+ pipe_hnd->desthost,
&info_ctr,
0xffffffff,
&total_entries,
@@ -188,7 +188,7 @@ static bool get_rpc_shares(struct cli_state *cli,
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(werr)) {
TALLOC_FREE(mem_ctx);
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
return False;
}
@@ -198,7 +198,7 @@ static bool get_rpc_shares(struct cli_state *cli,
}
TALLOC_FREE(mem_ctx);
- cli_rpc_pipe_close(pipe_hnd);
+ TALLOC_FREE(pipe_hnd);
return True;
}