From 46bcb10b5abb21758cf234764b64220ede1b7ab5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 12 Feb 2009 17:48:52 +0100 Subject: Shape up pdb_search a bit by making it a talloc ctx with a destructor --- source3/utils/net.c | 9 +++++---- source3/utils/net_sam.c | 16 ++++++++++------ source3/utils/pdbedit.c | 20 ++++++++++---------- 3 files changed, 25 insertions(+), 20 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net.c b/source3/utils/net.c index d483198a9e..7823a98219 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -272,7 +272,7 @@ static bool search_maxrid(struct pdb_search *search, const char *type, num_entries = pdb_search_entries(search, 0, 0xffffffff, &entries); for (i=0; isearch_users(in, u_search, 0)) { DEBUG(0, ("Could not start searching users\n")); - pdb_search_destroy(u_search); + TALLOC_FREE(u_search); return 1; } @@ -116,7 +116,7 @@ static int export_database (struct pdb_methods *in, fprintf(stderr, "export_database: Memory allocation " "failure!\n"); TALLOC_FREE( user ); - pdb_search_destroy(u_search); + TALLOC_FREE(u_search); return 1; } @@ -139,7 +139,7 @@ static int export_database (struct pdb_methods *in, TALLOC_FREE( user ); } - pdb_search_destroy(u_search); + TALLOC_FREE(u_search); return 0; } @@ -352,7 +352,7 @@ static int print_users_list (struct pdb_methods *in, bool verbosity, bool smbpwd struct pdb_search *u_search; struct samr_displayentry userentry; - u_search = pdb_search_init(PDB_USER_SEARCH); + u_search = pdb_search_init(talloc_tos(), PDB_USER_SEARCH); if (u_search == NULL) { DEBUG(0, ("pdb_search_init failed\n")); return 1; @@ -360,7 +360,7 @@ static int print_users_list (struct pdb_methods *in, bool verbosity, bool smbpwd if (!in->search_users(in, u_search, 0)) { DEBUG(0, ("Could not start searching users\n")); - pdb_search_destroy(u_search); + TALLOC_FREE(u_search); return 1; } @@ -391,7 +391,7 @@ static int print_users_list (struct pdb_methods *in, bool verbosity, bool smbpwd print_sam_info (sam_pwent, verbosity, smbpwdstyle); TALLOC_FREE(sam_pwent); } - pdb_search_destroy(u_search); + TALLOC_FREE(u_search); return 0; } @@ -404,7 +404,7 @@ static int fix_users_list (struct pdb_methods *in) struct pdb_search *u_search; struct samr_displayentry userentry; - u_search = pdb_search_init(PDB_USER_SEARCH); + u_search = pdb_search_init(talloc_tos(), PDB_USER_SEARCH); if (u_search == NULL) { DEBUG(0, ("pdb_search_init failed\n")); return 1; @@ -412,7 +412,7 @@ static int fix_users_list (struct pdb_methods *in) if (!in->search_users(in, u_search, 0)) { DEBUG(0, ("Could not start searching users\n")); - pdb_search_destroy(u_search); + TALLOC_FREE(u_search); return 1; } @@ -444,7 +444,7 @@ static int fix_users_list (struct pdb_methods *in) } TALLOC_FREE(sam_pwent); } - pdb_search_destroy(u_search); + TALLOC_FREE(u_search); return 0; } -- cgit