GNOME Bugzilla – Bug 168864
smb:// does not list domains in some networks
Last modified: 2005-03-03 17:05:44 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:
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.
Created attachment 38089 [details] Debug output of smb-method when problem occures
Created attachment 38121 [details] [review] Patch which should (?) fix the problem. I hope this patch fixes your problem. LMK either way.
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.
Created attachment 38163 [details] [review] New Patch Patch which addresses the 'workgroup overwritten in the domain parameter' problem you described.
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.
Created attachment 38165 [details] [review] Now works with Anonymous Shares as well
Created attachment 38169 [details] [review] And again with password protected shares working properly.
Created attachment 38170 [details] [review] Take #3544
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.
Nielsen, The last patch works fine for me in our office network. Thanks.
Wonderful. Closing.