(*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 "
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;
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;