summaryrefslogtreecommitdiff
path: root/source3/utils/pdbedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils/pdbedit.c')
-rw-r--r--source3/utils/pdbedit.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 0151b6b153..6942779556 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -23,6 +23,8 @@
#include "includes.h"
+#define BIT_CONFIGFILE 0x00000001
+#define BIT_DEBUGLEVEL 0x00000002
#define BIT_BACKEND 0x00000004
#define BIT_VERBOSE 0x00000008
#define BIT_SPSTYLE 0x00000010
@@ -51,6 +53,7 @@
#define MASK_ALWAYS_GOOD 0x0000001F
#define MASK_USER_GOOD 0x00001F00
extern pstring global_myname;
+extern BOOL AllowDebugChange;
/*********************************************************
Add all currently available users to another db
@@ -247,15 +250,15 @@ static int set_user_info (struct pdb_context *in, char *username, char *fullname
}
if (fullname)
- pdb_set_fullname(sam_pwent, fullname, PDB_CHANGED);
+ pdb_set_fullname(sam_pwent, fullname);
if (homedir)
- pdb_set_homedir(sam_pwent, homedir, PDB_CHANGED);
+ pdb_set_homedir(sam_pwent, homedir, True);
if (drive)
- pdb_set_dir_drive(sam_pwent,drive, PDB_CHANGED);
+ pdb_set_dir_drive(sam_pwent,drive, True);
if (script)
- pdb_set_logon_script(sam_pwent, script, PDB_CHANGED);
+ pdb_set_logon_script(sam_pwent, script, True);
if (profile)
- pdb_set_profile_path (sam_pwent, profile, PDB_CHANGED);
+ pdb_set_profile_path (sam_pwent, profile, True);
if (NT_STATUS_IS_OK(in->pdb_update_sam_account (in, sam_pwent)))
print_user_info (in, username, True, False);
@@ -285,7 +288,7 @@ static int new_user (struct pdb_context *in, char *username, char *fullname, cha
} else {
fprintf (stderr, "WARNING: user %s does not exist in system passwd\n", username);
pdb_init_sam(&sam_pwent);
- if (!pdb_set_username(sam_pwent, username, PDB_CHANGED)) {
+ if (!pdb_set_username(sam_pwent, username)) {
return False;
}
}
@@ -313,17 +316,17 @@ static int new_user (struct pdb_context *in, char *username, char *fullname, cha
SAFE_FREE(password2);
if (fullname)
- pdb_set_fullname(sam_pwent, fullname, PDB_CHANGED);
+ pdb_set_fullname(sam_pwent, fullname);
if (homedir)
- pdb_set_homedir (sam_pwent, homedir, PDB_CHANGED);
+ pdb_set_homedir (sam_pwent, homedir, True);
if (drive)
- pdb_set_dir_drive (sam_pwent, drive, PDB_CHANGED);
+ pdb_set_dir_drive (sam_pwent, drive, True);
if (script)
- pdb_set_logon_script(sam_pwent, script, PDB_CHANGED);
+ pdb_set_logon_script(sam_pwent, script, True);
if (profile)
- pdb_set_profile_path (sam_pwent, profile, PDB_CHANGED);
+ pdb_set_profile_path (sam_pwent, profile, True);
- pdb_set_acct_ctrl (sam_pwent, ACB_NORMAL, PDB_CHANGED);
+ pdb_set_acct_ctrl (sam_pwent, ACB_NORMAL);
if (NT_STATUS_IS_OK(in->pdb_add_sam_account (in, sam_pwent))) {
print_user_info (in, username, True, False);
@@ -361,11 +364,11 @@ static int new_machine (struct pdb_context *in, char *machinename)
pdb_set_plaintext_passwd (sam_pwent, password);
- pdb_set_username (sam_pwent, name, PDB_CHANGED);
+ pdb_set_username (sam_pwent, name);
- pdb_set_acct_ctrl (sam_pwent, ACB_WSTRUST, PDB_CHANGED);
+ pdb_set_acct_ctrl (sam_pwent, ACB_WSTRUST);
- pdb_set_group_sid_from_rid(sam_pwent, DOMAIN_GROUP_RID_COMPUTERS, PDB_CHANGED);
+ pdb_set_group_sid_from_rid(sam_pwent, DOMAIN_GROUP_RID_COMPUTERS);
if (NT_STATUS_IS_OK(in->pdb_add_sam_account (in, sam_pwent))) {
print_user_info (in, name, True, False);
@@ -447,6 +450,8 @@ 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 char *new_debuglevel = NULL;
static char *account_policy = NULL;
static long int account_policy_value = 0;
BOOL account_policy_value_set = False;
@@ -463,8 +468,8 @@ int main (int argc, char **argv)
{"user", 'u', POPT_ARG_STRING, &user_name, 0, "use username", "USER" },
{"fullname", 'f', POPT_ARG_STRING, &full_name, 0, "set full name", NULL},
{"homedir", 'h', POPT_ARG_STRING, &home_dir, 0, "set home directory", NULL},
- {"drive", 'D', POPT_ARG_STRING, &home_drive, 0, "set home drive", NULL},
- {"script", 'S', POPT_ARG_STRING, &logon_script, 0, "set logon script", NULL},
+ {"drive", 'd', POPT_ARG_STRING, &home_drive, 0, "set home drive", NULL},
+ {"script", 's', POPT_ARG_STRING, &logon_script, 0, "set logon script", NULL},
{"profile", 'p', POPT_ARG_STRING, &profile_path, 0, "set profile path", NULL},
{"create", 'a', POPT_ARG_NONE, &add_user, 0, "create user", NULL},
{"modify", 'r', POPT_ARG_NONE, &modify_user, 0, "modify user", NULL},
@@ -473,10 +478,10 @@ int main (int argc, char **argv)
{"backend", 'b', POPT_ARG_STRING, &backend, 0, "use different passdb backend as default backend", NULL},
{"import", 'i', POPT_ARG_STRING, &backend_in, 0, "import user accounts from this backend", NULL},
{"export", 'e', POPT_ARG_STRING, &backend_out, 0, "export user accounts to this 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", '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},
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
{0,0,0,0}
};
@@ -493,8 +498,13 @@ int main (int argc, char **argv)
}
}
- if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
- fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
+ 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);
exit(1);
}
@@ -509,7 +519,9 @@ int main (int argc, char **argv)
strupper(global_myname);
- setparms = (backend ? BIT_BACKEND : 0) +
+ setparms = (config_file ? BIT_CONFIGFILE : 0) +
+ (new_debuglevel ? BIT_DEBUGLEVEL : 0) +
+ (backend ? BIT_BACKEND : 0) +
(verbose ? BIT_VERBOSE : 0) +
(spstyle ? BIT_SPSTYLE : 0) +
(full_name ? BIT_FULLNAME : 0) +