summaryrefslogtreecommitdiff
path: root/source3/utils/pdbedit.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-10-12 03:38:07 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-10-12 03:38:07 +0000
commit4ac9ccfde4d36e3b6065c65c92dd02dddb78b4f2 (patch)
tree3a4d155eebb79435dc1b6b9493028a259bc13a30 /source3/utils/pdbedit.c
parent4920d2192206b6e0072d078cfba08f91bb03651d (diff)
downloadsamba-4ac9ccfde4d36e3b6065c65c92dd02dddb78b4f2.tar.gz
samba-4ac9ccfde4d36e3b6065c65c92dd02dddb78b4f2.tar.bz2
samba-4ac9ccfde4d36e3b6065c65c92dd02dddb78b4f2.zip
Nice *big* patch from metze.
The actual design change is relitivly small however: It all goes back to jerry's 'BOOL store', added to many of the elements in a SAM_ACCOUNT. This ensured that smb.conf defaults did not get 'fixed' into ldap. This was a great win for admins, and this patch follows in the same way. This patch extends the concept - we don't store values back into LDAP unless they have been changed. So if we read a value, but don't update it, or we read a value, find it's not there and use a default, we will not update ldap with that value. This reduced clutter in our LDAP DB, and makes it easier to change defaults later on. Metze's particular problem was that when we 'write back' an unchanged value, we would clear any muliple values in that feild. Now he can still have his mulitivalued 'uid' feild, without Samba changing it for *every* other operation. This also applies to many other attributes, and helps to eliminate a nasty race condition. (Time between get and set) This patch is big, and needs more testing, but metze has tested usrmgr, and I've fixed some pdbedit bugs, and tested domain joins, so it isn't compleatly flawed ;-). The same system will be introduced into the SAM code shortly, but this fixes bugs that people were coming across in production uses of Samba 3.0/HEAD, hence it's inclusion here. Andrew Bartlett (This used to be commit 7f237bde212eb188df84a5d8adb598a93fba8155)
Diffstat (limited to 'source3/utils/pdbedit.c')
-rw-r--r--source3/utils/pdbedit.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 9508e6db7c..0151b6b153 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -247,15 +247,15 @@ static int set_user_info (struct pdb_context *in, char *username, char *fullname
}
if (fullname)
- pdb_set_fullname(sam_pwent, fullname);
+ pdb_set_fullname(sam_pwent, fullname, PDB_CHANGED);
if (homedir)
- pdb_set_homedir(sam_pwent, homedir, True);
+ pdb_set_homedir(sam_pwent, homedir, PDB_CHANGED);
if (drive)
- pdb_set_dir_drive(sam_pwent,drive, True);
+ pdb_set_dir_drive(sam_pwent,drive, PDB_CHANGED);
if (script)
- pdb_set_logon_script(sam_pwent, script, True);
+ pdb_set_logon_script(sam_pwent, script, PDB_CHANGED);
if (profile)
- pdb_set_profile_path (sam_pwent, profile, True);
+ pdb_set_profile_path (sam_pwent, profile, PDB_CHANGED);
if (NT_STATUS_IS_OK(in->pdb_update_sam_account (in, sam_pwent)))
print_user_info (in, username, True, False);
@@ -285,7 +285,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)) {
+ if (!pdb_set_username(sam_pwent, username, PDB_CHANGED)) {
return False;
}
}
@@ -313,17 +313,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_set_fullname(sam_pwent, fullname, PDB_CHANGED);
if (homedir)
- pdb_set_homedir (sam_pwent, homedir, True);
+ pdb_set_homedir (sam_pwent, homedir, PDB_CHANGED);
if (drive)
- pdb_set_dir_drive (sam_pwent, drive, True);
+ pdb_set_dir_drive (sam_pwent, drive, PDB_CHANGED);
if (script)
- pdb_set_logon_script(sam_pwent, script, True);
+ pdb_set_logon_script(sam_pwent, script, PDB_CHANGED);
if (profile)
- pdb_set_profile_path (sam_pwent, profile, True);
+ pdb_set_profile_path (sam_pwent, profile, PDB_CHANGED);
- pdb_set_acct_ctrl (sam_pwent, ACB_NORMAL);
+ pdb_set_acct_ctrl (sam_pwent, ACB_NORMAL, PDB_CHANGED);
if (NT_STATUS_IS_OK(in->pdb_add_sam_account (in, sam_pwent))) {
print_user_info (in, username, True, False);
@@ -361,11 +361,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_set_username (sam_pwent, name, PDB_CHANGED);
- pdb_set_acct_ctrl (sam_pwent, ACB_WSTRUST);
+ pdb_set_acct_ctrl (sam_pwent, ACB_WSTRUST, PDB_CHANGED);
- pdb_set_group_sid_from_rid(sam_pwent, DOMAIN_GROUP_RID_COMPUTERS);
+ pdb_set_group_sid_from_rid(sam_pwent, DOMAIN_GROUP_RID_COMPUTERS, PDB_CHANGED);
if (NT_STATUS_IS_OK(in->pdb_add_sam_account (in, sam_pwent))) {
print_user_info (in, name, True, False);