summaryrefslogtreecommitdiff
path: root/source3/include
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/include
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/include')
-rw-r--r--source3/include/passdb.h2
-rw-r--r--source3/include/smb.h71
2 files changed, 54 insertions, 19 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 0c694987fe..32f416de4a 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -32,7 +32,7 @@
* this SAMBA will load. Increment this if *ANY* changes are made to the interface.
*/
-#define PASSDB_INTERFACE_VERSION 2
+#define PASSDB_INTERFACE_VERSION 3
/* use this inside a passdb module */
#define PDB_MODULE_VERSIONING_MAGIC \
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 822f2485dd..da83aaff47 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -569,25 +569,59 @@ typedef struct {
/*
* bit flags representing initialized fields in SAM_ACCOUNT
*/
-#define FLAG_SAM_UNINIT 0x00000000
-#define FLAG_SAM_UID 0x00000001
-#define FLAG_SAM_GID 0x00000002
-#define FLAG_SAM_SMBHOME 0x00000004
-#define FLAG_SAM_PROFILE 0x00000008
-#define FLAG_SAM_DRIVE 0x00000010
-#define FLAG_SAM_LOGONSCRIPT 0x00000020
-#define FLAG_SAM_LOGONTIME 0x00000040
-#define FLAG_SAM_LOGOFFTIME 0x00000080
-#define FLAG_SAM_KICKOFFTIME 0x00000100
-#define FLAG_SAM_CANCHANGETIME 0x00000200
-#define FLAG_SAM_MUSTCHANGETIME 0x00000400
-#define FLAG_SAM_PLAINTEXT_PW 0x00000800
+enum pdb_elements {
+ PDB_UNINIT,
+ PDB_UID,
+ PDB_GID,
+ PDB_SMBHOME,
+ PDB_PROFILE,
+ PDB_DRIVE,
+ PDB_LOGONSCRIPT,
+ PDB_LOGONTIME,
+ PDB_LOGOFFTIME,
+ PDB_KICKOFFTIME,
+ PDB_CANCHANGETIME,
+ PDB_MUSTCHANGETIME,
+ PDB_PLAINTEXT_PW,
+ PDB_USERNAME,
+ PDB_FULLNAME,
+ PDB_DOMAIN,
+ PDB_NTUSERNAME,
+ PDB_HOURSLEN,
+ PDB_LOGONDIVS,
+ PDB_USERSID,
+ PDB_GROUPSID,
+ PDB_ACCTCTRL,
+ PDB_PASSLASTSET,
+ PDB_UNIXHOMEDIR,
+ PDB_ACCTDESC,
+ PDB_WORKSTATIONS,
+ PDB_UNKNOWNSTR,
+ PDB_MUNGEDDIAL,
+ PDB_HOURS,
+ PDB_UNKNOWN3,
+ PDB_UNKNOWN5,
+ PDB_UNKNOWN6,
+ PDB_LMPASSWD,
+ PDB_NTPASSWD,
+
+ /* this must be the last element */
+ PDB_COUNT,
+};
+
+enum pdb_value_state {
+ PDB_DEFAULT=0,
+ PDB_SET,
+ PDB_CHANGED
+};
#define IS_SAM_UNIX_USER(x) \
- ((pdb_get_init_flag(x) & FLAG_SAM_UID) \
- && (pdb_get_init_flag(x) & FLAG_SAM_GID))
+ (( pdb_get_init_flags(x, PDB_UID) != PDB_DEFAULT ) \
+ && ( pdb_get_init_flags(x,PDB_GID) != PDB_DEFAULT ))
-#define IS_SAM_SET(x, flag) ((x)->private.init_flag & (flag))
+#define IS_SAM_SET(x, flag) (pdb_get_init_flags(x, flag) == PDB_SET)
+#define IS_SAM_CHANGED(x, flag) (pdb_get_init_flags(x, flag) == PDB_CHANGED)
+#define IS_SAM_DEFAULT(x, flag) (pdb_get_init_flags(x, flag) == PDB_DEFAULT)
typedef struct sam_passwd
{
@@ -599,8 +633,9 @@ typedef struct sam_passwd
struct user_data {
/* initiailization flags */
- uint32 init_flag;
-
+ struct bitmap *change_flags;
+ struct bitmap *set_flags;
+
time_t logon_time; /* logon time */
time_t logoff_time; /* logoff time */
time_t kickoff_time; /* kickoff time */