summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-06-10 11:48:31 +0200
committerVolker Lendecke <vl@samba.org>2009-06-10 23:08:09 +0200
commit6e9e0334ff9b0aff935fcdcdd2a5380e12446a06 (patch)
treef70e27c4085ccd232feb55e584075c04a2518e62 /source3
parenta9ec21cf219c3aef0388c252539f315d3e606a71 (diff)
downloadsamba-6e9e0334ff9b0aff935fcdcdd2a5380e12446a06.tar.gz
samba-6e9e0334ff9b0aff935fcdcdd2a5380e12446a06.tar.bz2
samba-6e9e0334ff9b0aff935fcdcdd2a5380e12446a06.zip
Fix a segfault in pdb_ads_delete_user()
If a user comes from the passdb cache, priv is NULL
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_ads.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c
index 8e30dfb5bc..3081046f2d 100644
--- a/source3/passdb/pdb_ads.c
+++ b/source3/passdb/pdb_ads.c
@@ -443,12 +443,20 @@ static NTSTATUS pdb_ads_delete_user(struct pdb_methods *m,
{
struct pdb_ads_state *state = talloc_get_type_abort(
m->private_data, struct pdb_ads_state);
- struct pdb_ads_samu_private *priv = pdb_ads_get_samu_private(m, sam);
+ NTSTATUS status;
+ char *dn;
int rc;
- rc = tldap_delete(state->ld, priv->dn, NULL, NULL);
+ status = pdb_ads_sid2dn(state, pdb_get_user_sid(sam), talloc_tos(),
+ &dn);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ rc = tldap_delete(state->ld, dn, NULL, NULL);
+ TALLOC_FREE(dn);
if (rc != TLDAP_SUCCESS) {
- DEBUG(10, ("ldap_delete for %s failed: %s\n", priv->dn,
+ DEBUG(10, ("ldap_delete for %s failed: %s\n", dn,
tldap_errstr(debug_ctx(), state->ld, rc)));
return NT_STATUS_LDAP(rc);
}