$OpenBSD: patch-src_suprocess_cpp,v 1.3 2020/09/07 14:48:46 rsadowski Exp $

use base doas(1) instead sudo(1) from ports

Index: src/suprocess.cpp
--- src/suprocess.cpp.orig
+++ src/suprocess.cpp
@@ -25,8 +25,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
@@ -69,7 +71,9 @@ QString SuProcess::superUserCommand()
 
 bool SuProcess::useUsersOwnPassword()
 {
-    if (superUserCommand() == QLatin1String("sudo") && m_user == "root") {
+    if ((superUserCommand() == QLatin1String("sudo")
+        || superUserCommand() == QLatin1String("doas"))
+            && m_user == "root") {
         return true;
     }
 
@@ -103,7 +107,8 @@ int SuProcess::exec(const char *password, int check)
     }
 
     QList<QByteArray> args;
-    if (d->superUserCommand == QLatin1String("sudo")) {
+    if (d->superUserCommand == QLatin1String("sudo")
+        || d->superUserCommand == QLatin1String("doas")) {
         args += "-u";
     }
 
@@ -144,7 +149,8 @@ int SuProcess::exec(const char *password, int check)
     }
     if (check == NeedPassword) {
         if (ret == killme) {
-            if (d->superUserCommand == QLatin1String("sudo")) {
+            if (d->superUserCommand == QLatin1String("sudo")
+                || d->superUserCommand == QLatin1String("doas")) {
                 // sudo can not be killed, just return
                 return ret;
             }
@@ -169,7 +175,8 @@ int SuProcess::exec(const char *password, int check)
 
     if (ret != ok) {
         kill(m_pid, SIGKILL);
-        if (d->superUserCommand != QLatin1String("sudo")) {
+        if (d->superUserCommand != QLatin1String("sudo")
+            || d->superUserCommand != QLatin1String("doas") ) {
             waitForChild();
         }
         return SuIncorrectPassword;
