From 0d7ac4bc2ca8eea117a0f594880b5aac02f1056d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 14 Jun 2002 02:58:03 +0000 Subject: Patch from ctrlsoft to make the pluggable passdb subsystem use an lp_list rather than a string when configuring mulitple backends. Also adjust some of the users of get_global_sam_sid() to cope with the fact that it just might not exist (uninitialised, can't access secrets.tdb). More places need conversion. Add some const and remove silly casts. Andrew Bartlett (This used to be commit c264bf2ec93037d2a9927c00295fa60c88b7219d) --- source3/utils/pdbedit.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index ed7f648f2d..bc50c3521a 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -34,7 +34,7 @@ int export_database (struct pdb_context *in, char *db){ struct pdb_context *context; SAM_ACCOUNT *user = NULL; - if (!NT_STATUS_IS_OK(make_pdb_context_name(&context, db))){ + if (!NT_STATUS_IS_OK(make_pdb_context_string(&context, db))){ fprintf(stderr, "Can't initialize %s.\n", db); return 1; } @@ -76,7 +76,7 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst if (!sam_pwent) return -1; if (verbosity) { - printf ("Unix username: %s\n", pdb_get_username(sam_pwent)); + printf ("Unix username: %s\n", pdb_get_username(sam_pwent)); printf ("NT username: %s\n", pdb_get_nt_username(sam_pwent)); if (IS_SAM_UNIX_USER(sam_pwent)) { uid = pdb_get_uid(sam_pwent); @@ -457,10 +457,6 @@ int main (int argc, char **argv) } - if (!backend_in) { - backend_in = lp_passdb_backend(); - } - setparms = (full_name || home_dir || home_drive || logon_script || profile_path); if (((add_user?1:0) + (delete_user?1:0) + (list_users?1:0) + (import?1:0) + (setparms?1:0)) + (backend_out?1:0) > 1) { @@ -468,10 +464,16 @@ int main (int argc, char **argv) exit(1); } - - if (!NT_STATUS_IS_OK(make_pdb_context_name(&in, backend_in))){ - fprintf(stderr, "Can't initialize %s.\n", backend_in); - return 1; + if (!backend_in) { + if (!NT_STATUS_IS_OK(make_pdb_context_list(&in, lp_passdb_backend()))){ + fprintf(stderr, "Can't initialize passdb backend.\n"); + return 1; + } + } else { + if (!NT_STATUS_IS_OK(make_pdb_context_string(&in, backend_in))){ + fprintf(stderr, "Can't initialize passdb backend.\n"); + return 1; + } } if (add_user) { -- cgit