s3: Fix a winbind crash
authorVolker Lendecke <vl@samba.org>
Fri, 25 Jun 2010 09:47:30 +0000 (11:47 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 25 Jun 2010 10:34:43 +0000 (12:34 +0200)
nss_get_info_cached might deep inside sequence_number() invalidate the
ads_struct without telling its callers.

source3/winbindd/winbindd_ads.c

index 96dabaa81a26dc60b560533e721ba9ff77122cf0..07510cb58501d18dc1cc652c744cb8b296d4f017 100644 (file)
@@ -560,6 +560,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)));