winbindd: handle trusted domains without sid.
authorGünther Deschner <gd@samba.org>
Tue, 29 Jul 2008 10:08:47 +0000 (12:08 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 30 Jul 2008 15:09:58 +0000 (17:09 +0200)
Guenther
(This used to be commit 0c1efc6c89b1a51a94d10971bf0fc515416709b3)

source3/winbindd/winbindd_ads.c
source3/winbindd/winbindd_cache.c

index 5e3d5d2aec4d3855d9011f343186254a7b580c85..097fa3907d91d05ac384aa447967f190389fc198 100644 (file)
@@ -1241,13 +1241,21 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
                        
                        (*names)[ret_count] = CONST_DISCARD(char *, trusts.array[i].netbios_name);
                        (*alt_names)[ret_count] = CONST_DISCARD(char *, trusts.array[i].dns_name);
-                       sid_copy(&(*dom_sids)[ret_count], trusts.array[i].sid);
+                       if (trusts.array[i].sid) {
+                               sid_copy(&(*dom_sids)[ret_count], trusts.array[i].sid);
+                       } else {
+                               sid_copy(&(*dom_sids)[ret_count], &global_sid_NULL);
+                       }
 
                        /* add to the trusted domain cache */
 
                        fstrcpy( d.name,  trusts.array[i].netbios_name);
                        fstrcpy( d.alt_name, trusts.array[i].dns_name);
-                       sid_copy( &d.sid, trusts.array[i].sid);
+                       if (trusts.array[i].sid) {
+                               sid_copy( &d.sid, trusts.array[i].sid);
+                       } else {
+                               sid_copy(&(*dom_sids)[ret_count], &global_sid_NULL);
+                       }
 
                        if ( domain->primary ) {
                                DEBUG(10,("trusted_domains(ads):  Searching "
index 60403717c18f7c7bac4e33cbed4c25ddccc30542..c9d857c2ec2c30e0aafb8138bc54b4067b4be192 100644 (file)
@@ -2072,7 +2072,9 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
        for (i=0; i<(*num_domains); i++) {
                (*names)[i] = centry_string(centry, mem_ctx);
                (*alt_names)[i] = centry_string(centry, mem_ctx);
-               centry_sid(centry, mem_ctx, &(*dom_sids)[i]);
+               if (!centry_sid(centry, mem_ctx, &(*dom_sids)[i])) {
+                       sid_copy(&(*dom_sids)[i], &global_sid_NULL);
+               }
        }
 
        status = centry->status;
@@ -3543,8 +3545,11 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom,
        list[idx].domain_name = talloc_strdup( list, new_dom->name );
        list[idx].dns_name = talloc_strdup( list, new_dom->alt_name );
 
-       if ( !is_null_sid( &new_dom->sid ) )
+       if ( !is_null_sid( &new_dom->sid ) ) {
                sid_copy( &list[idx].sid, &new_dom->sid );
+       } else {
+               sid_copy(&list[idx].sid, &global_sid_NULL);
+       }
 
        if ( new_dom->domain_flags != 0x0 )
                list[idx].trust_flags = new_dom->domain_flags;