X-Git-Url: http://git.samba.org/?a=blobdiff_plain;f=source%2Fpassdb%2Fpdb_ldap.c;h=d941abb00e68763279dda1dfb0a32e49c07f8581;hb=1dd8fa9a521046f1de8173ac00224706c5249665;hp=90a6ff011b35a385cbb7b28a61504f386ea88e99;hpb=08645826817d42c9d4b42ea0fd5e633d7fd08d35;p=samba.git diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c index 90a6ff011b3..d941abb00e6 100644 --- a/source/passdb/pdb_ldap.c +++ b/source/passdb/pdb_ldap.c @@ -349,6 +349,7 @@ int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state, filter = talloc_asprintf(talloc_tos(), "(&%s%s)", "(uid=%u)", get_objclass_filter(ldap_state->schema_ver)); if (!filter) { + SAFE_FREE(escape_user); return LDAP_NO_MEMORY; } /* @@ -358,10 +359,10 @@ int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state, filter = talloc_all_string_sub(talloc_tos(), filter, "%u", escape_user); + SAFE_FREE(escape_user); if (!filter) { return LDAP_NO_MEMORY; } - SAFE_FREE(escape_user); ret = smbldap_search_suffix(ldap_state->smbldap_state, filter, attr, result); @@ -1912,8 +1913,9 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, struc ldap_mods_free(mods,True); return NT_STATUS_UNSUCCESSFUL; } - - if (mods == NULL) { + + if ((lp_ldap_passwd_sync() != LDAP_PASSWD_SYNC_ONLY) + && (mods == NULL)) { DEBUG(4,("ldapsam_update_sam_account: mods is empty: nothing to update for user: %s\n", pdb_get_username(newpwd))); SAFE_FREE(dn); @@ -1921,7 +1923,11 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, struc } ret = ldapsam_modify_entry(my_methods,newpwd,dn,mods,LDAP_MOD_REPLACE, element_is_changed); - ldap_mods_free(mods,True); + + if (mods != NULL) { + ldap_mods_free(mods,True); + } + SAFE_FREE(dn); /* @@ -2683,7 +2689,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, goto done; } - rc = smbldap_search(conn, lp_ldap_user_suffix(), + rc = smbldap_search(conn, lp_ldap_suffix(), LDAP_SCOPE_SUBTREE, filter, sid_attrs, 0, &result); @@ -2739,7 +2745,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, LDAP_OBJ_SAMBASAMACCOUNT, gidstr); - rc = smbldap_search(conn, lp_ldap_user_suffix(), + rc = smbldap_search(conn, lp_ldap_suffix(), LDAP_SCOPE_SUBTREE, filter, sid_attrs, 0, &result); @@ -2823,7 +2829,7 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods, goto done; } - rc = smbldap_search(conn, lp_ldap_user_suffix(), + rc = smbldap_search(conn, lp_ldap_suffix(), LDAP_SCOPE_SUBTREE, filter, attrs, 0, &result); if (rc != LDAP_SUCCESS) @@ -6264,7 +6270,7 @@ NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location) entry, get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_USER_SID), - NULL); + talloc_tos()); if (domain_sid_string) { bool found_sid; @@ -6300,7 +6306,7 @@ NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location) entry, get_attr_key2string( dominfo_attr_list, LDAP_ATTR_ALGORITHMIC_RID_BASE ), - NULL); + talloc_tos()); if (alg_rid_base_string) { alg_rid_base = (uint32)atol(alg_rid_base_string); if (alg_rid_base != algorithmic_rid_base()) {