Error 0 from libsmbclient smbc_opendir("smb://:@@HOME/")

Michael Spilo mspilo at skipjam.com
Fri Aug 22 03:40:32 GMT 2003


Hi All,

Sorry to bother you again, but I'm still having problems browsing my
workgroups, now with libsmbclient 3.0rc1.  I'm new to this stuff, though
I dealt with NETBIOS for other issues in a previous life.

Anyway, the question is why do I get a -1 return with 0 errno on a
smbc_opendir("smb://:@@HOME/") Could this be caused by some stupid setup
mistake on my part? 

(The ":@" I've found is necessary if the workgroup name contains an @,
since there doesn't seem to be a way to escape the @ out of the URI
user:password@ sequence, which ends up a problem if you have @ in the
user name, password or server/workgroup, but that's another topic.)

I think the problem browsing is NOT related to the @, since, once I
escape it out as above, the @HOME workgroup name proceeds through to
cli_NetServer_Enum intact, and there doesn't seem to be any parsing from
there on.  Unless Windows is doing something funky with the @ once it
gets over there.

I have a small test-net set up with 3 Win XP Home systems and 1 Linux
system (RedHat 9 kernel 2.4.20-19.9) This is the setup:

192.168.0.3	@HOME MIKE
192.168.0.4 @HOME MITA-HP
192.168.0.5 WORKGROUP TOSHLAPTOP
192.168.0.70 WORKGROUP LINUXBOX (rh9cpq)

Browsing this setup from Windows works just fine and I can access shares
on Linux from any Windows system, I can mount shares on linux from
@HOME, but I can't list the Servers in @HOME using libsmbclient.  I can
list the WORKGROUP servers just fine, even when I force the __MSBROWSE__
over to the Windows system.

Below is some tooling around I did with nmblookup and smbclient, along
with debug 100 output from a program that does nothing but this:

	if( smbc_init(auth_fn, 100) < 0) {
		printf("Error initializing smbclient: %s\n",
strerror(errno));
		exit(1);
	}
	
	smbc_opendir("smb://:@@HOME/");
	
The smbc_opendir invariably fails with errno=0.  As you can see below
the packet returned by NetServerEnum request has no data, but returns
success.  

I don't know what it means, but the SVAL(rparam,2) has a value of 2.


------------------------------------------------------------------------
-----------

[root at rh9cpq bin]# nmblookup -M -- -
querying ____MSBROWSE___ on 192.168.0.255
192.168.0.70 ____MSBROWSE___<01>
192.168.0.3 ____MSBROWSE___<01>

[root at rh9cpq bin]# nmblookup -A 192.168.0.3
Looking up status of 192.168.0.3
        MIKE            <00> -         B <ACTIVE>
        MIKE            <20> -         B <ACTIVE>
        @HOME           <00> - <GROUP> B <ACTIVE>
        @HOME           <1e> - <GROUP> B <ACTIVE>
        @HOME           <1d> -         B <ACTIVE>
        ..__MSBROWSE__. <01> - <GROUP> B <ACTIVE>
 
[root at rh9cpq bin]# nmblookup -A 192.168.0.70
Looking up status of 192.168.0.70
        RH9CPQ          <00> -         B <ACTIVE>
        RH9CPQ          <03> -         B <ACTIVE>
        RH9CPQ          <20> -         B <ACTIVE>
        ..__MSBROWSE__. <01> - <GROUP> B <ACTIVE>
        WORKGROUP       <00> - <GROUP> B <ACTIVE>
        WORKGROUP       <1d> -         B <ACTIVE>
        WORKGROUP       <1e> - <GROUP> B <ACTIVE>
 
[root at rh9cpq bin]# smbclient -L x -I 192.168.0.70 -N
 
        Sharename      Type      Comment
        ---------      ----      -------
        tmp            Disk      Temporary file space
        public         Disk      Public Stuff
        IPC$           IPC       IPC Service (LINUXBOX)
        ADMIN$         IPC       IPC Service (LINUXBOX)
 
        Server               Comment
        ---------            -------
        RH9CPQ               LINUXBOX
        TOSHLAPTOP           Laptop
 
        Workgroup            Master
        ---------            -------
        @HOME                MITA-HP  <<== this is a odd thing***
        WORKGROUP            RH9CPQ

[root at rh9cpq bin]# nmblookup MITA-HP
querying MITA-HP on 192.168.0.255
192.168.0.4 MITA-HP<00>

[root at rh9cpq bin]# nmblookup -A 192.168.0.4
Looking up status of 192.168.0.4
        MITA-HP         <00> -         M <ACTIVE>
        MITA-HP         <20> -         M <ACTIVE>
        @HOME           <00> - <GROUP> M <ACTIVE>
        @HOME           <1e> - <GROUP> M <ACTIVE>
 
Debug output follows:
------------------------------------------------------
Attempting to register new charset UCS-2LE
Registered charset UCS-2LE
Attempting to register new charset UTF8
Registered charset UTF8
Attempting to register new charset ASCII
Registered charset ASCII
Attempting to register new charset UCS2-HEX
Registered charset UCS2-HEX
added interface ip=192.168.0.70 bcast=192.168.0.255 nmask=255.255.255.0
lp_load: refreshing parameters
Initialising global parameters
params.c:pm_process() - Processing configuration file
"/root/.smb/smb.conf"
Processing section "[global]"
doing parameter workgroup = WORKGROUP
doing parameter server string = LINUXBOX
doing parameter security = share
doing parameter log file = /var/log/samba-log.%m
pm_process() returned Yes
lp_servicenumber: couldn't find homes
set_server_role: role = ROLE_STANDALONE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Substituting charset 'UTF-8' for LOCALE
Using netbios name RH9CPQ.
Using workgroup WORKGROUP.
parsed path: fname='smb://:@@HOME/' server='@HOME' share='' path=''
internal_resolve_name: looking up @HOME#1d
Opening cache file at /usr/local/samba/var/locks/gencache.tdb
Returning valid cache entry: key = NBT/@HOME#1D, value = 192.168.0.3:0,
timeout = Thu Aug 21 23:04:58 2003

name @HOME#1D found.
name_status_find: looking up *#00 at 192.168.0.3
Returning valid cache entry: key = NBT/*#00.00.192.168.0.3, value =
MIKE, timeout = Thu Aug 21 23:04:58 2003

namecache_status_fetch: key NBT/*#00.00.192.168.0.3 -> MIKE
smbc_server: server_n=[MIKE] server=[MIKE]
 -> server_n=[MIKE] server=[MIKE]
internal_resolve_name: looking up MIKE#20
Returning valid cache entry: key = NBT/MIKE#20, value = 192.168.0.3:0,
timeout = Thu Aug 21 23:05:00 2003

name MIKE#20 found.
Connecting to 192.168.0.3 at port 445
socket option SO_KEEPALIVE = 0
socket option SO_REUSEADDR = 0
socket option SO_BROADCAST = 0
socket option TCP_NODELAY = 1
socket option IPTOS_LOWDELAY = 0
socket option IPTOS_THROUGHPUT = 0
socket option SO_SNDBUF = 16384
socket option SO_RCVBUF = 87380
socket option SO_SNDLOWAT = 1
socket option SO_RCVLOWAT = 1
socket option SO_SNDTIMEO = 0
socket option SO_RCVTIMEO = 0
 session request ok
write_socket(4,183)
write_socket(4,183) wrote 183
got smb length of 85
size=85
smb_com=0x72
smb_rcls=0
smb_reh=0
smb_err=0
smb_flg=136
smb_flg2=51201
smb_tid=0
smb_pid=5673
smb_uid=0
smb_mid=1
smt_wct=17
smb_vwv[ 0]=    8 (0x8)
smb_vwv[ 1]= 2563 (0xA03)
smb_vwv[ 2]=  256 (0x100)
smb_vwv[ 3]= 1024 (0x400)
smb_vwv[ 4]=   17 (0x11)
smb_vwv[ 5]=    0 (0x0)
smb_vwv[ 6]=  256 (0x100)
smb_vwv[ 7]=    0 (0x0)
smb_vwv[ 8]=    0 (0x0)
smb_vwv[ 9]=64768 (0xFD00)
smb_vwv[10]=  227 (0xE3)
smb_vwv[11]=49280 (0xC080)
smb_vwv[12]=55230 (0xD7BE)
smb_vwv[13]=22760 (0x58E8)
smb_vwv[14]=50024 (0xC368)
smb_vwv[15]=61441 (0xF001)
smb_vwv[16]=    0 (0x0)
smb_bcc=16
[000] C5 1C 6F F5 11 CE 57 48  8A DF 2E BB E5 0F B4 F0  ..o...WH
........
size=85
smb_com=0x72
smb_rcls=0
smb_reh=0
smb_err=0
smb_flg=136
smb_flg2=51201
smb_tid=0
smb_pid=5673
smb_uid=0
smb_mid=1
smt_wct=17
smb_vwv[ 0]=    8 (0x8)
smb_vwv[ 1]= 2563 (0xA03)
smb_vwv[ 2]=  256 (0x100)
smb_vwv[ 3]= 1024 (0x400)
smb_vwv[ 4]=   17 (0x11)
smb_vwv[ 5]=    0 (0x0)
smb_vwv[ 6]=  256 (0x100)
smb_vwv[ 7]=    0 (0x0)
smb_vwv[ 8]=    0 (0x0)
smb_vwv[ 9]=64768 (0xFD00)
smb_vwv[10]=  227 (0xE3)
smb_vwv[11]=49280 (0xC080)
smb_vwv[12]=55230 (0xD7BE)
smb_vwv[13]=22760 (0x58E8)
smb_vwv[14]=50024 (0xC368)
smb_vwv[15]=61441 (0xF001)
smb_vwv[16]=    0 (0x0)
smb_bcc=16
[000] C5 1C 6F F5 11 CE 57 48  8A DF 2E BB E5 0F B4 F0  ..o...WH
........
Serverzone is 14400
Doing spnego session setup (blob length=16)
server didn't supply a full spnego negprot
write_socket(4,166)
write_socket(4,166) wrote 166
got smb length of 262
size=262
smb_com=0x73
smb_rcls=22
smb_reh=0
smb_err=49152
smb_flg=136
smb_flg2=51201
smb_tid=0
smb_pid=5673
smb_uid=2048
smb_mid=2
smt_wct=4
smb_vwv[ 0]=  255 (0xFF)
smb_vwv[ 1]=  262 (0x106)
smb_vwv[ 2]=    0 (0x0)
smb_vwv[ 3]=  145 (0x91)
smb_bcc=219
[000] A1 81 8E 30 81 8B A0 03  0A 01 01 A1 0C 06 0A 2B  ...0....
.......+
[010] 06 01 04 01 82 37 02 02  0A A2 76 04 74 4E 54 4C  .....7..
..v.tNTL
[020] 4D 53 53 50 00 02 00 00  00 08 00 08 00 30 00 00  MSSP....
.....0..
[030] 00 05 02 8A 20 A8 AE F8  39 89 43 AD 1E 00 00 00  .... ...
9.C.....
[040] 00 00 00 00 00 3C 00 3C  00 38 00 00 00 4D 00 49  .....<.<
.8...M.I
[050] 00 4B 00 45 00 02 00 08  00 4D 00 49 00 4B 00 45  .K.E....
.M.I.K.E
[060] 00 01 00 08 00 4D 00 49  00 4B 00 45 00 04 00 08  .....M.I
.K.E....
[070] 00 6D 00 69 00 6B 00 65  00 03 00 08 00 6D 00 69  .m.i.k.e
.....m.i
[080] 00 6B 00 65 00 06 00 04  00 01 00 00 00 00 00 00  .k.e....
........
[090] 00 57 00 69 00 6E 00 64  00 6F 00 77 00 73 00 20  .W.i.n.d .o.w.s.

[0A0] 00 35 00 2E 00 31 00 00  00 57 00 69 00 6E 00 64  .5...1..
.W.i.n.d
[0B0] 00 6F 00 77 00 73 00 20  00 32 00 30 00 30 00 30  .o.w.s.
.2.0.0.0
[0C0] 00 20 00 4C 00 41 00 4E  00 20 00 4D 00 61 00 6E  . .L.A.N .
.M.a.n
[0D0] 00 61 00 67 00 65 00 72  00 00 00                 .a.g.e.r ...
size=262
smb_com=0x73
smb_rcls=22
smb_reh=0
smb_err=49152
smb_flg=136
smb_flg2=51201
smb_tid=0
smb_pid=5673
smb_uid=2048
smb_mid=2
smt_wct=4
smb_vwv[ 0]=  255 (0xFF)
smb_vwv[ 1]=  262 (0x106)
smb_vwv[ 2]=    0 (0x0)
smb_vwv[ 3]=  145 (0x91)
smb_bcc=219
[000] A1 81 8E 30 81 8B A0 03  0A 01 01 A1 0C 06 0A 2B  ...0....
.......+
[010] 06 01 04 01 82 37 02 02  0A A2 76 04 74 4E 54 4C  .....7..
..v.tNTL
[020] 4D 53 53 50 00 02 00 00  00 08 00 08 00 30 00 00  MSSP....
.....0..
[030] 00 05 02 8A 20 A8 AE F8  39 89 43 AD 1E 00 00 00  .... ...
9.C.....
[040] 00 00 00 00 00 3C 00 3C  00 38 00 00 00 4D 00 49  .....<.<
.8...M.I
[050] 00 4B 00 45 00 02 00 08  00 4D 00 49 00 4B 00 45  .K.E....
.M.I.K.E
[060] 00 01 00 08 00 4D 00 49  00 4B 00 45 00 04 00 08  .....M.I
.K.E....
[070] 00 6D 00 69 00 6B 00 65  00 03 00 08 00 6D 00 69  .m.i.k.e
.....m.i
[080] 00 6B 00 65 00 06 00 04  00 01 00 00 00 00 00 00  .k.e....
........
[090] 00 57 00 69 00 6E 00 64  00 6F 00 77 00 73 00 20  .W.i.n.d .o.w.s.

[0A0] 00 35 00 2E 00 31 00 00  00 57 00 69 00 6E 00 64  .5...1..
.W.i.n.d
[0B0] 00 6F 00 77 00 73 00 20  00 32 00 30 00 30 00 30  .o.w.s.
.2.0.0.0
[0C0] 00 20 00 4C 00 41 00 4E  00 20 00 4D 00 61 00 6E  . .L.A.N .
.M.a.n
[0D0] 00 61 00 67 00 65 00 72  00 00 00                 .a.g.e.r ...
Got challenge flags:
Got NTLMSSP neg_flags=0x208a0205
  NTLMSSP_NEGOTIATE_UNICODE
  NTLMSSP_REQUEST_TARGET
  NTLMSSP_NEGOTIATE_NTLM
  NTLMSSP_NEGOTIATE_NTLM2
  NTLMSSP_CHAL_TARGET_INFO
  NTLMSSP_NEGOTIATE_128
NTLMSSP: Set final flags:
Got NTLMSSP neg_flags=0x20080205
  NTLMSSP_NEGOTIATE_UNICODE
  NTLMSSP_REQUEST_TARGET
  NTLMSSP_NEGOTIATE_NTLM
  NTLMSSP_NEGOTIATE_NTLM2
  NTLMSSP_NEGOTIATE_128
write_socket(4,328)
write_socket(4,328) wrote 328
got smb length of 126
size=126
smb_com=0x73
smb_rcls=0
smb_reh=0
smb_err=0
smb_flg=136
smb_flg2=51201
smb_tid=0
smb_pid=5673
smb_uid=2048
smb_mid=3
smt_wct=4
smb_vwv[ 0]=  255 (0xFF)
smb_vwv[ 1]=  126 (0x7E)
smb_vwv[ 2]=    1 (0x1)
smb_vwv[ 3]=    9 (0x9)
smb_bcc=83
[000] A1 07 30 05 A0 03 0A 01  00 57 00 69 00 6E 00 64  ..0.....
.W.i.n.d
[010] 00 6F 00 77 00 73 00 20  00 35 00 2E 00 31 00 00  .o.w.s.
.5...1..
[020] 00 57 00 69 00 6E 00 64  00 6F 00 77 00 73 00 20  .W.i.n.d .o.w.s.

[030] 00 32 00 30 00 30 00 30  00 20 00 4C 00 41 00 4E  .2.0.0.0 .
.L.A.N
[040] 00 20 00 4D 00 61 00 6E  00 61 00 67 00 65 00 72  . .M.a.n
.a.g.e.r
[050] 00 00 00                                          ... 
size=126
smb_com=0x73
smb_rcls=0
smb_reh=0
smb_err=0
smb_flg=136
smb_flg2=51201
smb_tid=0
smb_pid=5673
smb_uid=2048
smb_mid=3
smt_wct=4
smb_vwv[ 0]=  255 (0xFF)
smb_vwv[ 1]=  126 (0x7E)
smb_vwv[ 2]=    1 (0x1)
smb_vwv[ 3]=    9 (0x9)
smb_bcc=83
[000] A1 07 30 05 A0 03 0A 01  00 57 00 69 00 6E 00 64  ..0.....
.W.i.n.d
[010] 00 6F 00 77 00 73 00 20  00 35 00 2E 00 31 00 00  .o.w.s.
.5...1..
[020] 00 57 00 69 00 6E 00 64  00 6F 00 77 00 73 00 20  .W.i.n.d .o.w.s.

[030] 00 32 00 30 00 30 00 30  00 20 00 4C 00 41 00 4E  .2.0.0.0 .
.L.A.N
[040] 00 20 00 4D 00 61 00 6E  00 61 00 67 00 65 00 72  . .M.a.n
.a.g.e.r
[050] 00 00 00                                          ... 
 session setup ok
write_socket(4,78)
write_socket(4,78) wrote 78
got smb length of 48
size=48
smb_com=0x75
smb_rcls=0
smb_reh=0
smb_err=0
smb_flg=136
smb_flg2=51201
smb_tid=2048
smb_pid=5673
smb_uid=2048
smb_mid=4
smt_wct=3
smb_vwv[ 0]=  255 (0xFF)
smb_vwv[ 1]=   48 (0x30)
smb_vwv[ 2]=    1 (0x1)
smb_bcc=7
[000] 49 50 43 00 00 00 00                              IPC.... 
 tconx ok
Server connect ok: //MIKE/IPC$: 0x8199820
size=122
smb_com=0x25
smb_rcls=0
smb_reh=0
smb_err=0
smb_flg=8
smb_flg2=51201
smb_tid=2048
smb_pid=5673
smb_uid=2048
smb_mid=5
smt_wct=14
smb_vwv[ 0]=   32 (0x20)
smb_vwv[ 1]=    0 (0x0)
smb_vwv[ 2]=    8 (0x8)
smb_vwv[ 3]=65535 (0xFFFF)
smb_vwv[ 4]=    0 (0x0)
smb_vwv[ 5]=    0 (0x0)
smb_vwv[ 6]=    0 (0x0)
smb_vwv[ 7]=    0 (0x0)
smb_vwv[ 8]=    0 (0x0)
smb_vwv[ 9]=   32 (0x20)
smb_vwv[10]=   90 (0x5A)
smb_vwv[11]=    0 (0x0)
smb_vwv[12]=  122 (0x7A)
smb_vwv[13]=    0 (0x0)
smb_bcc=59
[000] 00 5C 00 50 00 49 00 50  00 45 00 5C 00 4C 00 41  .\.P.I.P
.E.\.L.A
[010] 00 4E 00 4D 00 41 00 4E  00 00 00 68 00 57 72 4C  .N.M.A.N
...h.WrL
[020] 65 68 44 7A 00 42 31 36  42 42 44 7A 00 01 00 FF  ehDz.B16
BBDz....
[030] FF FE FF 00 00 40 48 4F  4D 45 00                 ..... at HO ME.
write_socket(4,126)
write_socket(4,126) wrote 126
got smb length of 64
size=64
smb_com=0x25
smb_rcls=0
smb_reh=0
smb_err=0
smb_flg=136
smb_flg2=51201
smb_tid=2048
smb_pid=5673
smb_uid=2048
smb_mid=5
smt_wct=10
smb_vwv[ 0]=    8 (0x8)
smb_vwv[ 1]=    0 (0x0)
smb_vwv[ 2]=    0 (0x0)
smb_vwv[ 3]=    8 (0x8)
smb_vwv[ 4]=   56 (0x38)
smb_vwv[ 5]=    0 (0x0)
smb_vwv[ 6]=    0 (0x0)
smb_vwv[ 7]=   64 (0x40)
smb_vwv[ 8]=    0 (0x0)
smb_vwv[ 9]=    0 (0x0)
smb_bcc=9
[000] 00 02 00 00 00 00 00 00  00                       ........ .
size=64
smb_com=0x25
smb_rcls=0
smb_reh=0
smb_err=0
smb_flg=136
smb_flg2=51201
smb_tid=2048
smb_pid=5673
smb_uid=2048
smb_mid=5
smt_wct=10
smb_vwv[ 0]=    8 (0x8)
smb_vwv[ 1]=    0 (0x0)
smb_vwv[ 2]=    0 (0x0)
smb_vwv[ 3]=    8 (0x8)
smb_vwv[ 4]=   56 (0x38)
smb_vwv[ 5]=    0 (0x0)
smb_vwv[ 6]=    0 (0x0)
smb_vwv[ 7]=   64 (0x40)
smb_vwv[ 8]=    0 (0x0)
smb_vwv[ 9]=    0 (0x0)
smb_bcc=9
[000] 00 02 00 00 00 00 00 00  00                       ........ .
cli_errno_from_nt: 32 bit codes: code=00000000
SMB Directory tree 0.0






More information about the samba-technical mailing list