summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-05-10 14:40:55 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-05-10 14:40:55 +0000
commit4f4f56d147628c5569f2c2fc6aeb2e0f5eecde8b (patch)
treed0cc5d125478ab67d4f4f3a7b4dac785d0bd3b23
parent0502d0ad6b5258dcd2aa84bf969f21592ce52e6f (diff)
downloadsamba-4f4f56d147628c5569f2c2fc6aeb2e0f5eecde8b.tar.gz
samba-4f4f56d147628c5569f2c2fc6aeb2e0f5eecde8b.tar.bz2
samba-4f4f56d147628c5569f2c2fc6aeb2e0f5eecde8b.zip
Allow -c to specify the location of the config file, and fix up some handling
of non-existant passdb cases. (This used to be commit e56de32f5ce5cb301137497451b0ccd633f09f54)
-rw-r--r--source3/utils/pdbedit.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index bf52d08989..6b4cd606d0 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -182,11 +182,9 @@ static int print_users_list (struct pdb_context *in, BOOL verbosity, BOOL smbpwd
SAM_ACCOUNT *sam_pwent=NULL;
BOOL check, ret;
- errno = 0; /* testing --simo */
check = in->pdb_setsampwent(in, False);
- if (check && errno == ENOENT) {
- fprintf (stderr,"Password database not found!\n");
- exit(1);
+ if (!check) {
+ return 1;
}
check = True;
@@ -411,6 +409,7 @@ int main (int argc, char **argv)
static char *backend_out = NULL;
static char *logon_script = NULL;
static char *profile_path = NULL;
+ static char *config_file = dyn_CONFIGFILE;
static int new_debuglevel = -1;
struct pdb_context *in;
@@ -431,7 +430,8 @@ int main (int argc, char **argv)
{"delete", 'x',POPT_ARG_VAL,&delete_user,1,"delete user",NULL},
{"import", 'i',POPT_ARG_STRING,&backend_in,0,"use different passdb backend",NULL},
{"export", 'e',POPT_ARG_STRING,&backend_out,0,"export user accounts to backend", NULL},
- {"debuglevel",'D',POPT_ARG_INT,&new_debuglevel,0,"set debuglevel",NULL},
+ {"debuglevel",'D', POPT_ARG_INT, &new_debuglevel,0,"set debuglevel",NULL},
+ {"configfile",'c',POPT_ARG_STRING, &config_file,0,"use different configuration file",NULL},
{0,0,0,0}
};
@@ -439,14 +439,6 @@ int main (int argc, char **argv)
setup_logging("pdbedit", True);
AllowDebugChange = False;
- if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
- fprintf(stderr, "Can't load %s - run testparm to debug it\n",
- dyn_CONFIGFILE);
- exit(1);
- }
-
- backend_in = lp_passdb_backend();
-
pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
@@ -456,6 +448,16 @@ int main (int argc, char **argv)
DEBUGLEVEL = new_debuglevel;
}
+ if (!lp_load(config_file,True,False,False)) {
+ fprintf(stderr, "Can't load %s - run testparm to debug it\n",
+ config_file);
+ exit(1);
+ }
+
+ 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) {