From d723ec4713b62d99aafbde25312ba77f888d9f86 Mon Sep 17 00:00:00 2001 From: espie Date: Mon, 6 Jan 2003 22:46:02 +0000 Subject: [PATCH] Fix kdesu --- x11/kde/libs3/patches/patch-kdesu_process_cpp | 28 ++++++++++++--- x11/kde/libs3/patches/patch-kdesu_su_cpp | 34 +++++++++++++++---- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/x11/kde/libs3/patches/patch-kdesu_process_cpp b/x11/kde/libs3/patches/patch-kdesu_process_cpp index df4405d444f..4efe9286f2d 100644 --- a/x11/kde/libs3/patches/patch-kdesu_process_cpp +++ b/x11/kde/libs3/patches/patch-kdesu_process_cpp @@ -1,7 +1,17 @@ -$OpenBSD: patch-kdesu_process_cpp,v 1.1 2002/05/15 17:19:44 espie Exp $ ---- kdesu/process.cpp.orig Wed May 15 11:41:43 2002 -+++ kdesu/process.cpp Wed May 15 11:41:31 2002 -@@ -360,8 +360,13 @@ int PtyProcess::waitForChild() +$OpenBSD: patch-kdesu_process_cpp,v 1.2 2003/01/06 22:46:02 espie Exp $ +--- kdesu/process.cpp.orig Mon Mar 4 01:59:15 2002 ++++ kdesu/process.cpp Mon Jan 6 23:41:20 2003 +@@ -38,6 +38,9 @@ + #include + #include + #endif ++#ifdef __OpenBSD__ ++#include ++#endif + + #ifdef HAVE_SYS_SELECT_H + #include // Needed on some systems. +@@ -360,8 +363,13 @@ int PtyProcess::waitForChild() while (1) { tv.tv_sec = 1; tv.tv_usec = 0; @@ -17,3 +27,13 @@ $OpenBSD: patch-kdesu_process_cpp,v 1.1 2002/05/15 17:19:44 espie Exp $ if (ret == -1) { if (errno == EINTR) continue; +@@ -448,6 +456,9 @@ int PtyProcess::SetupTTY(int fd) + ioctl(slave, I_PUSH, "ptem"); + ioctl(slave, I_PUSH, "ldterm"); + ++#endif ++#ifdef __OpenBSD__ ++ ioctl(slave, TIOCSCTTY, (char *)NULL); + #endif + + // Connect stdin, stdout and stderr diff --git a/x11/kde/libs3/patches/patch-kdesu_su_cpp b/x11/kde/libs3/patches/patch-kdesu_su_cpp index e603eba35d9..4f65d9db005 100644 --- a/x11/kde/libs3/patches/patch-kdesu_su_cpp +++ b/x11/kde/libs3/patches/patch-kdesu_su_cpp @@ -1,6 +1,6 @@ -$OpenBSD: patch-kdesu_su_cpp,v 1.1 2002/05/15 17:19:44 espie Exp $ ---- kdesu/su.cpp.orig Sat May 11 11:13:25 2002 -+++ kdesu/su.cpp Wed May 15 12:02:01 2002 +$OpenBSD: patch-kdesu_su_cpp,v 1.2 2003/01/06 22:46:02 espie Exp $ +--- kdesu/su.cpp.orig Mon Mar 4 01:59:16 2002 ++++ kdesu/su.cpp Mon Jan 6 23:40:41 2003 @@ -41,17 +41,33 @@ #ifndef __PATH_SU #define __PATH_SU "false" @@ -44,13 +44,15 @@ $OpenBSD: patch-kdesu_su_cpp,v 1.1 2002/05/15 17:19:44 espie Exp $ */ int SuProcess::exec(const char *password, int check) -@@ -74,14 +90,20 @@ int SuProcess::exec(const char *password +@@ -74,14 +90,22 @@ int SuProcess::exec(const char *password setTerminal(true); QCStringList args; + if (d->m_useSudo) + { + args += "-S"; ++ args += "-p"; ++ args += "Password:"; + args += "-u"; + } if ((m_Scheduler != SchedNormal) || (m_Priority > 50)) @@ -67,7 +69,7 @@ $OpenBSD: patch-kdesu_su_cpp,v 1.1 2002/05/15 17:19:44 espie Exp $ { return check ? SuNotFound : -1; } -@@ -90,7 +112,8 @@ int SuProcess::exec(const char *password +@@ -90,7 +114,8 @@ int SuProcess::exec(const char *password if (ret < 0) { if (!check) @@ -77,7 +79,7 @@ $OpenBSD: patch-kdesu_su_cpp,v 1.1 2002/05/15 17:19:44 espie Exp $ return ret; } if (check == 2) -@@ -98,6 +121,8 @@ int SuProcess::exec(const char *password +@@ -98,6 +123,8 @@ int SuProcess::exec(const char *password if (ret == 1) { kill(m_Pid, SIGTERM); @@ -86,3 +88,23 @@ $OpenBSD: patch-kdesu_su_cpp,v 1.1 2002/05/15 17:19:44 espie Exp $ waitForChild(); } return ret; +@@ -170,6 +197,9 @@ int SuProcess::ConverseSU(const char *pa + return 0; + } + ++ if (d->m_useSudo && line != "Password:") ++ break; ++ + // Match "Password: " with the regex ^[^:]+:[\w]*$. + for (i=0,j=0,colon=0; im_useSudo && line == "Password:") ++ return -1; ++ + // Read till we get "kdesu_stub" + if (line == "kdesu_stub") + {