Bug 6349 - wbinfo -D domainname gives out random result.
Summary: wbinfo -D domainname gives out random result.
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: Winbind (show other bugs)
Version: unspecified
Hardware: x86 Linux
: P3 major
Target Milestone: ---
Assignee: Guenther Deschner
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks: 4872
  Show dependency treegraph
 
Reported: 2009-05-11 15:41 UTC by James Ding
Modified: 2009-10-08 05:44 UTC (History)
2 users (show)

See Also:


Attachments
Patch for 3.4 (702 bytes, patch)
2009-08-30 04:48 UTC, Volker Lendecke
no flags Details
Patch for 3.3 (737 bytes, patch)
2009-08-30 04:51 UTC, Volker Lendecke
no flags Details
smb.conf from PDC - output of 'net conf list' (4.13 KB, text/plain)
2009-09-10 10:43 UTC, John H Terpstra (mail address dead(
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Ding 2009-05-11 15:41:57 UTC
Assume we are in a domain 'pet.net',we have a domain controller named 'cat.pet.net', pre-win2k domain name is 'pet'
Config samba to access this domain. Start winbind.
Run cmd 'wbinfo -D pet', we got:
--------------------8<---------------------------------------
Name              : PET
Alt_Name          : cat.pet.net
SID               : S-1-5-21-309666555-3165270563-1912345678
Active Directory  : YES
Native            : No
Primary           : No
-------------------->8---------------------------------------

Turn off domain controler or disconect domain controller, run the command again.
Sometime the result will filp over randanmly.
--------------------8<---------------------------------------
Name              : PET
Alt_Name          : cat.pet.net
SID               : S-1-5-21-309666555-3165270563-1912345678
Active Directory  : NO
Native            : YES
Primary           : YES
-------------------->8---------------------------------------

The following three bits will have random output
--------------------8<---------------------------------------
Active Directory  : YES
Native            : No
Primary           : No
-------------------->8---------------------------------------

The root cause is the domain flag is not zeroed out properly before we use it.

The fix is: (in function 'wbcDomainInfo', line number may not be accurate)
--------------------8<---------------------------------------
source/nsswitch/libwbclient/wbc_util.c

@@ -169,6 +169,7 @@
                                    &info->sid);
        BAIL_ON_WBC_ERROR(wbc_status);

+       info->domain_flags = 0;
        if (response.data.domain_info.native_mode)
                info->domain_flags |= WBC_DOMINFO_DOMAIN_NATIVE;
        if (response.data.domain_info.active_directory)
-------------------->8---------------------------------------


This bug exists in all current samba branches. Please port the fix to all branches. I believe it is the root cause of bug #4872.
Comment 1 James Ding 2009-05-11 19:26:26 UTC
Additional code review:

We have the same issue in the function 'process_domain_info_string'.

+       info->domain_flags = 0;
	if ( strcmp(r, "Offline") == 0) {
		info->domain_flags |= WBC_DOMINFO_DOMAIN_OFFLINE;
	}

Further suggestion: 
Review all talloc callings to make sure we did not leave uninitialized struct alone. Also we should have a tcalloc function to prevent any similar problems. 

  
Comment 2 John H Terpstra (mail address dead( 2009-08-17 16:56:38 UTC
This same bug happens when wbinfo -D is run against a Samba PDC running 3.4.0.
Comment 3 Volker Lendecke 2009-08-30 04:48:35 UTC
Created attachment 4611 [details]
Patch for 3.4

Can you try the attached patch for 3.4?

Thanks,

Volker
Comment 4 Volker Lendecke 2009-08-30 04:51:40 UTC
Created attachment 4612 [details]
Patch for 3.3
Comment 5 Guenther Deschner 2009-09-02 04:50:25 UTC
I tried very hard to reproduce this but couldnt. Given that the patch surely does the right thing, I'd say we pick it for 3.4/3.3.
Comment 6 Karolin Seeger 2009-09-02 05:05:53 UTC
Pushed.
Closing out bug report.

Please reopen if it's still an issue.

Thanks!
Comment 7 John H Terpstra (mail address dead( 2009-09-09 19:45:25 UTC
Karolin,

This is a totally reproducible problem in every site I have worked at in the last month.  I can reproduce it on my own network at will.  If you need access to my network let me know - I will gladly give you root-level access.

Here is the result of running "wbinfo -D MIDEARTH" in rapid succession.  You will see that wbinfo sometimes thinks that Samba 3.4.1 is ADS and it can not make up its mind (not that it has one!) whether or not Samba 3.4.1 is native mode.  Here we go:

atastore:~ # wbinfo -D MIDEARTH
Name              : MIDEARTH
Alt_Name          :
SID               : S-1-5-21-726309263-4128913605-1168186429
Active Directory  : Yes
Native            : Yes
Primary           : Yes
datastore:~ # wbinfo -D MIDEARTH
Name              : MIDEARTH
Alt_Name          :
SID               : S-1-5-21-726309263-4128913605-1168186429
Active Directory  : No
Native            : No
Primary           : Yes
datastore:~ # wbinfo -D MIDEARTH
Name              : MIDEARTH
Alt_Name          :
SID               : S-1-5-21-726309263-4128913605-1168186429
Active Directory  : Yes
Native            : No
Primary           : Yes
datastore:~ # wbinfo -D MIDEARTH
Name              : MIDEARTH
Alt_Name          :
SID               : S-1-5-21-726309263-4128913605-1168186429
Active Directory  : No
Native            : No
Primary           : Yes
datastore:~ # wbinfo -D MIDEARTH
Name              : MIDEARTH
Alt_Name          :
SID               : S-1-5-21-726309263-4128913605-1168186429
Active Directory  : Yes
Native            : Yes
Primary           : Yes
Comment 8 Karolin Seeger 2009-09-10 01:29:34 UTC
Günther, any ideas?
Comment 9 Guenther Deschner 2009-09-10 04:25:01 UTC
looking...
Comment 10 Guenther Deschner 2009-09-10 04:48:47 UTC
John, could you please describe a little more your setup. Is that really running 3.4.1 (and also 3.4.1 libwbclient) running ? Does this happen with winbindd on a samba pdc? Or with winbindd on a member ? 
Comment 11 Guenther Deschner 2009-09-10 04:49:43 UTC
At least here with 3.4.1 winbind on a pdc (with two w2k8 trusts) and 3.4.1 winbindd on a member server in the 3.4.1 domain I cannot reproduce this.
Comment 12 John H Terpstra (mail address dead( 2009-09-10 10:22:44 UTC
(In reply to comment #10)
> John, could you please describe a little more your setup. Is that really
> running 3.4.1 (and also 3.4.1 libwbclient) running ? 

It really is running 3.4.1 (from the OpenSUSE site).  I recompiled the SRPM and have the same problem with the RPMs I built on this system.

Yes, all files built are up to date.

> Does this happen with winbindd on a samba pdc? Or with winbindd on a member ? 
 
This is on the PDC where winbindd is running.  I can not reproduce this on a member. The PDC is running 3.4.1.

- John T.
Comment 13 John H Terpstra (mail address dead( 2009-09-10 10:43:42 UTC
Created attachment 4680 [details]
smb.conf from PDC - output of 'net conf list'
Comment 14 Guenther Deschner 2009-09-23 05:31:00 UTC
Fix (from volker) has been pushed to master, 3.4 and 3.3. Closing as fixed, please reopen if still an issue.