Bug 8586 - smbclient -L os2_server01 -Ugk fails with "Error returning browse list: NT_STATUS_UNSUCCESSFUL"
Summary: smbclient -L os2_server01 -Ugk fails with "Error returning browse list: NT_ST...
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Client Tools (show other bugs)
Version: 3.6.1
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Blocks: 8595
  Show dependency treegraph
Reported: 2011-11-08 03:50 UTC by Guenter Kukkukk
Modified: 2011-11-25 19:25 UTC (History)
2 users (show)

See Also:

wireshark sniff latest git tree against os/2 (5.62 KB, application/octet-stream)
2011-11-10 03:59 UTC, Guenter Kukkukk
no flags Details
wireshark sniff working (old) smbclient against os/2 (8.24 KB, application/octet-stream)
2011-11-10 04:04 UTC, Guenter Kukkukk
no flags Details
Patch for master (1.22 KB, patch)
2011-11-18 07:42 UTC, Stefan Metzmacher
no flags Details
Patch for v3-6-test (1.29 KB, patch)
2011-11-21 06:24 UTC, Stefan Metzmacher
kukks: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Guenter Kukkukk 2011-11-08 03:50:21 UTC
This failure is seen with 3.6.1 and latest master git tree.

I'm atm just hunting some os/2 related errors - unfortunately i don't have
an automated test environment here (even the os/2 boxes are usually not running)

smbclient -L server01 -Ugk
Enter gk's password: 
OS=[OS/2 2.30] Server=[IBM LAN Server 4.0]

        Sharename       Type      Comment
        ---------       ----      -------
Error returning browse list: NT_STATUS_UNSUCCESSFUL
I first thought it could be related to:


but it seems to be a bit more complicated...

Debugging now ....

Cheers, Günter
Comment 1 Guenter Kukkukk 2011-11-08 04:33:09 UTC

int cli_RNetShareEnum()
         if (cli_api(cli, ....

now just bails out with error - not easy to catch due to now used
async calls.

Is there some "tutorial, best used notices, ..." how to debug
those async calls ...?

Cheers, Günter
Comment 2 Guenter Kukkukk 2011-11-10 03:55:49 UTC
had only few time to track this down.

So i'll sent some intermediate wireshark sniffs:

  - a failing one from current git master against os/2
  - a working one done with an old smbclient 

Cheers, Günter
Comment 3 Guenter Kukkukk 2011-11-10 03:59:19 UTC
Created attachment 7075 [details]
wireshark sniff latest git tree against os/2
Comment 4 Guenter Kukkukk 2011-11-10 04:04:36 UTC
Created attachment 7076 [details]
wireshark sniff working (old) smbclient against os/2
Comment 5 Guenter Kukkukk 2011-11-18 02:20:52 UTC
Hmm, this is a real picky one ...

as can be seen from my sent network sniffs, the parameter offset
should be 76, but is 78 now (beside other stuff).

The problematic part is in libsmb/clitrans.c:
static void cli_trans_format()
	switch (cmd) {
	case SMBtrans:
		pad[0] = 0;
		iov[0].iov_base = (void *)pad;
		iov[0].iov_len = 1;   <====== !!!!!!!!
		iov[1].iov_base = (void *)state->pipe_name_conv;
		iov[1].iov_len = state->pipe_name_conv_len;
		wct = 14 + state->num_setup;
		param_offset += iov[0].iov_len + iov[1].iov_len;
		iov += 2;

If  iov[0].iov_len = 0;  _would_ have been used here:

35   param_offset = MIN_SMB_SIZE; 
13   calc. length of \PIPE\LANMAN   (here ASCII)
28   wct (here 14) * sizeof(uint16_t)
76   <== working case for param_offset

I tested that against os/2 and it was working, but obviously
will break all other setups where UCS2/UTF-16 pipe name encoding
is used.

With current  iov[0].iov_len = 1;
the failing param_offset is lateron calculated as 78.

So i think that the now generalized setup in
   static void cli_trans_format()
needs some more tweaking...

An os/2 server is not needed to test this, one can also
use samba (to take a network trace).
Here todays (18th Nov 2011) git master tree was used:

smbclient -L localhost -m LANMAN2 -U%

        Sharename       Type      Comment
        ---------       ----      -------
cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe \srvsvc failed with error NT_STATUS_IO_DEVICE_ERROR
Error returning browse list: NT_STATUS_CTL_FILE_NOT_SUPPORTED   <==== !!!!

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------

I atm have no clue how to solve this - it's a very often used
code path with inherent side-effects.....

Cheers,  Günter
Comment 6 Stefan Metzmacher 2011-11-18 07:42:11 UTC
Created attachment 7116 [details]
Patch for master

Can you test if this patch fixes the problem?
Comment 7 Guenter Kukkukk 2011-11-21 00:46:49 UTC
Hi Metze,
your patch fixes the problem.
Cheers,  Günter
Comment 8 Stefan Metzmacher 2011-11-21 06:24:41 UTC
Created attachment 7128 [details]
Patch for v3-6-test

Günter, please review and assign to Karolin
Comment 9 Guenter Kukkukk 2011-11-21 14:06:24 UTC
Hi Karolin,

the bug is fixed.
Cheers, Günter
Comment 10 Karolin Seeger 2011-11-25 19:25:34 UTC
Pushed to v3-6-test.
Closing out bug report.