[smb] default to guest user instead of getenv("USER")
authorJoakim Plate <elupus@xbmc.org>
Sat, 5 May 2012 13:48:35 +0000 (15:48 +0200)
committerJoakim Plate <elupus@xbmc.org>
Sat, 5 May 2012 13:49:33 +0000 (15:49 +0200)
The system logged in user could possibly be right,
however it will try to connect to remote server
with a blank password which is very likely to fail.
Thus we default to access remote server as guest
if no user has been passed in url.

xbmc/filesystem/SmbFile.cpp

index 874e0ec..242d482 100644 (file)
@@ -167,6 +167,7 @@ void CSMB::Init()
     smbc_setOptionOneSharePerServer(m_context, false);
     smbc_setOptionBrowseMaxLmbCount(m_context, 0);
     smbc_setTimeout(m_context, g_advancedSettings.m_sambaclienttimeout * 1000);
+    smbc_setUser(m_context, strdup("guest"));
 #else
     m_context->debug = g_advancedSettings.m_logLevel == LOG_LEVEL_DEBUG_SAMBA ? 10 : 0;
     m_context->callbacks.auth_fn = xb_smbc_auth;
@@ -175,6 +176,7 @@ void CSMB::Init()
     m_context->options.one_share_per_server = false;
     m_context->options.browse_max_lmb_count = 0;
     m_context->timeout = g_advancedSettings.m_sambaclienttimeout * 1000;
+    m_context->user = strdup("guest");
 #endif
 
     // initialize samba and do some hacking into the settings