~phablet-team/content-hub/15.04

« back to all changes in this revision

Viewing changes to tests/peers/exporter/exporter.cpp

  • Committer: CI Train Bot
  • Author(s): Ken VanDine
  • Date: 2015-06-03 17:45:37 UTC
  • mfrom: (208.1.1 15.04-lp1456628)
  • Revision ID: ci-train-bot@canonical.com-20150603174537-3wq910qtwos6l9z9
* 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 Fixes: #1456628
Approved by: Michael Sheldon

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include <QCoreApplication>
20
20
#include <QStringList>
 
21
#include <QUrl>
 
22
#include <sys/apparmor.h>
21
23
 
22
24
#include "autoexporter.h"
23
25
 
30
32
        qputenv("APP_ID", "content-hub-test-exporter");
31
33
    }
32
34
 
33
 
    AutoExporter exporter;
34
 
 
35
 
    QString peerName;
 
35
    QString peerName, url, profile;
36
36
 
37
37
    if (a.arguments().size() > 1)
38
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);
39
55
 
40
56
    if (!peerName.isEmpty())
41
57
    {