Fix kdesu
This commit is contained in:
parent
892ab0b2d9
commit
d723ec4713
@ -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 <stropts.h>
|
||||
#include <sys/stream.h>
|
||||
#endif
|
||||
+#ifdef __OpenBSD__
|
||||
+#include <sys/ioctl.h>
|
||||
+#endif
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h> // 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
|
||||
|
@ -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; i<line.length(); i++)
|
||||
{
|
||||
@@ -210,6 +240,9 @@ int SuProcess::ConverseSU(const char *pa
|
||||
}
|
||||
|
||||
case 2:
|
||||
+ if (d->m_useSudo && line == "Password:")
|
||||
+ return -1;
|
||||
+
|
||||
// Read till we get "kdesu_stub"
|
||||
if (line == "kdesu_stub")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user