summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-09-20 11:02:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:43 -0500
commitec62d5a96896ed38894282cd7547d012f604c597 (patch)
tree6d112befbb391c935da0cf48bafadd0b333e6058 /source3/passdb
parent5bfd4d2007dab209818ee6335e3cdf6fce66bc0e (diff)
downloadsamba-ec62d5a96896ed38894282cd7547d012f604c597.tar.gz
samba-ec62d5a96896ed38894282cd7547d012f604c597.tar.bz2
samba-ec62d5a96896ed38894282cd7547d012f604c597.zip
r2444: Based on jmcd's patch, implement special lists for the ldap user attributes to
delete. Richard, IMHO this is the better solution to the problem you currently have. Please review. Thanks, Volker (This used to be commit 6957d6a8921fbd97747258249d99b505a79cfcb4)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_ldap.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 4f9140d3a8..35dbf4f0dc 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -148,6 +148,27 @@ static char** get_userattr_list( int schema_ver )
return NULL;
}
+/**************************************************************************
+ Return the list of attribute names to delete given a user schema version.
+**************************************************************************/
+
+static char** get_userattr_delete_list( int schema_ver )
+{
+ switch ( schema_ver ) {
+ case SCHEMAVER_SAMBAACCOUNT:
+ return get_attr_list( attrib_map_to_delete_v22 );
+
+ case SCHEMAVER_SAMBASAMACCOUNT:
+ return get_attr_list( attrib_map_to_delete_v30 );
+ default:
+ DEBUG(0,("get_userattr_list: unknown schema version specified!\n"));
+ break;
+ }
+
+ return NULL;
+}
+
+
/*******************************************************************
Generate the LDAP search filter for the objectclass based on the
version of the schema we are using.
@@ -299,11 +320,11 @@ static NTSTATUS ldapsam_delete_entry(struct ldapsam_privates *ldap_state,
really exist. */
for (attrib = attrs; *attrib != NULL; attrib++) {
- if ((StrCaseCmp(*attrib, name) == 0) &&
- !(StrCaseCmp(*attrib,
- get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_MOD_TIMESTAMP)))) {
- DEBUG(10, ("ldapsam_delete_entry: deleting attribute %s\n", name));
- smbldap_set_mod(&mods, LDAP_MOD_DELETE, name, NULL);
+ if (strequal(*attrib, name)) {
+ DEBUG(10, ("ldapsam_delete_entry: deleting "
+ "attribute %s\n", name));
+ smbldap_set_mod(&mods, LDAP_MOD_DELETE, name,
+ NULL);
}
}
@@ -1520,7 +1541,7 @@ static NTSTATUS ldapsam_delete_sam_account(struct pdb_methods *my_methods, SAM_A
DEBUG (3, ("ldapsam_delete_sam_account: Deleting user %s from LDAP.\n", sname));
- attr_list= get_userattr_list( ldap_state->schema_ver );
+ attr_list= get_userattr_delete_list( ldap_state->schema_ver );
rc = ldapsam_search_suffix_by_name(ldap_state, sname, &result, attr_list);
if (rc != LDAP_SUCCESS) {