Permalink
Browse files

strip added smb:// shares of their user/pass when adding, and instead…

… store that info in the password manager
  • Loading branch information...
1 parent 870c888 commit 16d4661bee65691e52f2a39a9b7ad2834082941a Jonathan Marshall committed Jun 26, 2012
Showing with 15 additions and 1 deletion.
  1. +15 −1 xbmc/dialogs/GUIDialogMediaSource.cpp
@@ -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;
@@ -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

Member

pieh replied Jul 25, 2012

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()) ?

Member

jmarshallnz replied Jul 25, 2012

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.