summaryrefslogtreecommitdiff
path: root/source3/utils/pdbedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils/pdbedit.c')
-rw-r--r--source3/utils/pdbedit.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index cea3e3b295..908f0ba0af 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -175,7 +175,7 @@ static int export_database (struct pdb_methods *in,
static int export_groups (struct pdb_methods *in, struct pdb_methods *out)
{
- GROUP_MAP *maps = NULL;
+ GROUP_MAP **maps = NULL;
size_t i, entries = 0;
NTSTATUS status;
@@ -188,10 +188,10 @@ static int export_groups (struct pdb_methods *in, struct pdb_methods *out)
}
for (i=0; i<entries; i++) {
- out->add_group_mapping_entry(out, &(maps[i]));
+ out->add_group_mapping_entry(out, maps[i]);
}
- SAFE_FREE( maps );
+ TALLOC_FREE(maps);
return 0;
}
@@ -655,7 +655,11 @@ static int set_machine_info(const char *machinename,
return -1;
}
- strlower_m(name);
+ if (!strlower_m(name)) {
+ fprintf(stderr, "strlower_m %s failed\n", name);
+ TALLOC_FREE(sam_pwent);
+ return -1;
+ }
ret = pdb_getsampwnam(sam_pwent, name);
if (!ret) {
@@ -853,7 +857,10 @@ static int new_machine(const char *machinename, char *machine_sid)
return -1;
}
- strlower_m(name);
+ if (!strlower_m(name)) {
+ fprintf(stderr, "strlower_m %s failed\n", name);
+ return -1;
+ }
flags = LOCAL_ADD_USER | LOCAL_TRUST_ACCOUNT | LOCAL_SET_PASSWORD;
@@ -958,8 +965,8 @@ static int delete_machine_entry(const char *machinename)
if (!pdb_getsampwnam(samaccount, name)) {
fprintf (stderr,
"machine %s does not exist in the passdb\n", name);
- return -1;
TALLOC_FREE(samaccount);
+ return -1;
}
if (!NT_STATUS_IS_OK(pdb_delete_sam_account(samaccount))) {
@@ -1077,7 +1084,7 @@ int main (int argc, char **argv)
if (user_name == NULL)
user_name = poptGetArg(pc);
- if (!lp_load(get_dyn_CONFIGFILE(),True,False,False,True)) {
+ if (!lp_load_global(get_dyn_CONFIGFILE())) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", get_dyn_CONFIGFILE());
exit(1);
}
@@ -1117,7 +1124,7 @@ int main (int argc, char **argv)
/* HACK: set the global passdb backend by overwriting globals.
* This way we can use regular pdb functions for default
* operations that do not involve passdb migrations */
- lp_set_passdb_backend(backend);
+ lp_set_cmdline("passdb backend", backend);
} else {
backend = lp_passdb_backend();
}
@@ -1142,7 +1149,7 @@ int main (int argc, char **argv)
const char **names;
int count;
int i;
- account_policy_names_list(&names, &count);
+ account_policy_names_list(talloc_tos(), &names, &count);
fprintf(stderr, "No account policy by that name!\n");
if (count !=0) {
fprintf(stderr, "Account policy names are:\n");
@@ -1150,7 +1157,7 @@ int main (int argc, char **argv)
d_fprintf(stderr, "%s\n", names[i]);
}
}
- SAFE_FREE(names);
+ TALLOC_FREE(names);
exit(1);
}
if (!pdb_get_account_policy(field, &value)) {