From d2cf97aeba14a4d336fb57b01f19bd5a08dcb003 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 29 Nov 2007 13:24:54 -0800 Subject: Remove the explicit TALLOC_CTX * from cli_struct. Make us very explicit about how long a talloc ctx should last. Jeremy. (This used to be commit ba9e2be2b5a59684e854609f9d82ea1633448c62) --- source3/utils/smbcquotas.c | 7 +++---- source3/utils/smbtree.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index ae793c28f9..6ae63f4c68 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -62,7 +62,7 @@ static bool cli_open_policy_hnd(void) /* Some systems don't support SEC_RIGHTS_MAXIMUM_ALLOWED, but NT sends 0x2000000 so we might as well do it too. */ - if (!NT_STATUS_IS_OK(rpccli_lsa_open_policy(global_pipe_hnd, cli_ipc->mem_ctx, True, + if (!NT_STATUS_IS_OK(rpccli_lsa_open_policy(global_pipe_hnd, talloc_tos(), True, GENERIC_EXECUTE_ACCESS, &pol))) { return False; } @@ -87,7 +87,7 @@ static void SidToString(fstring str, DOM_SID *sid, bool _numeric) /* Ask LSA to convert the sid to a name */ if (!cli_open_policy_hnd() || - !NT_STATUS_IS_OK(rpccli_lsa_lookup_sids(global_pipe_hnd, cli_ipc->mem_ctx, + !NT_STATUS_IS_OK(rpccli_lsa_lookup_sids(global_pipe_hnd, talloc_tos(), &pol, 1, sid, &domains, &names, &types)) || !domains || !domains[0] || !names || !names[0]) { @@ -114,7 +114,7 @@ static bool StringToSid(DOM_SID *sid, const char *str) } if (!cli_open_policy_hnd() || - !NT_STATUS_IS_OK(rpccli_lsa_lookup_names(global_pipe_hnd, cli_ipc->mem_ctx, + !NT_STATUS_IS_OK(rpccli_lsa_lookup_names(global_pipe_hnd, talloc_tos(), &pol, 1, &str, NULL, 1, &sids, &types))) { result = False; @@ -559,4 +559,3 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" }, return result; } - diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index 0e0c993f4e..bcacddc414 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -71,13 +71,17 @@ static bool get_workgroups(struct user_auth_info *user_info) { struct cli_state *cli; struct sockaddr_storage server_ss; - pstring master_workgroup; + TALLOC_CTX *ctx = talloc_tos(); + char *master_workgroup = NULL; /* Try to connect to a #1d name of our current workgroup. If that doesn't work broadcast for a master browser and then jump off that workgroup. */ - pstrcpy(master_workgroup, lp_workgroup()); + master_workgroup = talloc_strdup(ctx, lp_workgroup()); + if (!master_workgroup) { + return false; + } if (!use_bcast && !find_master_ip(lp_workgroup(), &server_ss)) { DEBUG(4, ("Unable to find master browser for workgroup %s, falling back to broadcast\n", @@ -90,7 +94,9 @@ static bool get_workgroups(struct user_auth_info *user_info) return False; } - if (!(cli = get_ipc_connect_master_ip_bcast(master_workgroup, user_info))) { + if (!(cli = get_ipc_connect_master_ip_bcast(talloc_tos(), + user_info, + &master_workgroup))) { DEBUG(4, ("Unable to find master browser by " "broadcast\n")); return False; -- cgit