Hello community, here is the log from the commit of package kdesu for openSUSE:Factory checked in at 2020-12-15 12:28:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kdesu (Old) and /work/SRC/openSUSE:Factory/.kdesu.new.2328 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kdesu" Tue Dec 15 12:28:33 2020 rev:85 rq:855426 version:5.77.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kdesu/kdesu.changes 2020-11-23 10:32:03.949464896 +0100 +++ /work/SRC/openSUSE:Factory/.kdesu.new.2328/kdesu.changes 2020-12-15 12:30:33.848008994 +0100 @@ -1,0 +2,11 @@ +Sat Dec 5 18:56:28 UTC 2020 - Christophe Giboudeaux <[email protected]> + +- Update to 5.77.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/kde-frameworks-5.77.0 +- Changes since 5.76.0: + * Properly parse escaped double quotes + * Add OpenBSD's doas(1) support + +------------------------------------------------------------------- Old: ---- kdesu-5.76.0.tar.xz kdesu-5.76.0.tar.xz.sig New: ---- kdesu-5.77.0.tar.xz kdesu-5.77.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kdesu.spec ++++++ --- /var/tmp/diff_new_pack.5Wj4M5/_old 2020-12-15 12:30:34.752009723 +0100 +++ /var/tmp/diff_new_pack.5Wj4M5/_new 2020-12-15 12:30:34.752009723 +0100 @@ -17,14 +17,14 @@ %define lname libKF5Su5 -%define _tar_path 5.76 +%define _tar_path 5.77 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} %bcond_without lang Name: kdesu -Version: 5.76.0 +Version: 5.77.0 Release: 0 Summary: User interface for running shell commands with root privileges License: LGPL-2.1-or-later @@ -48,7 +48,7 @@ BuildRequires: cmake(KF5I18n) >= %{_kf5_bugfix_version} BuildRequires: cmake(KF5Pty) >= %{_kf5_bugfix_version} BuildRequires: cmake(KF5Service) >= %{_kf5_bugfix_version} -BuildRequires: cmake(Qt5Core) >= 5.12.0 +BuildRequires: cmake(Qt5Core) >= 5.13.0 BuildRequires: pkgconfig(x11) %description ++++++ fpie.patch ++++++ --- /var/tmp/diff_new_pack.5Wj4M5/_old 2020-12-15 12:30:34.800009761 +0100 +++ /var/tmp/diff_new_pack.5Wj4M5/_new 2020-12-15 12:30:34.804009765 +0100 @@ -1,8 +1,8 @@ -diff --git a/src/kdesud/CMakeLists.txt b/src/kdesud/CMakeLists.txt -index 90bd3f7..1118755 100644 ---- a/src/kdesud/CMakeLists.txt -+++ b/src/kdesud/CMakeLists.txt -@@ -20,10 +20,9 @@ if(HAVE_X11) +Index: kdesu-5.56.0git.20201120T123159~af8457b/src/kdesud/CMakeLists.txt +=================================================================== +--- kdesu-5.56.0git.20201120T123159~af8457b.orig/src/kdesud/CMakeLists.txt 2020-11-20 13:31:59.000000000 +0100 ++++ kdesu-5.56.0git.20201120T123159~af8457b/src/kdesud/CMakeLists.txt 2020-11-24 10:55:40.734205978 +0100 +@@ -28,10 +28,9 @@ target_include_directories(kdesud PRIVATE ${X11_X11_INCLUDE_PATH}) endif() @@ -14,5 +14,5 @@ + +set_property(TARGET kdesud APPEND_STRING PROPERTY LINK_FLAGS " -pie") - ########### install files ############### - + if(BUILD_TESTING) + add_subdirectory(autotests) ++++++ kdesu-5.76.0.tar.xz -> kdesu-5.77.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/CMakeLists.txt new/kdesu-5.77.0/CMakeLists.txt --- old/kdesu-5.76.0/CMakeLists.txt 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/CMakeLists.txt 2020-12-05 13:43:01.000000000 +0100 @@ -1,18 +1,18 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.76.0") # handled by release scripts -set(KF5_DEP_VERSION "5.76.0") # handled by release scripts +set(KF5_VERSION "5.77.0") # handled by release scripts +set(KF5_DEP_VERSION "5.77.0") # handled by release scripts project(KDESu VERSION ${KF5_VERSION}) include(FeatureSummary) -find_package(ECM 5.76.0 NO_MODULE) +find_package(ECM 5.77.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) -set(REQUIRED_QT_VERSION 5.12.0) +set(REQUIRED_QT_VERSION 5.13.0) find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) include(KDEInstallDirs) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) @@ -37,6 +37,18 @@ set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") +option(KDESU_USE_SUDO_DEFAULT "Set On to use sudo instead of su [default=Off]" Off) +option(KDESU_USE_DOAS_DEFAULT "Set On to use doas instead of su and sudo [default=Off]" Off) +if(KDESU_USE_SUDO_DEFAULT AND KDESU_USE_DOAS_DEFAULT) + message(FATAL_ERROR "Choose between sudo(1) or doas(1)") +elseif(KDESU_USE_SUDO_DEFAULT) + message("Using sudo as default") +elseif(KDESU_USE_DOAS_DEFAULT) + message("Using doas as default") +else() + message("Using su as default (set KDESU_USE_SUDO_DEFAULT=On to use sudo)") +endif() + option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/autotests/CMakeLists.txt new/kdesu-5.77.0/autotests/CMakeLists.txt --- old/kdesu-5.76.0/autotests/CMakeLists.txt 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/autotests/CMakeLists.txt 2020-12-05 13:43:01.000000000 +0100 @@ -2,3 +2,9 @@ find_package(Qt5Test REQUIRED) configure_file(config-kdesutest.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdesutest.h) ecm_add_test(kdesutest.cpp TEST_NAME kdesutest LINK_LIBRARIES Qt5::Test KF5::Su KF5::CoreAddons KF5::ConfigCore) + +if(KDESU_USE_SUDO_DEFAULT) + target_compile_definitions(kdesutest PRIVATE -DKDESU_USE_SUDO_DEFAULT="true") +elseif(KDESU_USE_DOAS_DEFAULT) + target_compile_definitions(kdesutest PRIVATE -DKDESU_USE_DOAS_DEFAULT="true") +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/autotests/kdesutest.cpp new/kdesu-5.77.0/autotests/kdesutest.cpp --- old/kdesu-5.76.0/autotests/kdesutest.cpp 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/autotests/kdesutest.cpp 2020-12-05 13:43:01.000000000 +0100 @@ -58,6 +58,26 @@ QVERIFY(result2 == KDESu::SuProcess::SuIncorrectPassword); } + void doasBadPassword() { + editConfig(QString::fromLocal8Bit("doas"), QString::fromLocal8Bit(CMAKE_HOME_DIRECTORY) + QString::fromLocal8Bit("/autotests/sudo")); + + KDESu::SuProcess *suProcess = new KDESu::SuProcess("root", "ls"); + QString suapp = suProcess->superUserCommand(); + QVERIFY(suapp==QLatin1String("doas")); + int result2 = suProcess->exec("broken", 0); + QVERIFY(result2 == KDESu::SuProcess::SuIncorrectPassword); + } + + void doasGoodPassword() { + editConfig(QString::fromLocal8Bit("doas"), QString::fromLocal8Bit(CMAKE_HOME_DIRECTORY) + QString::fromLocal8Bit("/autotests/sudo")); + + KDESu::SuProcess *suProcess = new KDESu::SuProcess("root", "ls"); + QString suapp = suProcess->superUserCommand(); + QVERIFY(suapp==QLatin1String("doas")); + int result = suProcess->exec(MYPASSWORD, 0); + QVERIFY(result == 0); + } + void suGoodPassword() { editConfig(QString::fromLocal8Bit("su"), QString::fromLocal8Bit(CMAKE_HOME_DIRECTORY) + QString::fromLocal8Bit("/autotests/su")); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/po/ml/kdesud5.po new/kdesu-5.77.0/po/ml/kdesud5.po --- old/kdesu-5.76.0/po/ml/kdesud5.po 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/po/ml/kdesud5.po 2020-12-05 13:43:01.000000000 +0100 @@ -17,7 +17,6 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Weblate 3.9.1\n" #, kde-format msgctxt "NAME OF TRANSLATORS" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/po/zh_CN/kdesud5.po new/kdesu-5.77.0/po/zh_CN/kdesud5.po --- old/kdesu-5.76.0/po/zh_CN/kdesud5.po 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/po/zh_CN/kdesud5.po 2020-12-05 13:43:01.000000000 +0100 @@ -7,7 +7,7 @@ "Project-Id-Version: kdeorg\n" "Report-Msgid-Bugs-To: https://bugs.kde.org\n" "POT-Creation-Date: 2020-08-09 02:04+0200\n" -"PO-Revision-Date: 2020-10-08 19:21\n" +"PO-Revision-Date: 2020-11-10 15:00\n" "Last-Translator: \n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/src/CMakeLists.txt new/kdesu-5.77.0/src/CMakeLists.txt --- old/kdesu-5.76.0/src/CMakeLists.txt 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/src/CMakeLists.txt 2020-12-05 13:43:01.000000000 +0100 @@ -44,13 +44,13 @@ DEPRECATION_VERSIONS 5.0 EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} ) -option(KDESU_USE_SUDO_DEFAULT "Set On to use sudo instead of su [default=Off]" Off) + if(KDESU_USE_SUDO_DEFAULT) - message("Using sudo as default") target_compile_definitions(KF5Su PRIVATE -DKDESU_USE_SUDO_DEFAULT="true") -else() - message("Using su as default (set KDESU_USE_SUDO_DEFAULT=On to use sudo)") +elseif(KDESU_USE_DOAS_DEFAULT) + target_compile_definitions(KF5Su PRIVATE -DKDESU_USE_DOAS_DEFAULT="true") endif() + target_include_directories(KF5Su PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..) # Apps must include <KDESu/File> or <kdesu/file.h> @@ -64,11 +64,6 @@ KF5::Service # KToolInvocation::kdeinitExecWait ) -if(KDESU_USE_SUDO_DEFAULT) - set_source_files_properties(suprocess.cpp PROPERTIES - COMPILE_FLAGS -DKDESU_USE_SUDO_DEFAULT) -endif() - set_target_properties(KF5Su PROPERTIES VERSION ${KDESU_VERSION_STRING} SOVERSION ${KDESU_SOVERSION} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/src/kdesud/CMakeLists.txt new/kdesu-5.77.0/src/kdesud/CMakeLists.txt --- old/kdesu-5.76.0/src/kdesud/CMakeLists.txt 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/src/kdesud/CMakeLists.txt 2020-12-05 13:43:01.000000000 +0100 @@ -33,6 +33,10 @@ macro_add_link_flags(kdesud ${KDE4_PIE_LDFLAGS}) endif() +if(BUILD_TESTING) + add_subdirectory(autotests) +endif() + ########### install files ############### install(TARGETS kdesud DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF5}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/src/kdesud/autotests/CMakeLists.txt new/kdesu-5.77.0/src/kdesud/autotests/CMakeLists.txt --- old/kdesu-5.76.0/src/kdesud/autotests/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/kdesu-5.77.0/src/kdesud/autotests/CMakeLists.txt 2020-12-05 13:43:01.000000000 +0100 @@ -0,0 +1,4 @@ +include(ECMAddTests) +find_package(Qt5Test REQUIRED) +configure_file(config-kdesudtest.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdesudtest.h) +ecm_add_test(kdesudtest.cpp ../lexer.cpp TEST_NAME kdesudtest LINK_LIBRARIES Qt5::Test KF5::CoreAddons KF5::ConfigCore) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/src/kdesud/autotests/config-kdesudtest.h.cmake new/kdesu-5.77.0/src/kdesud/autotests/config-kdesudtest.h.cmake --- old/kdesu-5.76.0/src/kdesud/autotests/config-kdesudtest.h.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/kdesu-5.77.0/src/kdesud/autotests/config-kdesudtest.h.cmake 2020-12-05 13:43:01.000000000 +0100 @@ -0,0 +1,2 @@ +#define CMAKE_HOME_DIRECTORY "${CMAKE_HOME_DIRECTORY}" +#define CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/src/kdesud/autotests/kdesudtest.cpp new/kdesu-5.77.0/src/kdesud/autotests/kdesudtest.cpp --- old/kdesu-5.76.0/src/kdesud/autotests/kdesudtest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kdesu-5.77.0/src/kdesud/autotests/kdesudtest.cpp 2020-12-05 13:43:01.000000000 +0100 @@ -0,0 +1,71 @@ +/* + SPDX-FileCopyrightText: 2020 Aleksei Nikiforov <[email protected]> + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ + +#include "config-kdesudtest.h" + +#include <QObject> +#include <QTest> + +#include "../lexer.h" + +namespace KDESu +{ + +class KdeSudTest: public QObject +{ + Q_OBJECT +private Q_SLOTS: + void initTestCase() { + } + + // copy of KDEsuClient::escape + QByteArray escape(const QByteArray &str) { + QByteArray copy; + copy.reserve(str.size() + 4); + copy.append('"'); + for (int i = 0; i < str.size(); i++) { + uchar c = str.at(i); + if (c < 32) { + copy.append('\\'); + copy.append('^'); + copy.append(c + '@'); + } else { + if (c == '\\' || c == '"') { + copy.append('\\'); + } + copy.append(c); + } + } + copy.append('"'); + return copy; + } + + void commandWithDoubleQuotes() { + // Process command like in KDEsuClient::exec + QByteArray cmd; + cmd = "EXEC "; + cmd += escape("bash -c \"ls -la\""); + cmd += ' '; + cmd += escape("testuser"); + cmd += '\n'; + + // Now handle command like in ConnectionHandler::doCommand + Lexer l(cmd); + QVERIFY(l.lex() == Lexer::Tok_exec); + + QVERIFY(l.lex() == Lexer::Tok_str); + QVERIFY(l.lval() == "bash -c \"ls -la\""); + + QVERIFY(l.lex() == Lexer::Tok_str); + QVERIFY(l.lval() == "testuser"); + + QVERIFY(l.lex() == '\n'); + } +}; +} + +#include <kdesudtest.moc> +QTEST_MAIN(KDESu::KdeSudTest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/src/kdesud/lexer.cpp new/kdesu-5.77.0/src/kdesud/lexer.cpp --- old/kdesu-5.76.0/src/kdesud/lexer.cpp 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/src/kdesud/lexer.cpp 2020-12-05 13:43:01.000000000 +0100 @@ -75,7 +75,7 @@ // handle escaped characters if (c == '\\') { c = m_Input[in++]; - if ((c == '"') || iscntrl(c)) + if (iscntrl(c)) return Tok_none; if (c == '^') { c = m_Input[in++]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdesu-5.76.0/src/suprocess.cpp new/kdesu-5.77.0/src/suprocess.cpp --- old/kdesu-5.76.0/src/suprocess.cpp 2020-11-07 13:04:46.000000000 +0100 +++ new/kdesu-5.77.0/src/suprocess.cpp 2020-12-05 13:43:01.000000000 +0100 @@ -23,8 +23,10 @@ #include <KSharedConfig> #include <kuser.h> -#ifdef KDESU_USE_SUDO_DEFAULT +#if defined(KDESU_USE_SUDO_DEFAULT) # define DEFAULT_SUPER_USER_COMMAND QStringLiteral("sudo") +#elif defined(KDESU_USE_DOAS_DEFAULT) +# define DEFAULT_SUPER_USER_COMMAND QStringLiteral("doas") #else # define DEFAULT_SUPER_USER_COMMAND QStringLiteral("su") #endif @@ -36,9 +38,17 @@ class Q_DECL_HIDDEN SuProcess::SuProcessPrivate { public: + bool isPrivilegeEscalation() const; QString superUserCommand; }; +bool SuProcess::SuProcessPrivate::isPrivilegeEscalation() const +{ + return (superUserCommand == QLatin1String("sudo") + || superUserCommand == QLatin1String("doas")); +} + + SuProcess::SuProcess(const QByteArray &user, const QByteArray &command) : d(new SuProcessPrivate) { @@ -49,7 +59,7 @@ KConfigGroup group(config, "super-user-command"); d->superUserCommand = group.readEntry("super-user-command", DEFAULT_SUPER_USER_COMMAND); - if (d->superUserCommand != QLatin1String("sudo") && d->superUserCommand != QLatin1String("su")) { + if (!d->isPrivilegeEscalation() && d->superUserCommand != QLatin1String("su")) { qCWarning(KSU_LOG) << "unknown super user command."; d->superUserCommand = DEFAULT_SUPER_USER_COMMAND; } @@ -67,7 +77,7 @@ bool SuProcess::useUsersOwnPassword() { - if (superUserCommand() == QLatin1String("sudo") && m_user == "root") { + if (d->isPrivilegeEscalation() && m_user == "root") { return true; } @@ -101,7 +111,7 @@ } QList<QByteArray> args; - if (d->superUserCommand == QLatin1String("sudo")) { + if (d->isPrivilegeEscalation()) { args += "-u"; } @@ -142,7 +152,7 @@ } if (check == NeedPassword) { if (ret == killme) { - if (d->superUserCommand == QLatin1String("sudo")) { + if (d->isPrivilegeEscalation()) { // sudo can not be killed, just return return ret; } @@ -167,7 +177,7 @@ if (ret != ok) { kill(m_pid, SIGKILL); - if (d->superUserCommand != QLatin1String("sudo")) { + if (d->isPrivilegeEscalation()) { waitForChild(); } return SuIncorrectPassword; _______________________________________________ openSUSE Commits mailing list -- [email protected] To unsubscribe, email [email protected] List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/[email protected]
