diff options
Diffstat (limited to 'source3/passdb/pdb_ldap.c')
-rw-r--r-- | source3/passdb/pdb_ldap.c | 33 |
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) { |