summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd_ads.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-06-25 11:47:30 +0200
committerVolker Lendecke <vl@samba.org>2010-06-25 12:54:15 +0200
commit7cf04431594e09043b3b53144fc8511d20b088ee (patch)
treedb8ed0987ad40ba3f2535e0b3bd03e02a7033bb8 /source3/winbindd/winbindd_ads.c
parenta9523f17ea2cd85a130e081f3a89cffbee1fdc06 (diff)
downloadsamba-7cf04431594e09043b3b53144fc8511d20b088ee.tar.gz
samba-7cf04431594e09043b3b53144fc8511d20b088ee.tar.bz2
samba-7cf04431594e09043b3b53144fc8511d20b088ee.zip
s3: Fix a winbind crash
nss_get_info_cached might deep inside sequence_number() invalidate the ads_struct without telling its callers.
Diffstat (limited to 'source3/winbindd/winbindd_ads.c')
-rw-r--r--source3/winbindd/winbindd_ads.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index 92e1188714..00b53a205c 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -563,6 +563,16 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
info->full_name = ads_pull_string(ads, mem_ctx, msg, "name");
}
+ /*
+ * We have to re-fetch ads from the domain,
+ * nss_get_info_cached might have invalidated it.
+ */
+ ads = ads_cached_connection(domain);
+ if (ads == NULL) {
+ domain->last_status = NT_STATUS_SERVER_DISABLED;
+ goto done;
+ }
+
if (!ads_pull_uint32(ads, msg, "primaryGroupID", &group_rid)) {
DEBUG(1,("No primary group for %s !?\n",
sid_string_dbg(sid)));