Skip to content

Commit

Permalink
strip added smb:// shares of their user/pass when adding, and instead…
Browse files Browse the repository at this point in the history
… store that info in the password manager
  • Loading branch information
Jonathan Marshall committed Jul 7, 2012
1 parent 870c888 commit 16d4661
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion xbmc/dialogs/GUIDialogMediaSource.cpp
Expand Up @@ -33,6 +33,7 @@
#include "settings/Settings.h"
#include "settings/GUISettings.h"
#include "guilib/LocalizeStrings.h"
#include "PasswordManager.h"

using namespace std;
using namespace XFILE;
Expand Down Expand Up @@ -467,7 +468,20 @@ vector<CStdString> CGUIDialogMediaSource::GetPaths()
{
vector<CStdString> paths;
for (int i = 0; i < m_paths->Size(); i++)
{
if (!m_paths->Get(i)->GetPath().IsEmpty())
paths.push_back(m_paths->Get(i)->GetPath());
{ // strip off the user and password for smb paths (anything that the password manager can auth)
// and add the user/pass to the password manager - note, we haven't confirmed that it works
// at this point, but if it doesn't, the user will get prompted anyway in SMBDirectory.
CURL url(m_paths->Get(i)->GetPath());
if (url.GetProtocol() == "smb")
{
CPasswordManager::GetInstance().SaveAuthenticatedURL(url);
url.SetPassword("");
url.SetUserName("");
}
paths.push_back(url.Get());
}
}
return paths;
}

0 comments on commit 16d4661

Please sign in to comment.