r21962: Make pdbedit use the configfile specified by -s
authorVolker Lendecke <vlendec@samba.org>
Sat, 24 Mar 2007 21:29:53 +0000 (21:29 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:18:53 +0000 (12:18 -0500)
source/utils/pdbedit.c

index 0e8de82043c9793ba2e93d800fdbdcc05c590afb..534dd994fe021f0ba194fdefb7eadba7bfcee0d6 100644 (file)
@@ -761,6 +761,7 @@ int main (int argc, char **argv)
        static char *pwd_time_format = NULL;
        static BOOL pw_from_stdin = False;
        struct pdb_methods *bin, *bout, *bdef;
+       char *configfile = NULL;
        poptContext pc;
        struct poptOption long_options[] = {
                POPT_AUTOHELP
@@ -818,6 +819,9 @@ int main (int argc, char **argv)
                case 'C':
                        account_policy_value_set = True;
                        break;
+               case 's':
+                       configfile = optarg;
+                       break;
                }
        }
 
@@ -826,7 +830,8 @@ int main (int argc, char **argv)
        if (user_name == NULL)
                user_name = poptGetArg(pc);
 
-       if (!lp_load(dyn_CONFIGFILE,True,False,False,True)) {
+       if (!lp_load(configfile?configfile:dyn_CONFIGFILE,
+                    True,False,False,True)) {
                fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
                exit(1);
        }