Merge lp:~ken-vandine/content-hub/lp1456628 into lp:content-hub

Proposed by Ken VanDine
Status: Merged
Approved by: Michael Sheldon
Approved revision: 223
Merged at revision: 212
Proposed branch: lp:~ken-vandine/content-hub/lp1456628
Merge into: lp:content-hub
Diff against target: 489 lines (+192/-27)
16 files modified
CMakeLists.txt (+1/-0)
debian/apparmor/content-hub-testability (+15/-0)
debian/content-hub-testability.install (+1/-0)
debian/control (+4/-0)
debian/rules (+4/-0)
debian/tests/aa-check (+41/-0)
debian/tests/control (+3/-0)
src/com/ubuntu/content/CMakeLists.txt (+2/-0)
src/com/ubuntu/content/detail/service.h (+1/-1)
src/com/ubuntu/content/detail/transfer.cpp (+19/-2)
src/com/ubuntu/content/detail/transfer.h (+4/-2)
src/com/ubuntu/content/utils.cpp (+51/-7)
tests/peers/exporter/CMakeLists.txt (+2/-0)
tests/peers/exporter/autoexporter.cpp (+21/-12)
tests/peers/exporter/autoexporter.h (+4/-0)
tests/peers/exporter/exporter.cpp (+19/-3)
To merge this branch: bzr merge lp:~ken-vandine/content-hub/lp1456628
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Approve
Review via email: mp+260191@code.launchpad.net

Commit message

