summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-07-28 06:43:03 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-07-28 06:43:03 +0000
commit5b5208a0b86c0c3d745f7a9694b4096a6b26043b (patch)
tree37e2373bdeb9d982256e986fa1c49cc22a058055 /source3/utils
parent4b68935a519955f7cda9b874220fdbd037a5b0c0 (diff)
downloadsamba-5b5208a0b86c0c3d745f7a9694b4096a6b26043b.tar.gz
samba-5b5208a0b86c0c3d745f7a9694b4096a6b26043b.tar.bz2
samba-5b5208a0b86c0c3d745f7a9694b4096a6b26043b.zip
Add the ability to set account policies too.
Andrew Bartlett (This used to be commit 2bf6edf78b64335bf10c10c893d6e8fa0fac708b)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/pdbedit.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 4f67cf7ab7..76c0196cf9 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -417,6 +417,8 @@ int main (int argc, char **argv)
static char *config_file = dyn_CONFIGFILE;
static char *new_debuglevel = NULL;
static char *account_policy = NULL;
+ static long int account_policy_value = 0;
+ BOOL account_policy_value_set = False;
struct pdb_context *in;
poptContext pc;
@@ -436,10 +438,10 @@ 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_STRING, &new_debuglevel,0,"set debuglevel",NULL},
- {"configfile",'c',POPT_ARG_STRING, &config_file,0,"use different configuration file",NULL},
- {"account-policy-get",'P',POPT_ARG_STRING, &account_policy,0,"get the value of an account policy (like maximum password age)",NULL},
-
+ {"debuglevel", 'D',POPT_ARG_STRING, &new_debuglevel,0,"set debuglevel",NULL},
+ {"configfile", 'c',POPT_ARG_STRING, &config_file,0,"use different configuration file",NULL},
+ {"account-policy",'P',POPT_ARG_STRING, &account_policy,0,"value of an account policy (like maximum password age)",NULL},
+ {"value", 'V',POPT_ARG_LONG, &account_policy_value,'V',"set the account policy to this value", NULL},
{0,0,0,0}
};
@@ -448,7 +450,13 @@ int main (int argc, char **argv)
pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
- while((opt = poptGetNextOpt(pc)) != -1);
+ while((opt = poptGetNextOpt(pc)) != -1) {
+ switch (opt) {
+ case 'V':
+ account_policy_value_set = True;
+ break;
+ }
+ }
if (new_debuglevel){
debug_parse_levels(new_debuglevel);
@@ -480,8 +488,18 @@ int main (int argc, char **argv)
fprintf(stderr, "valid account policy, but unable to fetch value!\n");
exit(1);
}
- printf("account policy value for %s is %u\n", account_policy, value);
- exit(0);
+ if (account_policy_value_set) {
+ printf("account policy value for %s was %u\n", account_policy, value);
+ if (!account_policy_set(field, account_policy_value)){
+ fprintf(stderr, "valid account policy, but unable to set value!\n");
+ exit(1);
+ }
+ printf("account policy value for %s is now %lu\n", account_policy, account_policy_value);
+ exit(0);
+ } else {
+ printf("account policy value for %s is %u\n", account_policy, value);
+ exit(0);
+ }
}
if (!backend_in) {