s3: Fix a winbind crash
authorVolker Lendecke <vl@samba.org>
Tue, 22 Jun 2010 13:59:44 +0000 (15:59 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 25 Jun 2010 10:54:15 +0000 (12:54 +0200)
nss_get_info_cached might have invalidated "ads" deep inside.

source3/winbindd/winbindd_ads.c

index faa4d8ee268bd82c19cd32cb2a58de4aa8bb681f..92e1188714ff9fd0f69ea93b2f6356d54789a8b2 100644 (file)
@@ -549,10 +549,15 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
 
        info->acct_name = ads_pull_username(ads, mem_ctx, msg);
 
-       nss_get_info_cached( domain, sid, mem_ctx, ads, msg, 
+       status = nss_get_info_cached( domain, sid, mem_ctx, ads, msg,
                      &info->homedir, &info->shell, &info->full_name, 
                      &gid);
        info->primary_gid = gid;
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(1, ("nss_get_info_cached failed: %s\n",
+                         nt_errstr(status)));
+               goto done;
+       }
 
        if (info->full_name == NULL) {
                info->full_name = ads_pull_string(ads, mem_ctx, msg, "name");