summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-07-24 05:26:32 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-07-24 05:26:32 +0000
commit24675d99e51609de542c70a8e6f39befeed46722 (patch)
tree88eea2eec03a093d36dce9d87e2f2c9b8dc8e07b /source3/utils
parent3760e52ca852c2818787720c9f33a4ddf5d66145 (diff)
downloadsamba-24675d99e51609de542c70a8e6f39befeed46722.tar.gz
samba-24675d99e51609de542c70a8e6f39befeed46722.tar.bz2
samba-24675d99e51609de542c70a8e6f39befeed46722.zip
Make it possible to query account policy values from pdbedit (set to come soon).
Update account_pol.c to use just uint32, rather then uint32 for paramaters, int32 for storage. (The int32 functions didn't have seperate return/status values, uint32 functions use a pointer-paramater). Move the #define -> string from a swtich to a table, so we can look it up both ways. Andrew Bartlett (This used to be commit c5b5e3d653f5c38a283d901a409be6603d5103f7)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/pdbedit.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index f48c24fbc0..4f67cf7ab7 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -416,6 +416,7 @@ int main (int argc, char **argv)
static char *profile_path = NULL;
static char *config_file = dyn_CONFIGFILE;
static char *new_debuglevel = NULL;
+ static char *account_policy = NULL;
struct pdb_context *in;
poptContext pc;
@@ -437,34 +438,51 @@ int main (int argc, char **argv)
{"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},
+
{0,0,0,0}
};
-
+
setup_logging("pdbedit", True);
-
+
pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
- POPT_CONTEXT_KEEP_FIRST);
-
+ POPT_CONTEXT_KEEP_FIRST);
+
while((opt = poptGetNextOpt(pc)) != -1);
-
+
if (new_debuglevel){
debug_parse_levels(new_debuglevel);
AllowDebugChange = False;
}
-
+
if (!lp_load(config_file,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
- config_file);
+ config_file);
exit(1);
}
-
-
+
+
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) {
+
+ if (((add_user?1:0) + (delete_user?1:0) + (list_users?1:0) + (import?1:0) + (setparms?1:0)) + (backend_out?1:0) + (account_policy?1:0) > 1) {
fprintf (stderr, "Incompatible options on command line!\n");
exit(1);
}
+
+ if (account_policy) {
+ uint32 value;
+ int field = account_policy_name_to_feildnum(account_policy);
+ if (field == 0) {
+ fprintf(stderr, "No account policy by that name\n");
+ exit(1);
+ }
+ if (!account_policy_get(field, &value)){
+ 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 (!backend_in) {
if (!NT_STATUS_IS_OK(make_pdb_context_list(&in, lp_passdb_backend()))){