Merge lp:~gerboland/unity-mir/clean-up-authorisation into lp:unity-mir

Proposed by Gerry Boland
Status: Merged
Approved by: Michał Sawicz
Approved revision: 36
Merged at revision: 38
Proposed branch: lp:~gerboland/unity-mir/clean-up-authorisation
Merge into: lp:unity-mir
Diff against target: 93 lines (+14/-17)
4 files modified
src/modules/Unity/ApplicationManager/application_manager.cpp (+6/-5)
src/modules/Unity/ApplicationManager/application_manager.h (+2/-2)
src/unity-mir/sessionauthorizer.cpp (+4/-8)
src/unity-mir/sessionauthorizer.h (+2/-2)
To merge this branch: bzr merge lp:~gerboland/unity-mir/clean-up-authorisation
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid Pending
Review via email: mp+180189@code.launchpad.net

Commit message

Clean up session authorization code, emit message on denial

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

29 + LOG("ApplicationManager::authorizedSessionName REJECTED connection from app with pid %lld", pid);

Should be authorizedSession.

=====

73 + Q_EMIT requestAuthorizationForSession(pid, authorized); // needs to block until authorizedName returned

Doesn't return authorizedName anymore, does it?

review: Needs Fixing
35. By Gerry Boland

Update comments to reflect method name change

36. By Gerry Boland

Update comment to reflect parameter name and type change

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/ApplicationManager/application_manager.cpp'
2--- src/modules/Unity/ApplicationManager/application_manager.cpp 2013-08-09 13:16:13 +0000
3+++ src/modules/Unity/ApplicationManager/application_manager.cpp 2013-08-15 15:15:37 +0000
4@@ -72,7 +72,7 @@
5 = std::dynamic_pointer_cast<SessionAuthorizer>(m_mirServer->the_session_authorizer());
6
7 QObject::connect(sessionAuthorizer.get(), &SessionAuthorizer::requestAuthorizationForSession,
8- this, &ApplicationManager::authorizedSessionName, Qt::BlockingQueuedConnection);
9+ this, &ApplicationManager::authorizedSession, Qt::BlockingQueuedConnection);
10
11 // we use random numbers, so seed the generator
12 qsrand(QTime::currentTime().msec());
13@@ -235,16 +235,17 @@
14
15 /************************************* Mir-side methods *************************************/
16
17-void ApplicationManager::authorizedSessionName(const quint64 pid, QString& authorizedName)
18+void ApplicationManager::authorizedSession(const quint64 pid, bool &authorized)
19 {
20- DLOG("ApplicationManager::authorizedSessionName (this=%p, pid=%lld)", this, pid);
21+ DLOG("ApplicationManager::authorizedSession (this=%p, pid=%lld)", this, pid);
22 Application* application = m_mainStageApplications->getApplicationWithPid(pid);
23 if (application) {
24 QString name = application->appId() + QString::number(qrand());
25 application->setSessionName(name);
26- authorizedName = name;
27+ authorized = true;
28 } else {
29- authorizedName = QString(); // i.e. do not authorize //TODO(greyback) dislike
30+ LOG("ApplicationManager::authorizedSession REJECTED connection from app with pid %lld", pid);
31+ authorized = false;
32 }
33 }
34
35
36=== modified file 'src/modules/Unity/ApplicationManager/application_manager.h'
37--- src/modules/Unity/ApplicationManager/application_manager.h 2013-08-09 13:16:13 +0000
38+++ src/modules/Unity/ApplicationManager/application_manager.h 2013-08-15 15:15:37 +0000
39@@ -85,14 +85,14 @@
40 Q_INVOKABLE Application* startProcess(QString desktopFile, ExecFlags flags = NoFlag, QStringList arguments = QStringList());
41 Q_INVOKABLE void stopProcess(Application* application);
42
43- void authorizedSessionName(const quint64 pid, QString &authorizedName);
44-
45 Q_SIGNALS:
46 void mainStageApplicationsChanged();
47 void mainStageFocusedApplicationChanged();
48 void focusRequested(FavoriteApplication favoriteApplication);
49
50 public Q_SLOTS:
51+ void authorizedSession(const quint64 pid, bool &authorized);
52+
53 void sessionStarting(std::shared_ptr<mir::shell::ApplicationSession> const& session);
54 void sessionStopping(std::shared_ptr<mir::shell::ApplicationSession> const& session);
55 void sessionFocused(std::shared_ptr<mir::shell::ApplicationSession> const& session);
56
57=== modified file 'src/unity-mir/sessionauthorizer.cpp'
58--- src/unity-mir/sessionauthorizer.cpp 2013-08-09 13:16:13 +0000
59+++ src/unity-mir/sessionauthorizer.cpp 2013-08-15 15:15:37 +0000
60@@ -30,14 +30,10 @@
61 bool SessionAuthorizer::connection_is_allowed(pid_t pid)
62 {
63 DLOG("SessionAuthorizer::connection_is_allowed (this=%p, pid=%d", this, pid);
64-
65- QString authorizedName;
66- Q_EMIT requestAuthorizationForSession(pid, authorizedName); // needs to block until authorizedName returned
67-
68- if (!authorizedName.isNull()) {
69- return true;
70- }
71- return false;
72+ bool authorized = true;
73+
74+ Q_EMIT requestAuthorizationForSession(pid, authorized); // needs to block until authorized value returned
75+ return authorized;
76 }
77
78 bool SessionAuthorizer::configure_display_is_allowed(pid_t pid)
79
80=== modified file 'src/unity-mir/sessionauthorizer.h'
81--- src/unity-mir/sessionauthorizer.h 2013-08-09 13:16:13 +0000
82+++ src/unity-mir/sessionauthorizer.h 2013-08-15 15:15:37 +0000
83@@ -39,8 +39,8 @@
84 virtual bool configure_display_is_allowed(pid_t pid) override;
85
86 Q_SIGNALS:
87- // needs to be blocked queued signal which returns value for authorizedName
88- void requestAuthorizationForSession(const quint64& pid, QString& authorizedName);
89+ // needs to be blocked queued signal which returns value for authorized
90+ void requestAuthorizationForSession(const quint64 &pid, bool &authorized);
91 };
92
93 #endif // SESSIONAUTHORIZER_H

Subscribers

People subscribed via source and target branches