~jamesh/thumbnailer/use-aa-query-label

« back to all changes in this revision

Viewing changes to src/service/dbusinterface.cpp

  • Committer: Tarmac
  • Author(s): James Henstridge
  • Date: 2015-06-15 01:56:18 UTC
  • mfrom: (213.1.10 use-aa-query-label)
  • Revision ID: tarmac-20150615015618-n47qom31w779seld
Track the credentials (user ID, AppArmor label) of clients connecting to the D-Bus service.  This is not yet used to make security decisions.

Approved by Michi Henning, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
{
53
53
}
54
54
 
 
55
CredentialsCache& DBusInterface::credentials()
 
56
{
 
57
    if (!credentials_)
 
58
    {
 
59
        credentials_.reset(new CredentialsCache(connection()));
 
60
    }
 
61
    return *credentials_.get();
 
62
}
 
63
 
55
64
QDBusUnixFileDescriptor DBusInterface::GetAlbumArt(QString const& artist,
56
65
                                                   QString const& album,
57
66
                                                   QSize const& requestedSize)
64
73
        auto request = thumbnailer_->get_album_art(artist.toStdString(), album.toStdString(), requestedSize);
65
74
        queueRequest(new Handler(connection(), message(),
66
75
                                 check_thread_pool_, create_thread_pool_,
67
 
                                 download_limiter_, std::move(request), details));
 
76
                                 download_limiter_, credentials(),
 
77
                                 std::move(request), details));
68
78
    }
69
79
    // LCOV_EXCL_START
70
80
    catch (exception const& e)
89
99
        auto request = thumbnailer_->get_artist_art(artist.toStdString(), album.toStdString(), requestedSize);
90
100
        queueRequest(new Handler(connection(), message(),
91
101
                                 check_thread_pool_, create_thread_pool_,
92
 
                                 download_limiter_, std::move(request), details));
 
102
                                 download_limiter_, credentials(),
 
103
                                 std::move(request), details));
93
104
    }
94
105
    // LCOV_EXCL_START
95
106
    catch (exception const& e)
107
118
                                                    QSize const& requestedSize)
108
119
{
109
120
    std::unique_ptr<ThumbnailRequest> request;
 
121
 
110
122
    try
111
123
    {
112
124
        QString details;
115
127
        auto request = thumbnailer_->get_thumbnail(filename.toStdString(), filename_fd.fileDescriptor(), requestedSize);
116
128
        queueRequest(new Handler(connection(), message(),
117
129
                                 check_thread_pool_, create_thread_pool_,
118
 
                                 extraction_limiter_, std::move(request), details));
 
130
                                 extraction_limiter_, credentials(),
 
131
                                 std::move(request), details));
119
132
    }
120
133
    catch (exception const& e)
121
134
    {