From 09df714c0935cfad1ad586e1b6443097d53c59d0 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Mon, 29 Nov 2021 00:53:42 +0100 Subject: Cleanup, add permissions to created file --- src/loginrpc.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/loginrpc.cpp b/src/loginrpc.cpp index 09f6454..c13483f 100644 --- a/src/loginrpc.cpp +++ b/src/loginrpc.cpp @@ -119,7 +119,6 @@ void LoginRpc::handleCommandV1(const QString &command) allOutputs << virtOut; } } - /* Commented, to have a view on the client while debugging TODO REMOVE XXX // Either -1 if we didn't have a virtual one, or != 0 if xrandr setting failed if (ret != 0) { // Play it safe and disable all the outputs @@ -133,7 +132,6 @@ void LoginRpc::handleCommandV1(const QString &command) p.waitForFinished(2000); p.kill(); } - */ } } @@ -147,10 +145,11 @@ void LoginRpc::handleCommandV1(const QString &command) // Create edit.config if (file.open(QIODevice::ReadWrite)) { file.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | - QFileDevice::ExeOwner | QFileDevice::ReadUser | - QFileDevice::WriteUser | QFileDevice::ExeUser | - QFileDevice::ReadGroup | QFileDevice::ExeGroup | - QFileDevice::ReadOther | QFileDevice::ExeOther); + QFileDevice::ExeOwner | QFileDevice::ReadUser | + QFileDevice::WriteUser | QFileDevice::ExeUser | + QFileDevice::ReadGroup | QFileDevice::WriteGroup | + QFileDevice::ExeGroup | QFileDevice::ReadOther | + QFileDevice::WriteOther | QFileDevice::ExeOther); qDebug() << "edit.config created!"; QTextStream stream(&file); stream << "[Desktop Entry]" << endl; @@ -173,12 +172,18 @@ void LoginRpc::handleCommandV1(const QString &command) qDebug() << "Edit session ID was provided: " << lines[4]; QFile file("editsession.id"); - if (file.open(QIODevice::ReadWrite)) { + if (file.open(QIODevice::ReadWrite)) { + file.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | + QFileDevice::ExeOwner | QFileDevice::ReadUser | + QFileDevice::WriteUser | QFileDevice::ExeUser | + QFileDevice::ReadGroup | QFileDevice::WriteGroup | + QFileDevice::ExeGroup | QFileDevice::ReadOther | + QFileDevice::WriteOther | QFileDevice::ExeOther); qDebug() << "editsession.id file created!"; - QTextStream stream(&file); - stream << lines[4]; - file.close(); - } + QTextStream stream(&file); + stream << lines[4]; + file.close(); + } } emit loginRequest(lines[0], lines[1], lines[2]); -- cgit v1.2.3-55-g7522