summaryrefslogtreecommitdiffstats
path: root/source3/utils/smbtree.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-29 13:24:54 -0800
committerJeremy Allison <jra@samba.org>2007-11-29 13:24:54 -0800
commitd2cf97aeba14a4d336fb57b01f19bd5a08dcb003 (patch)
tree659f15d8011a1a110850c01e11078eae86d8bdad /source3/utils/smbtree.c
parent42c87fe6e6036a56b178183b034275321949050d (diff)
downloadsamba-d2cf97aeba14a4d336fb57b01f19bd5a08dcb003.tar.gz
samba-d2cf97aeba14a4d336fb57b01f19bd5a08dcb003.tar.xz
samba-d2cf97aeba14a4d336fb57b01f19bd5a08dcb003.zip
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)
Diffstat (limited to 'source3/utils/smbtree.c')
-rw-r--r--source3/utils/smbtree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index 0e0c993f4e0..bcacddc4147 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;