Navigation Menu

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;
}

2 comments on commit 16d4661

@pieh
Copy link
Contributor

@pieh pieh commented on 16d4661 Jul 25, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something is wrong here, when I breakpoint here, url is already stripped off username/password I entered before and this will cause to save SaveAuthenticatedURL without them and so it will ask for username/password again even if "remeber for this path" is selected in credential dialog. Not sure what's purpose of this commit - maybe we should if (url.GetProtocol() == "smb" && !url.GetUserName().IsEmpty()) ?

@jmarshallnz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - you're right. Should probably have some checks in SaveAuthenticatedURL() as well so we don't save it if it's actually not authenticated.

Please sign in to comment.