Bug 10195 - wbinfo --lookup-sids fails with more than 129 SIDs
wbinfo --lookup-sids fails with more than 129 SIDs
Status: RESOLVED FIXED
Product: Samba 3.6
Classification: Unclassified
Component: Client Tools
3.6.19
x64 FreeBSD
: P5 normal
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-10 11:46 UTC by Michael Letzgus
Modified: 2013-10-29 09:13 UTC (History)
4 users (show)

See Also:


Attachments
Patch (868 bytes, patch)
2013-10-15 08:39 UTC, Volker Lendecke
no flags Details
v4-1-test patch (1.20 KB, patch)
2013-10-22 08:41 UTC, Andreas Schneider
vl: review+
Details
v4-0-test patch (1.20 KB, patch)
2013-10-22 08:42 UTC, Andreas Schneider
vl: review+
Details
v3-6-test patch (1.21 KB, patch)
2013-10-22 08:43 UTC, Andreas Schneider
vl: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Letzgus 2013-10-10 11:46:07 UTC
Hi,

in a script I'm doing the following lookup:

> wbinfo --lookup-sids $sid_list

If $sid_list contains less than 130 SIDs everything is fine, if there are 130 or more the result is an error:

wbcLookupSids failed: WBC_ERR_WINBIND_NOT_AVAILABLE
Could not lookup SIDs <all the comma separated SIDs>

There is no specific debug output in any logfiles (log.wb-, debug).
Comment 1 Volker Lendecke 2013-10-12 11:06:58 UTC
Just tried: This seems to work for me. Is it possible that you are running into a limit for the command line length? 129 SIDs could typically take roughly 8k of string space. Could this be a limit on your platform?
Comment 2 Michael Letzgus 2013-10-14 17:30:30 UTC
I don't think it's a problem with the shell. The ARG_MAX on my FreeBSD system is 256 k.

And:

* If the command line were truncated I expect some SIDs missing in the result, but not an error complaining about the winbind daemon

* The error message contains the correct number of SIDs, so the complete list must be in wbinfo.
Comment 3 Volker Lendecke 2013-10-14 19:08:56 UTC
Can you get us the equivalent of what would be an strace (ktrace/kdump) of the wbinfo command, together with debug level 10 logs of winbind?
Comment 4 Michael Letzgus 2013-10-14 20:36:34 UTC
I just created a trace but I'm not sure what kind confidential data is in there...

When providing ~220 SIDs there is a call in the trace with exactly 4096 bytes (87 SIDs and a crippled one.

When providing only 5 SIDs this buffer is 236 bytes including a final "\0". This final "\0" is missing in the case before!

Rough guess:
Somewhere in wbinfo is a buffer hard coded to 4k length. When there is 4k or more of input data there is no space left for the string termination and something goes wrong.

The final error message prints out all given SIDs in 1k-chunks.
Comment 5 Volker Lendecke 2013-10-15 08:39:39 UTC
Created attachment 9289 [details]
Patch

Can you try the attached patch?
Comment 6 Andreas Schneider 2013-10-22 08:41:23 UTC
Created attachment 9309 [details]
v4-1-test patch
Comment 7 Andreas Schneider 2013-10-22 08:42:07 UTC
Created attachment 9310 [details]
v4-0-test patch
Comment 8 Andreas Schneider 2013-10-22 08:43:42 UTC
Created attachment 9311 [details]
v3-6-test patch
Comment 9 Volker Lendecke 2013-10-22 10:23:49 UTC
Comment on attachment 9311 [details]
v3-6-test patch

Thanks for doing the port
Comment 10 Andreas Schneider 2013-10-22 10:35:22 UTC
Karolin, could you please add the patches to the next 4.1, 4.0 and 3.6 release?
Comment 11 Karolin Seeger 2013-10-28 10:01:24 UTC
Pushed to autobuild-v4-1-test, autobuild-v4-0-test and v3-6-test.
Comment 12 Karolin Seeger 2013-10-29 09:13:35 UTC
Pushed to v4-1-test and v4-0-test.
Closing out bug report.

Thanks!