Merge lp:~online-accounts/signon/packaging into lp:signon
- packaging
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | David Barth |
Approved revision: | 636 |
Merged at revision: | 632 |
Proposed branch: | lp:~online-accounts/signon/packaging |
Merge into: | lp:signon |
Diff against target: |
5206 lines (+1716/-958) 180 files modified
.gitlab-ci.yml (+51/-0) .qmake.conf (+2/-0) README.md (+7/-0) common-project-config.pri (+8/-18) common-vars.pri (+1/-1) debian/changelog (+24/-0) debian/control (+0/-25) debian/libsignon-qt-dev.install (+0/-4) debian/libsignon-qt1.install (+0/-1) debian/rules (+6/-26) doc/doc.pri (+0/-1) lib/SignOn/SignOnQt5ConfigVersion.cmake.in (+5/-5) lib/SignOn/SignOnQtConfig.cmake.in (+0/-7) lib/SignOn/SignOnQtConfigVersion.cmake.in (+0/-10) lib/SignOn/async-dbus-proxy.cpp (+1/-1) lib/SignOn/async-dbus-proxy.h (+1/-2) lib/SignOn/authservice.cpp (+1/-1) lib/SignOn/authservice.h (+1/-1) lib/SignOn/authserviceimpl.cpp (+1/-1) lib/SignOn/authserviceimpl.h (+1/-2) lib/SignOn/authsession.cpp (+1/-1) lib/SignOn/authsession.h (+1/-2) lib/SignOn/authsessionimpl.cpp (+1/-1) lib/SignOn/authsessionimpl.h (+1/-2) lib/SignOn/connection-manager.cpp (+1/-7) lib/SignOn/connection-manager.h (+1/-1) lib/SignOn/dbusinterface.cpp (+1/-1) lib/SignOn/dbusinterface.h (+1/-0) lib/SignOn/debug.cpp (+1/-1) lib/SignOn/debug.h (+1/-1) lib/SignOn/identity.cpp (+1/-1) lib/SignOn/identity.h (+1/-1) lib/SignOn/identityimpl.cpp (+1/-1) lib/SignOn/identityimpl.h (+1/-2) lib/SignOn/identityinfo.cpp (+1/-1) lib/SignOn/identityinfo.h (+1/-1) lib/SignOn/identityinfoimpl.cpp (+1/-1) lib/SignOn/identityinfoimpl.h (+1/-1) lib/SignOn/libsignon-qt.pri (+1/-5) lib/SignOn/libsignoncommon.h (+1/-1) lib/SignOn/sessiondata.h (+1/-0) lib/SignOn/signon.h (+1/-0) lib/SignOn/signonerror.h (+1/-1) lib/plugins/SignOn/authpluginif.h (+1/-0) lib/plugins/SignOn/signonplugincommon.h (+1/-0) lib/plugins/SignOn/uisessiondata.h (+1/-0) lib/plugins/SignOn/uisessiondata_priv.h (+10/-0) lib/plugins/signon-plugins-common/SignOn/blobiohandler.cpp (+4/-4) lib/plugins/signon-plugins-common/SignOn/blobiohandler.h (+3/-1) lib/plugins/signon-plugins-common/SignOn/ipc.h (+1/-0) lib/plugins/signon-plugins-common/signon-plugins-common.pc.in (+1/-1) lib/plugins/signon-plugins.pc.in (+1/-1) lib/signond/SignOn/SignOnExtension.pc.in (+1/-1) lib/signond/SignOn/abstract-access-control-manager.cpp (+1/-1) lib/signond/SignOn/abstract-access-control-manager.h (+1/-1) lib/signond/SignOn/abstract-crypto-manager.cpp (+1/-1) lib/signond/SignOn/abstract-crypto-manager.h (+1/-1) lib/signond/SignOn/abstract-key-authorizer.cpp (+1/-0) lib/signond/SignOn/abstract-key-authorizer.h (+1/-0) lib/signond/SignOn/abstract-key-manager.cpp (+1/-0) lib/signond/SignOn/abstract-key-manager.h (+1/-0) lib/signond/SignOn/abstract-secrets-storage.cpp (+1/-0) lib/signond/SignOn/abstract-secrets-storage.h (+1/-0) lib/signond/SignOn/debug.cpp (+1/-0) lib/signond/SignOn/debug.h (+1/-0) lib/signond/SignOn/export.h (+1/-0) lib/signond/SignOn/extension-interface.cpp (+1/-1) lib/signond/SignOn/extension-interface.h (+1/-1) lib/signond/SignOn/key-handler.cpp (+1/-0) lib/signond/SignOn/key-handler.h (+1/-0) lib/signond/SignOn/misc.cpp (+1/-0) lib/signond/SignOn/misc.h (+1/-0) lib/signond/signoncommon.h (+2/-2) signon.pro (+0/-3) src/extensions/cryptsetup/cryptsetup-plugin.cpp (+0/-4) src/extensions/cryptsetup/cryptsetup-plugin.h (+0/-2) src/plugins/example/exampledata.h (+1/-0) src/plugins/example/exampleplugin.cpp (+1/-0) src/plugins/example/exampleplugin.h (+1/-0) src/plugins/password/passwordplugin.cpp (+1/-0) src/plugins/password/passwordplugin.h (+1/-0) src/plugins/test/ssotest2data.h (+1/-0) src/plugins/test/ssotest2plugin.cpp (+1/-0) src/plugins/test/ssotest2plugin.h (+1/-0) src/plugins/test/ssotestplugin.cpp (+26/-34) src/plugins/test/ssotestplugin.h (+6/-2) src/remotepluginprocess/debug.cpp (+1/-0) src/remotepluginprocess/debug.h (+1/-0) src/remotepluginprocess/main.cpp (+7/-5) src/remotepluginprocess/my-network-proxy-factory.h (+1/-1) src/remotepluginprocess/remotepluginprocess.cpp (+18/-146) src/remotepluginprocess/remotepluginprocess.h (+1/-25) src/remotepluginprocess/remotepluginprocess.pro (+1/-1) src/signond/accesscontrolmanagerhelper.cpp (+1/-2) src/signond/accesscontrolmanagerhelper.h (+1/-2) src/signond/backup.cpp (+343/-0) src/signond/backup.h (+63/-0) src/signond/credentialsaccessmanager.cpp (+1/-1) src/signond/credentialsaccessmanager.h (+1/-1) src/signond/credentialsdb.cpp (+1/-2) src/signond/credentialsdb.h (+1/-2) src/signond/credentialsdb_p.h (+1/-1) src/signond/default-crypto-manager.cpp (+1/-1) src/signond/default-crypto-manager.h (+1/-1) src/signond/default-key-authorizer.cpp (+1/-0) src/signond/default-key-authorizer.h (+1/-0) src/signond/default-secrets-storage.cpp (+1/-1) src/signond/default-secrets-storage.h (+1/-1) src/signond/main.cpp (+1/-0) src/signond/pluginproxy.cpp (+1/-0) src/signond/pluginproxy.h (+1/-0) src/signond/signonauthsession.cpp (+10/-16) src/signond/signonauthsession.h (+2/-2) src/signond/signonauthsessionadaptor.cpp (+1/-1) src/signond/signonauthsessionadaptor.h (+1/-1) src/signond/signond-common.h (+1/-0) src/signond/signond.pro (+10/-8) src/signond/signondaemon.cpp (+11/-328) src/signond/signondaemon.h (+1/-15) src/signond/signondaemonadaptor.cpp (+1/-2) src/signond/signondaemonadaptor.h (+1/-2) src/signond/signondisposable.cpp (+1/-0) src/signond/signondisposable.h (+1/-0) src/signond/signonidentity.cpp (+1/-2) src/signond/signonidentity.h (+1/-2) src/signond/signonidentityadaptor.cpp (+1/-2) src/signond/signonidentityadaptor.h (+1/-2) src/signond/signonidentityinfo.cpp (+1/-1) src/signond/signonidentityinfo.h (+1/-1) src/signond/signonsessioncore.cpp (+15/-21) src/signond/signonsessioncore.h (+1/-1) src/signond/signonsessioncoretools.cpp (+1/-1) src/signond/signonsessioncoretools.h (+1/-1) src/signond/signontrace.h (+7/-4) src/signond/signonui_interface.cpp (+1/-1) src/signond/signonui_interface.h (+1/-1) tests/extensions/tst_access_control_manager.cpp (+1/-1) tests/libsignon-qt-tests/libsignon-qt-tests.pro (+1/-5) tests/libsignon-qt-tests/signon-ui.cpp (+1/-1) tests/libsignon-qt-tests/signon-ui.h (+1/-1) tests/libsignon-qt-tests/ssotestclient.cpp (+1/-0) tests/libsignon-qt-tests/ssotestclient.h (+1/-0) tests/libsignon-qt-tests/testauthserviceresult.cpp (+1/-0) tests/libsignon-qt-tests/testauthserviceresult.h (+1/-0) tests/libsignon-qt-tests/testauthsession.cpp (+1/-106) tests/libsignon-qt-tests/testauthsession.h (+1/-3) tests/libsignon-qt-tests/testidentityresult.cpp (+1/-0) tests/libsignon-qt-tests/testidentityresult.h (+1/-0) tests/libsignon-qt-tests/testsinglesignon.cpp (+1/-0) tests/libsignon-qt-tests/testsinglesignon.h (+1/-0) tests/libsignon-qt-tests/testthread.cpp (+1/-1) tests/libsignon-qt-tests/testthread.h (+1/-1) tests/passwordplugintest/passwordplugintest.cpp (+1/-1) tests/passwordplugintest/passwordplugintest.h (+1/-0) tests/run-with-signond.sh (+1/-1) tests/signond-tests/.gitignore (+1/-0) tests/signond-tests/backuptest.cpp (+1/-0) tests/signond-tests/backuptest.h (+1/-0) tests/signond-tests/databasetest.cpp (+1/-0) tests/signond-tests/databasetest.h (+1/-0) tests/signond-tests/fake_signonui.h (+53/-0) tests/signond-tests/identity-tool.cpp (+1/-1) tests/signond-tests/identity-tool.pro (+1/-5) tests/signond-tests/include.cpp (+1/-0) tests/signond-tests/mock-ac-plugin/identity-ac-helper.pro (+1/-5) tests/signond-tests/mock-ac-plugin/plugin.cpp (+1/-5) tests/signond-tests/mock-ac-plugin/plugin.h (+1/-3) tests/signond-tests/session_tool.cpp (+125/-0) tests/signond-tests/session_tool.pro (+13/-0) tests/signond-tests/signond-tests.pri (+3/-6) tests/signond-tests/signond-tests.pro (+7/-0) tests/signond-tests/signonui.py (+55/-0) tests/signond-tests/testpluginproxy.cpp (+1/-0) tests/signond-tests/testpluginproxy.h (+1/-0) tests/signond-tests/timeouts.cpp (+1/-1) tests/signond-tests/timeouts.h (+1/-1) tests/signond-tests/tst_access_control.cpp (+1/-1) tests/signond-tests/tst_access_control_manager_helper.cpp (+1/-1) tests/signond-tests/tst_signond.cpp (+648/-0) tests/signond-tests/tst_signond.pro (+32/-0) |
To merge this branch: | bzr merge lp:~online-accounts/signon/packaging |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jenkins for Webapps Team - CI Bot | continuous-integration | Pending | |
PS Jenkins bot | continuous-integration | Pending | |
Online Accounts | Pending | ||
Review via email: mp+296685@code.launchpad.net |
Commit message
Description of the change
New upstream release:
- Remove Qt4 support
- Lib: add more defines for SignOnUi password dialog
- signond: inform SignOnUI when a session finishes
- signond: add configure option to enable backup
- signond: minor code simplifications and cleanups
- plugins: don't use custom proxy implementation on Qt 5.5 and later
- RemotePluginPro
- Build: use qmake's DBUS_ADAPTORS to build the backup adaptor
- Build: support implicit out-of-tree builds
- Build: enable CI in gitlab
- Tests: add tst_signond using QtDBusMock
- Doc: don't build signond documentation
- Escape quotation marks in ConfigVersion.
Merge from upstream
- Tests: fix AuthSession's "invocation of process() from another process"
test (bug 1608822)
- 636. By Alberto Mardegan
-
Remove symbols files
Getting random symbols added/removed in different distros :-(
- 637. By Alberto Mardegan
-
Merge from upstream
- Tests: fix AuthSession's "invocation of process() from another process"
test (LP: #1608822) - 638. By Alberto Mardegan
-
Increase tests timeout
Preview Diff
1 | === added file '.gitlab-ci.yml' |
2 | --- .gitlab-ci.yml 1970-01-01 00:00:00 +0000 |
3 | +++ .gitlab-ci.yml 2016-08-24 14:26:52 +0000 |
4 | @@ -0,0 +1,51 @@ |
5 | +image: ubuntu:xenial |
6 | + |
7 | +cache: |
8 | + key: apt-cache |
9 | + paths: |
10 | + - apt-cache/ |
11 | + |
12 | +before_script: |
13 | + - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR |
14 | + - apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y qt5-qmake qtbase5-dev qtchooser pkg-config libqt5sql5-sqlite doxygen libdbus-1-dev |
15 | + - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y dbus-test-runner libqtdbusmock1-dev libqtdbustest1-dev |
16 | + - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y lcov gcovr |
17 | + |
18 | +build_amd64: |
19 | + stage: build |
20 | + script: |
21 | + - export QT_SELECT=qt5 |
22 | + - mkdir build |
23 | + - cd build |
24 | + - qmake CONFIG+=debug CONFIG+=coverage CONFIG+=enable-backup CONFIG+=enable-p2p .. |
25 | + - make -j 4 |
26 | + artifacts: |
27 | + paths: |
28 | + - build/ |
29 | + |
30 | +test_amd64: |
31 | + stage: test |
32 | + script: |
33 | + - find build | xargs touch # Avoid rebuilding |
34 | + - cd build |
35 | + - make coverage-html |
36 | + dependencies: |
37 | + - build_amd64 |
38 | + artifacts: |
39 | + paths: |
40 | + - ./ |
41 | + |
42 | +pages: |
43 | + stage: deploy |
44 | + script: |
45 | + - cd build |
46 | + - make install INSTALL_ROOT=$(pwd)/out |
47 | + - cd .. |
48 | + - mkdir public |
49 | + - cp -a build/coverage-html public/coverage |
50 | + - cp -a build/out/usr/share/doc/libsignon-qt/html/* public |
51 | + dependencies: |
52 | + - test_amd64 |
53 | + artifacts: |
54 | + paths: |
55 | + - public |
56 | |
57 | === added file '.qmake.conf' |
58 | --- .qmake.conf 1970-01-01 00:00:00 +0000 |
59 | +++ .qmake.conf 2016-08-24 14:26:52 +0000 |
60 | @@ -0,0 +1,2 @@ |
61 | +TOP_SRC_DIR = $$PWD |
62 | +TOP_BUILD_DIR = $$shadowed($$PWD) |
63 | |
64 | === modified file 'README.md' |
65 | --- README.md 2015-09-11 15:01:25 +0000 |
66 | +++ README.md 2016-08-24 14:26:52 +0000 |
67 | @@ -21,3 +21,10 @@ |
68 | make |
69 | make install |
70 | ``` |
71 | + |
72 | +Resources |
73 | +--------- |
74 | + |
75 | +[libsignon-qt API reference documentation](http://accounts-sso.gitlab.io/signond/index.html) |
76 | + |
77 | +[Official source code repository](https://gitlab.com/accounts-sso/signond) |
78 | |
79 | === modified file 'common-project-config.pri' |
80 | --- common-project-config.pri 2015-10-27 09:58:39 +0000 |
81 | +++ common-project-config.pri 2016-08-24 14:26:52 +0000 |
82 | @@ -15,32 +15,22 @@ |
83 | QMAKE_CXXFLAGS -= -Werror -Wno-write-strings |
84 | # Disable RTTI |
85 | QMAKE_CXXFLAGS += -fno-exceptions -fno-rtti |
86 | +# Use C++11 |
87 | +QMAKE_CXXFLAGS += -std=c++11 |
88 | |
89 | -greaterThan(QT_MAJOR_VERSION, 4) { |
90 | - # Qt5: use C++11. This is used to avoid the source incompatibility |
91 | - # with the QSKIP macro, as described in: |
92 | - # http://www.kdab.com/porting-from-qt-4-to-qt-5/ |
93 | - QMAKE_CXXFLAGS += -std=c++11 |
94 | +isEmpty(TOP_SRC_DIR) { |
95 | + TOP_SRC_DIR = $$PWD |
96 | + TOP_BUILD_DIR = $${TOP_SRC_DIR}/$${BUILD_DIR} |
97 | } |
98 | |
99 | -TOP_SRC_DIR = $$PWD |
100 | -TOP_BUILD_DIR = $${TOP_SRC_DIR}/$${BUILD_DIR} |
101 | - |
102 | #DEFINES += QT_NO_DEBUG_OUTPUT |
103 | DEFINES += DEBUG_ENABLED |
104 | #TODO comment this to restrict plugins to run under signon user |
105 | DEFINES += NO_SIGNON_USER |
106 | |
107 | -# Qt4/Qt5 common checks |
108 | -greaterThan(QT_MAJOR_VERSION, 4) { |
109 | - LIBSIGNON = libsignon-qt5 |
110 | - CMAKE_BASENAME = SignOnQt5 |
111 | - LIBQTCORE = Qt5Core |
112 | -} else { |
113 | - LIBSIGNON = libsignon-qt |
114 | - CMAKE_BASENAME = SignOnQt |
115 | - LIBQTCORE = QtCore |
116 | -} |
117 | +# Library name for CMake and pkg-config |
118 | +LIBSIGNON = libsignon-qt5 |
119 | +CMAKE_BASENAME = SignOnQt5 |
120 | |
121 | #----------------------------------------------------------------------------- |
122 | # setup the installation prefix |
123 | |
124 | === modified file 'common-vars.pri' |
125 | --- common-vars.pri 2015-09-28 14:43:07 +0000 |
126 | +++ common-vars.pri 2016-08-24 14:26:52 +0000 |
127 | @@ -14,7 +14,7 @@ |
128 | # Project version |
129 | # remember to update debian/* files if you changes this |
130 | #----------------------------------------------------------------------------- |
131 | -PROJECT_VERSION = 8.58 |
132 | +PROJECT_VERSION = 8.59 |
133 | |
134 | #----------------------------------------------------------------------------- |
135 | # Library version |
136 | |
137 | === modified file 'debian/changelog' |
138 | --- debian/changelog 2015-11-06 09:56:25 +0000 |
139 | +++ debian/changelog 2016-08-24 14:26:52 +0000 |
140 | @@ -1,3 +1,27 @@ |
141 | +signon (8.59-0ubuntu2) UNRELEASED; urgency=medium |
142 | + |
143 | + * debian/control, debian/libsignon-qt{1,-dev}.install, debian/rules: |
144 | + Don't build Qt4 packages. |
145 | + * New upstream release |
146 | + - Remove Qt4 support |
147 | + - Lib: add more defines for SignOnUi password dialog |
148 | + - signond: inform SignOnUI when a session finishes |
149 | + - signond: add configure option to enable backup |
150 | + - signond: minor code simplifications and cleanups |
151 | + - plugins: don't use custom proxy implementation on Qt 5.5 and later |
152 | + - RemotePluginProcess: don't use a thread for cancel |
153 | + - Build: use qmake's DBUS_ADAPTORS to build the backup adaptor |
154 | + - Build: support implicit out-of-tree builds |
155 | + - Build: enable CI in gitlab |
156 | + - Tests: add tst_signond using QtDBusMock |
157 | + - Doc: don't build signond documentation |
158 | + - Escape quotation marks in ConfigVersion.cmake.in files |
159 | + * Merge from upstream |
160 | + - Tests: fix AuthSession's "invocation of process() from another process" |
161 | + test (LP: #1608822) |
162 | + |
163 | + -- Alberto Mardegan <alberto.mardegan@canonical.com> Wed, 24 Aug 2016 16:40:59 +0300 |
164 | + |
165 | signon (8.58+16.04.20151106-0ubuntu1) xenial; urgency=medium |
166 | |
167 | [ Alberto Mardegan ] |
168 | |
169 | === modified file 'debian/control' |
170 | --- debian/control 2015-10-01 09:29:07 +0000 |
171 | +++ debian/control 2016-08-24 14:26:52 +0000 |
172 | @@ -9,13 +9,9 @@ |
173 | graphviz, |
174 | libdbus-1-dev, |
175 | libproxy-dev, |
176 | - libqt4-dev (>= 4.6), |
177 | - libqt4-sql-sqlite, |
178 | libqt5sql5-sqlite, |
179 | libssl-dev, |
180 | pkg-config, |
181 | - qt4-dev-tools, |
182 | - qt4-qmake, |
183 | qt5-qmake, |
184 | qtbase5-dev, |
185 | qtchooser, |
186 | @@ -26,27 +22,6 @@ |
187 | # upstream branch |
188 | Vcs-Bzr: lp:signon |
189 | |
190 | -Package: libsignon-qt1 |
191 | -Architecture: any |
192 | -Section: libs |
193 | -Priority: optional |
194 | -Depends: ${misc:Depends}, |
195 | - ${shlibs:Depends}, |
196 | -Multi-Arch: same |
197 | -Description: Single Sign On framework |
198 | - Framework to provide credential storage and authentication service. |
199 | - |
200 | -Package: libsignon-qt-dev |
201 | -Architecture: any |
202 | -Priority: optional |
203 | -Section: libdevel |
204 | -Depends: libqt4-dev (>= 4.5), |
205 | - libsignon-qt1 (= ${binary:Version}), |
206 | - ${misc:Depends}, |
207 | - ${shlibs:Depends}, |
208 | -Description: Development files for libsignon-qt |
209 | - Headers and static libraries for the libsignon-qt library. |
210 | - |
211 | Package: libsignon-qt5-1 |
212 | Architecture: any |
213 | Section: libs |
214 | |
215 | === removed file 'debian/libsignon-qt-dev.install' |
216 | --- debian/libsignon-qt-dev.install 2015-10-01 09:29:07 +0000 |
217 | +++ debian/libsignon-qt-dev.install 1970-01-01 00:00:00 +0000 |
218 | @@ -1,4 +0,0 @@ |
219 | -usr/include/signon-qt/SignOn/* |
220 | -usr/lib/*/cmake/SignOnQt4/ |
221 | -usr/lib/*/libsignon-qt.so |
222 | -usr/lib/*/pkgconfig/libsignon-qt.pc |
223 | |
224 | === removed file 'debian/libsignon-qt1.install' |
225 | --- debian/libsignon-qt1.install 2014-08-25 10:49:45 +0000 |
226 | +++ debian/libsignon-qt1.install 1970-01-01 00:00:00 +0000 |
227 | @@ -1,1 +0,0 @@ |
228 | -usr/lib/*/libsignon-qt.so.* |
229 | |
230 | === modified file 'debian/rules' |
231 | --- debian/rules 2015-01-28 15:29:02 +0000 |
232 | +++ debian/rules 2016-08-24 14:26:52 +0000 |
233 | @@ -9,34 +9,14 @@ |
234 | export NO_DOCS := no |
235 | export QMAKE_LIBDIR=/usr/lib |
236 | export DPKG_GENSYMBOLS_CHECK_LEVEL=4 |
237 | +export QT_SELECT=qt5 |
238 | |
239 | override_dh_auto_configure: |
240 | - mkdir -p build/qt4 build/qt5 |
241 | - QT_SELECT=qt4 \ |
242 | - dh_auto_configure -Bbuild/qt4 -- LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \ |
243 | - BUILD_DIR=build/qt4 \ |
244 | - "QMAKE_CXXFLAGS=$(CFLAGS)" ../../signon.pro |
245 | - QT_SELECT=qt5 \ |
246 | - dh_auto_configure -Bbuild/qt5 -- LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \ |
247 | - BUILD_DIR=build/qt5 \ |
248 | + mkdir -p build |
249 | + dh_auto_configure -Bbuild -- LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \ |
250 | + BUILD_DIR=build \ |
251 | CONFIG+=enable-p2p \ |
252 | - "QMAKE_CXXFLAGS=$(CFLAGS)" ../../signon.pro |
253 | - |
254 | -override_dh_auto_build: |
255 | - QT_SELECT=qt4 dh_auto_build -Bbuild/qt4 |
256 | - QT_SELECT=qt5 dh_auto_build -Bbuild/qt5 |
257 | - |
258 | -override_dh_auto_clean: |
259 | - dh_auto_clean -Bbuild/qt4 |
260 | - dh_auto_clean -Bbuild/qt5 |
261 | - |
262 | -override_dh_auto_install: |
263 | - dh_auto_install -Bbuild/qt4 -plibsignon-qt1 |
264 | - dh_auto_install -Bbuild/qt4 -plibsignon-qt-dev |
265 | - mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/SignOnQt debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/SignOnQt4 |
266 | - mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/SignOnQt4/SignOnQtConfig.cmake debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/SignOnQt4/SignOnQt4Config.cmake |
267 | - mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/SignOnQt4/SignOnQtConfigVersion.cmake debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/SignOnQt4/SignOnQt4ConfigVersion.cmake |
268 | - dh_auto_install -Bbuild/qt5 |
269 | + "QMAKE_CXXFLAGS=$(CFLAGS)" ../signon.pro |
270 | |
271 | override_dh_install: |
272 | rm -f debian/tmp/usr/include/signon-plugins/*example*.h |
273 | @@ -46,4 +26,4 @@ |
274 | dh_install --fail-missing |
275 | |
276 | %: |
277 | - dh $@ -Bbuild/qt5 --parallel --with migrations |
278 | + dh $@ -Bbuild --parallel --with migrations |
279 | |
280 | === modified file 'doc/doc.pri' |
281 | --- doc/doc.pri 2013-02-28 09:56:31 +0000 |
282 | +++ doc/doc.pri 2016-08-24 14:26:52 +0000 |
283 | @@ -18,7 +18,6 @@ |
284 | # extra build targets for generating and cleaning documentation |
285 | #----------------------------------------------------------------------------- |
286 | DOC_INPUT += $${_PRO_FILE_PWD_}/doc/src |
287 | -DOC_INPUT += $${_PRO_FILE_PWD_}/src |
288 | |
289 | # target for generating documentation |
290 | doctarget.target = docs |
291 | |
292 | === modified file 'lib/SignOn/SignOnQt5ConfigVersion.cmake.in' |
293 | --- lib/SignOn/SignOnQt5ConfigVersion.cmake.in 2014-03-14 10:51:51 +0000 |
294 | +++ lib/SignOn/SignOnQt5ConfigVersion.cmake.in 2016-08-24 14:26:52 +0000 |
295 | @@ -1,10 +1,10 @@ |
296 | set(PACKAGE_VERSION $${PROJECT_VERSION}) |
297 | |
298 | -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) |
299 | +if(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) |
300 | set(PACKAGE_VERSION_COMPATIBLE FALSE) |
301 | -else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) |
302 | +else(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) |
303 | set(PACKAGE_VERSION_COMPATIBLE TRUE) |
304 | - if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") |
305 | + if( \"${PACKAGE_FIND_VERSION}\" STREQUAL \"${PACKAGE_VERSION}\") |
306 | set(PACKAGE_VERSION_EXACT TRUE) |
307 | - endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") |
308 | -endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) |
309 | \ No newline at end of file |
310 | + endif( \"${PACKAGE_FIND_VERSION}\" STREQUAL \"${PACKAGE_VERSION}\") |
311 | +endif(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) |
312 | |
313 | === removed file 'lib/SignOn/SignOnQtConfig.cmake.in' |
314 | --- lib/SignOn/SignOnQtConfig.cmake.in 2014-02-13 14:18:31 +0000 |
315 | +++ lib/SignOn/SignOnQtConfig.cmake.in 1970-01-01 00:00:00 +0000 |
316 | @@ -1,7 +0,0 @@ |
317 | -# SIGNONQT_INCLUDE_DIRS - The libsignon-qt include directories |
318 | -# SIGNONQT_LIBRARIES - The libraries needed to use libsignon-qt |
319 | -# SIGNONQT_LIBRARIES_STATIC - The static version of libsignon-qt |
320 | - |
321 | -set(SIGNONQT_LIBRARIES $${INSTALL_LIBDIR}/lib$${TARGET}.so) |
322 | -set(SIGNONQT_LIBRARIES_STATIC $${INSTALL_LIBDIR}/lib$${TARGET}.a) |
323 | -set(SIGNONQT_INCLUDE_DIRS $${INSTALL_PREFIX}/include/$${TARGET}) |
324 | \ No newline at end of file |
325 | |
326 | === removed file 'lib/SignOn/SignOnQtConfigVersion.cmake.in' |
327 | --- lib/SignOn/SignOnQtConfigVersion.cmake.in 2014-02-13 14:18:31 +0000 |
328 | +++ lib/SignOn/SignOnQtConfigVersion.cmake.in 1970-01-01 00:00:00 +0000 |
329 | @@ -1,10 +0,0 @@ |
330 | -set(PACKAGE_VERSION $${PROJECT_VERSION}) |
331 | - |
332 | -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) |
333 | - set(PACKAGE_VERSION_COMPATIBLE FALSE) |
334 | -else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) |
335 | - set(PACKAGE_VERSION_COMPATIBLE TRUE) |
336 | - if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") |
337 | - set(PACKAGE_VERSION_EXACT TRUE) |
338 | - endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") |
339 | -endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) |
340 | \ No newline at end of file |
341 | |
342 | === modified file 'lib/SignOn/async-dbus-proxy.cpp' |
343 | --- lib/SignOn/async-dbus-proxy.cpp 2015-10-27 09:58:39 +0000 |
344 | +++ lib/SignOn/async-dbus-proxy.cpp 2016-08-24 14:26:52 +0000 |
345 | @@ -2,7 +2,7 @@ |
346 | * This file is part of signon |
347 | * |
348 | * Copyright (C) 2009-2010 Nokia Corporation. |
349 | - * Copyright (C) 2013-2015 Canonical Ltd. |
350 | + * Copyright (C) 2013-2016 Canonical Ltd. |
351 | * |
352 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
353 | * |
354 | |
355 | === modified file 'lib/SignOn/async-dbus-proxy.h' |
356 | --- lib/SignOn/async-dbus-proxy.h 2013-07-29 13:52:21 +0000 |
357 | +++ lib/SignOn/async-dbus-proxy.h 2016-08-24 14:26:52 +0000 |
358 | @@ -2,9 +2,8 @@ |
359 | * This file is part of signon |
360 | * |
361 | * Copyright (C) 2009-2010 Nokia Corporation. |
362 | - * Copyright (C) 2013 Canonical Ltd. |
363 | + * Copyright (C) 2013-2016 Canonical Ltd. |
364 | * |
365 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
366 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
367 | * |
368 | * This library is free software; you can redistribute it and/or |
369 | |
370 | === modified file 'lib/SignOn/authservice.cpp' |
371 | --- lib/SignOn/authservice.cpp 2015-10-27 09:58:39 +0000 |
372 | +++ lib/SignOn/authservice.cpp 2016-08-24 14:26:52 +0000 |
373 | @@ -2,7 +2,7 @@ |
374 | * This file is part of signon |
375 | * |
376 | * Copyright (C) 2009-2010 Nokia Corporation. |
377 | - * Copyright (C) 2011-2015 Canonical Ltd. |
378 | + * Copyright (C) 2011-2016 Canonical Ltd. |
379 | * |
380 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
381 | * |
382 | |
383 | === modified file 'lib/SignOn/authservice.h' |
384 | --- lib/SignOn/authservice.h 2012-04-18 13:03:21 +0000 |
385 | +++ lib/SignOn/authservice.h 2016-08-24 14:26:52 +0000 |
386 | @@ -2,8 +2,8 @@ |
387 | * This file is part of signon |
388 | * |
389 | * Copyright (C) 2009-2010 Nokia Corporation. |
390 | + * Copyright (C) 2012-2016 Canonical Ltd. |
391 | * |
392 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
393 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
394 | * |
395 | * This library is free software; you can redistribute it and/or |
396 | |
397 | === modified file 'lib/SignOn/authserviceimpl.cpp' |
398 | --- lib/SignOn/authserviceimpl.cpp 2015-10-27 09:58:39 +0000 |
399 | +++ lib/SignOn/authserviceimpl.cpp 2016-08-24 14:26:52 +0000 |
400 | @@ -2,7 +2,7 @@ |
401 | * This file is part of signon |
402 | * |
403 | * Copyright (C) 2009-2010 Nokia Corporation. |
404 | - * Copyright (C) 2013-2015 Canonical Ltd. |
405 | + * Copyright (C) 2013-2016 Canonical Ltd. |
406 | * |
407 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
408 | * |
409 | |
410 | === modified file 'lib/SignOn/authserviceimpl.h' |
411 | --- lib/SignOn/authserviceimpl.h 2013-07-29 09:23:36 +0000 |
412 | +++ lib/SignOn/authserviceimpl.h 2016-08-24 14:26:52 +0000 |
413 | @@ -2,9 +2,8 @@ |
414 | * This file is part of signon |
415 | * |
416 | * Copyright (C) 2009-2010 Nokia Corporation. |
417 | - * Copyright (C) 2013 Canonical Ltd. |
418 | + * Copyright (C) 2013-2016 Canonical Ltd. |
419 | * |
420 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
421 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
422 | * |
423 | * This library is free software; you can redistribute it and/or |
424 | |
425 | === modified file 'lib/SignOn/authsession.cpp' |
426 | --- lib/SignOn/authsession.cpp 2015-10-27 09:58:39 +0000 |
427 | +++ lib/SignOn/authsession.cpp 2016-08-24 14:26:52 +0000 |
428 | @@ -2,7 +2,7 @@ |
429 | * This file is part of signon |
430 | * |
431 | * Copyright (C) 2009-2010 Nokia Corporation. |
432 | - * Copyright (C) 2011-2015 Canonical Ltd. |
433 | + * Copyright (C) 2011-2016 Canonical Ltd. |
434 | * |
435 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
436 | * |
437 | |
438 | === modified file 'lib/SignOn/authsession.h' |
439 | --- lib/SignOn/authsession.h 2015-06-12 11:11:06 +0000 |
440 | +++ lib/SignOn/authsession.h 2016-08-24 14:26:52 +0000 |
441 | @@ -2,9 +2,8 @@ |
442 | * This file is part of signon |
443 | * |
444 | * Copyright (C) 2009-2010 Nokia Corporation. |
445 | - * Copyright (C) 2011-2015 Canonical Ltd. |
446 | + * Copyright (C) 2011-2016 Canonical Ltd. |
447 | * |
448 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
449 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
450 | * |
451 | * This library is free software; you can redistribute it and/or |
452 | |
453 | === modified file 'lib/SignOn/authsessionimpl.cpp' |
454 | --- lib/SignOn/authsessionimpl.cpp 2015-10-27 09:58:39 +0000 |
455 | +++ lib/SignOn/authsessionimpl.cpp 2016-08-24 14:26:52 +0000 |
456 | @@ -2,7 +2,7 @@ |
457 | * This file is part of signon |
458 | * |
459 | * Copyright (C) 2009-2010 Nokia Corporation. |
460 | - * Copyright (C) 2013-2015 Canonical Ltd. |
461 | + * Copyright (C) 2013-2016 Canonical Ltd. |
462 | * |
463 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
464 | * |
465 | |
466 | === modified file 'lib/SignOn/authsessionimpl.h' |
467 | --- lib/SignOn/authsessionimpl.h 2013-07-29 11:42:18 +0000 |
468 | +++ lib/SignOn/authsessionimpl.h 2016-08-24 14:26:52 +0000 |
469 | @@ -2,9 +2,8 @@ |
470 | * This file is part of signon |
471 | * |
472 | * Copyright (C) 2009-2010 Nokia Corporation. |
473 | - * Copyright (C) 2013 Canonical Ltd. |
474 | + * Copyright (C) 2013-2016 Canonical Ltd. |
475 | * |
476 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
477 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
478 | * |
479 | * This library is free software; you can redistribute it and/or |
480 | |
481 | === modified file 'lib/SignOn/connection-manager.cpp' |
482 | --- lib/SignOn/connection-manager.cpp 2015-10-27 09:58:39 +0000 |
483 | +++ lib/SignOn/connection-manager.cpp 2016-08-24 14:26:52 +0000 |
484 | @@ -1,7 +1,7 @@ |
485 | /* |
486 | * This file is part of signon |
487 | * |
488 | - * Copyright (C) 2013 Canonical Ltd. |
489 | + * Copyright (C) 2013-2016 Canonical Ltd. |
490 | * |
491 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
492 | * |
493 | @@ -30,9 +30,7 @@ |
494 | #include <QDBusPendingCallWatcher> |
495 | #include <QPointer> |
496 | #include <QProcessEnvironment> |
497 | -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
498 | #include <QStandardPaths> |
499 | -#endif |
500 | |
501 | using namespace SignOn; |
502 | |
503 | @@ -86,12 +84,8 @@ |
504 | return SocketConnectionUnavailable; |
505 | } |
506 | |
507 | -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
508 | QString runtimeDir = |
509 | QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); |
510 | -#else |
511 | - QString runtimeDir = environment.value(QLatin1String("XDG_RUNTIME_DIR")); |
512 | -#endif |
513 | if (runtimeDir.isEmpty()) return SocketConnectionUnavailable; |
514 | |
515 | QString socketFileName = |
516 | |
517 | === modified file 'lib/SignOn/connection-manager.h' |
518 | --- lib/SignOn/connection-manager.h 2013-07-29 13:52:21 +0000 |
519 | +++ lib/SignOn/connection-manager.h 2016-08-24 14:26:52 +0000 |
520 | @@ -1,7 +1,7 @@ |
521 | /* |
522 | * This file is part of signon |
523 | * |
524 | - * Copyright (C) 2013 Canonical Ltd. |
525 | + * Copyright (C) 2013-2016 Canonical Ltd. |
526 | * |
527 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
528 | * |
529 | |
530 | === modified file 'lib/SignOn/dbusinterface.cpp' |
531 | --- lib/SignOn/dbusinterface.cpp 2015-10-27 09:58:39 +0000 |
532 | +++ lib/SignOn/dbusinterface.cpp 2016-08-24 14:26:52 +0000 |
533 | @@ -2,7 +2,7 @@ |
534 | * This file is part of signon |
535 | * |
536 | * Copyright (C) 2011 Nokia Corporation. |
537 | - * Copyright (C) 2011-2015 Canonical Ltd. |
538 | + * Copyright (C) 2011-2016 Canonical Ltd. |
539 | * |
540 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
541 | * |
542 | |
543 | === modified file 'lib/SignOn/dbusinterface.h' |
544 | --- lib/SignOn/dbusinterface.h 2012-04-18 13:06:27 +0000 |
545 | +++ lib/SignOn/dbusinterface.h 2016-08-24 14:26:52 +0000 |
546 | @@ -2,6 +2,7 @@ |
547 | * This file is part of signon |
548 | * |
549 | * Copyright (C) 2011 Nokia Corporation. |
550 | + * Copyright (C) 2012-2016 Canonical Ltd. |
551 | * |
552 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
553 | * |
554 | |
555 | === modified file 'lib/SignOn/debug.cpp' |
556 | --- lib/SignOn/debug.cpp 2015-10-27 09:58:39 +0000 |
557 | +++ lib/SignOn/debug.cpp 2016-08-24 14:26:52 +0000 |
558 | @@ -1,7 +1,7 @@ |
559 | /* |
560 | * This file is part of signon |
561 | * |
562 | - * Copyright (C) 2015 Canonical Ltd. |
563 | + * Copyright (C) 2015-2016 Canonical Ltd. |
564 | * |
565 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
566 | * |
567 | |
568 | === modified file 'lib/SignOn/debug.h' |
569 | --- lib/SignOn/debug.h 2015-10-27 09:58:39 +0000 |
570 | +++ lib/SignOn/debug.h 2016-08-24 14:26:52 +0000 |
571 | @@ -1,7 +1,7 @@ |
572 | /* |
573 | * This file is part of signon |
574 | * |
575 | - * Copyright (C) 2015 Canonical Ltd. |
576 | + * Copyright (C) 2015-2016 Canonical Ltd. |
577 | * |
578 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
579 | * |
580 | |
581 | === modified file 'lib/SignOn/identity.cpp' |
582 | --- lib/SignOn/identity.cpp 2015-10-27 09:58:39 +0000 |
583 | +++ lib/SignOn/identity.cpp 2016-08-24 14:26:52 +0000 |
584 | @@ -2,7 +2,7 @@ |
585 | * This file is part of signon |
586 | * |
587 | * Copyright (C) 2009-2010 Nokia Corporation. |
588 | - * Copyright (C) 2011-2015 Canonical Ltd. |
589 | + * Copyright (C) 2011-2016 Canonical Ltd. |
590 | * |
591 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
592 | * |
593 | |
594 | === modified file 'lib/SignOn/identity.h' |
595 | --- lib/SignOn/identity.h 2012-04-18 13:06:27 +0000 |
596 | +++ lib/SignOn/identity.h 2016-08-24 14:26:52 +0000 |
597 | @@ -2,8 +2,8 @@ |
598 | * This file is part of signon |
599 | * |
600 | * Copyright (C) 2009-2010 Nokia Corporation. |
601 | + * Copyright (C) 2012-2016 Canonical Ltd. |
602 | * |
603 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
604 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
605 | * |
606 | * This library is free software; you can redistribute it and/or |
607 | |
608 | === modified file 'lib/SignOn/identityimpl.cpp' |
609 | --- lib/SignOn/identityimpl.cpp 2015-10-27 09:58:39 +0000 |
610 | +++ lib/SignOn/identityimpl.cpp 2016-08-24 14:26:52 +0000 |
611 | @@ -2,7 +2,7 @@ |
612 | * This file is part of signon |
613 | * |
614 | * Copyright (C) 2009-2010 Nokia Corporation. |
615 | - * Copyright (C) 2013-2015 Canonical Ltd. |
616 | + * Copyright (C) 2013-2016 Canonical Ltd. |
617 | * |
618 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
619 | * |
620 | |
621 | === modified file 'lib/SignOn/identityimpl.h' |
622 | --- lib/SignOn/identityimpl.h 2013-09-06 06:33:01 +0000 |
623 | +++ lib/SignOn/identityimpl.h 2016-08-24 14:26:52 +0000 |
624 | @@ -2,9 +2,8 @@ |
625 | * This file is part of signon |
626 | * |
627 | * Copyright (C) 2009-2010 Nokia Corporation. |
628 | - * Copyright (C) 2013 Canonical Ltd. |
629 | + * Copyright (C) 2013-2016 Canonical Ltd. |
630 | * |
631 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
632 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
633 | * |
634 | * This library is free software; you can redistribute it and/or |
635 | |
636 | === modified file 'lib/SignOn/identityinfo.cpp' |
637 | --- lib/SignOn/identityinfo.cpp 2015-10-27 09:58:39 +0000 |
638 | +++ lib/SignOn/identityinfo.cpp 2016-08-24 14:26:52 +0000 |
639 | @@ -2,7 +2,7 @@ |
640 | * This file is part of signon |
641 | * |
642 | * Copyright (C) 2009-2010 Nokia Corporation. |
643 | - * Copyright (C) 2011-2015 Canonical Ltd. |
644 | + * Copyright (C) 2011-2016 Canonical Ltd. |
645 | * |
646 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
647 | * |
648 | |
649 | === modified file 'lib/SignOn/identityinfo.h' |
650 | --- lib/SignOn/identityinfo.h 2013-04-10 09:55:32 +0000 |
651 | +++ lib/SignOn/identityinfo.h 2016-08-24 14:26:52 +0000 |
652 | @@ -2,8 +2,8 @@ |
653 | * This file is part of signon |
654 | * |
655 | * Copyright (C) 2009-2010 Nokia Corporation. |
656 | + * Copyright (C) 2011-2016 Canonical Ltd. |
657 | * |
658 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
659 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
660 | * |
661 | * This library is free software; you can redistribute it and/or |
662 | |
663 | === modified file 'lib/SignOn/identityinfoimpl.cpp' |
664 | --- lib/SignOn/identityinfoimpl.cpp 2015-10-27 09:58:39 +0000 |
665 | +++ lib/SignOn/identityinfoimpl.cpp 2016-08-24 14:26:52 +0000 |
666 | @@ -2,7 +2,7 @@ |
667 | * This file is part of signon |
668 | * |
669 | * Copyright (C) 2009-2010 Nokia Corporation. |
670 | - * Copyright (C) 2011-2015 Canonical Ltd. |
671 | + * Copyright (C) 2011-2016 Canonical Ltd. |
672 | * |
673 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
674 | * |
675 | |
676 | === modified file 'lib/SignOn/identityinfoimpl.h' |
677 | --- lib/SignOn/identityinfoimpl.h 2013-11-22 14:46:01 +0000 |
678 | +++ lib/SignOn/identityinfoimpl.h 2016-08-24 14:26:52 +0000 |
679 | @@ -2,8 +2,8 @@ |
680 | * This file is part of signon |
681 | * |
682 | * Copyright (C) 2009-2010 Nokia Corporation. |
683 | + * Copyright (C) 2012-2016 Canonical Ltd. |
684 | * |
685 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
686 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
687 | * |
688 | * This library is free software; you can redistribute it and/or |
689 | |
690 | === modified file 'lib/SignOn/libsignon-qt.pri' |
691 | --- lib/SignOn/libsignon-qt.pri 2015-10-27 09:58:39 +0000 |
692 | +++ lib/SignOn/libsignon-qt.pri 2016-08-24 14:26:52 +0000 |
693 | @@ -2,11 +2,7 @@ |
694 | include( ../../common-vars.pri ) |
695 | TEMPLATE = lib |
696 | |
697 | -greaterThan(QT_MAJOR_VERSION, 4) { |
698 | - TARGET = signon-qt5 |
699 | -} else { |
700 | - TARGET = signon-qt |
701 | -} |
702 | +TARGET = signon-qt5 |
703 | |
704 | # Input |
705 | public_headers += \ |
706 | |
707 | === modified file 'lib/SignOn/libsignoncommon.h' |
708 | --- lib/SignOn/libsignoncommon.h 2015-10-27 09:58:39 +0000 |
709 | +++ lib/SignOn/libsignoncommon.h 2016-08-24 14:26:52 +0000 |
710 | @@ -2,7 +2,7 @@ |
711 | * This file is part of signon |
712 | * |
713 | * Copyright (C) 2009-2010 Nokia Corporation. |
714 | - * Copyright (C) 2015 Canonical Ltd. |
715 | + * Copyright (C) 2015-2016 Canonical Ltd. |
716 | * |
717 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
718 | * |
719 | |
720 | === modified file 'lib/SignOn/sessiondata.h' |
721 | --- lib/SignOn/sessiondata.h 2012-10-25 15:54:22 +0000 |
722 | +++ lib/SignOn/sessiondata.h 2016-08-24 14:26:52 +0000 |
723 | @@ -2,6 +2,7 @@ |
724 | * This file is part of signon |
725 | * |
726 | * Copyright (C) 2009-2010 Nokia Corporation. |
727 | + * Copyright (C) 2012-2016 Canonical Ltd. |
728 | * |
729 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
730 | * |
731 | |
732 | === modified file 'lib/SignOn/signon.h' |
733 | --- lib/SignOn/signon.h 2012-04-18 13:06:27 +0000 |
734 | +++ lib/SignOn/signon.h 2016-08-24 14:26:52 +0000 |
735 | @@ -2,6 +2,7 @@ |
736 | * This file is part of signon |
737 | * |
738 | * Copyright (C) 2009-2010 Nokia Corporation. |
739 | + * Copyright (C) 2012-2016 Canonical Ltd. |
740 | * |
741 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
742 | * |
743 | |
744 | === modified file 'lib/SignOn/signonerror.h' |
745 | --- lib/SignOn/signonerror.h 2013-01-21 13:50:42 +0000 |
746 | +++ lib/SignOn/signonerror.h 2016-08-24 14:26:52 +0000 |
747 | @@ -2,8 +2,8 @@ |
748 | * This file is part of signon |
749 | * |
750 | * Copyright (C) 2009-2010 Nokia Corporation. |
751 | + * Copyright (C) 2012-2016 Canonical Ltd. |
752 | * |
753 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
754 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
755 | * |
756 | * This library is free software; you can redistribute it and/or |
757 | |
758 | === modified file 'lib/plugins/SignOn/authpluginif.h' |
759 | --- lib/plugins/SignOn/authpluginif.h 2012-04-18 13:06:27 +0000 |
760 | +++ lib/plugins/SignOn/authpluginif.h 2016-08-24 14:26:52 +0000 |
761 | @@ -2,6 +2,7 @@ |
762 | * This file is part of signon |
763 | * |
764 | * Copyright (C) 2009-2010 Nokia Corporation. |
765 | + * Copyright (C) 2012-2016 Canonical Ltd. |
766 | * |
767 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
768 | * |
769 | |
770 | === modified file 'lib/plugins/SignOn/signonplugincommon.h' |
771 | --- lib/plugins/SignOn/signonplugincommon.h 2012-04-18 13:06:27 +0000 |
772 | +++ lib/plugins/SignOn/signonplugincommon.h 2016-08-24 14:26:52 +0000 |
773 | @@ -2,6 +2,7 @@ |
774 | * This file is part of signon |
775 | * |
776 | * Copyright (C) 2009-2010 Nokia Corporation. |
777 | + * Copyright (C) 2012-2016 Canonical Ltd. |
778 | * |
779 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
780 | * |
781 | |
782 | === modified file 'lib/plugins/SignOn/uisessiondata.h' |
783 | --- lib/plugins/SignOn/uisessiondata.h 2015-09-28 11:55:23 +0000 |
784 | +++ lib/plugins/SignOn/uisessiondata.h 2016-08-24 14:26:52 +0000 |
785 | @@ -2,6 +2,7 @@ |
786 | * This file is part of signon |
787 | * |
788 | * Copyright (C) 2009-2010 Nokia Corporation. |
789 | + * Copyright (C) 2012-2016 Canonical Ltd. |
790 | * |
791 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
792 | * |
793 | |
794 | === modified file 'lib/plugins/SignOn/uisessiondata_priv.h' |
795 | --- lib/plugins/SignOn/uisessiondata_priv.h 2014-10-10 13:11:26 +0000 |
796 | +++ lib/plugins/SignOn/uisessiondata_priv.h 2016-08-24 14:26:52 +0000 |
797 | @@ -2,6 +2,7 @@ |
798 | * This file is part of signon |
799 | * |
800 | * Copyright (C) 2009-2010 Nokia Corporation. |
801 | + * Copyright (C) 2012-2016 Canonical Ltd. |
802 | * |
803 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
804 | * |
805 | @@ -26,11 +27,20 @@ |
806 | #define SSOUI_KEY_CAPTION QLatin1String("Caption") |
807 | #define SSOUI_KEY_MESSAGEID QLatin1String("QueryMessageId") |
808 | #define SSOUI_KEY_MESSAGE QLatin1String("QueryMessage") |
809 | +#define SSOUI_KEY_ERROR_MESSAGE QLatin1String("ErrorMessage") |
810 | #define SSOUI_KEY_QUERYUSERNAME QLatin1String("QueryUserName") |
811 | #define SSOUI_KEY_USERNAME QLatin1String("UserName") |
812 | +#define SSOUI_KEY_USERNAME_TEXT QLatin1String("UserNameText") |
813 | #define SSOUI_KEY_QUERYPASSWORD QLatin1String("QueryPassword") |
814 | #define SSOUI_KEY_PASSWORD QLatin1String("Secret") |
815 | +#define SSOUI_KEY_PASSWORD_TEXT QLatin1String("PasswordText") |
816 | #define SSOUI_KEY_REMEMBER QLatin1String("RememberPassword") |
817 | +/* 2 factor authentication field */ |
818 | +#define SSOUI_KEY_QUERY2FA QLatin1String("Query2fa") |
819 | +#define SSOUI_KEY_2FA QLatin1String("2fa") |
820 | +#define SSOUI_KEY_2FA_TEXT QLatin1String("2faText") |
821 | +/* Text for the login button */ |
822 | +#define SSOUI_KEY_LOGIN_TEXT QLatin1String("LoginText") |
823 | #define SSOUI_KEY_SHOWREALM QLatin1String("ShowRealm") |
824 | #define SSOUI_KEY_REALM QLatin1String("Realm") |
825 | #define SSOUI_KEY_NETWORKPROXY QLatin1String("NetworkProxy") |
826 | |
827 | === modified file 'lib/plugins/signon-plugins-common/SignOn/blobiohandler.cpp' |
828 | --- lib/plugins/signon-plugins-common/SignOn/blobiohandler.cpp 2015-04-23 11:34:19 +0000 |
829 | +++ lib/plugins/signon-plugins-common/SignOn/blobiohandler.cpp 2016-08-24 14:26:52 +0000 |
830 | @@ -2,8 +2,8 @@ |
831 | * This file is part of signon |
832 | * |
833 | * Copyright (C) 2009-2011 Nokia Corporation. |
834 | + * Copyright (C) 2012-2016 Canonical Ltd. |
835 | * |
836 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
837 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
838 | * |
839 | * This library is free software; you can redistribute it and/or |
840 | @@ -41,7 +41,8 @@ |
841 | m_readChannel(readChannel), |
842 | m_writeChannel(writeChannel), |
843 | m_readNotifier(0), |
844 | - m_blobSize(-1) |
845 | + m_blobSize(-1), |
846 | + m_isReading(false) |
847 | { |
848 | } |
849 | |
850 | @@ -73,9 +74,9 @@ |
851 | |
852 | void BlobIOHandler::setReadNotificationEnabled(bool enabled) |
853 | { |
854 | + m_isReading = enabled; |
855 | if (enabled) { |
856 | if (m_readNotifier != 0) { |
857 | - m_readNotifier->setEnabled(true); |
858 | connect(m_readNotifier, SIGNAL(activated(int)), |
859 | this, SLOT(readBlob())); |
860 | } else { |
861 | @@ -86,7 +87,6 @@ |
862 | if (m_readNotifier != 0) { |
863 | disconnect(m_readNotifier, SIGNAL(activated(int)), |
864 | this, SLOT(readBlob())); |
865 | - m_readNotifier->setEnabled(false); |
866 | } else { |
867 | disconnect(m_readChannel, SIGNAL(readyRead()), |
868 | this, SLOT(readBlob())); |
869 | |
870 | === modified file 'lib/plugins/signon-plugins-common/SignOn/blobiohandler.h' |
871 | --- lib/plugins/signon-plugins-common/SignOn/blobiohandler.h 2012-04-18 13:06:27 +0000 |
872 | +++ lib/plugins/signon-plugins-common/SignOn/blobiohandler.h 2016-08-24 14:26:52 +0000 |
873 | @@ -2,8 +2,8 @@ |
874 | * This file is part of signon |
875 | * |
876 | * Copyright (C) 2009-2011 Nokia Corporation. |
877 | + * Copyright (C) 2012-2016 Canonical Ltd. |
878 | * |
879 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
880 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
881 | * |
882 | * This library is free software; you can redistribute it and/or |
883 | @@ -45,6 +45,7 @@ |
884 | void receiveData(int expectedDataSize); |
885 | |
886 | void setReadChannelSocketNotifier(QSocketNotifier *notifier); |
887 | + bool isReading() const { return m_isReading; } |
888 | |
889 | public Q_SLOTS: |
890 | void readBlob(); |
891 | @@ -66,6 +67,7 @@ |
892 | QByteArray m_blobBuffer; |
893 | QSocketNotifier *m_readNotifier; |
894 | int m_blobSize; |
895 | + bool m_isReading; |
896 | }; |
897 | |
898 | } |
899 | |
900 | === modified file 'lib/plugins/signon-plugins-common/SignOn/ipc.h' |
901 | --- lib/plugins/signon-plugins-common/SignOn/ipc.h 2012-04-18 13:06:27 +0000 |
902 | +++ lib/plugins/signon-plugins-common/SignOn/ipc.h 2016-08-24 14:26:52 +0000 |
903 | @@ -2,6 +2,7 @@ |
904 | * This file is part of signon |
905 | * |
906 | * Copyright (C) 2011 Nokia Corporation. |
907 | + * Copyright (C) 2012-2016 Canonical Ltd. |
908 | * |
909 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
910 | * |
911 | |
912 | === modified file 'lib/plugins/signon-plugins-common/signon-plugins-common.pc.in' |
913 | --- lib/plugins/signon-plugins-common/signon-plugins-common.pc.in 2013-03-19 08:37:03 +0000 |
914 | +++ lib/plugins/signon-plugins-common/signon-plugins-common.pc.in 2016-08-24 14:26:52 +0000 |
915 | @@ -6,5 +6,5 @@ |
916 | Name: signon-plugins-common |
917 | Description: SignonPluginsCommon |
918 | Version: $$PROJECT_VERSION |
919 | -Libs.private: -L/usr/lib -l$${LIBQTCORE} |
920 | +Libs.private: -L/usr/lib -lQt5Core |
921 | Cflags: -I${includedir}/signon-plugins -I${includedir}/signon-plugins/SignOn |
922 | |
923 | === modified file 'lib/plugins/signon-plugins.pc.in' |
924 | --- lib/plugins/signon-plugins.pc.in 2013-03-19 08:37:03 +0000 |
925 | +++ lib/plugins/signon-plugins.pc.in 2016-08-24 14:26:52 +0000 |
926 | @@ -8,6 +8,6 @@ |
927 | Description: SignonPlugins |
928 | Version: $$PROJECT_VERSION |
929 | Requires: $${LIBSIGNON} |
930 | -Libs.private: -L/usr/lib -l$${LIBQTCORE} |
931 | +Libs.private: -L/usr/lib -lQt5Core |
932 | Cflags: -I${includedir}/signon-plugins -I${includedir}/signon-plugins/SignOn |
933 | Libs: -lsignon-plugins |
934 | |
935 | === modified file 'lib/signond/SignOn/SignOnExtension.pc.in' |
936 | --- lib/signond/SignOn/SignOnExtension.pc.in 2013-04-26 10:54:33 +0000 |
937 | +++ lib/signond/SignOn/SignOnExtension.pc.in 2016-08-24 14:26:52 +0000 |
938 | @@ -7,6 +7,6 @@ |
939 | Name: SignOnExtension |
940 | Description: SignOn extension development |
941 | Version: $$PROJECT_VERSION |
942 | -Requires: $${LIBQTCORE} |
943 | +Requires: Qt5Core |
944 | Libs: -L${libdir} -lsignon-extension |
945 | Cflags: -I${includedir}/signon-extension |
946 | |
947 | === modified file 'lib/signond/SignOn/abstract-access-control-manager.cpp' |
948 | --- lib/signond/SignOn/abstract-access-control-manager.cpp 2013-08-20 08:01:43 +0000 |
949 | +++ lib/signond/SignOn/abstract-access-control-manager.cpp 2016-08-24 14:26:52 +0000 |
950 | @@ -2,7 +2,7 @@ |
951 | * This file is part of signon |
952 | * |
953 | * Copyright (C) 2011 Intel Corporation. |
954 | - * Copyright (C) 2013 Canonical Ltd. |
955 | + * Copyright (C) 2013-2016 Canonical Ltd. |
956 | * |
957 | * Contact: Elena Reshetova <elena.reshetova@intel.com> |
958 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
959 | |
960 | === modified file 'lib/signond/SignOn/abstract-access-control-manager.h' |
961 | --- lib/signond/SignOn/abstract-access-control-manager.h 2013-08-20 08:01:43 +0000 |
962 | +++ lib/signond/SignOn/abstract-access-control-manager.h 2016-08-24 14:26:52 +0000 |
963 | @@ -2,7 +2,7 @@ |
964 | * This file is part of signon |
965 | * |
966 | * Copyright (C) 2011 Intel Corporation. |
967 | - * Copyright (C) 2013 Canonical Ltd. |
968 | + * Copyright (C) 2013-2016 Canonical Ltd. |
969 | * |
970 | * Contact: Elena Reshetova <elena.reshetova@intel.com> |
971 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
972 | |
973 | === modified file 'lib/signond/SignOn/abstract-crypto-manager.cpp' |
974 | --- lib/signond/SignOn/abstract-crypto-manager.cpp 2011-11-09 15:46:53 +0000 |
975 | +++ lib/signond/SignOn/abstract-crypto-manager.cpp 2016-08-24 14:26:52 +0000 |
976 | @@ -2,7 +2,7 @@ |
977 | /* |
978 | * This file is part of signon |
979 | * |
980 | - * Copyright (C) 2011 Canonical Ltd. |
981 | + * Copyright (C) 2011-2016 Canonical Ltd. |
982 | * |
983 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
984 | * |
985 | |
986 | === modified file 'lib/signond/SignOn/abstract-crypto-manager.h' |
987 | --- lib/signond/SignOn/abstract-crypto-manager.h 2011-11-09 15:46:53 +0000 |
988 | +++ lib/signond/SignOn/abstract-crypto-manager.h 2016-08-24 14:26:52 +0000 |
989 | @@ -2,7 +2,7 @@ |
990 | /* |
991 | * This file is part of signon |
992 | * |
993 | - * Copyright (C) 2011 Canonical Ltd. |
994 | + * Copyright (C) 2011-2016 Canonical Ltd. |
995 | * |
996 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
997 | * |
998 | |
999 | === modified file 'lib/signond/SignOn/abstract-key-authorizer.cpp' |
1000 | --- lib/signond/SignOn/abstract-key-authorizer.cpp 2012-04-18 13:06:27 +0000 |
1001 | +++ lib/signond/SignOn/abstract-key-authorizer.cpp 2016-08-24 14:26:52 +0000 |
1002 | @@ -2,6 +2,7 @@ |
1003 | * This file is part of signon |
1004 | * |
1005 | * Copyright (C) 2011 Nokia Corporation. |
1006 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1007 | * |
1008 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1009 | * |
1010 | |
1011 | === modified file 'lib/signond/SignOn/abstract-key-authorizer.h' |
1012 | --- lib/signond/SignOn/abstract-key-authorizer.h 2012-06-08 12:49:56 +0000 |
1013 | +++ lib/signond/SignOn/abstract-key-authorizer.h 2016-08-24 14:26:52 +0000 |
1014 | @@ -2,6 +2,7 @@ |
1015 | * This file is part of signon |
1016 | * |
1017 | * Copyright (C) 2011 Nokia Corporation. |
1018 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1019 | * |
1020 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1021 | * |
1022 | |
1023 | === modified file 'lib/signond/SignOn/abstract-key-manager.cpp' |
1024 | --- lib/signond/SignOn/abstract-key-manager.cpp 2012-04-18 13:06:27 +0000 |
1025 | +++ lib/signond/SignOn/abstract-key-manager.cpp 2016-08-24 14:26:52 +0000 |
1026 | @@ -2,6 +2,7 @@ |
1027 | * This file is part of signon |
1028 | * |
1029 | * Copyright (C) 2010 Nokia Corporation. |
1030 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1031 | * |
1032 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1033 | * |
1034 | |
1035 | === modified file 'lib/signond/SignOn/abstract-key-manager.h' |
1036 | --- lib/signond/SignOn/abstract-key-manager.h 2012-04-18 13:06:27 +0000 |
1037 | +++ lib/signond/SignOn/abstract-key-manager.h 2016-08-24 14:26:52 +0000 |
1038 | @@ -2,6 +2,7 @@ |
1039 | * This file is part of signon |
1040 | * |
1041 | * Copyright (C) 2010 Nokia Corporation. |
1042 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1043 | * |
1044 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1045 | * |
1046 | |
1047 | === modified file 'lib/signond/SignOn/abstract-secrets-storage.cpp' |
1048 | --- lib/signond/SignOn/abstract-secrets-storage.cpp 2011-11-16 10:02:41 +0000 |
1049 | +++ lib/signond/SignOn/abstract-secrets-storage.cpp 2016-08-24 14:26:52 +0000 |
1050 | @@ -3,6 +3,7 @@ |
1051 | * This file is part of signon |
1052 | * |
1053 | * Copyright (C) 2011 Canonical Ltd. |
1054 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1055 | * |
1056 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1057 | * |
1058 | |
1059 | === modified file 'lib/signond/SignOn/abstract-secrets-storage.h' |
1060 | --- lib/signond/SignOn/abstract-secrets-storage.h 2012-04-18 13:03:21 +0000 |
1061 | +++ lib/signond/SignOn/abstract-secrets-storage.h 2016-08-24 14:26:52 +0000 |
1062 | @@ -3,6 +3,7 @@ |
1063 | * This file is part of signon |
1064 | * |
1065 | * Copyright (C) 2011 Canonical Ltd. |
1066 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1067 | * |
1068 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1069 | * |
1070 | |
1071 | === modified file 'lib/signond/SignOn/debug.cpp' |
1072 | --- lib/signond/SignOn/debug.cpp 2012-04-18 13:06:27 +0000 |
1073 | +++ lib/signond/SignOn/debug.cpp 2016-08-24 14:26:52 +0000 |
1074 | @@ -2,6 +2,7 @@ |
1075 | * This file is part of signon |
1076 | * |
1077 | * Copyright (C) 2011 Nokia Corporation. |
1078 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1079 | * |
1080 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1081 | * |
1082 | |
1083 | === modified file 'lib/signond/SignOn/debug.h' |
1084 | --- lib/signond/SignOn/debug.h 2012-04-18 13:06:27 +0000 |
1085 | +++ lib/signond/SignOn/debug.h 2016-08-24 14:26:52 +0000 |
1086 | @@ -2,6 +2,7 @@ |
1087 | * This file is part of signon |
1088 | * |
1089 | * Copyright (C) 2011 Nokia Corporation. |
1090 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1091 | * |
1092 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1093 | * |
1094 | |
1095 | === modified file 'lib/signond/SignOn/export.h' |
1096 | --- lib/signond/SignOn/export.h 2012-04-18 13:06:27 +0000 |
1097 | +++ lib/signond/SignOn/export.h 2016-08-24 14:26:52 +0000 |
1098 | @@ -2,6 +2,7 @@ |
1099 | * This file is part of signon |
1100 | * |
1101 | * Copyright (C) 2011 Nokia Corporation. |
1102 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1103 | * |
1104 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1105 | * |
1106 | |
1107 | === modified file 'lib/signond/SignOn/extension-interface.cpp' |
1108 | --- lib/signond/SignOn/extension-interface.cpp 2011-12-23 07:46:09 +0000 |
1109 | +++ lib/signond/SignOn/extension-interface.cpp 2016-08-24 14:26:52 +0000 |
1110 | @@ -1,7 +1,7 @@ |
1111 | /* |
1112 | * This file is part of signon |
1113 | * |
1114 | - * Copyright (C) 2011 Canonical Ltd. |
1115 | + * Copyright (C) 2011-2016 Canonical Ltd. |
1116 | * |
1117 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1118 | * |
1119 | |
1120 | === modified file 'lib/signond/SignOn/extension-interface.h' |
1121 | --- lib/signond/SignOn/extension-interface.h 2012-04-18 13:03:21 +0000 |
1122 | +++ lib/signond/SignOn/extension-interface.h 2016-08-24 14:26:52 +0000 |
1123 | @@ -2,7 +2,7 @@ |
1124 | * This file is part of signon |
1125 | * |
1126 | * Copyright (C) 2010-2011 Nokia Corporation. |
1127 | - * Copyright (C) 2011 Canonical Ltd. |
1128 | + * Copyright (C) 2011-2016 Canonical Ltd. |
1129 | * Copyright (C) 2011 Intel Corporation. |
1130 | * |
1131 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1132 | |
1133 | === modified file 'lib/signond/SignOn/key-handler.cpp' |
1134 | --- lib/signond/SignOn/key-handler.cpp 2012-04-18 13:06:27 +0000 |
1135 | +++ lib/signond/SignOn/key-handler.cpp 2016-08-24 14:26:52 +0000 |
1136 | @@ -2,6 +2,7 @@ |
1137 | * This file is part of signon |
1138 | * |
1139 | * Copyright (C) 2011 Nokia Corporation. |
1140 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1141 | * |
1142 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1143 | * |
1144 | |
1145 | === modified file 'lib/signond/SignOn/key-handler.h' |
1146 | --- lib/signond/SignOn/key-handler.h 2012-06-08 12:49:56 +0000 |
1147 | +++ lib/signond/SignOn/key-handler.h 2016-08-24 14:26:52 +0000 |
1148 | @@ -2,6 +2,7 @@ |
1149 | * This file is part of signon |
1150 | * |
1151 | * Copyright (C) 2011 Nokia Corporation. |
1152 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1153 | * |
1154 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1155 | * |
1156 | |
1157 | === modified file 'lib/signond/SignOn/misc.cpp' |
1158 | --- lib/signond/SignOn/misc.cpp 2012-06-08 12:49:56 +0000 |
1159 | +++ lib/signond/SignOn/misc.cpp 2016-08-24 14:26:52 +0000 |
1160 | @@ -2,6 +2,7 @@ |
1161 | * This file is part of signon |
1162 | * |
1163 | * Copyright (C) 2011 Nokia Corporation. |
1164 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1165 | * |
1166 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1167 | * |
1168 | |
1169 | === modified file 'lib/signond/SignOn/misc.h' |
1170 | --- lib/signond/SignOn/misc.h 2012-04-18 13:06:27 +0000 |
1171 | +++ lib/signond/SignOn/misc.h 2016-08-24 14:26:52 +0000 |
1172 | @@ -2,6 +2,7 @@ |
1173 | * This file is part of signon |
1174 | * |
1175 | * Copyright (C) 2011 Nokia Corporation. |
1176 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1177 | * |
1178 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1179 | * |
1180 | |
1181 | === modified file 'lib/signond/signoncommon.h' |
1182 | --- lib/signond/signoncommon.h 2013-07-29 13:52:21 +0000 |
1183 | +++ lib/signond/signoncommon.h 2016-08-24 14:26:52 +0000 |
1184 | @@ -2,7 +2,7 @@ |
1185 | * This file is part of signon |
1186 | * |
1187 | * Copyright (C) 2009-2010 Nokia Corporation. |
1188 | - * Copyright (C) 2012 Canonical Ltd. |
1189 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1190 | * |
1191 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1192 | * |
1193 | @@ -105,7 +105,7 @@ |
1194 | SIGNOND_STRING(SIGNOND_ERR_PREFIX "InternalCommunication") |
1195 | |
1196 | #define SIGNOND_PERMISSION_DENIED_ERR_STR \ |
1197 | - SIGNOND_STRING("Client has insuficient permissions to access the service.") |
1198 | + SIGNOND_STRING("Client has insufficient permissions to access the service.") |
1199 | #define SIGNOND_PERMISSION_DENIED_ERR_NAME \ |
1200 | SIGNOND_STRING(SIGNOND_ERR_PREFIX "PermissionDenied") |
1201 | |
1202 | |
1203 | === modified file 'signon.pro' |
1204 | --- signon.pro 2013-10-30 11:51:34 +0000 |
1205 | +++ signon.pro 2016-08-24 14:26:52 +0000 |
1206 | @@ -9,7 +9,4 @@ |
1207 | |
1208 | include( doc/doc.pri ) |
1209 | |
1210 | -DISTNAME = $${PROJECT_NAME}-$${PROJECT_VERSION} |
1211 | -dist.commands = "git archive --format=tar --prefix=$${DISTNAME}/ HEAD | bzip2 -9 > $${DISTNAME}.tar.bz2" |
1212 | -QMAKE_EXTRA_TARGETS += dist |
1213 | # End of File |
1214 | |
1215 | === modified file 'src/extensions/cryptsetup/cryptsetup-plugin.cpp' |
1216 | --- src/extensions/cryptsetup/cryptsetup-plugin.cpp 2012-11-06 10:10:28 +0000 |
1217 | +++ src/extensions/cryptsetup/cryptsetup-plugin.cpp 2016-08-24 14:26:52 +0000 |
1218 | @@ -40,7 +40,3 @@ |
1219 | qDebug() << Q_FUNC_INFO; |
1220 | return new CryptoManager(parent); |
1221 | } |
1222 | - |
1223 | -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) |
1224 | -Q_EXPORT_PLUGIN2(cryptsetup, CryptsetupPlugin); |
1225 | -#endif |
1226 | |
1227 | === modified file 'src/extensions/cryptsetup/cryptsetup-plugin.h' |
1228 | --- src/extensions/cryptsetup/cryptsetup-plugin.h 2012-11-06 10:10:28 +0000 |
1229 | +++ src/extensions/cryptsetup/cryptsetup-plugin.h 2016-08-24 14:26:52 +0000 |
1230 | @@ -32,9 +32,7 @@ |
1231 | { |
1232 | Q_OBJECT |
1233 | Q_INTERFACES(SignOn::ExtensionInterface3) |
1234 | -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
1235 | Q_PLUGIN_METADATA(IID "com.nokia.SingleSignOn.ExtensionInterface/3.0") |
1236 | -#endif |
1237 | |
1238 | public: |
1239 | CryptsetupPlugin(); |
1240 | |
1241 | === modified file 'src/plugins/example/exampledata.h' |
1242 | --- src/plugins/example/exampledata.h 2012-04-18 13:06:27 +0000 |
1243 | +++ src/plugins/example/exampledata.h 2016-08-24 14:26:52 +0000 |
1244 | @@ -2,6 +2,7 @@ |
1245 | * This file is part of signon |
1246 | * |
1247 | * Copyright (C) 2009-2010 Nokia Corporation. |
1248 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1249 | * |
1250 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1251 | * |
1252 | |
1253 | === modified file 'src/plugins/example/exampleplugin.cpp' |
1254 | --- src/plugins/example/exampleplugin.cpp 2012-04-18 13:06:27 +0000 |
1255 | +++ src/plugins/example/exampleplugin.cpp 2016-08-24 14:26:52 +0000 |
1256 | @@ -2,6 +2,7 @@ |
1257 | * This file is part of signon |
1258 | * |
1259 | * Copyright (C) 2009-2010 Nokia Corporation. |
1260 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1261 | * |
1262 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1263 | * |
1264 | |
1265 | === modified file 'src/plugins/example/exampleplugin.h' |
1266 | --- src/plugins/example/exampleplugin.h 2012-04-18 13:06:27 +0000 |
1267 | +++ src/plugins/example/exampleplugin.h 2016-08-24 14:26:52 +0000 |
1268 | @@ -2,6 +2,7 @@ |
1269 | * This file is part of signon |
1270 | * |
1271 | * Copyright (C) 2009-2010 Nokia Corporation. |
1272 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1273 | * |
1274 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1275 | * |
1276 | |
1277 | === modified file 'src/plugins/password/passwordplugin.cpp' |
1278 | --- src/plugins/password/passwordplugin.cpp 2012-04-18 13:06:27 +0000 |
1279 | +++ src/plugins/password/passwordplugin.cpp 2016-08-24 14:26:52 +0000 |
1280 | @@ -2,6 +2,7 @@ |
1281 | * This file is part of signon |
1282 | * |
1283 | * Copyright (C) 2009-2010 Nokia Corporation. |
1284 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1285 | * |
1286 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1287 | * |
1288 | |
1289 | === modified file 'src/plugins/password/passwordplugin.h' |
1290 | --- src/plugins/password/passwordplugin.h 2012-04-18 13:06:27 +0000 |
1291 | +++ src/plugins/password/passwordplugin.h 2016-08-24 14:26:52 +0000 |
1292 | @@ -2,6 +2,7 @@ |
1293 | * This file is part of signon |
1294 | * |
1295 | * Copyright (C) 2009-2010 Nokia Corporation. |
1296 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1297 | * |
1298 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1299 | * |
1300 | |
1301 | === modified file 'src/plugins/test/ssotest2data.h' |
1302 | --- src/plugins/test/ssotest2data.h 2012-04-24 11:57:25 +0000 |
1303 | +++ src/plugins/test/ssotest2data.h 2016-08-24 14:26:52 +0000 |
1304 | @@ -2,6 +2,7 @@ |
1305 | * This file is part of signon |
1306 | * |
1307 | * Copyright (C) 2009-2010 Nokia Corporation. |
1308 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1309 | * |
1310 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1311 | * |
1312 | |
1313 | === modified file 'src/plugins/test/ssotest2plugin.cpp' |
1314 | --- src/plugins/test/ssotest2plugin.cpp 2013-03-01 06:57:55 +0000 |
1315 | +++ src/plugins/test/ssotest2plugin.cpp 2016-08-24 14:26:52 +0000 |
1316 | @@ -2,6 +2,7 @@ |
1317 | * This file is part of signon |
1318 | * |
1319 | * Copyright (C) 2009-2010 Nokia Corporation. |
1320 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1321 | * |
1322 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1323 | * |
1324 | |
1325 | === modified file 'src/plugins/test/ssotest2plugin.h' |
1326 | --- src/plugins/test/ssotest2plugin.h 2012-04-24 11:57:25 +0000 |
1327 | +++ src/plugins/test/ssotest2plugin.h 2016-08-24 14:26:52 +0000 |
1328 | @@ -2,6 +2,7 @@ |
1329 | * This file is part of signon |
1330 | * |
1331 | * Copyright (C) 2009-2010 Nokia Corporation. |
1332 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1333 | * |
1334 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1335 | * |
1336 | |
1337 | === modified file 'src/plugins/test/ssotestplugin.cpp' |
1338 | --- src/plugins/test/ssotestplugin.cpp 2012-06-08 12:49:56 +0000 |
1339 | +++ src/plugins/test/ssotestplugin.cpp 2016-08-24 14:26:52 +0000 |
1340 | @@ -2,6 +2,7 @@ |
1341 | * This file is part of signon |
1342 | * |
1343 | * Copyright (C) 2009-2010 Nokia Corporation. |
1344 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1345 | * |
1346 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1347 | * |
1348 | @@ -32,9 +33,6 @@ |
1349 | |
1350 | namespace SsoTestPluginNS { |
1351 | |
1352 | -static QMutex mutex; |
1353 | -static bool is_canceled = false; |
1354 | - |
1355 | SsoTestPlugin::SsoTestPlugin(QObject *parent): |
1356 | AuthPluginInterface(parent) |
1357 | { |
1358 | @@ -47,6 +45,8 @@ |
1359 | m_mechanisms += QLatin1String("BLOB"); |
1360 | |
1361 | qRegisterMetaType<SignOn::SessionData>("SignOn::SessionData"); |
1362 | + |
1363 | + QObject::connect(&m_timer, SIGNAL(timeout()), this, SLOT(execProcess())); |
1364 | } |
1365 | |
1366 | SsoTestPlugin::~SsoTestPlugin() |
1367 | @@ -55,9 +55,10 @@ |
1368 | |
1369 | void SsoTestPlugin::cancel() |
1370 | { |
1371 | - TRACE(); |
1372 | - QMutexLocker locker(&mutex); |
1373 | - is_canceled = true; |
1374 | + TRACE() << "Operation is canceled"; |
1375 | + emit error(Error(Error::SessionCanceled, |
1376 | + QLatin1String("The operation is canceled"))); |
1377 | + m_timer.stop(); |
1378 | } |
1379 | |
1380 | /* |
1381 | @@ -73,37 +74,28 @@ |
1382 | return; |
1383 | } |
1384 | |
1385 | - QMetaObject::invokeMethod(this, |
1386 | - "execProcess", |
1387 | - Qt::QueuedConnection, |
1388 | - Q_ARG(SignOn::SessionData, inData), |
1389 | - Q_ARG(QString, mechanism)); |
1390 | + m_data = inData; |
1391 | + m_mechanism = mechanism; |
1392 | + m_statusCounter = 0; |
1393 | + |
1394 | + m_timer.setInterval(100); |
1395 | + m_timer.setSingleShot(false); |
1396 | + m_timer.start(); |
1397 | } |
1398 | |
1399 | -void SsoTestPlugin::execProcess(const SignOn::SessionData &inData, |
1400 | - const QString &mechanism) |
1401 | +void SsoTestPlugin::execProcess() |
1402 | { |
1403 | - SignOn::SessionData outData(inData); |
1404 | + m_statusCounter++; |
1405 | + emit statusChanged(PLUGIN_STATE_WAITING, |
1406 | + QLatin1String("hello from the test plugin")); |
1407 | + if (m_statusCounter < 10) return; |
1408 | + |
1409 | + m_timer.stop(); |
1410 | + |
1411 | + SignOn::SessionData outData(m_data); |
1412 | outData.setRealm("testRealm_after_test"); |
1413 | |
1414 | - for (int i = 0; i < 10; i++) |
1415 | - if (!is_canceled) { |
1416 | - TRACE() << "Signal is sent"; |
1417 | - emit statusChanged(PLUGIN_STATE_WAITING, |
1418 | - QLatin1String("hello from the test plugin")); |
1419 | - usleep(0.1 * 1000000); |
1420 | - } |
1421 | - |
1422 | - if (is_canceled) { |
1423 | - TRACE() << "Operation is canceled"; |
1424 | - QMutexLocker locker(&mutex); |
1425 | - is_canceled = false; |
1426 | - emit error(Error(Error::SessionCanceled, |
1427 | - QLatin1String("The operation is canceled"))); |
1428 | - return; |
1429 | - } |
1430 | - |
1431 | - if (mechanism == QLatin1String("BLOB")) { |
1432 | + if (m_mechanism == QLatin1String("BLOB")) { |
1433 | emit result(outData); |
1434 | return; |
1435 | } |
1436 | @@ -111,12 +103,12 @@ |
1437 | foreach(QString key, outData.propertyNames()) |
1438 | TRACE() << key << ": " << outData.getProperty(key); |
1439 | |
1440 | - if (mechanism == QLatin1String("mech1")) { |
1441 | + if (m_mechanism == QLatin1String("mech1")) { |
1442 | emit result(outData); |
1443 | return; |
1444 | } |
1445 | |
1446 | - if (mechanism == QLatin1String("mech2")) { |
1447 | + if (m_mechanism == QLatin1String("mech2")) { |
1448 | SignOn::UiSessionData data; |
1449 | data.setQueryPassword(true); |
1450 | emit userActionRequired(data); |
1451 | |
1452 | === modified file 'src/plugins/test/ssotestplugin.h' |
1453 | --- src/plugins/test/ssotestplugin.h 2012-04-24 11:57:25 +0000 |
1454 | +++ src/plugins/test/ssotestplugin.h 2016-08-24 14:26:52 +0000 |
1455 | @@ -2,6 +2,7 @@ |
1456 | * This file is part of signon |
1457 | * |
1458 | * Copyright (C) 2009-2010 Nokia Corporation. |
1459 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1460 | * |
1461 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1462 | * |
1463 | @@ -50,10 +51,13 @@ |
1464 | private: |
1465 | QString m_type; |
1466 | QStringList m_mechanisms; |
1467 | + SignOn::SessionData m_data; |
1468 | + QString m_mechanism; |
1469 | + QTimer m_timer; |
1470 | + int m_statusCounter; |
1471 | |
1472 | private Q_SLOTS: |
1473 | - void execProcess(const SignOn::SessionData &inData, |
1474 | - const QString &mechanism); |
1475 | + void execProcess(); |
1476 | }; |
1477 | |
1478 | } //namespace SsoTestPluginNS |
1479 | |
1480 | === modified file 'src/remotepluginprocess/debug.cpp' |
1481 | --- src/remotepluginprocess/debug.cpp 2012-04-18 13:06:27 +0000 |
1482 | +++ src/remotepluginprocess/debug.cpp 2016-08-24 14:26:52 +0000 |
1483 | @@ -2,6 +2,7 @@ |
1484 | * This file is part of signon |
1485 | * |
1486 | * Copyright (C) 2011 Nokia Corporation. |
1487 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1488 | * |
1489 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1490 | * |
1491 | |
1492 | === modified file 'src/remotepluginprocess/debug.h' |
1493 | --- src/remotepluginprocess/debug.h 2012-10-02 11:24:30 +0000 |
1494 | +++ src/remotepluginprocess/debug.h 2016-08-24 14:26:52 +0000 |
1495 | @@ -2,6 +2,7 @@ |
1496 | * This file is part of signon |
1497 | * |
1498 | * Copyright (C) 2011 Nokia Corporation. |
1499 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1500 | * |
1501 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1502 | * |
1503 | |
1504 | === modified file 'src/remotepluginprocess/main.cpp' |
1505 | --- src/remotepluginprocess/main.cpp 2013-08-20 08:19:54 +0000 |
1506 | +++ src/remotepluginprocess/main.cpp 2016-08-24 14:26:52 +0000 |
1507 | @@ -2,6 +2,7 @@ |
1508 | * This file is part of signon |
1509 | * |
1510 | * Copyright (C) 2009-2010 Nokia Corporation. |
1511 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1512 | * |
1513 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1514 | * |
1515 | @@ -31,8 +32,6 @@ |
1516 | #include <syslog.h> |
1517 | } |
1518 | |
1519 | -#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0) |
1520 | - |
1521 | #include "debug.h" |
1522 | #include "remotepluginprocess.h" |
1523 | |
1524 | @@ -42,8 +41,11 @@ |
1525 | |
1526 | RemotePluginProcess *process = NULL; |
1527 | |
1528 | -void messageHandler(QtMsgType type, const char *msg) |
1529 | +void messageHandler(QtMsgType type, const QMessageLogContext &context, |
1530 | + const QString & msg) |
1531 | { |
1532 | + Q_UNUSED(context); |
1533 | + |
1534 | if (debugLevel < 2) { |
1535 | if (type == QtDebugMsg) return; |
1536 | if (debugLevel < 1 && type == QtWarningMsg) return; |
1537 | @@ -59,13 +61,13 @@ |
1538 | default: priority = LOG_INFO; break; |
1539 | } |
1540 | |
1541 | - syslog(priority, "%s", msg); |
1542 | + syslog(priority, "%s", msg.toUtf8().constData()); |
1543 | } |
1544 | |
1545 | int main(int argc, char *argv[]) |
1546 | { |
1547 | openlog(NULL, LOG_CONS | LOG_PID, LOG_DAEMON); |
1548 | - qInstallMsgHandler(messageHandler); |
1549 | + qInstallMessageHandler(messageHandler); |
1550 | debugInit(); |
1551 | |
1552 | TRACE() << "handler:" << (void *)messageHandler; |
1553 | |
1554 | === modified file 'src/remotepluginprocess/my-network-proxy-factory.h' |
1555 | --- src/remotepluginprocess/my-network-proxy-factory.h 2012-09-17 07:32:20 +0000 |
1556 | +++ src/remotepluginprocess/my-network-proxy-factory.h 2016-08-24 14:26:52 +0000 |
1557 | @@ -1,7 +1,7 @@ |
1558 | /* |
1559 | * This file is part of signon |
1560 | * |
1561 | - * Copyright (C) 2012 Canonical Ltd. |
1562 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1563 | * |
1564 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1565 | * |
1566 | |
1567 | === modified file 'src/remotepluginprocess/remotepluginprocess.cpp' |
1568 | --- src/remotepluginprocess/remotepluginprocess.cpp 2012-09-17 07:32:20 +0000 |
1569 | +++ src/remotepluginprocess/remotepluginprocess.cpp 2016-08-24 14:26:52 +0000 |
1570 | @@ -2,6 +2,7 @@ |
1571 | * This file is part of signon |
1572 | * |
1573 | * Copyright (C) 2009-2010 Nokia Corporation. |
1574 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1575 | * |
1576 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1577 | * |
1578 | @@ -40,12 +41,11 @@ |
1579 | |
1580 | namespace RemotePluginProcessNS { |
1581 | |
1582 | -static CancelEventThread *cancelThread = NULL; |
1583 | - |
1584 | /* ---------------------- RemotePluginProcess ---------------------- */ |
1585 | |
1586 | RemotePluginProcess::RemotePluginProcess(QObject *parent): |
1587 | - QObject(parent) |
1588 | + QObject(parent), |
1589 | + m_currentOperation(PLUGIN_OP_STOP) |
1590 | { |
1591 | m_plugin = NULL; |
1592 | m_readnotifier = NULL; |
1593 | @@ -60,12 +60,6 @@ |
1594 | delete m_plugin; |
1595 | delete m_readnotifier; |
1596 | delete m_errnotifier; |
1597 | - |
1598 | - if (cancelThread) { |
1599 | - cancelThread->quit(); |
1600 | - cancelThread->wait(); |
1601 | - delete cancelThread; |
1602 | - } |
1603 | } |
1604 | |
1605 | RemotePluginProcess * |
1606 | @@ -159,11 +153,6 @@ |
1607 | connect(m_errnotifier, SIGNAL(activated(int)), |
1608 | this, SIGNAL(processStopped())); |
1609 | |
1610 | - if (!cancelThread) |
1611 | - cancelThread = new CancelEventThread(m_plugin); |
1612 | - |
1613 | - TRACE() << "cancel thread created"; |
1614 | - |
1615 | m_blobIOHandler = new BlobIOHandler(&m_inFile, &m_outFile, this); |
1616 | |
1617 | connect(m_blobIOHandler, |
1618 | @@ -201,12 +190,10 @@ |
1619 | error( |
1620 | Error(Error::InternalServer, |
1621 | QLatin1String("Failed to I/O session data to/from the signon daemon."))); |
1622 | - connect(m_readnotifier, SIGNAL(activated(int)), this, SLOT(startTask())); |
1623 | } |
1624 | |
1625 | void RemotePluginProcess::result(const SignOn::SessionData &data) |
1626 | { |
1627 | - disableCancelThread(); |
1628 | QDataStream out(&m_outFile); |
1629 | QVariantMap resultDataMap; |
1630 | |
1631 | @@ -237,8 +224,6 @@ |
1632 | |
1633 | void RemotePluginProcess::error(const SignOn::Error &err) |
1634 | { |
1635 | - disableCancelThread(); |
1636 | - |
1637 | QDataStream out(&m_outFile); |
1638 | |
1639 | out << (quint32)PLUGIN_RESPONSE_ERROR; |
1640 | @@ -252,7 +237,6 @@ |
1641 | void RemotePluginProcess::userActionRequired(const SignOn::UiSessionData &data) |
1642 | { |
1643 | TRACE(); |
1644 | - disableCancelThread(); |
1645 | |
1646 | QDataStream out(&m_outFile); |
1647 | QVariantMap resultDataMap; |
1648 | @@ -268,7 +252,6 @@ |
1649 | void RemotePluginProcess::refreshed(const SignOn::UiSessionData &data) |
1650 | { |
1651 | TRACE(); |
1652 | - disableCancelThread(); |
1653 | |
1654 | QDataStream out(&m_outFile); |
1655 | QVariantMap resultDataMap; |
1656 | @@ -276,8 +259,6 @@ |
1657 | foreach(QString key, data.propertyNames()) |
1658 | resultDataMap[key] = data.getProperty(key); |
1659 | |
1660 | - m_readnotifier->setEnabled(true); |
1661 | - |
1662 | out << (quint32)PLUGIN_RESPONSE_REFRESHED; |
1663 | |
1664 | m_blobIOHandler->sendData(resultDataMap); |
1665 | @@ -330,14 +311,11 @@ |
1666 | { |
1667 | QDataStream in(&m_inFile); |
1668 | |
1669 | - |
1670 | in >> m_currentMechanism; |
1671 | |
1672 | int processBlobSize = -1; |
1673 | in >> processBlobSize; |
1674 | |
1675 | - disconnect(m_readnotifier, SIGNAL(activated(int)), this, SLOT(startTask())); |
1676 | - |
1677 | m_currentOperation = PLUGIN_OP_PROCESS; |
1678 | m_blobIOHandler->receiveData(processBlobSize); |
1679 | } |
1680 | @@ -348,8 +326,6 @@ |
1681 | int processBlobSize = -1; |
1682 | in >> processBlobSize; |
1683 | |
1684 | - disconnect(m_readnotifier, SIGNAL(activated(int)), this, SLOT(startTask())); |
1685 | - |
1686 | m_currentOperation = PLUGIN_OP_PROCESS_UI; |
1687 | m_blobIOHandler->receiveData(processBlobSize); |
1688 | } |
1689 | @@ -360,17 +336,12 @@ |
1690 | int processBlobSize = -1; |
1691 | in >> processBlobSize; |
1692 | |
1693 | - disconnect(m_readnotifier, SIGNAL(activated(int)), this, SLOT(startTask())); |
1694 | - |
1695 | m_currentOperation = PLUGIN_OP_REFRESH; |
1696 | m_blobIOHandler->receiveData(processBlobSize); |
1697 | } |
1698 | |
1699 | void RemotePluginProcess::sessionDataReceived(const QVariantMap &sessionDataMap) |
1700 | { |
1701 | - enableCancelThread(); |
1702 | - TRACE() << "The cancel thread is started"; |
1703 | - |
1704 | if (m_currentOperation == PLUGIN_OP_PROCESS) { |
1705 | SessionData inData(sessionDataMap); |
1706 | m_plugin->process(inData, m_currentMechanism); |
1707 | @@ -391,81 +362,33 @@ |
1708 | } |
1709 | |
1710 | m_currentOperation = PLUGIN_OP_STOP; |
1711 | - connect(m_readnotifier, SIGNAL(activated(int)), this, SLOT(startTask())); |
1712 | -} |
1713 | - |
1714 | -void RemotePluginProcess::enableCancelThread() |
1715 | -{ |
1716 | - QEventLoop loop; |
1717 | - connect(cancelThread, |
1718 | - SIGNAL(started()), |
1719 | - &loop, |
1720 | - SLOT(quit())); |
1721 | - |
1722 | - m_readnotifier->setEnabled(false); |
1723 | - QTimer::singleShot(0.5*1000, &loop, SLOT(quit())); |
1724 | - cancelThread->start(); |
1725 | - loop.exec(); |
1726 | - QThread::yieldCurrentThread(); |
1727 | -} |
1728 | - |
1729 | -void RemotePluginProcess::disableCancelThread() |
1730 | -{ |
1731 | - if (!cancelThread->isRunning()) |
1732 | - return; |
1733 | - |
1734 | - /** |
1735 | - * Sort of terrible workaround which |
1736 | - * I do not know how to fix: the thread |
1737 | - * could hang up during wait up without |
1738 | - * these loops and sleeps |
1739 | - */ |
1740 | - cancelThread->quit(); |
1741 | - |
1742 | - TRACE() << "Before the isFinished loop "; |
1743 | - |
1744 | - int i = 0; |
1745 | - while (!cancelThread->isFinished()) { |
1746 | - cancelThread->quit(); |
1747 | - TRACE() << "Internal iteration " << i++; |
1748 | - usleep(0.005 * 1000000); |
1749 | - } |
1750 | - |
1751 | - if (!cancelThread->wait(500)) { |
1752 | - BLAME() << "Cannot disable cancel thread"; |
1753 | - int i; |
1754 | - for (i = 0; i < 5; i++) { |
1755 | - usleep(0.01 * 1000000); |
1756 | - if (cancelThread->wait(500)) |
1757 | - break; |
1758 | - } |
1759 | - |
1760 | - if (i == 5) { |
1761 | - BLAME() << "Cannot do anything with cancel thread"; |
1762 | - cancelThread->terminate(); |
1763 | - cancelThread->wait(); |
1764 | - } |
1765 | - } |
1766 | - |
1767 | - m_readnotifier->setEnabled(true); |
1768 | } |
1769 | |
1770 | void RemotePluginProcess::startTask() |
1771 | { |
1772 | + if (m_blobIOHandler->isReading()) { |
1773 | + /* A data blob is being read; there's nothing for us here */ |
1774 | + return; |
1775 | + } |
1776 | + |
1777 | quint32 opcode = PLUGIN_OP_STOP; |
1778 | bool is_stopped = false; |
1779 | |
1780 | QDataStream in(&m_inFile); |
1781 | in >> opcode; |
1782 | |
1783 | + /* If the plugin is busy, the only allowed action here is canceling */ |
1784 | + if (m_currentOperation != PLUGIN_OP_STOP && opcode != PLUGIN_OP_CANCEL) { |
1785 | + qCritical() << "Operation requested while plugin busy! - code" << |
1786 | + opcode; |
1787 | + m_plugin->abort(); |
1788 | + Q_EMIT processStopped(); |
1789 | + return; |
1790 | + } |
1791 | + |
1792 | switch (opcode) { |
1793 | case PLUGIN_OP_CANCEL: |
1794 | - { |
1795 | - m_plugin->cancel(); break; |
1796 | - //still do not have clear understanding |
1797 | - //of the cancelation-stop mechanism |
1798 | - //is_stopped = true; |
1799 | - } |
1800 | + m_plugin->cancel(); |
1801 | break; |
1802 | case PLUGIN_OP_TYPE: |
1803 | type(); |
1804 | @@ -507,56 +430,5 @@ |
1805 | } |
1806 | } |
1807 | |
1808 | -CancelEventThread::CancelEventThread(AuthPluginInterface *plugin) |
1809 | -{ |
1810 | - m_plugin = plugin; |
1811 | - m_cancelNotifier = 0; |
1812 | -} |
1813 | - |
1814 | -CancelEventThread::~CancelEventThread() |
1815 | -{ |
1816 | - delete m_cancelNotifier; |
1817 | -} |
1818 | - |
1819 | -void CancelEventThread::run() |
1820 | -{ |
1821 | - if (!m_cancelNotifier) { |
1822 | - m_cancelNotifier = new QSocketNotifier(STDIN_FILENO, |
1823 | - QSocketNotifier::Read); |
1824 | - connect(m_cancelNotifier, SIGNAL(activated(int)), |
1825 | - this, SLOT(cancel()), Qt::DirectConnection); |
1826 | - } |
1827 | - |
1828 | - m_cancelNotifier->setEnabled(true); |
1829 | - exec(); |
1830 | - m_cancelNotifier->setEnabled(false); |
1831 | -} |
1832 | - |
1833 | -void CancelEventThread::cancel() |
1834 | -{ |
1835 | - char buf[4]; |
1836 | - memset(buf, 0, 4); |
1837 | - int n = 0; |
1838 | - |
1839 | - if (!(n = read(STDIN_FILENO, buf, 4))) { |
1840 | - qCritical() << "Cannot read from cancel socket"; |
1841 | - return; |
1842 | - } |
1843 | - |
1844 | - /* |
1845 | - * Read the actual value of |
1846 | - * */ |
1847 | - QByteArray ba(buf, 4); |
1848 | - quint32 opcode; |
1849 | - QDataStream ds(ba); |
1850 | - ds >> opcode; |
1851 | - |
1852 | - if (opcode != PLUGIN_OP_CANCEL) |
1853 | - qCritical() << "wrong operation code: breakage of remotepluginprocess " |
1854 | - "threads synchronization: " << opcode; |
1855 | - |
1856 | - m_plugin->cancel(); |
1857 | -} |
1858 | - |
1859 | } //namespace RemotePluginProcessNS |
1860 | |
1861 | |
1862 | === modified file 'src/remotepluginprocess/remotepluginprocess.h' |
1863 | --- src/remotepluginprocess/remotepluginprocess.h 2012-04-18 13:06:27 +0000 |
1864 | +++ src/remotepluginprocess/remotepluginprocess.h 2016-08-24 14:26:52 +0000 |
1865 | @@ -2,6 +2,7 @@ |
1866 | * This file is part of signon |
1867 | * |
1868 | * Copyright (C) 2009-2010 Nokia Corporation. |
1869 | + * Copyright (C) 2012-2016 Canonical Ltd. |
1870 | * |
1871 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1872 | * |
1873 | @@ -67,28 +68,6 @@ |
1874 | namespace RemotePluginProcessNS { |
1875 | |
1876 | /*! |
1877 | - * @class CancelEventThread |
1878 | - * Thread to enable cancel functionality. |
1879 | - */ |
1880 | -class CancelEventThread: public QThread |
1881 | -{ |
1882 | - Q_OBJECT |
1883 | - |
1884 | -public: |
1885 | - CancelEventThread(AuthPluginInterface *plugin); |
1886 | - ~CancelEventThread(); |
1887 | - |
1888 | - void run(); |
1889 | - |
1890 | -public Q_SLOTS: |
1891 | - void cancel(); |
1892 | - |
1893 | -private: |
1894 | - AuthPluginInterface *m_plugin; |
1895 | - QSocketNotifier *m_cancelNotifier; |
1896 | -}; |
1897 | - |
1898 | -/*! |
1899 | * @class RemotePluginProcess |
1900 | * Class to execute plugin process. |
1901 | */ |
1902 | @@ -136,9 +115,6 @@ |
1903 | void userActionFinished(); |
1904 | void refresh(); |
1905 | |
1906 | - void enableCancelThread(); |
1907 | - void disableCancelThread(); |
1908 | - |
1909 | private Q_SLOTS: |
1910 | void result(const SignOn::SessionData &data); |
1911 | void store(const SignOn::SessionData &data); |
1912 | |
1913 | === modified file 'src/remotepluginprocess/remotepluginprocess.pro' |
1914 | --- src/remotepluginprocess/remotepluginprocess.pro 2015-10-27 09:58:39 +0000 |
1915 | +++ src/remotepluginprocess/remotepluginprocess.pro 2016-08-24 14:26:52 +0000 |
1916 | @@ -26,7 +26,7 @@ |
1917 | build_all \ |
1918 | link_pkgconfig |
1919 | |
1920 | -system(pkg-config --exists libproxy-1.0) { |
1921 | +lessThan(QT_VERSION, "5.5.0"):system(pkg-config --exists libproxy-1.0) { |
1922 | DEFINES += HAVE_LIBPROXY |
1923 | PKGCONFIG += libproxy-1.0 |
1924 | SOURCES += my-network-proxy-factory.cpp |
1925 | |
1926 | === modified file 'src/signond/accesscontrolmanagerhelper.cpp' |
1927 | --- src/signond/accesscontrolmanagerhelper.cpp 2014-11-14 10:45:01 +0000 |
1928 | +++ src/signond/accesscontrolmanagerhelper.cpp 2016-08-24 14:26:52 +0000 |
1929 | @@ -4,9 +4,8 @@ |
1930 | * |
1931 | * Copyright (C) 2009-2010 Nokia Corporation. |
1932 | * Copyright (C) 2011 Intel Corporation. |
1933 | - * Copyright (C) 2013 Canonical Ltd. |
1934 | + * Copyright (C) 2013-2016 Canonical Ltd. |
1935 | * |
1936 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
1937 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1938 | * Contact: Elena Reshetova <elena.reshetova@intel.com> |
1939 | * |
1940 | |
1941 | === modified file 'src/signond/accesscontrolmanagerhelper.h' |
1942 | --- src/signond/accesscontrolmanagerhelper.h 2013-08-20 08:01:44 +0000 |
1943 | +++ src/signond/accesscontrolmanagerhelper.h 2016-08-24 14:26:52 +0000 |
1944 | @@ -4,9 +4,8 @@ |
1945 | * |
1946 | * Copyright (C) 2009-2010 Nokia Corporation. |
1947 | * Copyright (C) 2011 Intel Corporation. |
1948 | - * Copyright (C) 2013 Canonical Ltd. |
1949 | + * Copyright (C) 2013-2016 Canonical Ltd. |
1950 | * |
1951 | - * Contact: Aurel Popirtac <ext-Aurel.Popirtac@nokia.com> |
1952 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1953 | * Contact: Elena Reshetova <elena.reshetova@intel.com> |
1954 | * |
1955 | |
1956 | === added file 'src/signond/backup.cpp' |
1957 | --- src/signond/backup.cpp 1970-01-01 00:00:00 +0000 |
1958 | +++ src/signond/backup.cpp 2016-08-24 14:26:52 +0000 |
1959 | @@ -0,0 +1,343 @@ |
1960 | +/* |
1961 | + * This file is part of signon |
1962 | + * |
1963 | + * Copyright (C) 2009-2010 Nokia Corporation. |
1964 | + * Copyright (C) 2013-2016 Canonical Ltd. |
1965 | + * |
1966 | + * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
1967 | + * |
1968 | + * This library is free software; you can redistribute it and/or |
1969 | + * modify it under the terms of the GNU Lesser General Public License |
1970 | + * version 2.1 as published by the Free Software Foundation. |
1971 | + * |
1972 | + * This library is distributed in the hope that it will be useful, but |
1973 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
1974 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1975 | + * Lesser General Public License for more details. |
1976 | + * |
1977 | + * You should have received a copy of the GNU Lesser General Public |
1978 | + * License along with this library; if not, write to the Free Software |
1979 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
1980 | + * 02110-1301 USA |
1981 | + */ |
1982 | + |
1983 | +#include <QCoreApplication> |
1984 | +#include <QDebug> |
1985 | +#include <QDir> |
1986 | +#include <QFile> |
1987 | +#include <QDBusConnection> |
1988 | + |
1989 | +#include "SignOn/misc.h" |
1990 | + |
1991 | +#include "backup.h" |
1992 | +#include "backup_adaptor.h" |
1993 | +#include "credentialsaccessmanager.h" |
1994 | +#include "signond-common.h" |
1995 | + |
1996 | +#define BACKUP_DIR_NAME() \ |
1997 | + (QDir::separator() + QLatin1String("backup")) |
1998 | + |
1999 | +using namespace SignOn; |
2000 | + |
2001 | +namespace SignonDaemonNS { |
2002 | + |
2003 | +Backup::Backup(CredentialsAccessManager *cam, bool backupMode, |
2004 | + QObject *parent): |
2005 | + QObject(parent), |
2006 | + m_cam(cam), |
2007 | + m_backup(backupMode) |
2008 | +{ |
2009 | + QDBusConnection sessionConnection = QDBusConnection::sessionBus(); |
2010 | + |
2011 | + QDBusConnection::RegisterOptions registerSessionOptions = |
2012 | + QDBusConnection::ExportAdaptors; |
2013 | + |
2014 | + (void)new BackupclientAdaptor(this); |
2015 | + |
2016 | + if (!sessionConnection.registerObject(SIGNOND_DAEMON_OBJECTPATH |
2017 | + + QLatin1String("/Backup"), |
2018 | + this, registerSessionOptions)) { |
2019 | + TRACE() << "Object cannot be registered"; |
2020 | + |
2021 | + qFatal("SignonDaemon requires to register backup object"); |
2022 | + } |
2023 | + |
2024 | + if (!sessionConnection.registerService(SIGNOND_SERVICE + |
2025 | + QLatin1String(".Backup"))) { |
2026 | + QDBusError err = sessionConnection.lastError(); |
2027 | + TRACE() << "Service cannot be registered: " << |
2028 | + err.errorString(err.type()); |
2029 | + |
2030 | + qFatal("SignonDaemon requires to register backup service"); |
2031 | + } |
2032 | +} |
2033 | + |
2034 | +Backup::~Backup() |
2035 | +{ |
2036 | + QDBusConnection sessionConnection = QDBusConnection::sessionBus(); |
2037 | + sessionConnection.unregisterObject(SIGNOND_DAEMON_OBJECTPATH |
2038 | + + QLatin1String("/Backup")); |
2039 | + sessionConnection.unregisterService(SIGNOND_SERVICE |
2040 | + + QLatin1String(".Backup")); |
2041 | +} |
2042 | + |
2043 | +void Backup::eraseBackupDir() const |
2044 | +{ |
2045 | + const CAMConfiguration &config = m_cam->configuration(); |
2046 | + QString backupRoot = config.m_storagePath + BACKUP_DIR_NAME(); |
2047 | + |
2048 | + QDir target(backupRoot); |
2049 | + if (!target.exists()) return; |
2050 | + |
2051 | + QStringList targetEntries = target.entryList(QDir::Files); |
2052 | + foreach (QString entry, targetEntries) { |
2053 | + target.remove(entry); |
2054 | + } |
2055 | + |
2056 | + target.rmdir(backupRoot); |
2057 | +} |
2058 | + |
2059 | +bool Backup::copyToBackupDir(const QStringList &fileNames) const |
2060 | +{ |
2061 | + const CAMConfiguration &config = m_cam->configuration(); |
2062 | + QString backupRoot = config.m_storagePath + BACKUP_DIR_NAME(); |
2063 | + |
2064 | + QDir target(backupRoot); |
2065 | + if (!target.exists() && !target.mkpath(backupRoot)) { |
2066 | + qCritical() << "Cannot create target directory"; |
2067 | + return false; |
2068 | + } |
2069 | + |
2070 | + setUserOwnership(backupRoot); |
2071 | + |
2072 | + /* Now copy the files to be backed up */ |
2073 | + bool ok = true; |
2074 | + foreach (const QString &fileName, fileNames) { |
2075 | + /* Remove the target file, if it exists */ |
2076 | + if (target.exists(fileName)) |
2077 | + target.remove(fileName); |
2078 | + |
2079 | + /* Copy the source into the target directory */ |
2080 | + QString source = config.m_storagePath + QDir::separator() + fileName; |
2081 | + if (!QFile::exists(source)) continue; |
2082 | + |
2083 | + QString destination = backupRoot + QDir::separator() + fileName; |
2084 | + ok = QFile::copy(source, destination); |
2085 | + if (!ok) { |
2086 | + BLAME() << "Copying" << source << "to" << destination << "failed"; |
2087 | + break; |
2088 | + } |
2089 | + |
2090 | + setUserOwnership(destination); |
2091 | + } |
2092 | + |
2093 | + return ok; |
2094 | +} |
2095 | + |
2096 | +bool Backup::copyFromBackupDir(const QStringList &fileNames) const |
2097 | +{ |
2098 | + const CAMConfiguration &config = m_cam->configuration(); |
2099 | + QString backupRoot = config.m_storagePath + BACKUP_DIR_NAME(); |
2100 | + |
2101 | + QDir sourceDir(backupRoot); |
2102 | + if (!sourceDir.exists()) { |
2103 | + TRACE() << "Backup directory does not exist!"; |
2104 | + } |
2105 | + |
2106 | + if (!sourceDir.exists(config.m_dbName)) { |
2107 | + TRACE() << "Backup does not contain DB:" << config.m_dbName; |
2108 | + } |
2109 | + |
2110 | + /* Now restore the files from the backup */ |
2111 | + bool ok = true; |
2112 | + QDir target(config.m_storagePath); |
2113 | + QStringList movedFiles, copiedFiles; |
2114 | + foreach (const QString &fileName, fileNames) { |
2115 | + /* Rename the target file, if it exists */ |
2116 | + if (target.exists(fileName)) { |
2117 | + if (target.rename(fileName, fileName + QLatin1String(".bak"))) |
2118 | + movedFiles += fileName; |
2119 | + } |
2120 | + |
2121 | + /* Copy the source into the target directory */ |
2122 | + QString source = backupRoot + QDir::separator() + fileName; |
2123 | + if (!QFile::exists(source)) { |
2124 | + TRACE() << "Ignoring file not present in backup:" << source; |
2125 | + continue; |
2126 | + } |
2127 | + |
2128 | + QString destination = |
2129 | + config.m_storagePath + QDir::separator() + fileName; |
2130 | + |
2131 | + ok = QFile::copy(source, destination); |
2132 | + if (ok) { |
2133 | + copiedFiles << fileName; |
2134 | + } else { |
2135 | + qWarning() << "Copy failed for:" << source; |
2136 | + break; |
2137 | + } |
2138 | + } |
2139 | + |
2140 | + if (!ok) { |
2141 | + qWarning() << "Restore failed, recovering previous DB"; |
2142 | + |
2143 | + foreach (const QString &fileName, copiedFiles) { |
2144 | + target.remove(fileName); |
2145 | + } |
2146 | + |
2147 | + foreach (const QString &fileName, movedFiles) { |
2148 | + if (!target.rename(fileName + QLatin1String(".bak"), fileName)) { |
2149 | + qCritical() << "Could not recover:" << fileName; |
2150 | + } |
2151 | + } |
2152 | + } else { |
2153 | + /* delete ".bak" files */ |
2154 | + foreach (const QString &fileName, movedFiles) { |
2155 | + target.remove(fileName + QLatin1String(".bak")); |
2156 | + } |
2157 | + |
2158 | + } |
2159 | + return ok; |
2160 | +} |
2161 | + |
2162 | +bool Backup::createStorageFileTree(const QStringList &backupFiles) const |
2163 | +{ |
2164 | + const CAMConfiguration &config = m_cam->configuration(); |
2165 | + QDir storageDir(config.m_storagePath); |
2166 | + |
2167 | + if (!storageDir.exists()) { |
2168 | + if (!storageDir.mkpath(config.m_storagePath)) { |
2169 | + qCritical() << "Could not create storage dir for backup."; |
2170 | + return false; |
2171 | + } |
2172 | + } |
2173 | + |
2174 | + foreach (const QString &fileName, backupFiles) { |
2175 | + if (storageDir.exists(fileName)) continue; |
2176 | + |
2177 | + QString filePath = storageDir.path() + QDir::separator() + fileName; |
2178 | + QFile file(filePath); |
2179 | + if (!file.open(QIODevice::WriteOnly)) { |
2180 | + qCritical() << "Failed to create empty file for backup:" << filePath; |
2181 | + return false; |
2182 | + } else { |
2183 | + file.close(); |
2184 | + } |
2185 | + } |
2186 | + |
2187 | + return true; |
2188 | +} |
2189 | + |
2190 | +uchar Backup::backupStarts() |
2191 | +{ |
2192 | + TRACE() << "backup"; |
2193 | + if (!m_backup && m_cam->credentialsSystemOpened()) |
2194 | + { |
2195 | + m_cam->closeCredentialsSystem(); |
2196 | + if (m_cam->credentialsSystemOpened()) |
2197 | + { |
2198 | + qCritical() << "Cannot close credentials database"; |
2199 | + return 2; |
2200 | + } |
2201 | + } |
2202 | + |
2203 | + const CAMConfiguration &config = m_cam->configuration(); |
2204 | + |
2205 | + /* do backup copy: prepare the list of files to be backed up */ |
2206 | + QStringList backupFiles; |
2207 | + backupFiles << config.m_dbName; |
2208 | + backupFiles << m_cam->backupFiles(); |
2209 | + |
2210 | + /* make sure that all the backup files and storage directory exist: |
2211 | + create storage dir and empty files if not so, as backup/restore |
2212 | + operations must be consistent */ |
2213 | + if (!createStorageFileTree(backupFiles)) { |
2214 | + qCritical() << "Cannot create backup file tree."; |
2215 | + return 2; |
2216 | + } |
2217 | + |
2218 | + /* perform the copy */ |
2219 | + eraseBackupDir(); |
2220 | + if (!copyToBackupDir(backupFiles)) { |
2221 | + qCritical() << "Cannot copy database"; |
2222 | + if (!m_backup) |
2223 | + m_cam->openCredentialsSystem(); |
2224 | + return 2; |
2225 | + } |
2226 | + |
2227 | + if (!m_backup) |
2228 | + { |
2229 | + //mount file system back |
2230 | + if (!m_cam->openCredentialsSystem()) { |
2231 | + qCritical() << "Cannot reopen database"; |
2232 | + } |
2233 | + } |
2234 | + return 0; |
2235 | +} |
2236 | + |
2237 | +uchar Backup::backupFinished() |
2238 | +{ |
2239 | + TRACE() << "close"; |
2240 | + |
2241 | + eraseBackupDir(); |
2242 | + |
2243 | + if (m_backup) |
2244 | + { |
2245 | + //close daemon |
2246 | + TRACE() << "close daemon"; |
2247 | + QCoreApplication::quit(); |
2248 | + } |
2249 | + |
2250 | + return 0; |
2251 | + } |
2252 | + |
2253 | +/* |
2254 | + * Does nothing but start-on-demand |
2255 | + * */ |
2256 | +uchar Backup::restoreStarts() |
2257 | +{ |
2258 | + TRACE(); |
2259 | + return 0; |
2260 | +} |
2261 | + |
2262 | +uchar Backup::restoreFinished() |
2263 | +{ |
2264 | + TRACE() << "restore"; |
2265 | + //restore requested |
2266 | + if (m_cam->credentialsSystemOpened()) |
2267 | + { |
2268 | + //umount file system |
2269 | + if (!m_cam->closeCredentialsSystem()) |
2270 | + { |
2271 | + qCritical() << "database cannot be closed"; |
2272 | + return 2; |
2273 | + } |
2274 | + } |
2275 | + |
2276 | + const CAMConfiguration &config = m_cam->configuration(); |
2277 | + |
2278 | + QStringList backupFiles; |
2279 | + backupFiles << config.m_dbName; |
2280 | + backupFiles << m_cam->backupFiles(); |
2281 | + |
2282 | + /* perform the copy */ |
2283 | + if (!copyFromBackupDir(backupFiles)) { |
2284 | + qCritical() << "Cannot copy database"; |
2285 | + m_cam->openCredentialsSystem(); |
2286 | + return 2; |
2287 | + } |
2288 | + |
2289 | + eraseBackupDir(); |
2290 | + |
2291 | + //TODO check database integrity |
2292 | + if (!m_backup) |
2293 | + { |
2294 | + //mount file system back |
2295 | + if (!m_cam->openCredentialsSystem()) |
2296 | + return 2; |
2297 | + } |
2298 | + |
2299 | + return 0; |
2300 | +} |
2301 | + |
2302 | +} //namespace SignonDaemonNS |
2303 | |
2304 | === added file 'src/signond/backup.h' |
2305 | --- src/signond/backup.h 1970-01-01 00:00:00 +0000 |
2306 | +++ src/signond/backup.h 2016-08-24 14:26:52 +0000 |
2307 | @@ -0,0 +1,63 @@ |
2308 | +/* |
2309 | + * This file is part of signon |
2310 | + * |
2311 | + * Copyright (C) 2009-2010 Nokia Corporation. |
2312 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2313 | + * |
2314 | + * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2315 | + * |
2316 | + * This library is free software; you can redistribute it and/or |
2317 | + * modify it under the terms of the GNU Lesser General Public License |
2318 | + * version 2.1 as published by the Free Software Foundation. |
2319 | + * |
2320 | + * This library is distributed in the hope that it will be useful, but |
2321 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
2322 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2323 | + * Lesser General Public License for more details. |
2324 | + * |
2325 | + * You should have received a copy of the GNU Lesser General Public |
2326 | + * License along with this library; if not, write to the Free Software |
2327 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
2328 | + * 02110-1301 USA |
2329 | + */ |
2330 | + |
2331 | +#ifndef SIGNON_BACKUP_H_ |
2332 | +#define SIGNON_BACKUP_H_ |
2333 | + |
2334 | +#include <QDBusContext> |
2335 | +#include <QObject> |
2336 | +#include <QString> |
2337 | + |
2338 | +namespace SignonDaemonNS { |
2339 | + |
2340 | +class CredentialsAccessManager; |
2341 | + |
2342 | +class Backup: public QObject, protected QDBusContext |
2343 | +{ |
2344 | + Q_OBJECT |
2345 | + |
2346 | +public: |
2347 | + Backup(CredentialsAccessManager *cam, bool backupMode, |
2348 | + QObject *parent = 0); |
2349 | + ~Backup(); |
2350 | + |
2351 | +public Q_SLOTS: |
2352 | + uchar backupStarts(); |
2353 | + uchar backupFinished(); |
2354 | + uchar restoreStarts(); |
2355 | + uchar restoreFinished(); |
2356 | + |
2357 | +private: |
2358 | + void eraseBackupDir() const; |
2359 | + bool copyToBackupDir(const QStringList &fileNames) const; |
2360 | + bool copyFromBackupDir(const QStringList &fileNames) const; |
2361 | + bool createStorageFileTree(const QStringList &fileNames) const; |
2362 | + |
2363 | +private: |
2364 | + CredentialsAccessManager *m_cam; |
2365 | + bool m_backup; // whether signond was started just to take a backup |
2366 | +}; |
2367 | + |
2368 | +} // namespace |
2369 | + |
2370 | +#endif /* SIGNON_BACKUP_H_ */ |
2371 | |
2372 | === modified file 'src/signond/credentialsaccessmanager.cpp' |
2373 | --- src/signond/credentialsaccessmanager.cpp 2013-10-14 09:18:41 +0000 |
2374 | +++ src/signond/credentialsaccessmanager.cpp 2016-08-24 14:26:52 +0000 |
2375 | @@ -4,8 +4,8 @@ |
2376 | * |
2377 | * Copyright (C) 2009-2010 Nokia Corporation. |
2378 | * Copyright (C) 2011 Intel Corporation. |
2379 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2380 | * |
2381 | - * Contact: Aurel Popirtac <mailto:ext-Aurel.Popirtac@nokia.com> |
2382 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2383 | * Contact: Jussi Laako <jussi.laako@linux.intel.com> |
2384 | * |
2385 | |
2386 | === modified file 'src/signond/credentialsaccessmanager.h' |
2387 | --- src/signond/credentialsaccessmanager.h 2012-04-18 13:06:27 +0000 |
2388 | +++ src/signond/credentialsaccessmanager.h 2016-08-24 14:26:52 +0000 |
2389 | @@ -3,8 +3,8 @@ |
2390 | * This file is part of signon |
2391 | * |
2392 | * Copyright (C) 2009-2010 Nokia Corporation. |
2393 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2394 | * |
2395 | - * Contact: Aurel Popirtac <mailto:ext-Aurel.Popirtac@nokia.com> |
2396 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2397 | * |
2398 | * This library is free software; you can redistribute it and/or |
2399 | |
2400 | === modified file 'src/signond/credentialsdb.cpp' |
2401 | --- src/signond/credentialsdb.cpp 2014-08-21 07:33:45 +0000 |
2402 | +++ src/signond/credentialsdb.cpp 2016-08-24 14:26:52 +0000 |
2403 | @@ -3,9 +3,8 @@ |
2404 | * This file is part of signon |
2405 | * |
2406 | * Copyright (C) 2009-2010 Nokia Corporation. |
2407 | - * Copyright (C) 2012 Canonical Ltd. |
2408 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2409 | * |
2410 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
2411 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2412 | * |
2413 | * This library is free software; you can redistribute it and/or |
2414 | |
2415 | === modified file 'src/signond/credentialsdb.h' |
2416 | --- src/signond/credentialsdb.h 2014-08-21 07:33:45 +0000 |
2417 | +++ src/signond/credentialsdb.h 2016-08-24 14:26:52 +0000 |
2418 | @@ -3,9 +3,8 @@ |
2419 | * This file is part of signon |
2420 | * |
2421 | * Copyright (C) 2009-2010 Nokia Corporation. |
2422 | - * Copyright (C) 2012 Canonical Ltd. |
2423 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2424 | * |
2425 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
2426 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2427 | * |
2428 | * This library is free software; you can redistribute it and/or |
2429 | |
2430 | === modified file 'src/signond/credentialsdb_p.h' |
2431 | --- src/signond/credentialsdb_p.h 2012-08-27 13:42:05 +0000 |
2432 | +++ src/signond/credentialsdb_p.h 2016-08-24 14:26:52 +0000 |
2433 | @@ -3,7 +3,7 @@ |
2434 | * This file is part of signon |
2435 | * |
2436 | * Copyright (C) 2009-2010 Nokia Corporation. |
2437 | - * Copyright (C) 2012 Canonical Ltd. |
2438 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2439 | * |
2440 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2441 | * |
2442 | |
2443 | === modified file 'src/signond/default-crypto-manager.cpp' |
2444 | --- src/signond/default-crypto-manager.cpp 2011-11-09 15:46:57 +0000 |
2445 | +++ src/signond/default-crypto-manager.cpp 2016-08-24 14:26:52 +0000 |
2446 | @@ -2,7 +2,7 @@ |
2447 | /* |
2448 | * This file is part of signon |
2449 | * |
2450 | - * Copyright (C) 2011 Canonical Ltd. |
2451 | + * Copyright (C) 2011-2016 Canonical Ltd. |
2452 | * |
2453 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2454 | * |
2455 | |
2456 | === modified file 'src/signond/default-crypto-manager.h' |
2457 | --- src/signond/default-crypto-manager.h 2012-04-18 13:03:21 +0000 |
2458 | +++ src/signond/default-crypto-manager.h 2016-08-24 14:26:52 +0000 |
2459 | @@ -2,7 +2,7 @@ |
2460 | /* |
2461 | * This file is part of signon |
2462 | * |
2463 | - * Copyright (C) 2011 Canonical Ltd. |
2464 | + * Copyright (C) 2011-2016 Canonical Ltd. |
2465 | * |
2466 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2467 | * |
2468 | |
2469 | === modified file 'src/signond/default-key-authorizer.cpp' |
2470 | --- src/signond/default-key-authorizer.cpp 2012-04-18 13:06:27 +0000 |
2471 | +++ src/signond/default-key-authorizer.cpp 2016-08-24 14:26:52 +0000 |
2472 | @@ -2,6 +2,7 @@ |
2473 | * This file is part of signon |
2474 | * |
2475 | * Copyright (C) 2011 Nokia Corporation. |
2476 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2477 | * |
2478 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2479 | * |
2480 | |
2481 | === modified file 'src/signond/default-key-authorizer.h' |
2482 | --- src/signond/default-key-authorizer.h 2012-04-18 13:06:27 +0000 |
2483 | +++ src/signond/default-key-authorizer.h 2016-08-24 14:26:52 +0000 |
2484 | @@ -2,6 +2,7 @@ |
2485 | * This file is part of signon |
2486 | * |
2487 | * Copyright (C) 2011 Nokia Corporation. |
2488 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2489 | * |
2490 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2491 | * |
2492 | |
2493 | === modified file 'src/signond/default-secrets-storage.cpp' |
2494 | --- src/signond/default-secrets-storage.cpp 2015-02-03 02:00:32 +0000 |
2495 | +++ src/signond/default-secrets-storage.cpp 2016-08-24 14:26:52 +0000 |
2496 | @@ -2,7 +2,7 @@ |
2497 | /* |
2498 | * This file is part of signon |
2499 | * |
2500 | - * Copyright (C) 2011 Canonical Ltd. |
2501 | + * Copyright (C) 2011-2016 Canonical Ltd. |
2502 | * |
2503 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2504 | * |
2505 | |
2506 | === modified file 'src/signond/default-secrets-storage.h' |
2507 | --- src/signond/default-secrets-storage.h 2015-02-03 02:00:32 +0000 |
2508 | +++ src/signond/default-secrets-storage.h 2016-08-24 14:26:52 +0000 |
2509 | @@ -2,7 +2,7 @@ |
2510 | /* |
2511 | * This file is part of signon |
2512 | * |
2513 | - * Copyright (C) 2011 Canonical Ltd. |
2514 | + * Copyright (C) 2011-2016 Canonical Ltd. |
2515 | * |
2516 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2517 | * |
2518 | |
2519 | === modified file 'src/signond/main.cpp' |
2520 | --- src/signond/main.cpp 2012-04-18 13:06:27 +0000 |
2521 | +++ src/signond/main.cpp 2016-08-24 14:26:52 +0000 |
2522 | @@ -2,6 +2,7 @@ |
2523 | * This file is part of signon |
2524 | * |
2525 | * Copyright (C) 2009-2010 Nokia Corporation. |
2526 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2527 | * |
2528 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2529 | * |
2530 | |
2531 | === modified file 'src/signond/pluginproxy.cpp' |
2532 | --- src/signond/pluginproxy.cpp 2015-01-23 08:41:04 +0000 |
2533 | +++ src/signond/pluginproxy.cpp 2016-08-24 14:26:52 +0000 |
2534 | @@ -2,6 +2,7 @@ |
2535 | * This file is part of signon |
2536 | * |
2537 | * Copyright (C) 2009-2010 Nokia Corporation. |
2538 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2539 | * |
2540 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2541 | * |
2542 | |
2543 | === modified file 'src/signond/pluginproxy.h' |
2544 | --- src/signond/pluginproxy.h 2013-01-11 11:33:56 +0000 |
2545 | +++ src/signond/pluginproxy.h 2016-08-24 14:26:52 +0000 |
2546 | @@ -2,6 +2,7 @@ |
2547 | * This file is part of signon |
2548 | * |
2549 | * Copyright (C) 2009-2010 Nokia Corporation. |
2550 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2551 | * |
2552 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2553 | * |
2554 | |
2555 | === modified file 'src/signond/signonauthsession.cpp' |
2556 | --- src/signond/signonauthsession.cpp 2013-07-23 09:07:35 +0000 |
2557 | +++ src/signond/signonauthsession.cpp 2016-08-24 14:26:52 +0000 |
2558 | @@ -2,9 +2,9 @@ |
2559 | * This file is part of signon |
2560 | * |
2561 | * Copyright (C) 2009-2010 Nokia Corporation. |
2562 | - * Copyright (C) 2013 Canonical Ltd. |
2563 | + * Copyright (C) 2013-2016 Canonical Ltd. |
2564 | * |
2565 | - * Conta Alberto Mardegan <alberto.mardegan@canonical.com> |
2566 | + * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2567 | * |
2568 | * This library is free software; you can redistribute it and/or |
2569 | * modify it under the terms of the GNU Lesser General Public License |
2570 | @@ -27,11 +27,9 @@ |
2571 | |
2572 | using namespace SignonDaemonNS; |
2573 | |
2574 | -SignonAuthSession::SignonAuthSession(quint32 id, |
2575 | - const QString &method, |
2576 | +SignonAuthSession::SignonAuthSession(SignonSessionCore *core, |
2577 | pid_t ownerPid): |
2578 | - m_id(id), |
2579 | - m_method(method), |
2580 | + QObject(core), |
2581 | m_ownerPid(ownerPid) |
2582 | { |
2583 | TRACE(); |
2584 | @@ -44,6 +42,9 @@ |
2585 | TRACE() << objectName; |
2586 | |
2587 | setObjectName(objectName); |
2588 | + |
2589 | + connect(core, SIGNAL(stateChanged(const QString&, int, const QString&)), |
2590 | + this, SLOT(stateChangedSlot(const QString&, int, const QString&))); |
2591 | } |
2592 | |
2593 | SignonAuthSession::~SignonAuthSession() |
2594 | @@ -58,19 +59,13 @@ |
2595 | pid_t ownerPid) |
2596 | { |
2597 | TRACE(); |
2598 | - SignonAuthSession *sas = new SignonAuthSession(id, method, ownerPid); |
2599 | - |
2600 | SignonSessionCore *core = SignonSessionCore::sessionCore(id, method, parent); |
2601 | if (!core) { |
2602 | TRACE() << "Cannot retrieve proper tasks queue"; |
2603 | - delete sas; |
2604 | return NULL; |
2605 | } |
2606 | |
2607 | - sas->setParent(core); |
2608 | - |
2609 | - connect(core, SIGNAL(stateChanged(const QString&, int, const QString&)), |
2610 | - sas, SLOT(stateChangedSlot(const QString&, int, const QString&))); |
2611 | + SignonAuthSession *sas = new SignonAuthSession(core, ownerPid); |
2612 | |
2613 | TRACE() << "SignonAuthSession created successfully:" << sas->objectName(); |
2614 | return sas; |
2615 | @@ -83,12 +78,12 @@ |
2616 | |
2617 | quint32 SignonAuthSession::id() const |
2618 | { |
2619 | - return m_id; |
2620 | + return parent()->id(); |
2621 | } |
2622 | |
2623 | QString SignonAuthSession::method() const |
2624 | { |
2625 | - return m_method; |
2626 | + return parent()->method(); |
2627 | } |
2628 | |
2629 | pid_t SignonAuthSession::ownerPid() const |
2630 | @@ -122,7 +117,6 @@ |
2631 | |
2632 | void SignonAuthSession::setId(quint32 id) |
2633 | { |
2634 | - m_id = id; |
2635 | parent()->setId(id); |
2636 | } |
2637 | |
2638 | |
2639 | === modified file 'src/signond/signonauthsession.h' |
2640 | --- src/signond/signonauthsession.h 2013-07-23 09:07:35 +0000 |
2641 | +++ src/signond/signonauthsession.h 2016-08-24 14:26:52 +0000 |
2642 | @@ -2,7 +2,7 @@ |
2643 | * This file is part of signon |
2644 | * |
2645 | * Copyright (C) 2009-2010 Nokia Corporation. |
2646 | - * Copyright (C) 2012-2013 Canonical Ltd. |
2647 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2648 | * |
2649 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2650 | * |
2651 | @@ -81,7 +81,7 @@ |
2652 | const QString &message); |
2653 | |
2654 | protected: |
2655 | - SignonAuthSession(quint32 id, const QString &method, pid_t ownerPid); |
2656 | + SignonAuthSession(SignonSessionCore *core, pid_t ownerPid); |
2657 | virtual ~SignonAuthSession(); |
2658 | |
2659 | private: |
2660 | |
2661 | === modified file 'src/signond/signonauthsessionadaptor.cpp' |
2662 | --- src/signond/signonauthsessionadaptor.cpp 2013-08-05 08:47:33 +0000 |
2663 | +++ src/signond/signonauthsessionadaptor.cpp 2016-08-24 14:26:52 +0000 |
2664 | @@ -3,7 +3,7 @@ |
2665 | * |
2666 | * Copyright (C) 2009-2010 Nokia Corporation. |
2667 | * Copyright (C) 2011 Intel Corporation. |
2668 | - * Copyright (C) 2013 Canonical Ltd. |
2669 | + * Copyright (C) 2013-2016 Canonical Ltd. |
2670 | * |
2671 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2672 | * Contact: Jussi Laako <jussi.laako@linux.intel.com> |
2673 | |
2674 | === modified file 'src/signond/signonauthsessionadaptor.h' |
2675 | --- src/signond/signonauthsessionadaptor.h 2012-04-18 13:03:21 +0000 |
2676 | +++ src/signond/signonauthsessionadaptor.h 2016-08-24 14:26:52 +0000 |
2677 | @@ -2,7 +2,7 @@ |
2678 | * This file is part of signon |
2679 | * |
2680 | * Copyright (C) 2009-2010 Nokia Corporation. |
2681 | - * Copyright (C) 2012 Canonical Ltd. |
2682 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2683 | * |
2684 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2685 | * |
2686 | |
2687 | === modified file 'src/signond/signond-common.h' |
2688 | --- src/signond/signond-common.h 2012-11-07 08:51:26 +0000 |
2689 | +++ src/signond/signond-common.h 2016-08-24 14:26:52 +0000 |
2690 | @@ -2,6 +2,7 @@ |
2691 | * This file is part of signon |
2692 | * |
2693 | * Copyright (C) 2010 Nokia Corporation. |
2694 | + * Copyright (C) 2012-2016 Canonical Ltd. |
2695 | * |
2696 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2697 | * |
2698 | |
2699 | === modified file 'src/signond/signond.pro' |
2700 | --- src/signond/signond.pro 2015-10-27 09:58:39 +0000 |
2701 | +++ src/signond/signond.pro 2016-08-24 14:26:52 +0000 |
2702 | @@ -9,8 +9,8 @@ |
2703 | dbus |
2704 | |
2705 | #generate adaptor for backup |
2706 | -system(qdbusxml2cpp -c BackupIfAdaptor -a backupifadaptor.h:backupifadaptor.cpp \ |
2707 | - ../../lib/signond/com.nokia.SingleSignOn.Backup.xml) |
2708 | +DBUS_ADAPTORS += \ |
2709 | + ../../lib/signond/com.nokia.SingleSignOn.Backup.xml |
2710 | |
2711 | HEADERS += \ |
2712 | accesscontrolmanagerhelper.h \ |
2713 | @@ -33,7 +33,6 @@ |
2714 | signonidentityinfo.h \ |
2715 | signonui_interface.h \ |
2716 | signonidentityadaptor.h \ |
2717 | - backupifadaptor.h \ |
2718 | signonsessioncoretools.h |
2719 | SOURCES += \ |
2720 | accesscontrolmanagerhelper.cpp \ |
2721 | @@ -54,7 +53,6 @@ |
2722 | signondaemon.cpp \ |
2723 | signonidentityinfo.cpp \ |
2724 | signonidentityadaptor.cpp \ |
2725 | - backupifadaptor.cpp \ |
2726 | signonsessioncoretools.cpp |
2727 | INCLUDEPATH += . \ |
2728 | $${TOP_SRC_DIR}/lib/plugins \ |
2729 | @@ -75,6 +73,14 @@ |
2730 | PKGCONFIG += dbus-1 |
2731 | } |
2732 | |
2733 | +CONFIG(enable-backup) { |
2734 | + DEFINES += ENABLE_BACKUP |
2735 | + SOURCES += \ |
2736 | + backup.cpp |
2737 | + HEADERS += \ |
2738 | + backup.h |
2739 | +} |
2740 | + |
2741 | DEFINES += QT_NO_CAST_TO_ASCII \ |
2742 | QT_NO_CAST_FROM_ASCII |
2743 | DEFINES += "SIGNOND_PLUGINS_DIR=$${SIGNOND_PLUGINS_DIR_QUOTED}" |
2744 | @@ -87,10 +93,6 @@ |
2745 | -lsignon-plugins-common \ |
2746 | -lsignon-extension |
2747 | |
2748 | -QMAKE_DISTCLEAN += \ |
2749 | - backupifadaptor.cpp \ |
2750 | - backupifadaptor.h |
2751 | - |
2752 | headers.files = $$HEADERS |
2753 | include( ../../common-installs-config.pri ) |
2754 | |
2755 | |
2756 | === modified file 'src/signond/signondaemon.cpp' |
2757 | --- src/signond/signondaemon.cpp 2015-06-12 11:21:18 +0000 |
2758 | +++ src/signond/signondaemon.cpp 2016-08-24 14:26:52 +0000 |
2759 | @@ -2,9 +2,8 @@ |
2760 | * This file is part of signon |
2761 | * |
2762 | * Copyright (C) 2009-2010 Nokia Corporation. |
2763 | - * Copyright (C) 2013-2015 Canonical Ltd. |
2764 | + * Copyright (C) 2013-2016 Canonical Ltd. |
2765 | * |
2766 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
2767 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
2768 | * |
2769 | * This library is free software; you can redistribute it and/or |
2770 | @@ -28,8 +27,6 @@ |
2771 | #include <sys/types.h> |
2772 | } |
2773 | |
2774 | -#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0) |
2775 | - |
2776 | #include <QtDebug> |
2777 | #include <QDir> |
2778 | #include <QDBusConnection> |
2779 | @@ -38,12 +35,11 @@ |
2780 | #include <QPluginLoader> |
2781 | #include <QProcessEnvironment> |
2782 | #include <QSocketNotifier> |
2783 | -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
2784 | #include <QStandardPaths> |
2785 | -#endif |
2786 | |
2787 | #include "SignOn/misc.h" |
2788 | |
2789 | +#include "backup.h" |
2790 | #include "signondaemon.h" |
2791 | #include "signond-common.h" |
2792 | #include "signontrace.h" |
2793 | @@ -51,7 +47,6 @@ |
2794 | #include "signonidentity.h" |
2795 | #include "signonauthsession.h" |
2796 | #include "accesscontrolmanagerhelper.h" |
2797 | -#include "backupifadaptor.h" |
2798 | |
2799 | #define SIGNON_RETURN_IF_CAM_UNAVAILABLE(_ret_arg_) do { \ |
2800 | if (m_pCAMManager && !m_pCAMManager->credentialsSystemOpened()) { \ |
2801 | @@ -63,9 +58,6 @@ |
2802 | } \ |
2803 | } while(0) |
2804 | |
2805 | -#define BACKUP_DIR_NAME() \ |
2806 | - (QDir::separator() + QLatin1String("backup")) |
2807 | - |
2808 | using namespace SignOn; |
2809 | |
2810 | namespace SignonDaemonNS { |
2811 | @@ -218,12 +210,8 @@ |
2812 | environment.value(QLatin1String("SSO_EXTENSIONS_DIR")); |
2813 | } |
2814 | |
2815 | -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
2816 | QString runtimeDir = |
2817 | QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); |
2818 | -#else |
2819 | - QString runtimeDir = environment.value(QLatin1String("XDG_RUNTIME_DIR")); |
2820 | -#endif |
2821 | if (!runtimeDir.isEmpty()) { |
2822 | QString socketFileName = |
2823 | QString::fromLatin1("%1/" SIGNOND_SOCKET_FILENAME).arg(runtimeDir); |
2824 | @@ -267,10 +255,6 @@ |
2825 | ::close(sigFd[0]); |
2826 | ::close(sigFd[1]); |
2827 | |
2828 | - if (m_backup) { |
2829 | - exit(0); |
2830 | - } |
2831 | - |
2832 | delete m_dbusServer; |
2833 | |
2834 | SignonAuthSession::stopAllAuthSessions(); |
2835 | @@ -282,16 +266,8 @@ |
2836 | } |
2837 | |
2838 | QDBusConnection sessionConnection = QDBusConnection::sessionBus(); |
2839 | - |
2840 | - sessionConnection.unregisterObject(SIGNOND_DAEMON_OBJECTPATH |
2841 | - + QLatin1String("/Backup")); |
2842 | - sessionConnection.unregisterService(SIGNOND_SERVICE |
2843 | - + QLatin1String(".Backup")); |
2844 | - if (m_backup == false) |
2845 | - { |
2846 | - sessionConnection.unregisterObject(SIGNOND_DAEMON_OBJECTPATH); |
2847 | - sessionConnection.unregisterService(SIGNOND_SERVICE); |
2848 | - } |
2849 | + sessionConnection.unregisterObject(SIGNOND_DAEMON_OBJECTPATH); |
2850 | + sessionConnection.unregisterService(SIGNOND_SERVICE); |
2851 | |
2852 | delete m_configuration; |
2853 | |
2854 | @@ -392,49 +368,20 @@ |
2855 | "constructed first"); |
2856 | |
2857 | setupSignalHandlers(); |
2858 | - m_backup = app->arguments().contains(QLatin1String("-backup")); |
2859 | m_pCAMManager = |
2860 | new CredentialsAccessManager(m_configuration->camConfiguration()); |
2861 | |
2862 | +#ifdef ENABLE_BACKUP |
2863 | /* backup dbus interface */ |
2864 | - QDBusConnection sessionConnection = QDBusConnection::sessionBus(); |
2865 | - |
2866 | - if (!sessionConnection.isConnected()) { |
2867 | - QDBusError err = sessionConnection.lastError(); |
2868 | - TRACE() << "Session connection cannot be established:" << |
2869 | - err.errorString(err.type()); |
2870 | - TRACE() << err.message(); |
2871 | - |
2872 | - qFatal("SignonDaemon requires session bus to start working"); |
2873 | - } |
2874 | - |
2875 | - QDBusConnection::RegisterOptions registerSessionOptions = |
2876 | - QDBusConnection::ExportAdaptors; |
2877 | - |
2878 | - (void)new BackupIfAdaptor(this); |
2879 | - |
2880 | - if (!sessionConnection.registerObject(SIGNOND_DAEMON_OBJECTPATH |
2881 | - + QLatin1String("/Backup"), |
2882 | - this, registerSessionOptions)) { |
2883 | - TRACE() << "Object cannot be registered"; |
2884 | - |
2885 | - qFatal("SignonDaemon requires to register backup object"); |
2886 | - } |
2887 | - |
2888 | - if (!sessionConnection.registerService(SIGNOND_SERVICE + |
2889 | - QLatin1String(".Backup"))) { |
2890 | - QDBusError err = sessionConnection.lastError(); |
2891 | - TRACE() << "Service cannot be registered: " << |
2892 | - err.errorString(err.type()); |
2893 | - |
2894 | - qFatal("SignonDaemon requires to register backup service"); |
2895 | - } |
2896 | - |
2897 | - if (m_backup) { |
2898 | + bool backupMode = app->arguments().contains(QLatin1String("-backup")); |
2899 | + (void)new Backup(m_pCAMManager, backupMode, this); |
2900 | + |
2901 | + if (backupMode) { |
2902 | TRACE() << "Signond initialized in backup mode."; |
2903 | //skip rest of initialization in backup mode |
2904 | return; |
2905 | } |
2906 | +#endif |
2907 | |
2908 | /* DBus Service init */ |
2909 | QDBusConnection connection = SIGNOND_BUS; |
2910 | @@ -677,11 +624,6 @@ |
2911 | |
2912 | TRACE() << method; |
2913 | |
2914 | - QStringList mechs = SignonSessionCore::loadedPluginMethods(method); |
2915 | - |
2916 | - if (!mechs.isEmpty()) |
2917 | - return mechs; |
2918 | - |
2919 | PluginProxy *plugin = PluginProxy::createNewPluginProxy(method); |
2920 | |
2921 | if (!plugin) { |
2922 | @@ -694,7 +636,7 @@ |
2923 | return QStringList(); |
2924 | } |
2925 | |
2926 | - mechs = plugin->mechanisms(); |
2927 | + QStringList mechs = plugin->mechanisms(); |
2928 | delete plugin; |
2929 | |
2930 | return mechs; |
2931 | @@ -776,265 +718,6 @@ |
2932 | return authSession; |
2933 | } |
2934 | |
2935 | -void SignonDaemon::eraseBackupDir() const |
2936 | -{ |
2937 | - const CAMConfiguration config = m_configuration->camConfiguration(); |
2938 | - QString backupRoot = config.m_storagePath + BACKUP_DIR_NAME(); |
2939 | - |
2940 | - QDir target(backupRoot); |
2941 | - if (!target.exists()) return; |
2942 | - |
2943 | - QStringList targetEntries = target.entryList(QDir::Files); |
2944 | - foreach (QString entry, targetEntries) { |
2945 | - target.remove(entry); |
2946 | - } |
2947 | - |
2948 | - target.rmdir(backupRoot); |
2949 | -} |
2950 | - |
2951 | -bool SignonDaemon::copyToBackupDir(const QStringList &fileNames) const |
2952 | -{ |
2953 | - const CAMConfiguration config = m_configuration->camConfiguration(); |
2954 | - QString backupRoot = config.m_storagePath + BACKUP_DIR_NAME(); |
2955 | - |
2956 | - QDir target(backupRoot); |
2957 | - if (!target.exists() && !target.mkpath(backupRoot)) { |
2958 | - qCritical() << "Cannot create target directory"; |
2959 | - return false; |
2960 | - } |
2961 | - |
2962 | - setUserOwnership(backupRoot); |
2963 | - |
2964 | - /* Now copy the files to be backed up */ |
2965 | - bool ok = true; |
2966 | - foreach (const QString &fileName, fileNames) { |
2967 | - /* Remove the target file, if it exists */ |
2968 | - if (target.exists(fileName)) |
2969 | - target.remove(fileName); |
2970 | - |
2971 | - /* Copy the source into the target directory */ |
2972 | - QString source = config.m_storagePath + QDir::separator() + fileName; |
2973 | - if (!QFile::exists(source)) continue; |
2974 | - |
2975 | - QString destination = backupRoot + QDir::separator() + fileName; |
2976 | - ok = QFile::copy(source, destination); |
2977 | - if (!ok) { |
2978 | - BLAME() << "Copying" << source << "to" << destination << "failed"; |
2979 | - break; |
2980 | - } |
2981 | - |
2982 | - setUserOwnership(destination); |
2983 | - } |
2984 | - |
2985 | - return ok; |
2986 | -} |
2987 | - |
2988 | -bool SignonDaemon::copyFromBackupDir(const QStringList &fileNames) const |
2989 | -{ |
2990 | - const CAMConfiguration config = m_configuration->camConfiguration(); |
2991 | - QString backupRoot = config.m_storagePath + BACKUP_DIR_NAME(); |
2992 | - |
2993 | - QDir sourceDir(backupRoot); |
2994 | - if (!sourceDir.exists()) { |
2995 | - TRACE() << "Backup directory does not exist!"; |
2996 | - } |
2997 | - |
2998 | - if (!sourceDir.exists(config.m_dbName)) { |
2999 | - TRACE() << "Backup does not contain DB:" << config.m_dbName; |
3000 | - } |
3001 | - |
3002 | - /* Now restore the files from the backup */ |
3003 | - bool ok = true; |
3004 | - QDir target(config.m_storagePath); |
3005 | - QStringList movedFiles, copiedFiles; |
3006 | - foreach (const QString &fileName, fileNames) { |
3007 | - /* Remove the target file, if it exists */ |
3008 | - if (target.exists(fileName)) { |
3009 | - if (target.rename(fileName, fileName + QLatin1String(".bak"))) |
3010 | - movedFiles += fileName; |
3011 | - } |
3012 | - |
3013 | - /* Copy the source into the target directory */ |
3014 | - QString source = backupRoot + QDir::separator() + fileName; |
3015 | - if (!QFile::exists(source)) { |
3016 | - TRACE() << "Ignoring file not present in backup:" << source; |
3017 | - continue; |
3018 | - } |
3019 | - |
3020 | - QString destination = |
3021 | - config.m_storagePath + QDir::separator() + fileName; |
3022 | - |
3023 | - ok = QFile::copy(source, destination); |
3024 | - if (ok) { |
3025 | - copiedFiles << fileName; |
3026 | - } else { |
3027 | - qWarning() << "Copy failed for:" << source; |
3028 | - break; |
3029 | - } |
3030 | - } |
3031 | - |
3032 | - if (!ok) { |
3033 | - qWarning() << "Restore failed, recovering previous DB"; |
3034 | - |
3035 | - foreach (const QString &fileName, copiedFiles) { |
3036 | - target.remove(fileName); |
3037 | - } |
3038 | - |
3039 | - foreach (const QString &fileName, movedFiles) { |
3040 | - if (!target.rename(fileName + QLatin1String(".bak"), fileName)) { |
3041 | - qCritical() << "Could not recover:" << fileName; |
3042 | - } |
3043 | - } |
3044 | - } else { |
3045 | - /* delete ".bak" files */ |
3046 | - foreach (const QString &fileName, movedFiles) { |
3047 | - target.remove(fileName + QLatin1String(".bak")); |
3048 | - } |
3049 | - |
3050 | - } |
3051 | - return ok; |
3052 | -} |
3053 | - |
3054 | -bool SignonDaemon::createStorageFileTree(const QStringList &backupFiles) const |
3055 | -{ |
3056 | - QString storageDirPath = m_configuration->camConfiguration().m_storagePath; |
3057 | - QDir storageDir(storageDirPath); |
3058 | - |
3059 | - if (!storageDir.exists()) { |
3060 | - if (!storageDir.mkpath(storageDirPath)) { |
3061 | - qCritical() << "Could not create storage dir for backup."; |
3062 | - return false; |
3063 | - } |
3064 | - } |
3065 | - |
3066 | - foreach (const QString &fileName, backupFiles) { |
3067 | - if (storageDir.exists(fileName)) continue; |
3068 | - |
3069 | - QString filePath = storageDir.path() + QDir::separator() + fileName; |
3070 | - QFile file(filePath); |
3071 | - if (!file.open(QIODevice::WriteOnly)) { |
3072 | - qCritical() << "Failed to create empty file for backup:" << filePath; |
3073 | - return false; |
3074 | - } else { |
3075 | - file.close(); |
3076 | - } |
3077 | - } |
3078 | - |
3079 | - return true; |
3080 | -} |
3081 | - |
3082 | -uchar SignonDaemon::backupStarts() |
3083 | -{ |
3084 | - TRACE() << "backup"; |
3085 | - if (!m_backup && m_pCAMManager->credentialsSystemOpened()) |
3086 | - { |
3087 | - m_pCAMManager->closeCredentialsSystem(); |
3088 | - if (m_pCAMManager->credentialsSystemOpened()) |
3089 | - { |
3090 | - qCritical() << "Cannot close credentials database"; |
3091 | - return 2; |
3092 | - } |
3093 | - } |
3094 | - |
3095 | - const CAMConfiguration config = m_configuration->camConfiguration(); |
3096 | - |
3097 | - /* do backup copy: prepare the list of files to be backed up */ |
3098 | - QStringList backupFiles; |
3099 | - backupFiles << config.m_dbName; |
3100 | - backupFiles << m_pCAMManager->backupFiles(); |
3101 | - |
3102 | - /* make sure that all the backup files and storage directory exist: |
3103 | - create storage dir and empty files if not so, as backup/restore |
3104 | - operations must be consistent */ |
3105 | - if (!createStorageFileTree(backupFiles)) { |
3106 | - qCritical() << "Cannot create backup file tree."; |
3107 | - return 2; |
3108 | - } |
3109 | - |
3110 | - /* perform the copy */ |
3111 | - eraseBackupDir(); |
3112 | - if (!copyToBackupDir(backupFiles)) { |
3113 | - qCritical() << "Cannot copy database"; |
3114 | - if (!m_backup) |
3115 | - m_pCAMManager->openCredentialsSystem(); |
3116 | - return 2; |
3117 | - } |
3118 | - |
3119 | - if (!m_backup) |
3120 | - { |
3121 | - //mount file system back |
3122 | - if (!m_pCAMManager->openCredentialsSystem()) { |
3123 | - qCritical() << "Cannot reopen database"; |
3124 | - } |
3125 | - } |
3126 | - return 0; |
3127 | -} |
3128 | - |
3129 | -uchar SignonDaemon::backupFinished() |
3130 | -{ |
3131 | - TRACE() << "close"; |
3132 | - |
3133 | - eraseBackupDir(); |
3134 | - |
3135 | - if (m_backup) |
3136 | - { |
3137 | - //close daemon |
3138 | - TRACE() << "close daemon"; |
3139 | - this->deleteLater(); |
3140 | - } |
3141 | - |
3142 | - return 0; |
3143 | - } |
3144 | - |
3145 | -/* |
3146 | - * Does nothing but start-on-demand |
3147 | - * */ |
3148 | -uchar SignonDaemon::restoreStarts() |
3149 | -{ |
3150 | - TRACE(); |
3151 | - return 0; |
3152 | -} |
3153 | - |
3154 | -uchar SignonDaemon::restoreFinished() |
3155 | -{ |
3156 | - TRACE() << "restore"; |
3157 | - //restore requested |
3158 | - if (m_pCAMManager->credentialsSystemOpened()) |
3159 | - { |
3160 | - //umount file system |
3161 | - if (!m_pCAMManager->closeCredentialsSystem()) |
3162 | - { |
3163 | - qCritical() << "database cannot be closed"; |
3164 | - return 2; |
3165 | - } |
3166 | - } |
3167 | - |
3168 | - const CAMConfiguration config = m_configuration->camConfiguration(); |
3169 | - |
3170 | - QStringList backupFiles; |
3171 | - backupFiles << config.m_dbName; |
3172 | - backupFiles << m_pCAMManager->backupFiles(); |
3173 | - |
3174 | - /* perform the copy */ |
3175 | - if (!copyFromBackupDir(backupFiles)) { |
3176 | - qCritical() << "Cannot copy database"; |
3177 | - m_pCAMManager->openCredentialsSystem(); |
3178 | - return 2; |
3179 | - } |
3180 | - |
3181 | - eraseBackupDir(); |
3182 | - |
3183 | - //TODO check database integrity |
3184 | - if (!m_backup) |
3185 | - { |
3186 | - //mount file system back |
3187 | - if (!m_pCAMManager->openCredentialsSystem()) |
3188 | - return 2; |
3189 | - } |
3190 | - |
3191 | - return 0; |
3192 | -} |
3193 | - |
3194 | void SignonDaemon::onDisconnected() |
3195 | { |
3196 | TRACE() << "Disconnected from session bus: exiting"; |
3197 | |
3198 | === modified file 'src/signond/signondaemon.h' |
3199 | --- src/signond/signondaemon.h 2013-08-20 13:17:21 +0000 |
3200 | +++ src/signond/signondaemon.h 2016-08-24 14:26:52 +0000 |
3201 | @@ -2,9 +2,8 @@ |
3202 | * This file is part of signon |
3203 | * |
3204 | * Copyright (C) 2009-2010 Nokia Corporation. |
3205 | - * Copyright (C) 2012-2013 Canonical Ltd. |
3206 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3207 | * |
3208 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3209 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3210 | * |
3211 | * This library is free software; you can redistribute it and/or |
3212 | @@ -143,12 +142,6 @@ |
3213 | void onIdentityStored(SignonIdentity *identity); |
3214 | void onIdentityDestroyed(); |
3215 | |
3216 | -public Q_SLOTS: // backup METHODS |
3217 | - uchar backupStarts(); |
3218 | - uchar backupFinished(); |
3219 | - uchar restoreStarts(); |
3220 | - uchar restoreFinished(); |
3221 | - |
3222 | private: |
3223 | SignonDaemon(QObject *parent); |
3224 | void initExtensions(); |
3225 | @@ -158,11 +151,6 @@ |
3226 | void watchIdentity(SignonIdentity *identity); |
3227 | void setupSignalHandlers(); |
3228 | |
3229 | - void eraseBackupDir() const; |
3230 | - bool copyToBackupDir(const QStringList &fileNames) const; |
3231 | - bool copyFromBackupDir(const QStringList &fileNames) const; |
3232 | - bool createStorageFileTree(const QStringList &fileNames) const; |
3233 | - |
3234 | void setLastError(const QString &name, const QString &msg); |
3235 | void clearLastError(); |
3236 | |
3237 | @@ -179,8 +167,6 @@ |
3238 | * */ |
3239 | CredentialsAccessManager *m_pCAMManager; |
3240 | |
3241 | - bool m_backup; |
3242 | - |
3243 | int m_identityTimeout; |
3244 | int m_authSessionTimeout; |
3245 | |
3246 | |
3247 | === modified file 'src/signond/signondaemonadaptor.cpp' |
3248 | --- src/signond/signondaemonadaptor.cpp 2014-11-14 10:08:04 +0000 |
3249 | +++ src/signond/signondaemonadaptor.cpp 2016-08-24 14:26:52 +0000 |
3250 | @@ -3,9 +3,8 @@ |
3251 | * |
3252 | * Copyright (C) 2009-2010 Nokia Corporation. |
3253 | * Copyright (C) 2011 Intel Corporation. |
3254 | - * Copyright (C) 2013 Canonical Ltd. |
3255 | + * Copyright (C) 2013-2016 Canonical Ltd. |
3256 | * |
3257 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3258 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3259 | * Contact: Jussi Laako <jussi.laako@linux.intel.com> |
3260 | * |
3261 | |
3262 | === modified file 'src/signond/signondaemonadaptor.h' |
3263 | --- src/signond/signondaemonadaptor.h 2013-08-20 08:01:44 +0000 |
3264 | +++ src/signond/signondaemonadaptor.h 2016-08-24 14:26:52 +0000 |
3265 | @@ -2,9 +2,8 @@ |
3266 | * This file is part of signon |
3267 | * |
3268 | * Copyright (C) 2009-2010 Nokia Corporation. |
3269 | - * Copyright (C) 2012 Canonical Ltd. |
3270 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3271 | * |
3272 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3273 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3274 | * |
3275 | * This library is free software; you can redistribute it and/or |
3276 | |
3277 | === modified file 'src/signond/signondisposable.cpp' |
3278 | --- src/signond/signondisposable.cpp 2012-04-18 13:06:27 +0000 |
3279 | +++ src/signond/signondisposable.cpp 2016-08-24 14:26:52 +0000 |
3280 | @@ -2,6 +2,7 @@ |
3281 | * This file is part of signon |
3282 | * |
3283 | * Copyright (C) 2010 Nokia Corporation. |
3284 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3285 | * |
3286 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3287 | * |
3288 | |
3289 | === modified file 'src/signond/signondisposable.h' |
3290 | --- src/signond/signondisposable.h 2012-04-18 13:06:27 +0000 |
3291 | +++ src/signond/signondisposable.h 2016-08-24 14:26:52 +0000 |
3292 | @@ -2,6 +2,7 @@ |
3293 | * This file is part of signon |
3294 | * |
3295 | * Copyright (C) 2010 Nokia Corporation. |
3296 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3297 | * |
3298 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3299 | * |
3300 | |
3301 | === modified file 'src/signond/signonidentity.cpp' |
3302 | --- src/signond/signonidentity.cpp 2014-11-17 09:33:43 +0000 |
3303 | +++ src/signond/signonidentity.cpp 2016-08-24 14:26:52 +0000 |
3304 | @@ -3,9 +3,8 @@ |
3305 | * |
3306 | * Copyright (C) 2009-2010 Nokia Corporation. |
3307 | * Copyright (C) 2011 Intel Corporation. |
3308 | - * Copyright (C) 2013 Canonical Ltd. |
3309 | + * Copyright (C) 2013-2016 Canonical Ltd. |
3310 | * |
3311 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3312 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3313 | * Contact: Jussi Laako <jussi.laako@linux.intel.com> |
3314 | * |
3315 | |
3316 | === modified file 'src/signond/signonidentity.h' |
3317 | --- src/signond/signonidentity.h 2014-08-21 07:33:45 +0000 |
3318 | +++ src/signond/signonidentity.h 2016-08-24 14:26:52 +0000 |
3319 | @@ -2,9 +2,8 @@ |
3320 | * This file is part of signon |
3321 | * |
3322 | * Copyright (C) 2009-2010 Nokia Corporation. |
3323 | - * Copyright (C) 2012-2013 Canonical Ltd. |
3324 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3325 | * |
3326 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3327 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3328 | * |
3329 | * This library is free software; you can redistribute it and/or |
3330 | |
3331 | === modified file 'src/signond/signonidentityadaptor.cpp' |
3332 | --- src/signond/signonidentityadaptor.cpp 2013-08-05 08:47:33 +0000 |
3333 | +++ src/signond/signonidentityadaptor.cpp 2016-08-24 14:26:52 +0000 |
3334 | @@ -3,9 +3,8 @@ |
3335 | * |
3336 | * Copyright (C) 2009-2010 Nokia Corporation. |
3337 | * Copyright (C) 2011 Intel Corporation. |
3338 | - * Copyright (C) 2013 Canonical Ltd. |
3339 | + * Copyright (C) 2013-2016 Canonical Ltd. |
3340 | * |
3341 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3342 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3343 | * Contact: Jussi Laako <jussi.laako@linux.intel.com> |
3344 | * |
3345 | |
3346 | === modified file 'src/signond/signonidentityadaptor.h' |
3347 | --- src/signond/signonidentityadaptor.h 2012-04-18 13:03:21 +0000 |
3348 | +++ src/signond/signonidentityadaptor.h 2016-08-24 14:26:52 +0000 |
3349 | @@ -2,9 +2,8 @@ |
3350 | * This file is part of signon |
3351 | * |
3352 | * Copyright (C) 2009-2010 Nokia Corporation. |
3353 | - * Copyright (C) 2012 Canonical Ltd. |
3354 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3355 | * |
3356 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3357 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3358 | * |
3359 | * This library is free software; you can redistribute it and/or |
3360 | |
3361 | === modified file 'src/signond/signonidentityinfo.cpp' |
3362 | --- src/signond/signonidentityinfo.cpp 2014-11-17 09:33:43 +0000 |
3363 | +++ src/signond/signonidentityinfo.cpp 2016-08-24 14:26:52 +0000 |
3364 | @@ -2,8 +2,8 @@ |
3365 | * This file is part of signon |
3366 | * |
3367 | * Copyright (C) 2009-2010 Nokia Corporation. |
3368 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3369 | * |
3370 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3371 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3372 | * |
3373 | * This library is free software; you can redistribute it and/or |
3374 | |
3375 | === modified file 'src/signond/signonidentityinfo.h' |
3376 | --- src/signond/signonidentityinfo.h 2014-11-17 09:33:43 +0000 |
3377 | +++ src/signond/signonidentityinfo.h 2016-08-24 14:26:52 +0000 |
3378 | @@ -2,8 +2,8 @@ |
3379 | * This file is part of signon |
3380 | * |
3381 | * Copyright (C) 2009-2010 Nokia Corporation. |
3382 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3383 | * |
3384 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3385 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3386 | * |
3387 | * This library is free software; you can redistribute it and/or |
3388 | |
3389 | === modified file 'src/signond/signonsessioncore.cpp' |
3390 | --- src/signond/signonsessioncore.cpp 2014-10-10 13:11:26 +0000 |
3391 | +++ src/signond/signonsessioncore.cpp 2016-08-24 14:26:52 +0000 |
3392 | @@ -3,6 +3,7 @@ |
3393 | * |
3394 | * Copyright (C) 2009-2010 Nokia Corporation. |
3395 | * Copyright (C) 2011 Intel Corporation. |
3396 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3397 | * |
3398 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3399 | * Contact: Jussi Laako <jussi.laako@linux.intel.com> |
3400 | @@ -207,21 +208,6 @@ |
3401 | sessionsOfNonStoredCredentials.clear(); |
3402 | } |
3403 | |
3404 | -QStringList SignonSessionCore::loadedPluginMethods(const QString &method) |
3405 | -{ |
3406 | - foreach (SignonSessionCore *corePtr, sessionsOfStoredCredentials) { |
3407 | - if (corePtr->method() == method) |
3408 | - return corePtr->queryAvailableMechanisms(QStringList()); |
3409 | - } |
3410 | - |
3411 | - foreach (SignonSessionCore *corePtr, sessionsOfNonStoredCredentials) { |
3412 | - if (corePtr->method() == method) |
3413 | - return corePtr->queryAvailableMechanisms(QStringList()); |
3414 | - } |
3415 | - |
3416 | - return QStringList(); |
3417 | -} |
3418 | - |
3419 | QStringList |
3420 | SignonSessionCore::queryAvailableMechanisms(const QStringList &wantedMechanisms) |
3421 | { |
3422 | @@ -614,11 +600,14 @@ |
3423 | rd.m_conn.send(rd.m_msg.createReply(arguments)); |
3424 | |
3425 | if (m_watcher && !m_watcher->isFinished()) { |
3426 | - m_signonui->cancelUiRequest(rd.m_cancelKey); |
3427 | delete m_watcher; |
3428 | m_watcher = 0; |
3429 | } |
3430 | - m_queryCredsUiDisplayed = false; |
3431 | + /* Inform SignOnUi that we are done */ |
3432 | + if (m_queryCredsUiDisplayed) { |
3433 | + m_signonui->cancelUiRequest(rd.m_cancelKey); |
3434 | + m_queryCredsUiDisplayed = false; |
3435 | + } |
3436 | } |
3437 | |
3438 | requestDone(); |
3439 | @@ -745,6 +734,7 @@ |
3440 | m_watcher = new QDBusPendingCallWatcher( |
3441 | m_signonui->queryDialog(request.m_params), |
3442 | this); |
3443 | + m_queryCredsUiDisplayed = true; |
3444 | connect(m_watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), |
3445 | this, SLOT(queryUiSlot(QDBusPendingCallWatcher*))); |
3446 | } |
3447 | @@ -771,6 +761,7 @@ |
3448 | m_watcher = new QDBusPendingCallWatcher( |
3449 | m_signonui->refreshDialog(m_listOfRequests.head().m_params), |
3450 | this); |
3451 | + m_queryCredsUiDisplayed = true; |
3452 | connect(m_watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), |
3453 | this, SLOT(queryUiSlot(QDBusPendingCallWatcher*))); |
3454 | } |
3455 | @@ -792,10 +783,14 @@ |
3456 | replyError(rd.m_conn, rd.m_msg, err, message); |
3457 | |
3458 | if (m_watcher && !m_watcher->isFinished()) { |
3459 | - m_signonui->cancelUiRequest(rd.m_cancelKey); |
3460 | delete m_watcher; |
3461 | m_watcher = 0; |
3462 | } |
3463 | + /* Inform SignOnUi that we are done */ |
3464 | + if (m_queryCredsUiDisplayed) { |
3465 | + m_queryCredsUiDisplayed = false; |
3466 | + m_signonui->cancelUiRequest(rd.m_cancelKey); |
3467 | + } |
3468 | } |
3469 | |
3470 | requestDone(); |
3471 | @@ -857,17 +852,16 @@ |
3472 | rd.m_params = resultParameters; |
3473 | |
3474 | /* If the query ui was canceled or any other error occurred |
3475 | - * do not set this flag to true. */ |
3476 | + * we assume that the UI is not displayed. */ |
3477 | if (resultParameters.contains(SSOUI_KEY_ERROR) |
3478 | && (resultParameters[SSOUI_KEY_ERROR] == QUERY_ERROR_CANCELED)) { |
3479 | |
3480 | m_queryCredsUiDisplayed = false; |
3481 | - } else { |
3482 | - m_queryCredsUiDisplayed = true; |
3483 | } |
3484 | } else { |
3485 | rd.m_params.insert(SSOUI_KEY_ERROR, |
3486 | (int)SignOn::QUERY_ERROR_NO_SIGNONUI); |
3487 | + m_queryCredsUiDisplayed = false; |
3488 | } |
3489 | |
3490 | if (!m_canceled) { |
3491 | |
3492 | === modified file 'src/signond/signonsessioncore.h' |
3493 | --- src/signond/signonsessioncore.h 2013-02-06 09:03:19 +0000 |
3494 | +++ src/signond/signonsessioncore.h 2016-08-24 14:26:52 +0000 |
3495 | @@ -2,6 +2,7 @@ |
3496 | * This file is part of signon |
3497 | * |
3498 | * Copyright (C) 2009-2010 Nokia Corporation. |
3499 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3500 | * |
3501 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3502 | * |
3503 | @@ -63,7 +64,6 @@ |
3504 | * just for any case |
3505 | * */ |
3506 | static void stopAllAuthSessions(); |
3507 | - static QStringList loadedPluginMethods(const QString &method); |
3508 | |
3509 | void destroy(); |
3510 | |
3511 | |
3512 | === modified file 'src/signond/signonsessioncoretools.cpp' |
3513 | --- src/signond/signonsessioncoretools.cpp 2012-08-27 13:42:05 +0000 |
3514 | +++ src/signond/signonsessioncoretools.cpp 2016-08-24 14:26:52 +0000 |
3515 | @@ -2,8 +2,8 @@ |
3516 | * This file is part of signon |
3517 | * |
3518 | * Copyright (C) 2009-2011 Nokia Corporation. |
3519 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3520 | * |
3521 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3522 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3523 | * |
3524 | * This library is free software; you can redistribute it and/or |
3525 | |
3526 | === modified file 'src/signond/signonsessioncoretools.h' |
3527 | --- src/signond/signonsessioncoretools.h 2012-08-27 13:42:05 +0000 |
3528 | +++ src/signond/signonsessioncoretools.h 2016-08-24 14:26:52 +0000 |
3529 | @@ -2,8 +2,8 @@ |
3530 | * This file is part of signon |
3531 | * |
3532 | * Copyright (C) 2009-2011 Nokia Corporation. |
3533 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3534 | * |
3535 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3536 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3537 | * |
3538 | * This library is free software; you can redistribute it and/or |
3539 | |
3540 | === modified file 'src/signond/signontrace.h' |
3541 | --- src/signond/signontrace.h 2012-08-16 09:42:35 +0000 |
3542 | +++ src/signond/signontrace.h 2016-08-24 14:26:52 +0000 |
3543 | @@ -2,8 +2,8 @@ |
3544 | * This file is part of signon |
3545 | * |
3546 | * Copyright (C) 2009-2010 Nokia Corporation. |
3547 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3548 | * |
3549 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3550 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3551 | * |
3552 | * This library is free software; you can redistribute it and/or |
3553 | @@ -58,8 +58,11 @@ |
3554 | m_pInstance = new SignonTrace(logOutput); |
3555 | } |
3556 | |
3557 | - static void output(QtMsgType type, const char *msg) |
3558 | + static void output(QtMsgType type, const QMessageLogContext &context, |
3559 | + const QString &msg) |
3560 | { |
3561 | + Q_UNUSED(context); |
3562 | + |
3563 | if (!m_pInstance) |
3564 | return; |
3565 | |
3566 | @@ -79,7 +82,7 @@ |
3567 | default: priority = LOG_INFO; break; |
3568 | } |
3569 | |
3570 | - syslog(priority, "%s", msg); |
3571 | + syslog(priority, "%s", msg.toUtf8().constData()); |
3572 | } |
3573 | |
3574 | private: |
3575 | @@ -88,7 +91,7 @@ |
3576 | { |
3577 | if (logOutput == Syslog) { |
3578 | openlog(NULL, LOG_PID, LOG_DAEMON); |
3579 | - qInstallMsgHandler(output); |
3580 | + qInstallMessageHandler(output); |
3581 | } |
3582 | } |
3583 | |
3584 | |
3585 | === modified file 'src/signond/signonui_interface.cpp' |
3586 | --- src/signond/signonui_interface.cpp 2013-04-24 08:49:02 +0000 |
3587 | +++ src/signond/signonui_interface.cpp 2016-08-24 14:26:52 +0000 |
3588 | @@ -2,7 +2,7 @@ |
3589 | * This file is part of signon |
3590 | * |
3591 | * Copyright (C) 2009-2010 Nokia Corporation. |
3592 | - * Copyright (C) 2013 Canonical Ltd. |
3593 | + * Copyright (C) 2013-2016 Canonical Ltd. |
3594 | * |
3595 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3596 | * |
3597 | |
3598 | === modified file 'src/signond/signonui_interface.h' |
3599 | --- src/signond/signonui_interface.h 2013-04-24 08:49:02 +0000 |
3600 | +++ src/signond/signonui_interface.h 2016-08-24 14:26:52 +0000 |
3601 | @@ -2,7 +2,7 @@ |
3602 | * This file is part of signon |
3603 | * |
3604 | * Copyright (C) 2009-2010 Nokia Corporation. |
3605 | - * Copyright (C) 2013 Canonical Ltd. |
3606 | + * Copyright (C) 2013-2016 Canonical Ltd. |
3607 | * |
3608 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3609 | * |
3610 | |
3611 | === modified file 'tests/extensions/tst_access_control_manager.cpp' |
3612 | --- tests/extensions/tst_access_control_manager.cpp 2013-08-20 08:01:43 +0000 |
3613 | +++ tests/extensions/tst_access_control_manager.cpp 2016-08-24 14:26:52 +0000 |
3614 | @@ -1,7 +1,7 @@ |
3615 | /* |
3616 | * This file is part of signon |
3617 | * |
3618 | - * Copyright (C) 2013 Canonical Ltd. |
3619 | + * Copyright (C) 2013-2016 Canonical Ltd. |
3620 | * |
3621 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3622 | * |
3623 | |
3624 | === modified file 'tests/libsignon-qt-tests/libsignon-qt-tests.pro' |
3625 | --- tests/libsignon-qt-tests/libsignon-qt-tests.pro 2015-10-27 09:58:39 +0000 |
3626 | +++ tests/libsignon-qt-tests/libsignon-qt-tests.pro 2016-08-24 14:26:52 +0000 |
3627 | @@ -11,11 +11,7 @@ |
3628 | testlib |
3629 | QT -= gui |
3630 | |
3631 | -greaterThan(QT_MAJOR_VERSION, 4) { |
3632 | - LIBS *= -lsignon-qt5 |
3633 | -} else { |
3634 | - LIBS *= -lsignon-qt |
3635 | -} |
3636 | +LIBS *= -lsignon-qt5 |
3637 | QMAKE_LIBDIR += $${TOP_BUILD_DIR}/lib/SignOn |
3638 | QMAKE_RPATHDIR = $${QMAKE_LIBDIR} |
3639 | |
3640 | |
3641 | === modified file 'tests/libsignon-qt-tests/signon-ui.cpp' |
3642 | --- tests/libsignon-qt-tests/signon-ui.cpp 2012-10-25 12:58:10 +0000 |
3643 | +++ tests/libsignon-qt-tests/signon-ui.cpp 2016-08-24 14:26:52 +0000 |
3644 | @@ -1,7 +1,7 @@ |
3645 | /* |
3646 | * This file is part of signon |
3647 | * |
3648 | - * Copyright (C) 2012 Canonical Ltd. |
3649 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3650 | * |
3651 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3652 | * |
3653 | |
3654 | === modified file 'tests/libsignon-qt-tests/signon-ui.h' |
3655 | --- tests/libsignon-qt-tests/signon-ui.h 2012-10-25 12:58:10 +0000 |
3656 | +++ tests/libsignon-qt-tests/signon-ui.h 2016-08-24 14:26:52 +0000 |
3657 | @@ -1,7 +1,7 @@ |
3658 | /* |
3659 | * This file is part of signon |
3660 | * |
3661 | - * Copyright (C) 2012 Canonical Ltd. |
3662 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3663 | * |
3664 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3665 | * |
3666 | |
3667 | === modified file 'tests/libsignon-qt-tests/ssotestclient.cpp' |
3668 | --- tests/libsignon-qt-tests/ssotestclient.cpp 2014-11-17 09:37:35 +0000 |
3669 | +++ tests/libsignon-qt-tests/ssotestclient.cpp 2016-08-24 14:26:52 +0000 |
3670 | @@ -2,6 +2,7 @@ |
3671 | * This file is part of signon |
3672 | * |
3673 | * Copyright (C) 2009-2010 Nokia Corporation. |
3674 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3675 | * |
3676 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3677 | * |
3678 | |
3679 | === modified file 'tests/libsignon-qt-tests/ssotestclient.h' |
3680 | --- tests/libsignon-qt-tests/ssotestclient.h 2014-11-17 09:37:35 +0000 |
3681 | +++ tests/libsignon-qt-tests/ssotestclient.h 2016-08-24 14:26:52 +0000 |
3682 | @@ -2,6 +2,7 @@ |
3683 | * This file is part of signon |
3684 | * |
3685 | * Copyright (C) 2009-2010 Nokia Corporation. |
3686 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3687 | * |
3688 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3689 | * |
3690 | |
3691 | === modified file 'tests/libsignon-qt-tests/testauthserviceresult.cpp' |
3692 | --- tests/libsignon-qt-tests/testauthserviceresult.cpp 2012-04-18 13:06:27 +0000 |
3693 | +++ tests/libsignon-qt-tests/testauthserviceresult.cpp 2016-08-24 14:26:52 +0000 |
3694 | @@ -2,6 +2,7 @@ |
3695 | * This file is part of signon |
3696 | * |
3697 | * Copyright (C) 2009-2010 Nokia Corporation. |
3698 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3699 | * |
3700 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3701 | * |
3702 | |
3703 | === modified file 'tests/libsignon-qt-tests/testauthserviceresult.h' |
3704 | --- tests/libsignon-qt-tests/testauthserviceresult.h 2012-04-18 13:06:27 +0000 |
3705 | +++ tests/libsignon-qt-tests/testauthserviceresult.h 2016-08-24 14:26:52 +0000 |
3706 | @@ -2,6 +2,7 @@ |
3707 | * This file is part of signon |
3708 | * |
3709 | * Copyright (C) 2009-2010 Nokia Corporation. |
3710 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3711 | * |
3712 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3713 | * |
3714 | |
3715 | === modified file 'tests/libsignon-qt-tests/testauthsession.cpp' |
3716 | --- tests/libsignon-qt-tests/testauthsession.cpp 2014-11-17 09:37:35 +0000 |
3717 | +++ tests/libsignon-qt-tests/testauthsession.cpp 2016-08-24 14:26:52 +0000 |
3718 | @@ -2,7 +2,7 @@ |
3719 | * This file is part of signon |
3720 | * |
3721 | * Copyright (C) 2009-2010 Nokia Corporation. |
3722 | - * Copyright (C) 2013 Canonical Ltd. |
3723 | + * Copyright (C) 2013-2016 Canonical Ltd. |
3724 | * |
3725 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3726 | * |
3727 | @@ -405,111 +405,6 @@ |
3728 | QCOMPARE(errorType, SignOn::Error::MethodOrMechanismNotAllowed); |
3729 | } |
3730 | |
3731 | -void TestAuthSession::process_from_other_process() |
3732 | -{ |
3733 | - // In order to try reusing same authentication session from |
3734 | - // another process we need the session object path, which isn't |
3735 | - // available through the client API. To work around this we |
3736 | - // don't use the API but make direct D-Bus calls instead |
3737 | - |
3738 | - // The session bus used by the API cannot be accessed outside |
3739 | - // the API library so create our own bus |
3740 | - QDBusConnection dbuscon1 = |
3741 | - QDBusConnection::connectToBus(QDBusConnection::SessionBus, |
3742 | - "originalconnection"); |
3743 | - QDBusInterface iface(SIGNOND_SERVICE, |
3744 | - SIGNOND_DAEMON_OBJECTPATH, |
3745 | - SIGNOND_DAEMON_INTERFACE, |
3746 | - dbuscon1); |
3747 | - |
3748 | - SlotMachine slotMachine; |
3749 | - QEventLoop sessionLoop; |
3750 | - QObject::connect(&slotMachine, SIGNAL(done()), &sessionLoop, SLOT(quit())); |
3751 | - QTimer::singleShot(10*1000, &sessionLoop, SLOT(quit())); |
3752 | - |
3753 | - QVariantList arguments; |
3754 | - arguments += (quint32)SIGNOND_NEW_IDENTITY; |
3755 | - arguments += QString::fromLatin1("ssotest"); |
3756 | - iface.callWithCallback(QLatin1String("getAuthSessionObjectPath"), |
3757 | - arguments, &slotMachine, |
3758 | - SLOT(authenticationSlot(const QString&)), |
3759 | - SLOT(errorSlot(const QDBusError&))); |
3760 | - |
3761 | - sessionLoop.exec(); |
3762 | - |
3763 | - QString qs; |
3764 | - if (slotMachine.m_path.isEmpty()) |
3765 | - qDebug() << "getAuthSessionObjectPath failed: " << slotMachine.m_errorMessage.toLatin1().data(); |
3766 | - QVERIFY(slotMachine.m_path.length() > 0); |
3767 | - |
3768 | - int exitCode = 1; |
3769 | - pid_t childPid = fork(); |
3770 | - QVERIFY(childPid != -1); |
3771 | - |
3772 | - if (childPid != 0) { |
3773 | - int status = 0; |
3774 | - childPid = waitpid(childPid, &status, 0); |
3775 | - QVERIFY(childPid != -1 && WIFEXITED(status)); |
3776 | - exitCode = WEXITSTATUS(status); |
3777 | - } else { |
3778 | - // We're in the child process now... |
3779 | - // Do not reuse existing session bus because it is seen by signond |
3780 | - // as if coming from the parent process and we want to test connection |
3781 | - // from other process |
3782 | - QDBusConnection dbuscon2 = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "otherconnection"); |
3783 | - QDBusInterface *dbus = new QDBusInterface(SIGNOND_SERVICE, |
3784 | - slotMachine.m_path, |
3785 | - QLatin1String(SIGNOND_AUTH_SESSION_INTERFACE), |
3786 | - dbuscon2); |
3787 | - |
3788 | - SessionData inData; |
3789 | - inData.setSecret("testSecret"); |
3790 | - inData.setUserName("testUsername"); |
3791 | - QVariantMap inDataVarMap; |
3792 | - foreach(QString key, inData.propertyNames()) { |
3793 | - if (!inData.getProperty(key).isNull() && inData.getProperty(key).isValid()) |
3794 | - inDataVarMap[key] = inData.getProperty(key); |
3795 | - } |
3796 | - |
3797 | - arguments.clear(); |
3798 | - arguments += inDataVarMap; |
3799 | - arguments += QString::fromLatin1("mech1"); |
3800 | - |
3801 | - QDBusMessage msg = QDBusMessage::createMethodCall(dbus->service(), |
3802 | - dbus->path(), |
3803 | - dbus->interface(), |
3804 | - QString::fromLatin1("process")); |
3805 | - msg.setArguments(arguments); |
3806 | - |
3807 | - QEventLoop processLoop; |
3808 | - QObject::connect(&slotMachine, SIGNAL(done()), &processLoop, SLOT(quit())); |
3809 | - QTimer::singleShot(10*1000, &processLoop, SLOT(quit())); |
3810 | - |
3811 | - dbus->connection().callWithCallback(msg, &slotMachine, |
3812 | - SLOT(responseSlot(const QVariantMap&)), |
3813 | - SLOT(errorSlot(const QDBusError&)), |
3814 | - SIGNOND_MAX_TIMEOUT); |
3815 | - |
3816 | - processLoop.exec(); |
3817 | - |
3818 | - delete dbus; |
3819 | - |
3820 | - if (slotMachine.m_responseReceived) { |
3821 | - qDebug() << "AuthSession::process succeeded even though it was expected to fail"; |
3822 | - exit(1); |
3823 | - } else { |
3824 | - if (slotMachine.m_errorName == SIGNOND_PERMISSION_DENIED_ERR_NAME) |
3825 | - exit(0); |
3826 | - |
3827 | - qDebug() << "AuthSession::process failed but with unexpected error: " << |
3828 | - slotMachine.m_errorMessage; |
3829 | - exit(1); |
3830 | - } |
3831 | - } |
3832 | - |
3833 | - QCOMPARE(exitCode, 0); |
3834 | -} |
3835 | - |
3836 | void TestAuthSession::process_many_times_after_auth() |
3837 | { |
3838 | AuthSession *as; |
3839 | |
3840 | === modified file 'tests/libsignon-qt-tests/testauthsession.h' |
3841 | --- tests/libsignon-qt-tests/testauthsession.h 2013-07-23 09:07:35 +0000 |
3842 | +++ tests/libsignon-qt-tests/testauthsession.h 2016-08-24 14:26:52 +0000 |
3843 | @@ -3,9 +3,8 @@ |
3844 | * This file is part of signon |
3845 | * |
3846 | * Copyright (C) 2009-2010 Nokia Corporation. |
3847 | - * Copyright (C) 2013 Canonical Ltd. |
3848 | + * Copyright (C) 2013-2016 Canonical Ltd. |
3849 | * |
3850 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3851 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3852 | * |
3853 | * This library is free software; you can redistribute it and/or |
3854 | @@ -86,7 +85,6 @@ |
3855 | void process_with_nonexisting_type(); |
3856 | void process_with_nonexisting_method(); |
3857 | void process_with_unauthorized_method(); |
3858 | - void process_from_other_process(); |
3859 | void process_many_times_after_auth(); |
3860 | void process_many_times_before_auth(); |
3861 | void process_with_big_session_data(); |
3862 | |
3863 | === modified file 'tests/libsignon-qt-tests/testidentityresult.cpp' |
3864 | --- tests/libsignon-qt-tests/testidentityresult.cpp 2012-04-18 13:06:27 +0000 |
3865 | +++ tests/libsignon-qt-tests/testidentityresult.cpp 2016-08-24 14:26:52 +0000 |
3866 | @@ -2,6 +2,7 @@ |
3867 | * This file is part of signon |
3868 | * |
3869 | * Copyright (C) 2009-2010 Nokia Corporation. |
3870 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3871 | * |
3872 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3873 | * |
3874 | |
3875 | === modified file 'tests/libsignon-qt-tests/testidentityresult.h' |
3876 | --- tests/libsignon-qt-tests/testidentityresult.h 2012-04-18 13:06:27 +0000 |
3877 | +++ tests/libsignon-qt-tests/testidentityresult.h 2016-08-24 14:26:52 +0000 |
3878 | @@ -2,6 +2,7 @@ |
3879 | * This file is part of signon |
3880 | * |
3881 | * Copyright (C) 2009-2010 Nokia Corporation. |
3882 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3883 | * |
3884 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3885 | * |
3886 | |
3887 | === modified file 'tests/libsignon-qt-tests/testsinglesignon.cpp' |
3888 | --- tests/libsignon-qt-tests/testsinglesignon.cpp 2012-04-18 13:06:27 +0000 |
3889 | +++ tests/libsignon-qt-tests/testsinglesignon.cpp 2016-08-24 14:26:52 +0000 |
3890 | @@ -2,6 +2,7 @@ |
3891 | * This file is part of signon |
3892 | * |
3893 | * Copyright (C) 2009-2010 Nokia Corporation. |
3894 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3895 | * |
3896 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3897 | * |
3898 | |
3899 | === modified file 'tests/libsignon-qt-tests/testsinglesignon.h' |
3900 | --- tests/libsignon-qt-tests/testsinglesignon.h 2012-04-18 13:06:27 +0000 |
3901 | +++ tests/libsignon-qt-tests/testsinglesignon.h 2016-08-24 14:26:52 +0000 |
3902 | @@ -2,6 +2,7 @@ |
3903 | * This file is part of signon |
3904 | * |
3905 | * Copyright (C) 2009-2010 Nokia Corporation. |
3906 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3907 | * |
3908 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3909 | * |
3910 | |
3911 | === modified file 'tests/libsignon-qt-tests/testthread.cpp' |
3912 | --- tests/libsignon-qt-tests/testthread.cpp 2012-04-18 13:06:27 +0000 |
3913 | +++ tests/libsignon-qt-tests/testthread.cpp 2016-08-24 14:26:52 +0000 |
3914 | @@ -3,8 +3,8 @@ |
3915 | * This file is part of signon |
3916 | * |
3917 | * Copyright (C) 2009-2010 Nokia Corporation. |
3918 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3919 | * |
3920 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3921 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3922 | * |
3923 | * This library is free software; you can redistribute it and/or |
3924 | |
3925 | === modified file 'tests/libsignon-qt-tests/testthread.h' |
3926 | --- tests/libsignon-qt-tests/testthread.h 2012-04-18 13:06:27 +0000 |
3927 | +++ tests/libsignon-qt-tests/testthread.h 2016-08-24 14:26:52 +0000 |
3928 | @@ -3,8 +3,8 @@ |
3929 | * This file is part of signon |
3930 | * |
3931 | * Copyright (C) 2009-2010 Nokia Corporation. |
3932 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3933 | * |
3934 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3935 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3936 | * |
3937 | * This library is free software; you can redistribute it and/or |
3938 | |
3939 | === modified file 'tests/passwordplugintest/passwordplugintest.cpp' |
3940 | --- tests/passwordplugintest/passwordplugintest.cpp 2012-04-18 13:06:27 +0000 |
3941 | +++ tests/passwordplugintest/passwordplugintest.cpp 2016-08-24 14:26:52 +0000 |
3942 | @@ -3,8 +3,8 @@ |
3943 | * This file is part of signon |
3944 | * |
3945 | * Copyright (C) 2009-2010 Nokia Corporation. |
3946 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3947 | * |
3948 | - * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> |
3949 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3950 | * |
3951 | * This library is free software; you can redistribute it and/or |
3952 | |
3953 | === modified file 'tests/passwordplugintest/passwordplugintest.h' |
3954 | --- tests/passwordplugintest/passwordplugintest.h 2012-04-18 13:06:27 +0000 |
3955 | +++ tests/passwordplugintest/passwordplugintest.h 2016-08-24 14:26:52 +0000 |
3956 | @@ -3,6 +3,7 @@ |
3957 | * This file is part of signon |
3958 | * |
3959 | * Copyright (C) 2009-2010 Nokia Corporation. |
3960 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3961 | * |
3962 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3963 | * |
3964 | |
3965 | === modified file 'tests/run-with-signond.sh' |
3966 | --- tests/run-with-signond.sh 2015-04-23 12:37:16 +0000 |
3967 | +++ tests/run-with-signond.sh 2016-08-24 14:26:52 +0000 |
3968 | @@ -24,7 +24,7 @@ |
3969 | if command -v dbus-test-runner > /dev/null ; then |
3970 | echo "Using dbus-test-runner" |
3971 | export SSO_LOGGING_OUTPUT="stdout" |
3972 | - dbus-test-runner -m 180 --dbus-config=${DBUS_CONFIG} \ |
3973 | + dbus-test-runner -m 600 --dbus-config=${DBUS_CONFIG} \ |
3974 | -t "$@" --keep-env |
3975 | else |
3976 | echo "Using dbus-launch" |
3977 | |
3978 | === modified file 'tests/signond-tests/.gitignore' |
3979 | --- tests/signond-tests/.gitignore 2014-11-17 09:59:40 +0000 |
3980 | +++ tests/signond-tests/.gitignore 2016-08-24 14:26:52 +0000 |
3981 | @@ -5,4 +5,5 @@ |
3982 | /tst_backup |
3983 | /tst_database |
3984 | /tst_pluginproxy |
3985 | +/tst_signond |
3986 | /tst_timeouts |
3987 | |
3988 | === modified file 'tests/signond-tests/backuptest.cpp' |
3989 | --- tests/signond-tests/backuptest.cpp 2013-08-20 08:01:43 +0000 |
3990 | +++ tests/signond-tests/backuptest.cpp 2016-08-24 14:26:52 +0000 |
3991 | @@ -2,6 +2,7 @@ |
3992 | * This file is part of signon |
3993 | * |
3994 | * Copyright (C) 2009-2010 Nokia Corporation. |
3995 | + * Copyright (C) 2012-2016 Canonical Ltd. |
3996 | * |
3997 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
3998 | * |
3999 | |
4000 | === modified file 'tests/signond-tests/backuptest.h' |
4001 | --- tests/signond-tests/backuptest.h 2012-08-27 13:42:05 +0000 |
4002 | +++ tests/signond-tests/backuptest.h 2016-08-24 14:26:52 +0000 |
4003 | @@ -2,6 +2,7 @@ |
4004 | * This file is part of signon |
4005 | * |
4006 | * Copyright (C) 2009-2010 Nokia Corporation. |
4007 | + * Copyright (C) 2012-2016 Canonical Ltd. |
4008 | * |
4009 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4010 | * |
4011 | |
4012 | === modified file 'tests/signond-tests/databasetest.cpp' |
4013 | --- tests/signond-tests/databasetest.cpp 2014-08-21 08:46:18 +0000 |
4014 | +++ tests/signond-tests/databasetest.cpp 2016-08-24 14:26:52 +0000 |
4015 | @@ -2,6 +2,7 @@ |
4016 | * This file is part of signon |
4017 | * |
4018 | * Copyright (C) 2009-2010 Nokia Corporation. |
4019 | + * Copyright (C) 2012-2016 Canonical Ltd. |
4020 | * |
4021 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4022 | * |
4023 | |
4024 | === modified file 'tests/signond-tests/databasetest.h' |
4025 | --- tests/signond-tests/databasetest.h 2012-08-27 13:59:00 +0000 |
4026 | +++ tests/signond-tests/databasetest.h 2016-08-24 14:26:52 +0000 |
4027 | @@ -2,6 +2,7 @@ |
4028 | * This file is part of signon |
4029 | * |
4030 | * Copyright (C) 2009-2010 Nokia Corporation. |
4031 | + * Copyright (C) 2012-2016 Canonical Ltd. |
4032 | * |
4033 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4034 | * |
4035 | |
4036 | === added file 'tests/signond-tests/fake_signonui.h' |
4037 | --- tests/signond-tests/fake_signonui.h 1970-01-01 00:00:00 +0000 |
4038 | +++ tests/signond-tests/fake_signonui.h 2016-08-24 14:26:52 +0000 |
4039 | @@ -0,0 +1,53 @@ |
4040 | +/* |
4041 | + * Copyright (C) 2016 Canonical Ltd. |
4042 | + * |
4043 | + * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4044 | + * |
4045 | + * This file is part of signond |
4046 | + * |
4047 | + * This library is free software; you can redistribute it and/or |
4048 | + * modify it under the terms of the GNU Lesser General Public License |
4049 | + * version 2.1 as published by the Free Software Foundation. |
4050 | + * |
4051 | + * This library is distributed in the hope that it will be useful, but |
4052 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
4053 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4054 | + * Lesser General Public License for more details. |
4055 | + * |
4056 | + * You should have received a copy of the GNU Lesser General Public |
4057 | + * License along with this library; if not, write to the Free Software |
4058 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
4059 | + * 02110-1301 USA |
4060 | + */ |
4061 | + |
4062 | +#ifndef SSO_FAKE_SIGNONUI_H |
4063 | +#define SSO_FAKE_SIGNONUI_H |
4064 | + |
4065 | +#include <QVariantMap> |
4066 | +#include <libqtdbusmock/DBusMock.h> |
4067 | + |
4068 | +class FakeSignOnUi |
4069 | +{ |
4070 | +public: |
4071 | + FakeSignOnUi(QtDBusMock::DBusMock *mock): m_mock(mock) { |
4072 | + m_mock->registerTemplate("com.nokia.singlesignonui", |
4073 | + SIGNONUI_MOCK_TEMPLATE, |
4074 | + QDBusConnection::SessionBus); |
4075 | + } |
4076 | + |
4077 | + void setNextReply(const QVariantMap &reply) { |
4078 | + mockedService().call("SetNextReply", reply); |
4079 | + } |
4080 | + |
4081 | + OrgFreedesktopDBusMockInterface &mockedService() { |
4082 | + return m_mock->mockInterface("com.nokia.singlesignonui", |
4083 | + "/SignonUi", |
4084 | + "com.nokia.singlesignonui", |
4085 | + QDBusConnection::SessionBus); |
4086 | + } |
4087 | + |
4088 | +private: |
4089 | + QtDBusMock::DBusMock *m_mock; |
4090 | +}; |
4091 | + |
4092 | +#endif // SSO_FAKE_SIGNONUI_H |
4093 | |
4094 | === modified file 'tests/signond-tests/identity-tool.cpp' |
4095 | --- tests/signond-tests/identity-tool.cpp 2013-08-20 08:01:44 +0000 |
4096 | +++ tests/signond-tests/identity-tool.cpp 2016-08-24 14:26:52 +0000 |
4097 | @@ -1,7 +1,7 @@ |
4098 | /* |
4099 | * This file is part of signon |
4100 | * |
4101 | - * Copyright (C) 2013 Canonical Ltd. |
4102 | + * Copyright (C) 2013-2016 Canonical Ltd. |
4103 | * |
4104 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4105 | * |
4106 | |
4107 | === modified file 'tests/signond-tests/identity-tool.pro' |
4108 | --- tests/signond-tests/identity-tool.pro 2015-10-27 09:58:39 +0000 |
4109 | +++ tests/signond-tests/identity-tool.pro 2016-08-24 14:26:52 +0000 |
4110 | @@ -6,11 +6,7 @@ |
4111 | QT += core |
4112 | QT -= gui |
4113 | |
4114 | -greaterThan(QT_MAJOR_VERSION, 4) { |
4115 | - LIBS += -lsignon-qt5 |
4116 | -} else { |
4117 | - LIBS += -lsignon-qt |
4118 | -} |
4119 | +LIBS += -lsignon-qt5 |
4120 | |
4121 | QMAKE_LIBDIR += \ |
4122 | $${TOP_BUILD_DIR}/lib/signond/SignOn \ |
4123 | |
4124 | === modified file 'tests/signond-tests/include.cpp' |
4125 | --- tests/signond-tests/include.cpp 2013-08-20 08:01:43 +0000 |
4126 | +++ tests/signond-tests/include.cpp 2016-08-24 14:26:52 +0000 |
4127 | @@ -3,6 +3,7 @@ |
4128 | * This file is part of signon |
4129 | * |
4130 | * Copyright (C) 2009-2010 Nokia Corporation. |
4131 | + * Copyright (C) 2012-2016 Canonical Ltd. |
4132 | * |
4133 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4134 | * |
4135 | |
4136 | === modified file 'tests/signond-tests/mock-ac-plugin/identity-ac-helper.pro' |
4137 | --- tests/signond-tests/mock-ac-plugin/identity-ac-helper.pro 2015-10-27 09:58:39 +0000 |
4138 | +++ tests/signond-tests/mock-ac-plugin/identity-ac-helper.pro 2016-08-24 14:26:52 +0000 |
4139 | @@ -6,11 +6,7 @@ |
4140 | QT += core |
4141 | QT -= gui |
4142 | |
4143 | -greaterThan(QT_MAJOR_VERSION, 4) { |
4144 | - LIBS += -lsignon-qt5 |
4145 | -} else { |
4146 | - LIBS += -lsignon-qt |
4147 | -} |
4148 | +LIBS += -lsignon-qt5 |
4149 | |
4150 | QMAKE_LIBDIR += \ |
4151 | $${TOP_BUILD_DIR}/lib/signond/SignOn \ |
4152 | |
4153 | === modified file 'tests/signond-tests/mock-ac-plugin/plugin.cpp' |
4154 | --- tests/signond-tests/mock-ac-plugin/plugin.cpp 2013-08-20 08:01:44 +0000 |
4155 | +++ tests/signond-tests/mock-ac-plugin/plugin.cpp 2016-08-24 14:26:52 +0000 |
4156 | @@ -1,7 +1,7 @@ |
4157 | /* |
4158 | * This file is part of signon |
4159 | * |
4160 | - * Copyright (C) 2013 Canonical Ltd. |
4161 | + * Copyright (C) 2013-2016 Canonical Ltd. |
4162 | * |
4163 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4164 | * |
4165 | @@ -39,7 +39,3 @@ |
4166 | qDebug() << Q_FUNC_INFO; |
4167 | return new AccessControlManager(parent); |
4168 | } |
4169 | - |
4170 | -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) |
4171 | -Q_EXPORT_PLUGIN2(mock-ac, Plugin); |
4172 | -#endif |
4173 | |
4174 | === modified file 'tests/signond-tests/mock-ac-plugin/plugin.h' |
4175 | --- tests/signond-tests/mock-ac-plugin/plugin.h 2013-08-20 08:01:44 +0000 |
4176 | +++ tests/signond-tests/mock-ac-plugin/plugin.h 2016-08-24 14:26:52 +0000 |
4177 | @@ -1,7 +1,7 @@ |
4178 | /* |
4179 | * This file is part of signon |
4180 | * |
4181 | - * Copyright (C) 2013 Canonical Ltd. |
4182 | + * Copyright (C) 2013-2016 Canonical Ltd. |
4183 | * |
4184 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4185 | * |
4186 | @@ -30,9 +30,7 @@ |
4187 | { |
4188 | Q_OBJECT |
4189 | Q_INTERFACES(SignOn::ExtensionInterface3) |
4190 | -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
4191 | Q_PLUGIN_METADATA(IID "com.nokia.SingleSignOn.ExtensionInterface/3.0") |
4192 | -#endif |
4193 | |
4194 | public: |
4195 | Plugin(QObject *parent = 0); |
4196 | |
4197 | === added file 'tests/signond-tests/session_tool.cpp' |
4198 | --- tests/signond-tests/session_tool.cpp 1970-01-01 00:00:00 +0000 |
4199 | +++ tests/signond-tests/session_tool.cpp 2016-08-24 14:26:52 +0000 |
4200 | @@ -0,0 +1,125 @@ |
4201 | +/* |
4202 | + * This file is part of signond |
4203 | + * |
4204 | + * Copyright (C) 2016 Canonical Ltd. |
4205 | + * |
4206 | + * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4207 | + * |
4208 | + * This library is free software; you can redistribute it and/or |
4209 | + * modify it under the terms of the GNU Lesser General Public License |
4210 | + * version 2.1 as published by the Free Software Foundation. |
4211 | + * |
4212 | + * This library is distributed in the hope that it will be useful, but |
4213 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
4214 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4215 | + * Lesser General Public License for more details. |
4216 | + * |
4217 | + * You should have received a copy of the GNU Lesser General Public |
4218 | + * License along with this library; if not, write to the Free Software |
4219 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
4220 | + * 02110-1301 USA |
4221 | + */ |
4222 | + |
4223 | +#include <QCoreApplication> |
4224 | +#include <QDBusConnection> |
4225 | +#include <QDBusError> |
4226 | +#include <QDBusInterface> |
4227 | +#include <QDBusMessage> |
4228 | +#include <QTextStream> |
4229 | +#include <QTimer> |
4230 | + |
4231 | +#include "signond/signoncommon.h" |
4232 | + |
4233 | +class AuthSession: public QObject |
4234 | +{ |
4235 | + Q_OBJECT |
4236 | + |
4237 | +public: |
4238 | + AuthSession(const QString &path); |
4239 | + ~AuthSession(); |
4240 | + |
4241 | +public Q_SLOTS: |
4242 | + void process(const QVariantMap &sessionData); |
4243 | + void onResponse(const QVariantMap &response); |
4244 | + void onError(const QDBusError &error); |
4245 | + |
4246 | +private: |
4247 | + QTextStream m_out; |
4248 | + QDBusInterface *m_dbus; |
4249 | +}; |
4250 | + |
4251 | +AuthSession::AuthSession(const QString &path): |
4252 | + QObject(), |
4253 | + m_out(stdout) |
4254 | +{ |
4255 | + m_dbus = new QDBusInterface(SIGNOND_SERVICE, |
4256 | + path, |
4257 | + QLatin1String(SIGNOND_AUTH_SESSION_INTERFACE), |
4258 | + QDBusConnection::sessionBus()); |
4259 | +} |
4260 | + |
4261 | +AuthSession::~AuthSession() |
4262 | +{ |
4263 | + delete m_dbus; |
4264 | +} |
4265 | + |
4266 | +void AuthSession::process(const QVariantMap &sessionData) |
4267 | +{ |
4268 | + QVariantList arguments; |
4269 | + arguments += sessionData; |
4270 | + arguments += QStringLiteral("mech1"); |
4271 | + |
4272 | + QDBusMessage msg = QDBusMessage::createMethodCall(m_dbus->service(), |
4273 | + m_dbus->path(), |
4274 | + m_dbus->interface(), |
4275 | + QStringLiteral("process")); |
4276 | + msg.setArguments(arguments); |
4277 | + |
4278 | + m_dbus->connection().callWithCallback(msg, this, |
4279 | + SLOT(onResponse(const QVariantMap&)), |
4280 | + SLOT(onError(const QDBusError&)), |
4281 | + SIGNOND_MAX_TIMEOUT); |
4282 | +} |
4283 | + |
4284 | +void AuthSession::onResponse(const QVariantMap &response) |
4285 | +{ |
4286 | + // The called doesn't really care about the response value |
4287 | + Q_UNUSED(response); |
4288 | + m_out << "Response:"; |
4289 | + QCoreApplication::quit(); |
4290 | +} |
4291 | + |
4292 | +void AuthSession::onError(const QDBusError &error) |
4293 | +{ |
4294 | + m_out << "Error:" << error.name(); |
4295 | + QCoreApplication::quit(); |
4296 | +} |
4297 | + |
4298 | +int main(int argc, char **argv) |
4299 | +{ |
4300 | + QCoreApplication app(argc, argv); |
4301 | + |
4302 | + QString sessionPath; |
4303 | + |
4304 | + QStringList args = QCoreApplication::arguments(); |
4305 | + for (int i = 1; i < args.count(); i++) { |
4306 | + if (args[i] == "--sessionPath") { |
4307 | + sessionPath = args[++i]; |
4308 | + } |
4309 | + } |
4310 | + |
4311 | + AuthSession authSession(sessionPath); |
4312 | + |
4313 | + QVariantMap sessionData { |
4314 | + { "Secret", QStringLiteral("testSecret") }, |
4315 | + { "UserName", QStringLiteral("testUsername") }, |
4316 | + }; |
4317 | + authSession.process(sessionData); |
4318 | + |
4319 | + QTimer::singleShot(10*1000, &app, SLOT(quit())); |
4320 | + app.exec(); |
4321 | + |
4322 | + return 0; |
4323 | +} |
4324 | + |
4325 | +#include "session_tool.moc" |
4326 | |
4327 | === added file 'tests/signond-tests/session_tool.pro' |
4328 | --- tests/signond-tests/session_tool.pro 1970-01-01 00:00:00 +0000 |
4329 | +++ tests/signond-tests/session_tool.pro 2016-08-24 14:26:52 +0000 |
4330 | @@ -0,0 +1,13 @@ |
4331 | +include(../../common-project-config.pri) |
4332 | + |
4333 | +TEMPLATE = app |
4334 | +TARGET = session_tool |
4335 | + |
4336 | +QT += core dbus |
4337 | +QT -= gui |
4338 | + |
4339 | +INCLUDEPATH += \ |
4340 | + $${TOP_SRC_DIR}/lib |
4341 | + |
4342 | +SOURCES = \ |
4343 | + session_tool.cpp |
4344 | |
4345 | === modified file 'tests/signond-tests/signond-tests.pri' |
4346 | --- tests/signond-tests/signond-tests.pri 2015-10-27 09:58:39 +0000 |
4347 | +++ tests/signond-tests/signond-tests.pri 2016-08-24 14:26:52 +0000 |
4348 | @@ -12,12 +12,9 @@ |
4349 | |
4350 | QT -= gui |
4351 | |
4352 | -LIBS += -lsignon-extension |
4353 | -greaterThan(QT_MAJOR_VERSION, 4) { |
4354 | - LIBS += -lsignon-qt5 |
4355 | -} else { |
4356 | - LIBS += -lsignon-qt |
4357 | -} |
4358 | +LIBS += \ |
4359 | + -lsignon-extension \ |
4360 | + -lsignon-qt5 |
4361 | |
4362 | QMAKE_LIBDIR += \ |
4363 | $${TOP_BUILD_DIR}/lib/signond/SignOn \ |
4364 | |
4365 | === modified file 'tests/signond-tests/signond-tests.pro' |
4366 | --- tests/signond-tests/signond-tests.pro 2015-02-03 14:59:11 +0000 |
4367 | +++ tests/signond-tests/signond-tests.pro 2016-08-24 14:26:52 +0000 |
4368 | @@ -7,5 +7,12 @@ |
4369 | tst_database.pro \ |
4370 | access-control.pro \ |
4371 | |
4372 | +system(pkg-config --exists libqtdbusmock-1) { |
4373 | + SUBDIRS += \ |
4374 | + session_tool.pro \ |
4375 | + tst_signond.pro |
4376 | + tst_signond.depends += session_tool |
4377 | +} |
4378 | + |
4379 | # Disabled until fixed |
4380 | #SUBDIRS += tst_backup.pro |
4381 | |
4382 | === added file 'tests/signond-tests/signonui.py' |
4383 | --- tests/signond-tests/signonui.py 1970-01-01 00:00:00 +0000 |
4384 | +++ tests/signond-tests/signonui.py 2016-08-24 14:26:52 +0000 |
4385 | @@ -0,0 +1,55 @@ |
4386 | +'''signonui mock template |
4387 | + |
4388 | +This creates the expected methods and properties of the |
4389 | +com.nokia.singlesignonui service. |
4390 | +''' |
4391 | + |
4392 | +# This program is free software; you can redistribute it and/or modify it under |
4393 | +# the terms of the GNU Lesser General Public License as published by the Free |
4394 | +# Software Foundation; either version 2.1 of the License. See |
4395 | +# http://www.gnu.org/copyleft/lgpl.html for the full text of the license. |
4396 | + |
4397 | +__author__ = 'Alberto Mardegan' |
4398 | +__email__ = 'alberto.mardegan@canonical.com' |
4399 | +__copyright__ = '(c) 2016 Canonical Ltd.' |
4400 | +__license__ = 'LGPL 2.1' |
4401 | + |
4402 | +import dbus |
4403 | +import time |
4404 | + |
4405 | +from dbusmock import MOCK_IFACE |
4406 | +import dbusmock |
4407 | + |
4408 | +BUS_NAME = 'com.nokia.singlesignonui' |
4409 | +MAIN_OBJ = '/SignonUi' |
4410 | +MAIN_SERVICE_IFACE = 'com.nokia.singlesignonui' |
4411 | +MAIN_IFACE = MAIN_SERVICE_IFACE |
4412 | +SYSTEM_BUS = False |
4413 | + |
4414 | + |
4415 | +def query_dialog(self, params): |
4416 | + if self.nextReplyError: |
4417 | + raise dbus.exceptions.DBusException('SignOnUi error', |
4418 | + name=self.nextReplyError) |
4419 | + return self.nextReplyData |
4420 | + |
4421 | + |
4422 | +def load(mock, parameters): |
4423 | + mock.query_dialog = query_dialog |
4424 | + mock.refresh_dialog = query_dialog |
4425 | + mock.AddMethods(MAIN_SERVICE_IFACE, [ |
4426 | + ('queryDialog', 'a{sv}', 'a{sv}', 'ret = self.query_dialog(self, args[0])'), |
4427 | + ('refreshDialog', 'a{sv}', 'a{sv}', 'ret = self.refresh_dialog(self, args[0])'), |
4428 | + ('cancelUiRequest', 's', '', 'ret = None'), |
4429 | + ('removeIdentityData', 'u', '', 'ret = None'), |
4430 | + ]) |
4431 | + |
4432 | + mock.nextReplyData = {} |
4433 | + mock.nextReplyError = '' |
4434 | + |
4435 | + |
4436 | +@dbus.service.method(MOCK_IFACE, in_signature='a{sv}', out_signature='') |
4437 | +def SetNextReply(self, data): |
4438 | + self.nextReplyData = data.get('data', {}) |
4439 | + self.nextReplyError = data.get('error', '') |
4440 | + |
4441 | |
4442 | === modified file 'tests/signond-tests/testpluginproxy.cpp' |
4443 | --- tests/signond-tests/testpluginproxy.cpp 2013-08-20 08:01:43 +0000 |
4444 | +++ tests/signond-tests/testpluginproxy.cpp 2016-08-24 14:26:52 +0000 |
4445 | @@ -2,6 +2,7 @@ |
4446 | * This file is part of signon |
4447 | * |
4448 | * Copyright (C) 2009-2010 Nokia Corporation. |
4449 | + * Copyright (C) 2012-2016 Canonical Ltd. |
4450 | * |
4451 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4452 | * |
4453 | |
4454 | === modified file 'tests/signond-tests/testpluginproxy.h' |
4455 | --- tests/signond-tests/testpluginproxy.h 2013-08-20 08:01:43 +0000 |
4456 | +++ tests/signond-tests/testpluginproxy.h 2016-08-24 14:26:52 +0000 |
4457 | @@ -2,6 +2,7 @@ |
4458 | * This file is part of signon |
4459 | * |
4460 | * Copyright (C) 2009-2010 Nokia Corporation. |
4461 | + * Copyright (C) 2012-2016 Canonical Ltd. |
4462 | * |
4463 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4464 | * |
4465 | |
4466 | === modified file 'tests/signond-tests/timeouts.cpp' |
4467 | --- tests/signond-tests/timeouts.cpp 2014-11-17 09:37:35 +0000 |
4468 | +++ tests/signond-tests/timeouts.cpp 2016-08-24 14:26:52 +0000 |
4469 | @@ -2,7 +2,7 @@ |
4470 | * This file is part of signon |
4471 | * |
4472 | * Copyright (C) 2010 Nokia Corporation. |
4473 | - * Copyright (C) 2012 Canonical Ltd. |
4474 | + * Copyright (C) 2012-2016 Canonical Ltd. |
4475 | * |
4476 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4477 | * |
4478 | |
4479 | === modified file 'tests/signond-tests/timeouts.h' |
4480 | --- tests/signond-tests/timeouts.h 2012-08-27 13:42:05 +0000 |
4481 | +++ tests/signond-tests/timeouts.h 2016-08-24 14:26:52 +0000 |
4482 | @@ -2,7 +2,7 @@ |
4483 | * This file is part of signon |
4484 | * |
4485 | * Copyright (C) 2010 Nokia Corporation. |
4486 | - * Copyright (C) 2012 Canonical Ltd. |
4487 | + * Copyright (C) 2012-2016 Canonical Ltd. |
4488 | * |
4489 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4490 | * |
4491 | |
4492 | === modified file 'tests/signond-tests/tst_access_control.cpp' |
4493 | --- tests/signond-tests/tst_access_control.cpp 2013-08-20 08:01:44 +0000 |
4494 | +++ tests/signond-tests/tst_access_control.cpp 2016-08-24 14:26:52 +0000 |
4495 | @@ -1,7 +1,7 @@ |
4496 | /* |
4497 | * This file is part of signon |
4498 | * |
4499 | - * Copyright (C) 2013 Canonical Ltd. |
4500 | + * Copyright (C) 2013-2016 Canonical Ltd. |
4501 | * |
4502 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4503 | * |
4504 | |
4505 | === modified file 'tests/signond-tests/tst_access_control_manager_helper.cpp' |
4506 | --- tests/signond-tests/tst_access_control_manager_helper.cpp 2014-11-17 11:53:47 +0000 |
4507 | +++ tests/signond-tests/tst_access_control_manager_helper.cpp 2016-08-24 14:26:52 +0000 |
4508 | @@ -1,7 +1,7 @@ |
4509 | /* |
4510 | * This file is part of signon |
4511 | * |
4512 | - * Copyright (C) 2014 Canonical Ltd. |
4513 | + * Copyright (C) 2014-2016 Canonical Ltd. |
4514 | * |
4515 | * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4516 | * |
4517 | |
4518 | === added file 'tests/signond-tests/tst_signond.cpp' |
4519 | --- tests/signond-tests/tst_signond.cpp 1970-01-01 00:00:00 +0000 |
4520 | +++ tests/signond-tests/tst_signond.cpp 2016-08-24 14:26:52 +0000 |
4521 | @@ -0,0 +1,648 @@ |
4522 | +/* |
4523 | + * Copyright (C) 2016 Canonical Ltd. |
4524 | + * |
4525 | + * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> |
4526 | + * |
4527 | + * This file is part of signond |
4528 | + * |
4529 | + * This library is free software; you can redistribute it and/or |
4530 | + * modify it under the terms of the GNU Lesser General Public License |
4531 | + * version 2.1 as published by the Free Software Foundation. |
4532 | + * |
4533 | + * This library is distributed in the hope that it will be useful, but |
4534 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
4535 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4536 | + * Lesser General Public License for more details. |
4537 | + * |
4538 | + * You should have received a copy of the GNU Lesser General Public |
4539 | + * License along with this library; if not, write to the Free Software |
4540 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
4541 | + * 02110-1301 USA |
4542 | + */ |
4543 | + |
4544 | +#include <QDebug> |
4545 | +#include <QDir> |
4546 | +#include <QProcess> |
4547 | +#include <QSignalSpy> |
4548 | +#include <QTemporaryDir> |
4549 | +#include <QTest> |
4550 | +#include <libqtdbusmock/DBusMock.h> |
4551 | +#include <signal.h> |
4552 | +#include <sys/types.h> |
4553 | + |
4554 | +#include "SignOn/UiSessionData" |
4555 | +#include "signond/signoncommon.h" |
4556 | + |
4557 | +#include "fake_signonui.h" |
4558 | + |
4559 | +namespace QTest { |
4560 | +template<> |
4561 | +char *toString(const QSet<QString> &set) |
4562 | +{ |
4563 | + QByteArray ba = "QSet<QString>("; |
4564 | + QStringList list = set.toList(); |
4565 | + ba += list.join(", "); |
4566 | + ba += ")"; |
4567 | + return qstrdup(ba.data()); |
4568 | +} |
4569 | +} // QTest namespace |
4570 | + |
4571 | +using namespace QtDBusMock; |
4572 | + |
4573 | +class SignondTest: public QObject |
4574 | +{ |
4575 | + Q_OBJECT |
4576 | + |
4577 | +public: |
4578 | + SignondTest(); |
4579 | + |
4580 | +private Q_SLOTS: |
4581 | + void initTestCase(); |
4582 | + void cleanup(); |
4583 | + void testStart(); |
4584 | + void testQueryMethods(); |
4585 | + void testQueryMechanisms_data(); |
4586 | + void testQueryMechanisms(); |
4587 | + void testIdentityCreation(); |
4588 | + void testIdentityRemoval(); |
4589 | + void testIdentityReferences(); |
4590 | + void testAuthSessionMechanisms_data(); |
4591 | + void testAuthSessionMechanisms(); |
4592 | + void testAuthSessionProcess(); |
4593 | + void testAuthSessionProcessFromOtherProcess(); |
4594 | + void testAuthSessionProcessUi(); |
4595 | + void testAuthSessionCloseUi_data(); |
4596 | + void testAuthSessionCloseUi(); |
4597 | + |
4598 | +private: |
4599 | + void setupEnvironment(); |
4600 | + bool signondIsRunning(); |
4601 | + bool killSignond(); |
4602 | + void clearBaseDir(); |
4603 | + const QDBusConnection &connection() { return m_dbus.sessionConnection(); } |
4604 | + QDBusMessage methodCall(const QString &path, const QString &interface, |
4605 | + const QString &method) { |
4606 | + return QDBusMessage::createMethodCall(SIGNOND_SERVICE, path, |
4607 | + interface, method); |
4608 | + } |
4609 | + bool replyIsValid(const QDBusMessage &reply); |
4610 | + QString createIdentity(const QVariantMap &data, uint *id = 0); |
4611 | + |
4612 | +private: |
4613 | + QTemporaryDir m_baseDir; |
4614 | + QtDBusTest::DBusTestRunner m_dbus; |
4615 | + QtDBusMock::DBusMock m_mock; |
4616 | + FakeSignOnUi m_signonUi; |
4617 | +}; |
4618 | + |
4619 | +static bool mapIsSuperset(const QVariantMap &superSet, const QVariantMap &set) |
4620 | +{ |
4621 | + QMapIterator<QString, QVariant> it(set); |
4622 | + while (it.hasNext()) { |
4623 | + it.next(); |
4624 | + if (!superSet.contains(it.key())) { |
4625 | + qDebug() << "Missing key" << it.key(); |
4626 | + return false; |
4627 | + } |
4628 | + if (superSet.value(it.key()) != it.value()) { |
4629 | + qDebug() << it.key() << "is" << superSet.value(it.key()) << " expecting " << it.value(); |
4630 | + return false; |
4631 | + } |
4632 | + } |
4633 | + |
4634 | + return true; |
4635 | +} |
4636 | + |
4637 | +SignondTest::SignondTest(): |
4638 | + QObject(0), |
4639 | + m_dbus((setupEnvironment(), TEST_DBUS_CONFIG_FILE)), |
4640 | + m_mock(m_dbus), |
4641 | + m_signonUi(&m_mock) |
4642 | +{ |
4643 | + DBusMock::registerMetaTypes(); |
4644 | +} |
4645 | + |
4646 | +void SignondTest::setupEnvironment() |
4647 | +{ |
4648 | + QVERIFY(m_baseDir.isValid()); |
4649 | + QByteArray baseDirPath = m_baseDir.path().toUtf8(); |
4650 | + QDir baseDir(m_baseDir.path()); |
4651 | + |
4652 | + qunsetenv("XDG_DATA_DIR"); |
4653 | + qputenv("BUILDDIR", BUILDDIR); |
4654 | + qputenv("HOME", baseDirPath); |
4655 | + qputenv("XDG_RUNTIME_DIR", baseDirPath + "/runtime-dir"); |
4656 | + baseDir.mkpath("runtime-dir"); |
4657 | + qputenv("SSO_STORAGE_PATH", baseDirPath); |
4658 | + qputenv("SSO_EXTENSIONS_DIR", baseDirPath + "/non-existing-dir"); |
4659 | + qputenv("SSO_USE_PEER_BUS", "0"); |
4660 | + qputenv("SSO_LOGGING_LEVEL", "2"); |
4661 | + qputenv("SSO_PLUGINS_DIR", BUILDDIR "/src/plugins/test"); |
4662 | + QByteArray ldLibraryPath = qgetenv("LD_LIBRARY_PATH"); |
4663 | + qputenv("LD_LIBRARY_PATH", |
4664 | + BUILDDIR "/lib/plugins:" |
4665 | + BUILDDIR "/lib/plugins/signon-plugins-common:" |
4666 | + BUILDDIR "/lib/signond/SignOn:" + |
4667 | + ldLibraryPath); |
4668 | + QByteArray execPath = qgetenv("PATH"); |
4669 | + qputenv("PATH", |
4670 | + BUILDDIR "/src/remotepluginprocess:" + |
4671 | + execPath); |
4672 | + |
4673 | + /* Make sure we accidentally don't talk to the developer's signond running |
4674 | + * in the session bus */ |
4675 | + qunsetenv("DBUS_SESSION_BUS_ADDRESS"); |
4676 | +} |
4677 | + |
4678 | +bool SignondTest::replyIsValid(const QDBusMessage &msg) |
4679 | +{ |
4680 | + if (msg.type() == QDBusMessage::ErrorMessage) { |
4681 | + qDebug() << "Error name:" << msg.errorName(); |
4682 | + qDebug() << "Error text:" << msg.errorMessage(); |
4683 | + } |
4684 | + return msg.type() == QDBusMessage::ReplyMessage; |
4685 | +} |
4686 | + |
4687 | +bool SignondTest::signondIsRunning() |
4688 | +{ |
4689 | + return connection(). |
4690 | + interface()->isServiceRegistered(SIGNOND_SERVICE).value(); |
4691 | +} |
4692 | + |
4693 | +bool SignondTest::killSignond() |
4694 | +{ |
4695 | + uint pid = connection().interface()->servicePid(SIGNOND_SERVICE).value(); |
4696 | + if (pid == 0) return true; |
4697 | + return kill(pid, SIGTERM) == 0 || errno == ESRCH; |
4698 | +} |
4699 | + |
4700 | +void SignondTest::clearBaseDir() |
4701 | +{ |
4702 | + QDir baseDir(m_baseDir.path()); |
4703 | + baseDir.removeRecursively(); |
4704 | + baseDir.mkpath("."); |
4705 | +} |
4706 | + |
4707 | +QString SignondTest::createIdentity(const QVariantMap &data, uint *id) |
4708 | +{ |
4709 | + QDBusMessage msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, |
4710 | + SIGNOND_DAEMON_INTERFACE, |
4711 | + "registerNewIdentity"); |
4712 | + QDBusMessage reply = connection().call(msg); |
4713 | + if (!replyIsValid(reply)) return QString(); |
4714 | + |
4715 | + QString objectPath = |
4716 | + reply.arguments()[0].value<QDBusObjectPath>().path(); |
4717 | + |
4718 | + msg = methodCall(objectPath, SIGNOND_IDENTITY_INTERFACE, "store"); |
4719 | + msg << data; |
4720 | + reply = connection().call(msg); |
4721 | + if (!replyIsValid(reply)) return QString(); |
4722 | + |
4723 | + if (id) { |
4724 | + *id = reply.arguments()[0].toUInt(); |
4725 | + } |
4726 | + return objectPath; |
4727 | +} |
4728 | + |
4729 | +void SignondTest::initTestCase() |
4730 | +{ |
4731 | + m_dbus.startServices(); |
4732 | +} |
4733 | + |
4734 | +void SignondTest::cleanup() |
4735 | +{ |
4736 | + if (QTest::currentTestFailed()) { |
4737 | + m_baseDir.setAutoRemove(false); |
4738 | + qDebug() << "Base dir:" << m_baseDir.path(); |
4739 | + } |
4740 | +} |
4741 | + |
4742 | +void SignondTest::testStart() |
4743 | +{ |
4744 | + QVERIFY(killSignond()); |
4745 | + QTRY_VERIFY(!signondIsRunning()); |
4746 | + |
4747 | + QDBusMessage reply = |
4748 | + connection().interface()->call("StartServiceByName", |
4749 | + SIGNOND_SERVICE, uint(0)); |
4750 | + QVERIFY(replyIsValid(reply)); |
4751 | + QTRY_VERIFY(signondIsRunning()); |
4752 | +} |
4753 | + |
4754 | +void SignondTest::testQueryMethods() |
4755 | +{ |
4756 | + QDBusMessage msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, |
4757 | + SIGNOND_DAEMON_INTERFACE, |
4758 | + "queryMethods"); |
4759 | + QDBusMessage reply = connection().call(msg); |
4760 | + QVERIFY(replyIsValid(reply)); |
4761 | + QCOMPARE(reply.arguments().count(), 1); |
4762 | + QStringList methods = reply.arguments()[0].toStringList(); |
4763 | + QStringList expectedMethods { "ssotest", "ssotest2" }; |
4764 | + QCOMPARE(methods.toSet(), expectedMethods.toSet()); |
4765 | +} |
4766 | + |
4767 | +void SignondTest::testQueryMechanisms_data() |
4768 | +{ |
4769 | + QTest::addColumn<QString>("method"); |
4770 | + QTest::addColumn<QStringList>("expectedMechanisms"); |
4771 | + |
4772 | + QTest::newRow("ssotest") << |
4773 | + "ssotest" << QStringList { "mech1", "mech2", "mech3", "BLOB" }; |
4774 | + QTest::newRow("ssotest2") << |
4775 | + "ssotest2" << QStringList { "mech1", "mech2", "mech3" }; |
4776 | +} |
4777 | + |
4778 | +void SignondTest::testQueryMechanisms() |
4779 | +{ |
4780 | + QFETCH(QString, method); |
4781 | + QFETCH(QStringList, expectedMechanisms); |
4782 | + |
4783 | + QDBusMessage msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, |
4784 | + SIGNOND_DAEMON_INTERFACE, |
4785 | + "queryMechanisms"); |
4786 | + msg << method; |
4787 | + QDBusMessage reply = connection().call(msg); |
4788 | + QVERIFY(replyIsValid(reply)); |
4789 | + |
4790 | + QCOMPARE(reply.arguments().count(), 1); |
4791 | + QStringList mechanisms = reply.arguments()[0].toStringList(); |
4792 | + QCOMPARE(mechanisms.toSet(), expectedMechanisms.toSet()); |
4793 | +} |
4794 | + |
4795 | +void SignondTest::testIdentityCreation() |
4796 | +{ |
4797 | + QDBusMessage msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, |
4798 | + SIGNOND_DAEMON_INTERFACE, |
4799 | + "registerNewIdentity"); |
4800 | + QDBusMessage reply = connection().call(msg); |
4801 | + QVERIFY(replyIsValid(reply)); |
4802 | + |
4803 | + QCOMPARE(reply.arguments().count(), 1); |
4804 | + |
4805 | + QString objectPath = |
4806 | + reply.arguments()[0].value<QDBusObjectPath>().path(); |
4807 | + QVERIFY(objectPath.startsWith('/')); |
4808 | + |
4809 | + QVariantMap identityData { |
4810 | + { SIGNOND_IDENTITY_INFO_USERNAME, "John" }, |
4811 | + { SIGNOND_IDENTITY_INFO_CAPTION, "John's account" }, |
4812 | + { SIGNOND_IDENTITY_INFO_ACL, QStringList { "*" } }, |
4813 | + }; |
4814 | + msg = methodCall(objectPath, SIGNOND_IDENTITY_INTERFACE, "store"); |
4815 | + msg << identityData; |
4816 | + reply = connection().call(msg); |
4817 | + QVERIFY(replyIsValid(reply)); |
4818 | + |
4819 | + uint id = reply.arguments()[0].toUInt(); |
4820 | + QVERIFY(id != 0); |
4821 | + |
4822 | + /* Read the current identity info */ |
4823 | + msg = methodCall(objectPath, SIGNOND_IDENTITY_INTERFACE, "getInfo"); |
4824 | + reply = connection().call(msg); |
4825 | + QVERIFY(replyIsValid(reply)); |
4826 | + |
4827 | + QVariantMap storedData = QDBusReply<QVariantMap>(reply).value(); |
4828 | + QVERIFY(mapIsSuperset(storedData, identityData)); |
4829 | + |
4830 | + /* Reload the identity */ |
4831 | + msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, SIGNOND_DAEMON_INTERFACE, |
4832 | + "getIdentity"); |
4833 | + msg << id; |
4834 | + reply = connection().call(msg); |
4835 | + QVERIFY(replyIsValid(reply)); |
4836 | + |
4837 | + QCOMPARE(reply.arguments().count(), 2); |
4838 | + objectPath = reply.arguments()[0].value<QDBusObjectPath>().path(); |
4839 | + QVERIFY(objectPath.startsWith('/')); |
4840 | + storedData = |
4841 | + qdbus_cast<QVariantMap>(reply.arguments()[1].value<QDBusArgument>()); |
4842 | + QVERIFY(mapIsSuperset(storedData, identityData)); |
4843 | + |
4844 | + /* Query identities */ |
4845 | + msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, SIGNOND_DAEMON_INTERFACE, |
4846 | + "queryIdentities"); |
4847 | + msg << QVariantMap(); |
4848 | + reply = connection().call(msg); |
4849 | + QVERIFY(replyIsValid(reply)); |
4850 | + |
4851 | + QCOMPARE(reply.arguments().count(), 1); |
4852 | + QList<QVariantMap> identities = |
4853 | + qdbus_cast<QList<QVariantMap>>(reply.arguments()[0].value<QDBusArgument>()); |
4854 | + QCOMPARE(identities.count(), 1); |
4855 | + storedData = identities[0]; |
4856 | + QVERIFY(mapIsSuperset(storedData, identityData)); |
4857 | +} |
4858 | + |
4859 | +void SignondTest::testIdentityRemoval() |
4860 | +{ |
4861 | + m_signonUi.mockedService().ClearCalls().waitForFinished(); |
4862 | + |
4863 | + QVariantMap identityData { |
4864 | + { SIGNOND_IDENTITY_INFO_USERNAME, "John Deleteme" }, |
4865 | + { SIGNOND_IDENTITY_INFO_CAPTION, "John's account" }, |
4866 | + { SIGNOND_IDENTITY_INFO_ACL, QStringList { "*" } }, |
4867 | + }; |
4868 | + uint id; |
4869 | + QString objectPath = createIdentity(identityData, &id); |
4870 | + QVERIFY(objectPath.startsWith('/')); |
4871 | + QVERIFY(id > 0); |
4872 | + |
4873 | + QDBusMessage msg = |
4874 | + methodCall(objectPath, SIGNOND_IDENTITY_INTERFACE, "remove"); |
4875 | + QDBusMessage reply = connection().call(msg); |
4876 | + QVERIFY(replyIsValid(reply)); |
4877 | + |
4878 | + /* Check that signonui has been asked to remove its data */ |
4879 | + QList<MethodCall> calls = |
4880 | + m_signonUi.mockedService().GetMethodCalls("removeIdentityData"); |
4881 | + QCOMPARE(calls.count(), 1); |
4882 | + MethodCall call = calls.first(); |
4883 | + QCOMPARE(call.args().count(), 1); |
4884 | + QCOMPARE(call.args().first().toUInt(), id); |
4885 | + |
4886 | + /* Read the current identity info */ |
4887 | + msg = methodCall(objectPath, SIGNOND_IDENTITY_INTERFACE, "getInfo"); |
4888 | + reply = connection().call(msg); |
4889 | + QCOMPARE(reply.type(), QDBusMessage::ErrorMessage); |
4890 | + |
4891 | + /* Load the identity again */ |
4892 | + msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, SIGNOND_DAEMON_INTERFACE, |
4893 | + "getIdentity"); |
4894 | + msg << id; |
4895 | + reply = connection().call(msg); |
4896 | + QCOMPARE(reply.type(), QDBusMessage::ErrorMessage); |
4897 | +} |
4898 | + |
4899 | +void SignondTest::testIdentityReferences() |
4900 | +{ |
4901 | + QVariantMap identityData { |
4902 | + { SIGNOND_IDENTITY_INFO_USERNAME, "John" }, |
4903 | + { SIGNOND_IDENTITY_INFO_CAPTION, "John's account" }, |
4904 | + { SIGNOND_IDENTITY_INFO_ACL, QStringList { "*" } }, |
4905 | + }; |
4906 | + QString objectPath = createIdentity(identityData); |
4907 | + |
4908 | + /* Read the current identity info */ |
4909 | + QDBusMessage msg = |
4910 | + methodCall(objectPath, SIGNOND_IDENTITY_INTERFACE, "getInfo"); |
4911 | + QDBusMessage reply = connection().call(msg); |
4912 | + QVERIFY(replyIsValid(reply)); |
4913 | + |
4914 | + QVariantMap storedData = QDBusReply<QVariantMap>(reply).value(); |
4915 | + QCOMPARE(storedData.value(SIGNOND_IDENTITY_INFO_REFCOUNT).toInt(), 0); |
4916 | + |
4917 | + /* Add a reference */ |
4918 | + msg = methodCall(objectPath, SIGNOND_IDENTITY_INTERFACE, "addReference"); |
4919 | + msg << "hello"; |
4920 | + reply = connection().call(msg); |
4921 | + QVERIFY(replyIsValid(reply)); |
4922 | + |
4923 | + /* Check new refcount */ |
4924 | + msg = methodCall(objectPath, SIGNOND_IDENTITY_INTERFACE, "getInfo"); |
4925 | + reply = connection().call(msg); |
4926 | + QVERIFY(replyIsValid(reply)); |
4927 | + storedData = QDBusReply<QVariantMap>(reply).value(); |
4928 | + QEXPECT_FAIL("", "refcount not updated: https://gitlab.com/accounts-sso/signond/issues/1", Continue); |
4929 | + QCOMPARE(storedData.value(SIGNOND_IDENTITY_INFO_REFCOUNT).toInt(), 1); |
4930 | +} |
4931 | + |
4932 | +void SignondTest::testAuthSessionMechanisms_data() |
4933 | +{ |
4934 | + QTest::addColumn<QString>("method"); |
4935 | + QTest::addColumn<QStringList>("wantedMechanisms"); |
4936 | + QTest::addColumn<QStringList>("expectedMechanisms"); |
4937 | + |
4938 | + QTest::newRow("ssotest - any") << |
4939 | + "ssotest" << |
4940 | + QStringList {} << |
4941 | + QStringList { "mech1", "mech2", "mech3", "BLOB" }; |
4942 | + QTest::newRow("ssotest - subset") << |
4943 | + "ssotest" << |
4944 | + QStringList { "BLOB", "mech1" } << |
4945 | + QStringList { "BLOB", "mech1" }; |
4946 | + QTest::newRow("ssotest2 - any") << |
4947 | + "ssotest2" << |
4948 | + QStringList {} << |
4949 | + QStringList { "mech1", "mech2", "mech3" }; |
4950 | + QTest::newRow("ssotest2 - mix") << |
4951 | + "ssotest2" << |
4952 | + QStringList { "BLOB", "mech1" } << |
4953 | + QStringList { "mech1" }; |
4954 | +} |
4955 | + |
4956 | +void SignondTest::testAuthSessionMechanisms() |
4957 | +{ |
4958 | + QFETCH(QString, method); |
4959 | + QFETCH(QStringList, wantedMechanisms); |
4960 | + QFETCH(QStringList, expectedMechanisms); |
4961 | + |
4962 | + QDBusMessage msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, |
4963 | + SIGNOND_DAEMON_INTERFACE, |
4964 | + "getAuthSessionObjectPath"); |
4965 | + msg << uint(0); |
4966 | + msg << method; |
4967 | + QDBusMessage reply = connection().call(msg); |
4968 | + QVERIFY(replyIsValid(reply)); |
4969 | + |
4970 | + QCOMPARE(reply.arguments().count(), 1); |
4971 | + |
4972 | + QString objectPath = reply.arguments()[0].toString(); |
4973 | + QVERIFY(objectPath.startsWith('/')); |
4974 | + |
4975 | + /* Check the available mechanisms */ |
4976 | + msg = methodCall(objectPath, SIGNOND_AUTH_SESSION_INTERFACE, |
4977 | + "queryAvailableMechanisms"); |
4978 | + msg << wantedMechanisms; |
4979 | + reply = connection().call(msg); |
4980 | + QVERIFY(replyIsValid(reply)); |
4981 | + |
4982 | + QStringList mechanisms = QDBusReply<QStringList>(reply).value(); |
4983 | + QCOMPARE(mechanisms.toSet(), expectedMechanisms.toSet()); |
4984 | +} |
4985 | + |
4986 | +void SignondTest::testAuthSessionProcess() |
4987 | +{ |
4988 | + QDBusMessage msg = methodCall(SIGNOND_DAEMON_OBJECTPATH, |
4989 | + SIGNOND_DAEMON_INTERFACE, |
4990 | + "getAuthSessionObjectPath"); |
4991 | + msg << uint(0); |
4992 | + msg << QString("ssotest"); |
4993 | + QDBusMessage reply = connection().call(msg); |
4994 | + QVERIFY(replyIsValid(reply)); |
4995 | + |
4996 | + QCOMPARE(reply.arguments().count(), 1); |
4997 | + |
4998 | + QString objectPath = reply.arguments()[0].toString(); |
4999 | + QVERIFY(objectPath.startsWith('/')); |
5000 | + |