Merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-02 into lp:ubuntu-filemanager-app

Proposed by Carlos Jose Mazieri
Status: Merged
Approved by: Arto Jalkanen
Approved revision: 476
Merged at revision: 485
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-02
Merge into: lp:ubuntu-filemanager-app
Prerequisite: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-01
Diff against target: 136 lines (+50/-20)
5 files modified
src/plugin/folderlistmodel/location.cpp (+1/-1)
src/plugin/folderlistmodel/locationsfactory.cpp (+31/-18)
src/plugin/folderlistmodel/net/netauthenticationdata.cpp (+12/-0)
src/plugin/folderlistmodel/net/netauthenticationdata.h (+2/-0)
src/plugin/folderlistmodel/smb/smblocation.cpp (+4/-1)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-02
Reviewer Review Type Date Requested Status
Arto Jalkanen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+273334@code.launchpad.net

Commit message

    After using a such user/password for authentication in a remote location it is necessary to reset that values for other items, without this items which do not require authentication may fail to get data.

    That means if a remote location does not need authentication the user/password is reset to initial value.

Description of the change

    After using a such user/password for authentication in a remote location it is necessary to reset that values for other items, without this items which do not require authentication may fail to get data.

    That means if a remote location does not need authentication the user/password is reset to initial value.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/plugin/folderlistmodel/location.cpp'
--- src/plugin/folderlistmodel/location.cpp 2015-07-11 21:21:16 +0000
+++ src/plugin/folderlistmodel/location.cpp 2015-10-04 15:45:50 +0000
@@ -173,7 +173,7 @@
173 */173 */
174QString Location::currentAuthenticationUser()174QString Location::currentAuthenticationUser()
175{175{
176 return QString(::qgetenv("USER"));176 return NetAuthenticationData::currentUser();
177}177}
178178
179/*!179/*!
180180
=== modified file 'src/plugin/folderlistmodel/locationsfactory.cpp'
--- src/plugin/folderlistmodel/locationsfactory.cpp 2015-07-13 20:41:48 +0000
+++ src/plugin/folderlistmodel/locationsfactory.cpp 2015-10-04 15:45:50 +0000
@@ -194,31 +194,44 @@
194194
195195
196DirItemInfo * LocationsFactory::validateCurrentUrl(Location *location, const NetAuthenticationData &authData)196DirItemInfo * LocationsFactory::validateCurrentUrl(Location *location, const NetAuthenticationData &authData)
197{197{
198 //when there is authentication data, set the authentication before validating an item198 //when there is authentication data, set the authentication before validating an item
199 if (!authData.isEmpty())199 if (location->isRemote())
200 {200 {
201 location->setAuthentication(authData.user, authData.password);201 if (!authData.isEmpty())
202 {
203 location->setAuthentication(authData.user, authData.password);
204 }
205 else
206 {
207 //reset the password even it was set before, it is necessary to browse other items
208 location->setAuthentication(NetAuthenticationData::currentUser(),
209 NetAuthenticationData::noPassword());
210 }
202 }211 }
203212
204 DirItemInfo *item = location->validateUrlPath(m_tmpPath);213 DirItemInfo *item = location->validateUrlPath(m_tmpPath);
205214
206 //for remote loacations, authentication might have failed215 //for remote loacations, authentication might have failed
207 //if so try to use a stored authentication data and autenticate again216 //if so try to use a stored authentication data and authenticate it again
208 if ( item && item->needsAuthentication()217 if (location->isRemote() && item != 0)
209 && location->useAuthenticationDataIfExists(*item))218 {
210 {219 if ( item->needsAuthentication()
211 delete item;220 && location->useAuthenticationDataIfExists(*item))
212 item = location->validateUrlPath(m_tmpPath);221 {
213 }222 delete item;
214 //if failed it is necessary to ask the user to provide user/password223 item = location->validateUrlPath(m_tmpPath);
215 if ( item && item->needsAuthentication() )224 }
216 {225 //if failed it is necessary to ask the user to provide user/password
217 location->notifyItemNeedsAuthentication(item);226 if ( item != 0 && item->needsAuthentication() )
218 delete item;227 {
219 item = 0;228 location->notifyItemNeedsAuthentication(item);
220 }229 delete item;
221 if (item && !item->isContentReadable())230 item = 0;
231 }
232 }
233 //now just see if the item is readable
234 if (item != 0 && !item->isContentReadable())
222 {235 {
223 delete item;236 delete item;
224 item = 0;237 item = 0;
225238
=== modified file 'src/plugin/folderlistmodel/net/netauthenticationdata.cpp'
--- src/plugin/folderlistmodel/net/netauthenticationdata.cpp 2015-10-04 15:45:50 +0000
+++ src/plugin/folderlistmodel/net/netauthenticationdata.cpp 2015-10-04 15:45:50 +0000
@@ -33,6 +33,18 @@
33void * NetAuthenticationDataList::m_parent = 0;33void * NetAuthenticationDataList::m_parent = 0;
3434
3535
36const QString& NetAuthenticationData::currentUser()
37{
38 static QString curUser(::qgetenv("USER"));
39 return curUser;
40}
41
42const QString& NetAuthenticationData::noPassword()
43{
44 static QString emptyPassword;
45 return emptyPassword;
46}
47
36NetAuthenticationDataList::NetAuthenticationDataList(): m_savedAuths(0)48NetAuthenticationDataList::NetAuthenticationDataList(): m_savedAuths(0)
37{ 49{
38 //settings file does not need to open all the time50 //settings file does not need to open all the time
3951
=== modified file 'src/plugin/folderlistmodel/net/netauthenticationdata.h'
--- src/plugin/folderlistmodel/net/netauthenticationdata.h 2015-03-01 15:32:42 +0000
+++ src/plugin/folderlistmodel/net/netauthenticationdata.h 2015-10-04 15:45:50 +0000
@@ -42,6 +42,8 @@
42 inline bool isEmpty() const { return user.isEmpty(); }42 inline bool isEmpty() const { return user.isEmpty(); }
43 QString user;43 QString user;
44 QString password; 44 QString password;
45 static const QString& currentUser();
46 static const QString& noPassword();
45};47};
4648
4749
4850
=== modified file 'src/plugin/folderlistmodel/smb/smblocation.cpp'
--- src/plugin/folderlistmodel/smb/smblocation.cpp 2015-09-07 18:40:47 +0000
+++ src/plugin/folderlistmodel/smb/smblocation.cpp 2015-10-04 15:45:50 +0000
@@ -29,6 +29,8 @@
29#include "locationurl.h"29#include "locationurl.h"
30#include "smblocationitemfile.h"30#include "smblocationitemfile.h"
31#include "smblocationitemdir.h"31#include "smblocationitemdir.h"
32#include "netauthenticationdata.h"
33
3234
3335
34#if defined(Q_OS_UNIX)36#if defined(Q_OS_UNIX)
@@ -40,7 +42,8 @@
40 , SmbLocationAuthentication()42 , SmbLocationAuthentication()
41{43{
42 m_smb = new SmbUtil(suitableAuthenticationFunction());44 m_smb = new SmbUtil(suitableAuthenticationFunction());
43 setAuthentication(::qgetenv("USER"), QString());45 setAuthentication(NetAuthenticationData::currentUser(),
46 NetAuthenticationData::noPassword());
44}47}
4548
4649

Subscribers

People subscribed via source and target branches