[PATCHES] idmap_rfc2307
Christof Schmitt
cs at samba.org
Wed Sep 17 14:34:35 MDT 2014
Here is a fix for the idmap_rfc2307 for a crash after a connection
problem to a DC. The second patch is just cleanup that removes unused
variables.
Christof
-------------- next part --------------
From 97520f11f293dbd9b254749879adea7b07fad86a Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Wed, 17 Sep 2014 13:23:11 -0700
Subject: [PATCH 1/2] idmap_rfc2307: Fix a crash after connection problem to DC
When the connection to the DC has a problem, the code behind
ads_do_search_retry closes the current connection and opens a new one.
The new connection has a new struct LDAP to represent the connection. In
this case, the LDAP pointer in the idmap_rfc2307_context becomes
invalid.
Fix this problem by updating the local pointer after calling
ads_do_search_retry.
Signed-off-by: Christof Schmitt <cs at samba.org>
---
source3/winbindd/idmap_rfc2307.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/source3/winbindd/idmap_rfc2307.c b/source3/winbindd/idmap_rfc2307.c
index 2b7a593..db8bab6 100644
--- a/source3/winbindd/idmap_rfc2307.c
+++ b/source3/winbindd/idmap_rfc2307.c
@@ -103,6 +103,7 @@ static NTSTATUS idmap_rfc2307_ads_search(struct idmap_rfc2307_context *ctx,
status = ads_do_search_retry(ctx->ads, bind_path,
LDAP_SCOPE_SUBTREE, expr, attrs, result);
+ ctx->ldap = ctx->ads->ldap.ld;
return ads_ntstatus(status);
}
--
1.7.1
From 897ac7cf73e25a8ac4883620d1861472bbd82bc8 Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Wed, 17 Sep 2014 13:28:19 -0700
Subject: [PATCH 2/2] idmap_rfc2307: Remove unsed parameter and variable
Signed-off-by: Christof Schmitt <cs at samba.org>
---
source3/winbindd/idmap_rfc2307.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/source3/winbindd/idmap_rfc2307.c b/source3/winbindd/idmap_rfc2307.c
index db8bab6..c04dfac 100644
--- a/source3/winbindd/idmap_rfc2307.c
+++ b/source3/winbindd/idmap_rfc2307.c
@@ -551,7 +551,6 @@ static struct id_map* idmap_rfc2307_find_map(struct idmap_rfc2307_map *maps,
static void idmap_rfc2307_map_xid_results(struct idmap_rfc2307_context *ctx,
TALLOC_CTX *mem_ctx,
- struct id_map **ids,
struct idmap_rfc2307_map *maps,
LDAPMessage *result,
struct idmap_domain *dom,
@@ -622,7 +621,7 @@ static NTSTATUS idmap_rfc2307_sids_to_unixids(struct idmap_domain *dom,
struct idmap_rfc2307_context *ctx;
TALLOC_CTX *mem_ctx;
struct idmap_rfc2307_map *int_maps;
- int cnt_usr = 0, cnt_grp = 0, idx = 0, bidx = 0;
+ int cnt_usr = 0, cnt_grp = 0, idx = 0;
char *fltr_usr = NULL, *fltr_grp = NULL;
NTSTATUS ret;
int i;
@@ -722,9 +721,8 @@ again:
goto out;
}
- idmap_rfc2307_map_xid_results(ctx, mem_ctx, &ids[bidx],
- int_maps, result, dom,
- attrs, ID_TYPE_UID);
+ idmap_rfc2307_map_xid_results(ctx, mem_ctx, int_maps,
+ result, dom, attrs, ID_TYPE_UID);
cnt_usr = 0;
TALLOC_FREE(fltr_usr);
@@ -746,9 +744,8 @@ again:
goto out;
}
- idmap_rfc2307_map_xid_results(ctx, mem_ctx, &ids[bidx],
- int_maps, result, dom,
- attrs, ID_TYPE_GID);
+ idmap_rfc2307_map_xid_results(ctx, mem_ctx, int_maps, result,
+ dom, attrs, ID_TYPE_GID);
cnt_grp = 0;
TALLOC_FREE(fltr_grp);
}
--
1.7.1
More information about the samba-technical
mailing list