After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 168864 - smb:// does not list domains in some networks
smb:// does not list domains in some networks
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: Module: smb
cvs (head)
Other All
: Normal normal
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
Depends on:
Blocks:
 
 
Reported: 2005-03-01 11:05 UTC by Narayana Pattipati
Modified: 2005-03-03 17:05 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Debug output of smb-method when problem occures (958 bytes, text/plain)
2005-03-01 11:12 UTC, Narayana Pattipati
  Details
Patch which should (?) fix the problem. (2.30 KB, patch)
2005-03-01 20:43 UTC, Stef Walter
none Details | Review
New Patch (2.35 KB, patch)
2005-03-02 17:02 UTC, Stef Walter
none Details | Review
Now works with Anonymous Shares as well (2.17 KB, patch)
2005-03-02 19:14 UTC, Stef Walter
none Details | Review
And again with password protected shares working properly. (3.67 KB, patch)
2005-03-02 20:57 UTC, Stef Walter
none Details | Review
Take #3544 (3.78 KB, patch)
2005-03-02 21:42 UTC, Stef Walter
none Details | Review
Patch cleaned up and ready for commit (2.36 KB, patch)
2005-03-02 21:56 UTC, Stef Walter
none Details | Review

Description Narayana Pattipati 2005-03-01 11:05:01 UTC
Please describe the problem:
smb:// method is not listing any domains/workgroups in our office
network (there are as many as 30 domains in our office network). 

Couple of weeks back, I worked in a customer location and there smb:// lists
all their domains. Also another customer reports the same issue in his network. 

The problem was not there in our office network before the recent smb-method
rewrite. I will attach the debug output.


Steps to reproduce:
1. 
2. 
3. 


Actual results:
smb:// method does not list any domains.

Expected results:
Should list all domains/workgroups in a network.

Does this happen every time?
Yes

Other information:
Comment 1 Narayana Pattipati 2005-03-01 11:10:25 UTC
After debugging, I think the problem lies in, where the code is trying
to authenticate for the top level (enumerating work group), which should
not be done.

smb-method.c:update_workgroup_cache() function:

while (perform_authentication (&actx) > 0) {
   dir = smb_context->opendir (smb_context, "smb://");
   actx.res = (dir != NULL) ? GNOME_VFS_OK : gnome_vfs_result_from_errno
();
}

Why should this be done for top level ?

Nielsen: If I remove perform_authentication() for top level, then the
problem seen is resolved. Is that change fine ? If so, I can make the
patch and submit a patch to bugzilla.
Comment 2 Narayana Pattipati 2005-03-01 11:12:19 UTC
Created attachment 38089 [details]
Debug output of smb-method when problem occures
Comment 3 Stef Walter 2005-03-01 20:43:17 UTC
Created attachment 38121 [details] [review]
Patch which should (?) fix the problem.

I hope this patch fixes your problem. LMK either way.
Comment 4 Narayana Pattipati 2005-03-02 06:31:48 UTC
Nielsen, Thanks for the help.

The above patch does not fix the issue. Here is the debug output from smb-method
with the new changes:

------------------------------------------
<-- smb module init called -->
LOCK
UNLOCK
do_get_file_info() smb:///
do_open_directory() smb:///
update_workgroup_cache: enumerating workgroups
LOCK
[auth] Initializing Authentication
[auth] perform_authentication called.
[auth] First authentication pass
[auth] auth_callback called: server: 10.114.10.139 share: IPC$
[auth] Initial authentication lookups
[auth] No credentials, returning null values
---------------------------------------

The problem is, as we don't get any credentials, we simply return null strings
for username, password and domain. I will cut-paste the actual gdb debug output
for the auth_callback function, which might help in understanding the problem
better.

--------------------------------------------
Breakpoint 2, auth_callback (server_name=0x41eec730 "10.114.10.139",
    share_name=0x41c33d66 "IPC$", domain_out=0x41eebf30 "WIPRO",
    domainmaxlen=256, username_out=0x41eec530 "npatti", unmaxlen=256,
    password_out=0x41eec430 "", pwmaxlen=256) at smb-method.c:1194
1194            DEBUG_SMB (("[auth] auth_callback called: server: %s share: %s\n",
(gdb) n
1197        if (!current_auth_context)
(gdb) n
1200            actx = current_auth_context;
(gdb) n
1203            if (!server_name || !server_name[0])
(gdb) n
1206            actx->auth_called = TRUE;
(gdb) n
1209            g_free (actx->for_server);
(gdb) n
1210            actx->for_server = string_dup_nzero (server_name);
(gdb) n
1211            g_free (actx->for_share);
(gdb)
1212            actx->for_share = string_dup_nzero (share_name);
(gdb)
1215            if (actx->passes == 1)
(gdb) n
1216                    initial_authentication (actx);
(gdb) n
1219            if (actx->use_user) {
(gdb) n
1226            } else if (actx->passes == 1 && g_ascii_strcasecmp (share_name,
"IPC$") != 0) {
(gdb) n
1234                    strncpy (username_out, "", unmaxlen);
(gdb) n
1235                    strncpy (password_out, "", pwmaxlen);
(gdb) n
1237                    DEBUG_SMB(("[auth] No credentials, returning null
values\n"));
(gdb) n
1239    }
(gdb) n

The auth_callback is called with WIPRO domain and master browser 
(10.114.10.139) values got by smbclient while looking for master browser. These
values are enough for listing the domains/workgroups. But as we go down the
function, the code overwrites those values and fills null strings. Thats causing
the problem.
Comment 5 Stef Walter 2005-03-02 17:02:28 UTC
Created attachment 38163 [details] [review]
New Patch

Patch which addresses the 'workgroup overwritten in the domain parameter'
problem you described.
Comment 6 Stef Walter 2005-03-02 17:15:14 UTC
Just as a side note, in some other cases, the domain_out parameter isn't filled
in (for whatever fun reason) and we have to fill it in. The patch above should
address that. 
Comment 7 Stef Walter 2005-03-02 19:14:14 UTC
Created attachment 38165 [details] [review]
Now works with Anonymous Shares as well
Comment 8 Stef Walter 2005-03-02 20:57:36 UTC
Created attachment 38169 [details] [review]
And again with password protected shares working properly.
Comment 9 Stef Walter 2005-03-02 21:42:15 UTC
Created attachment 38170 [details] [review]
Take #3544
Comment 10 Stef Walter 2005-03-02 21:56:10 UTC
Created attachment 38171 [details] [review]
Patch cleaned up and ready for commit

We're going to need permission to break the freeze if we want to get this in.
Comment 11 Narayana Pattipati 2005-03-03 09:50:58 UTC
Nielsen,

The last patch works fine for me in our office network. Thanks.
Comment 12 Stef Walter 2005-03-03 17:05:44 UTC
Wonderful. Closing.