Remove reverse-applicable patches.

ubuntu/focal
Simon Quigley 5 years ago
parent 6fc480825e
commit a03d1eddb4

5
debian/changelog vendored

@ -1,11 +1,8 @@
lxqt-sudo (0.14.0-0ubuntu1) UNRELEASED; urgency=medium
[ apt-ghetto ]
* Leave only required variables to get into the elevated child process.
[ Simon Quigley ]
* New upstream release.
- Bump build dependencies.
- Remove reverse-applicable patches.
* Bump Standards-version to 4.3.0, no changes needed.
* Bump debhelper compat to 12, no changes needed.

@ -1,46 +0,0 @@
Description: Fix the layout and line break
In some cases, text was being cut off from the prompt and was not visible.
Author: Tsu Jan <tsujan2000@gmail.com>
Origin: upstream
Bug: https://github.com/lxqt/lxqt/issues/1505
Applied-Upstream: commit:01c23a5
Last-Update: 2018-08-20
--- a/passworddialog.cpp
+++ b/passworddialog.cpp
@@ -41,7 +41,7 @@ PasswordDialog::PasswordDialog(QStringLi
QString cmd;
if (0 < argv.size())
cmd = argv[0];
- ui->descriptionL->setText(tr("<b>%1</b> needs administrative privileges.\nPlease enter your password.").arg(cmd));
+ ui->descriptionL->setText(tr("<b>%1</b> needs administrative privileges.<br>Please enter your password.").arg(cmd));
ui->iconL->setPixmap(QIcon::fromTheme("dialog-password").pixmap(64, 64));
setWindowIcon(QIcon::fromTheme("security-high"));
}
--- a/passworddialog.ui
+++ b/passworddialog.ui
@@ -10,12 +10,6 @@
<height>200</height>
</rect>
</property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
<property name="windowTitle">
<string>LXQt sudo</string>
</property>
@@ -31,6 +25,12 @@
</item>
<item row="0" column="1" alignment="Qt::AlignVCenter">
<widget class="QLabel" name="descriptionL">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
<string/>
</property>

@ -1,2 +0,0 @@
fix-layout-line-break.patch
sudo-strip-environment.patch

@ -1,69 +0,0 @@
Description: Sudo: Strip environment
Leave only required environment variables (for X & locale) to get into the elevated child process.
Author: Palo Kisa <palo.kisa@gmail.com>
Applied-Upstream: https://github.com/lxqt/lxqt-sudo/commit/07ec9ec14e5d8ff2fe5aba33d9f0a1cd07a4db60
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/sudo.cpp
+++ b/sudo.cpp
@@ -36,12 +36,14 @@
#include <QSocketNotifier>
#include <QDebug>
#include <QThread>
+#include <QProcessEnvironment>
#include <pty.h>
#include <unistd.h>
#include <memory>
#include <csignal>
#include <sys/wait.h>
#include <fcntl.h>
+#include <iostream>
namespace
{
@@ -80,11 +82,42 @@ namespace
<< QObject::tr("%1 version %2\n").arg(app_master).arg(app_version);
}
+ //Note: array must be sorted to allow usage of binary search
+ static constexpr char const * const ALLOWED_VARS[] = {
+ "DISPLAY"
+ , "LANG", "LANGUAGE", "LC_ADDRESS", "LC_ALL", "LC_COLLATE", "LC_CTYPE", "LC_IDENTIFICATION", "LC_MEASUREMENT"
+ , "LC_MESSAGES", "LC_MONETARY", "LC_NAME", "LC_NUMERIC", "LC_PAPER", "LC_TELEPHONE", "LC_TIME"
+ , "PATH", "QT_PLATFORM_PLUGIN", "QT_QPA_PLATFORMTHEME", "WAYLAND_DISPLAY", "XAUTHORITY"
+ };
+ static constexpr char const * const * const ALLOWED_END = ALLOWED_VARS + sizeof (ALLOWED_VARS) / sizeof (ALLOWED_VARS[0]);
+ struct assert_helper
+ {
+ assert_helper()
+ {
+ Q_ASSERT(std::is_sorted(ALLOWED_VARS, ALLOWED_END
+ , [] (char const * const a, char const * const b) { return strcmp(a, b) < 0; }));
+ }
+ };
+ assert_helper h;
+
inline void env_workarounds()
{
- //cleanup environment
- //pcmanfm-qt will not start if the DBUS_SESSION_BUS_ADDRESS is preserved
- unsetenv("DBUS_SESSION_BUS_ADDRESS");
+ std::cerr << LXQTSUDO << ": Stripping child environment except for: ";
+ std::copy(ALLOWED_VARS, ALLOWED_END - 1, std::ostream_iterator<const char *>{std::cerr, ", "});
+ std::cerr << *(ALLOWED_END - 1) << '\n'; // printing the last separately to avoid trailing comma
+ // cleanup environment, because e.g.:
+ // - pcmanfm-qt will not start if the DBUS_SESSION_BUS_ADDRESS is preserved
+ // - Qt apps may change user's config files permissions if the XDG_* are preserved
+ for (auto const & key : QProcessEnvironment::systemEnvironment().keys())
+ {
+ auto const & i = std::lower_bound(ALLOWED_VARS, ALLOWED_END, key, [] (char const * const a, QString const & b) {
+ return b > a;
+ });
+ if (i == ALLOWED_END || key != *i)
+ {
+ unsetenv(key.toStdString().c_str());
+ }
+ }
}
}
Loading…
Cancel
Save