From fe41af9e50be7af85dd7be64017c9f8a082905c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ven=20Car?= Date: Thu, 22 Oct 2020 11:58:36 +0200 Subject: [PATCH] ScreenshotEffect: don't expect authorization for interactive screenshots --- effects/screenshot/screenshot.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp index 191baae256..58e4dc4a88 100644 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -548,9 +548,14 @@ bool ScreenShotEffect::checkCall() const QString ScreenShotEffect::interactive(int mask) { - if (!checkCall()) { + if (!calledFromDBus()) { return QString(); } + if (isTakingScreenshot()) { + sendErrorReply(s_errorAlreadyTaking, s_errorAlreadyTakingMsg); + return QString(); + } + m_type = (ScreenShotType) mask; m_windowMode = WindowMode::File; m_replyMessage = message(); @@ -574,9 +579,14 @@ QString ScreenShotEffect::interactive(int mask) void ScreenShotEffect::interactive(QDBusUnixFileDescriptor fd, int mask) { - if (!checkCall()) { + if (!calledFromDBus()) { return; } + if (isTakingScreenshot()) { + sendErrorReply(s_errorAlreadyTaking, s_errorAlreadyTakingMsg); + return; + } + m_fd = dup(fd.fileDescriptor()); if (m_fd == -1) { sendErrorReply(s_errorFd, s_errorFdMsg);