* SECURITY UPDATE: file disclosure via unchecked AppArmor profile
    (LP: #1456628)
  - Don't allow exporting of files that aren't allowed by the source apparmor profile
  - CVE-2015-1327

Description of the change

Verify the source app has read access to local files being transferred

Debs can be found at http://people.canonical.com/~kenvandine/lp1456628.tar

This can be tested by installing the content-hub-testability package and running these commands checking their exit value.

"content-hub-test-exporter content-hub-test-importer file:///etc/issue content-hub-test-ok"

Should exit 0

"content-hub-test-exporter content-hub-test-importer file:///etc/issue content-hub-test-bad"

Should exit 1

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Haven't tested yet, but the code looks good (with one small query about some potential redundancy in diff comments)

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * I'm a core-dev, added autopkgtests, apparmor profile for testing and build depends for apparmor

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?

 * Yes

Did CI run pass? If not, please explain why.

 * No CI due to private MR

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?

 * Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-04-20 21:21:19 +0000
+++ CMakeLists.txt 2015-06-02 12:46:00 +0000
@@ -68,6 +68,7 @@
68pkg_check_modules(DBUS REQUIRED dbus-1)68pkg_check_modules(DBUS REQUIRED dbus-1)
69pkg_check_modules(UBUNTU_DOWNLOAD_MANAGER REQUIRED ubuntu-download-manager-client)69pkg_check_modules(UBUNTU_DOWNLOAD_MANAGER REQUIRED ubuntu-download-manager-client)
70pkg_check_modules(NOTIFY REQUIRED libnotify)70pkg_check_modules(NOTIFY REQUIRED libnotify)
71pkg_check_modules(APPARMOR REQUIRED libapparmor)
7172
72add_definitions(-DDEBUG_ENABLED)73add_definitions(-DDEBUG_ENABLED)
7374
7475
=== added directory 'debian/apparmor'
=== added file 'debian/apparmor/content-hub-testability'
--- debian/apparmor/content-hub-testability 1970-01-01 00:00:00 +0000
+++ debian/apparmor/content-hub-testability 2015-06-02 12:46:00 +0000
@@ -0,0 +1,15 @@
1# vim:syntax=apparmor
2# Author: Ken VanDine <ken.vandine@canonical.com>
3#
4#include <tunables/global>
5
6profile "content-hub-test-ok" {
7 #include <abstractions/base>
8 #include <abstractions/dbus-session>
9 /etc/issue r,
10}
11profile "content-hub-test-bad" {
12 #include <abstractions/base>
13 #include <abstractions/dbus-session>
14 audit deny /etc/issue r,
15}
016
=== modified file 'debian/content-hub-testability.install'
--- debian/content-hub-testability.install 2014-08-07 19:35:30 +0000
+++ debian/content-hub-testability.install 2015-06-02 12:46:00 +0000
@@ -3,3 +3,4 @@
3usr/share/applications/content-hub-test*3usr/share/applications/content-hub-test*
4usr/share/content-hub/testability/data4usr/share/content-hub/testability/data
5usr/share/icons/hicolor/512x512/apps/content-hub-test*5usr/share/icons/hicolor/512x512/apps/content-hub-test*
6debian/apparmor/content-hub-testability etc/apparmor.d
67
=== modified file 'debian/control'
--- debian/control 2015-04-22 14:27:27 +0000
+++ debian/control 2015-06-02 12:46:00 +0000
@@ -5,10 +5,12 @@
5 click-dev,5 click-dev,
6 dbus-test-runner,6 dbus-test-runner,
7 debhelper (>= 9),7 debhelper (>= 9),
8 dh-apparmor,
8 dh-translations,9 dh-translations,
9 doxygen,10 doxygen,
10 google-mock,11 google-mock,
11 lcov,12 lcov,
13 libapparmor-dev,
12 libglib2.0-dev,14 libglib2.0-dev,
13 libgsettings-qt-dev,15 libgsettings-qt-dev,
14 libnih-dbus-dev,16 libnih-dbus-dev,
@@ -28,6 +30,7 @@
28Vcs-Bzr: https://code.launchpad.net/~phablet-team/content-hub/trunk30Vcs-Bzr: https://code.launchpad.net/~phablet-team/content-hub/trunk
29Vcs-Browser: https://bazaar.launchpad.net/~phablet-team/content-hub/trunk/files31Vcs-Browser: https://bazaar.launchpad.net/~phablet-team/content-hub/trunk/files
30X-Ubuntu-Use-Langpack: yes32X-Ubuntu-Use-Langpack: yes
33XS-Testsuite: autopkgtest
3134
32Package: content-hub35Package: content-hub
33Architecture: any36Architecture: any
@@ -88,5 +91,6 @@
88Architecture: any91Architecture: any
89Depends: ${misc:Depends},92Depends: ${misc:Depends},
90 ${shlibs:Depends},93 ${shlibs:Depends},
94 content-hub,
91Description: content sharing testability95Description: content sharing testability
92 Files and utilities needed for automated testing of content-hub96 Files and utilities needed for automated testing of content-hub
9397
=== modified file 'debian/rules'
--- debian/rules 2014-10-10 16:13:03 +0000
+++ debian/rules 2015-06-02 12:46:00 +0000
@@ -6,6 +6,10 @@
6%:6%:
7 dh $@ --with click,translations --fail-missing -- -B build7 dh $@ --with click,translations --fail-missing -- -B build
88
9override_dh_auto_install:
10 dh_auto_install
11 dh_apparmor -pcontent-hub-testability --profile-name=content-hub-testability
12
9override_dh_auto_test:13override_dh_auto_test:
10 dbus-test-runner -t make -p "-C" -p "build/tests/acceptance-tests" -p test14 dbus-test-runner -t make -p "-C" -p "build/tests/acceptance-tests" -p test
11 15
1216
=== added directory 'debian/tests'
=== added file 'debian/tests/aa-check'
--- debian/tests/aa-check 1970-01-01 00:00:00 +0000
+++ debian/tests/aa-check 2015-06-02 12:46:00 +0000
@@ -0,0 +1,41 @@
1#!/bin/sh
2
3# start X
4(Xvfb :5 >/dev/null 2>&1 &)
5XVFB_PID=$!
6export DISPLAY=:5
7
8# start local session D-BUS
9eval `dbus-launch`
10trap "kill $DBUS_SESSION_BUS_PID $XVFB_PID" 0 TERM QUIT INT
11export DBUS_SESSION_BUS_ADDRESS
12export XAUTHORITY=/dev/null
13
14oktests="content-hub-test-ok"
15badtests="content-hub-test-bad"
16FAILED=""
17
18for a in $oktests; do
19 content-hub-test-importer &2>/dev/null
20 content-hub-test-exporter content-hub-test-importer file:///etc/issue $a 2>/dev/null
21 if [ $? -ne 0 ]; then
22 FAILED="$FAILED $a"
23 fi
24done
25
26for b in $badtests; do
27 content-hub-test-importer &2>/dev/null
28 content-hub-test-exporter content-hub-test-importer file:///etc/issue $b 2>/dev/null
29 if [ $? -eq 0 ]; then
30 FAILED="$FAILED $b"
31 fi
32done
33
34if [ -z "$FAILED" ]; then
35 echo "All tests passed"
36 exit 0
37else
38 echo "$FAILED failed"
39 exit 1
40fi
41
042
=== added file 'debian/tests/control'
--- debian/tests/control 1970-01-01 00:00:00 +0000
+++ debian/tests/control 2015-06-02 12:46:00 +0000
@@ -0,0 +1,3 @@
1Tests: aa-check
2Depends: content-hub-testability, dbus-x11, xvfb
3Restrictions: allow-stderr
04
=== modified file 'src/com/ubuntu/content/CMakeLists.txt'
--- src/com/ubuntu/content/CMakeLists.txt 2014-05-26 06:45:57 +0000
+++ src/com/ubuntu/content/CMakeLists.txt 2015-06-02 12:46:00 +0000
@@ -28,6 +28,7 @@
28 ${UBUNTU_LAUNCH_INCLUDE_DIRS}28 ${UBUNTU_LAUNCH_INCLUDE_DIRS}
29 ${UBUNTU_DOWNLOAD_MANAGER_INCLUDE_DIRS}29 ${UBUNTU_DOWNLOAD_MANAGER_INCLUDE_DIRS}
30 ${NOTIFY_INCLUDE_DIRS}30 ${NOTIFY_INCLUDE_DIRS}
31 ${APPARMOR_INCLUDE_DIRS}
31)32)
3233
33qt5_add_dbus_interface(34qt5_add_dbus_interface(
@@ -105,6 +106,7 @@
105 ${GIO_LIBRARIES}106 ${GIO_LIBRARIES}
106 ${UBUNTU_DOWNLOAD_MANAGER_LIBRARIES}107 ${UBUNTU_DOWNLOAD_MANAGER_LIBRARIES}
107 ${NOTIFY_LIBRARIES}108 ${NOTIFY_LIBRARIES}
109 ${APPARMOR_LDFLAGS}
108)110)
109111
110install(112install(
111113
=== modified file 'src/com/ubuntu/content/detail/service.h'
--- src/com/ubuntu/content/detail/service.h 2014-11-19 18:37:26 +0000
+++ src/com/ubuntu/content/detail/service.h 2015-06-02 12:46:00 +0000
@@ -79,7 +79,7 @@
79 void handle_exports(int);79 void handle_exports(int);
80 void handler_unregistered(const QString&);80 void handler_unregistered(const QString&);
81 QDBusObjectPath CreateTransfer(const QString&, const QString&, int, const QString&);81 QDBusObjectPath CreateTransfer(const QString&, const QString&, int, const QString&);
82 void download_notify (com::ubuntu::content::detail::Transfer*);82 void download_notify(com::ubuntu::content::detail::Transfer*);
8383
84};84};
85}85}
8686
=== modified file 'src/com/ubuntu/content/detail/transfer.cpp'
--- src/com/ubuntu/content/detail/transfer.cpp 2015-04-21 14:46:25 +0000
+++ src/com/ubuntu/content/detail/transfer.cpp 2015-06-02 12:46:00 +0000
@@ -36,7 +36,7 @@
36 const QString& source,36 const QString& source,
37 const QString& destination,37 const QString& destination,
38 const int direction,38 const int direction,
39 const QString& content_type) :39 const QString& content_type):
40 state(cuc::Transfer::created),40 state(cuc::Transfer::created),
41 id(id),41 id(id),
42 source(source),42 source(source),
@@ -166,12 +166,28 @@
166 return;166 return;
167 } 167 }
168168
169 QString profile = aa_profile(message().service());
170 TRACE() << Q_FUNC_INFO << "PROFILE:" << profile;
171
169 QVariantList ret;172 QVariantList ret;
170 Q_FOREACH(QVariant iv, items) {173 Q_FOREACH(QVariant iv, items) {
171 cuc::Item item = qdbus_cast<Item>(iv);174 cuc::Item item = qdbus_cast<Item>(iv);
172 if (item.url().isEmpty()) {175 if (item.url().isEmpty()) {
173 ret.append(QVariant::fromValue(item));176 ret.append(QVariant::fromValue(item));
174 } else {177 } else {
178 TRACE() << Q_FUNC_INFO;
179 if (profile.toStdString() != QString("unconfined").toStdString() &&
180 item.url().isLocalFile()) {
181 TRACE() << Q_FUNC_INFO << "IS LOCAL FILE";
182 QString file(item.url().toLocalFile());
183 TRACE() << Q_FUNC_INFO << "FILE:" << file;
184 // Verify app has read access to local file before transfer
185 if (not check_profile_read(profile, file)) {
186 // If failed to access file, abort
187 ret.clear();
188 goto abort;
189 }
190 }
175 QString newUrl = copy_to_store(item.url().toString(), d->store);191 QString newUrl = copy_to_store(item.url().toString(), d->store);
176 if (!newUrl.isEmpty()) {192 if (!newUrl.isEmpty()) {
177 item.setUrl(QUrl(newUrl));193 item.setUrl(QUrl(newUrl));
@@ -179,11 +195,12 @@
179 ret.append(QVariant::fromValue(item));195 ret.append(QVariant::fromValue(item));
180 } else {196 } else {
181 ret.clear();197 ret.clear();
182 break;198 goto abort;
183 }199 }
184 }200 }
185 }201 }
186202
203abort:
187 if (ret.count() <= 0)204 if (ret.count() <= 0)
188 {205 {
189 qWarning() << "Failed to charge items, aborting";206 qWarning() << "Failed to charge items, aborting";
190207
=== modified file 'src/com/ubuntu/content/detail/transfer.h'
--- src/com/ubuntu/content/detail/transfer.h 2014-09-26 10:34:39 +0000
+++ src/com/ubuntu/content/detail/transfer.h 2015-06-02 12:46:00 +0000
@@ -18,9 +18,11 @@
18#ifndef TRANSFER_H_18#ifndef TRANSFER_H_
19#define TRANSFER_H_19#define TRANSFER_H_
2020
21#include <QDir>
21#include <QObject>22#include <QObject>
22#include <QStringList>23#include <QStringList>
23#include <QDir>24#include <QtDBus/QDBusMessage>
25#include <QtDBus/QDBusContext>
24#include <ubuntu/download_manager/error.h>26#include <ubuntu/download_manager/error.h>
2527
26namespace com28namespace com
@@ -31,7 +33,7 @@
31{33{
32namespace detail34namespace detail
33{35{
34class Transfer : public QObject36class Transfer : public QObject, protected QDBusContext
35{37{
36 Q_OBJECT38 Q_OBJECT
37 Q_PROPERTY(int State READ State NOTIFY StateChanged)39 Q_PROPERTY(int State READ State NOTIFY StateChanged)
3840
=== modified file 'src/com/ubuntu/content/utils.cpp'
--- src/com/ubuntu/content/utils.cpp 2015-03-16 16:57:15 +0000
+++ src/com/ubuntu/content/utils.cpp 2015-06-02 12:46:00 +0000
@@ -16,12 +16,14 @@
16 * Authored by: Ken VanDine <ken.vandine@canonical.com>16 * Authored by: Ken VanDine <ken.vandine@canonical.com>
17 */17 */
1818
19#include <QCoreApplication>
20#include <QDir>
21#include <QFile>
22#include <QFileInfo>
23#include <QProcess>
19#include <QtCore>24#include <QtCore>
20#include <QtDBus/QDBusMessage>25#include <QtDBus/QDBusMessage>
21#include <QtDBus/QDBusConnection>26#include <QtDBus/QDBusConnection>
22#include <QFile>
23#include <QDir>
24#include <QFileInfo>
25#include <QUrl>27#include <QUrl>
26#include <nih/alloc.h>28#include <nih/alloc.h>
27#include <nih-dbus/dbus_util.h>29#include <nih-dbus/dbus_util.h>
@@ -31,6 +33,11 @@
31#include "com/ubuntu/content/type.h"33#include "com/ubuntu/content/type.h"
32#include <unistd.h>34#include <unistd.h>
3335
36#include <sys/apparmor.h>
37/* need to be exposed in libapparmor but for now ... */
38#define AA_CLASS_FILE 2
39#define AA_MAY_READ (1 << 2)
40
34namespace cuc = com::ubuntu::content;41namespace cuc = com::ubuntu::content;
3542
36namespace {43namespace {
@@ -102,10 +109,6 @@
102 reply.errorMessage();109 reply.errorMessage();
103 }110 }
104111
105 if (aaProfile.toStdString() == QString("unconfined").toStdString())
106 {
107 return QString("");
108 }
109 return aaProfile;112 return aaProfile;
110}113}
111114
@@ -175,4 +178,45 @@
175 return false;178 return false;
176}179}
177180
181int query_file(const char *label, const char *path, int *allowed)
182{
183 int rc, audited;
184 char *query;
185
186 /* + 1 for null separator and then + 1 AA_CLASS_FILE */
187 int label_size = strlen(label);
188 int size = label_size + 1 + strlen(path) + AA_QUERY_CMD_LABEL_SIZE + 1;
189 /* +1 for null terminator used by strcpy, yes we could drop this
190 * using memcpy */
191 query = (char*)malloc(size + 1);
192 if (!query)
193 return -1;
194 /* we want the null terminator here */
195 strcpy(query + AA_QUERY_CMD_LABEL_SIZE, label);
196 query[AA_QUERY_CMD_LABEL_SIZE + label_size + 1] = AA_CLASS_FILE;
197 strcpy(query + AA_QUERY_CMD_LABEL_SIZE + label_size + 2, path);
198 rc = aa_query_label(AA_MAY_READ, query, size , allowed, &audited);
199 free(query);
200 return rc;
201}
202
203bool check_profile_read(QString profile, QString path)
204{
205 TRACE() << Q_FUNC_INFO << "PROFILE:" << profile;
206
207 int allowed;
208 if (query_file(profile.toStdString().c_str(), path.toStdString().c_str(), &allowed) == -1) {
209 qWarning() << "error:" << strerror(errno) << path;
210 return false;
211 }
212
213 if (allowed) {
214 TRACE() << "ALLOWED:" << QString::number(allowed);
215 return true;
216 }
217 TRACE() << "NOT ALLOWED:" << QString::number(allowed);
218 return false;
219
220}
221
178}222}
179223
=== modified file 'tests/peers/exporter/CMakeLists.txt'
--- tests/peers/exporter/CMakeLists.txt 2014-08-07 19:35:30 +0000
+++ tests/peers/exporter/CMakeLists.txt 2015-06-02 12:46:00 +0000
@@ -24,6 +24,7 @@
24)24)
2525
26qt5_use_modules(content-hub-test-exporter Core Gui DBus)26qt5_use_modules(content-hub-test-exporter Core Gui DBus)
27pkg_check_modules(APPARMOR REQUIRED libapparmor)
2728
28set_target_properties(29set_target_properties(
29 content-hub-test-exporter30 content-hub-test-exporter
@@ -35,6 +36,7 @@
35 content-hub-test-exporter36 content-hub-test-exporter
36 37
37 content-hub 38 content-hub
39 ${APPARMOR_LDFLAGS}
38)40)
3941
40install(42install(
4143
=== modified file 'tests/peers/exporter/autoexporter.cpp'
--- tests/peers/exporter/autoexporter.cpp 2015-04-14 15:28:56 +0000
+++ tests/peers/exporter/autoexporter.cpp 2015-06-02 12:46:00 +0000
@@ -24,6 +24,12 @@
24 hub->register_import_export_handler(this);24 hub->register_import_export_handler(this);
25}25}
2626
27void AutoExporter::setUrl(QString url)
28{
29 qDebug() << Q_FUNC_INFO << url;
30 m_url = url;
31}
32
27void AutoExporter::handle_import(cuc::Transfer *transfer)33void AutoExporter::handle_import(cuc::Transfer *transfer)
28{34{
29 qDebug() << Q_FUNC_INFO << "not implemented";35 qDebug() << Q_FUNC_INFO << "not implemented";
@@ -42,19 +48,20 @@
4248
43 QVector<cuc::Item> items;49 QVector<cuc::Item> items;
4450
45 if (transfer->contentType() == cuc::Type::Known::contacts().id()) {51 if (m_url.isEmpty()) {
46 items << cuc::Item(QUrl("file:///usr/share/content-hub/testability/data/Joker.vcf"));52 if (transfer->contentType() == cuc::Type::Known::contacts().id()) {
4753 items << cuc::Item(QUrl("file:///usr/share/content-hub/testability/data/Joker.vcf"));
48 if (transfer->selectionType() == cuc::Transfer::SelectionType::multiple) {54 if (transfer->selectionType() == cuc::Transfer::SelectionType::multiple) {
49 items << cuc::Item(QUrl("file:///usr/share/content-hub/testability/data/Stark,_Tony.vcf"));55 items << cuc::Item(QUrl("file:///usr/share/content-hub/testability/data/Stark,_Tony.vcf"));
56 }
57 } else {
58 items << cuc::Item(QUrl("file:///usr/share/content-hub/testability/data/webbrowser-app.png"));
59 if (transfer->selectionType() == cuc::Transfer::SelectionType::multiple) {
60 items << cuc::Item(QUrl("file:///usr/share/content-hub/testability/data/clock.png"));
61 }
50 }62 }
51
52 } else {63 } else {
53 items << cuc::Item(QUrl("file:///usr/share/content-hub/testability/data/webbrowser-app.png"));64 items << cuc::Item(QUrl(m_url));
54
55 if (transfer->selectionType() == cuc::Transfer::SelectionType::multiple) {
56 items << cuc::Item(QUrl("file:///usr/share/content-hub/testability/data/clock.png"));
57 }
58 }65 }
5966
60 transfer->charge(items);67 transfer->charge(items);
@@ -83,9 +90,11 @@
8390
84 qDebug() << Q_FUNC_INFO << "STATE:" << transfer->state();91 qDebug() << Q_FUNC_INFO << "STATE:" << transfer->state();
8592
93 if (transfer->state() == cuc::Transfer::aborted)
94 QCoreApplication::instance()->exit(1);
8695
87 if (transfer->state() == cuc::Transfer::collected)96 if (transfer->state() == cuc::Transfer::collected)
88 QCoreApplication::instance()->quit();97 QCoreApplication::instance()->exit(0);
89}98}
9099
91100
92101
=== modified file 'tests/peers/exporter/autoexporter.h'
--- tests/peers/exporter/autoexporter.h 2014-08-07 18:48:10 +0000
+++ tests/peers/exporter/autoexporter.h 2015-06-02 12:46:00 +0000
@@ -39,6 +39,10 @@
39 Q_INVOKABLE void handle_export(cuc::Transfer*);39 Q_INVOKABLE void handle_export(cuc::Transfer*);
40 Q_INVOKABLE void handle_share(cuc::Transfer*);40 Q_INVOKABLE void handle_share(cuc::Transfer*);
41 Q_INVOKABLE void stateChanged();41 Q_INVOKABLE void stateChanged();
42 void setUrl(QString);
43
44private:
45 QString m_url;
42};46};
4347
44#endif // AUTOEXPORTER_H48#endif // AUTOEXPORTER_H
4549
=== modified file 'tests/peers/exporter/exporter.cpp'
--- tests/peers/exporter/exporter.cpp 2014-08-07 18:48:10 +0000
+++ tests/peers/exporter/exporter.cpp 2015-06-02 12:46:00 +0000
@@ -18,6 +18,8 @@
1818
19#include <QCoreApplication>19#include <QCoreApplication>
20#include <QStringList>20#include <QStringList>
21#include <QUrl>
22#include <sys/apparmor.h>
2123
22#include "autoexporter.h"24#include "autoexporter.h"
2325
@@ -30,12 +32,26 @@
30 qputenv("APP_ID", "content-hub-test-exporter");32 qputenv("APP_ID", "content-hub-test-exporter");
31 }33 }
3234
33 AutoExporter exporter;35 QString peerName, url, profile;
34
35 QString peerName;
3636
37 if (a.arguments().size() > 1)37 if (a.arguments().size() > 1)
38 peerName = a.arguments().at(1);38 peerName = a.arguments().at(1);
39 if (a.arguments().size() > 2)
40 url = a.arguments().at(2);
41 if (a.arguments().size() > 3)
42 profile = a.arguments().at(3);
43
44 if (not profile.isEmpty()) {
45 int ret = 2;
46 ret = aa_change_profile(profile.toStdString().c_str());
47 if (ret != 0)
48 return 1;
49 }
50
51 AutoExporter exporter;
52
53 if (not url.isEmpty())
54 exporter.setUrl(url);
3955
40 if (!peerName.isEmpty())56 if (!peerName.isEmpty())
41 {57 {

Subscribers

People subscribed via source and target branches