1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
diff -Naur kdesu/stub.cpp kdesu.new/stub.cpp
--- kdesu/stub.cpp 2008-05-21 08:08:55.000000000 -0300
+++ kdesu.new/stub.cpp 2009-10-13 01:32:10.000000000 -0300
@@ -105,6 +105,7 @@
int StubProcess::ConverseStub(int check)
{
QByteArray line, tmp;
+
while (1)
{
line = readLine();
@@ -117,7 +118,17 @@
enableLocalEcho(false);
if (check) writeLine("stop");
else writeLine("ok");
- } else if (line == "display") {
+ break;
+ }
+ }
+
+ while (1)
+ {
+ line = readLine();
+ if (line.isNull())
+ return -1;
+
+ if (line == "display") {
writeLine(display());
} else if (line == "display_auth") {
#ifdef Q_WS_X11
diff -Naur kdesu/su.cpp kdesu.new/su.cpp
--- kdesu/su.cpp 2008-05-21 08:08:55.000000000 -0300
+++ kdesu.new/su.cpp 2009-10-19 00:21:31.000000000 -0200
@@ -258,13 +258,6 @@
//////////////////////////////////////////////////////////////////////////
case WaitForPrompt:
{
- // In case no password is needed.
- if (line == "kdesu_stub")
- {
- unreadLine(line);
- return ok;
- }
-
while(waitMS(fd(),100)>0)
{
// There is more output available, so the previous line
@@ -279,6 +272,13 @@
kDebug(900) << k_lineinfo << "Read line <" << more << ">";
}
+ // In case no password is needed.
+ if (line == "kdesu_stub")
+ {
+ unreadLine(line);
+ return ok;
+ }
+
// Match "Password: " with the regex ^[^:]+:[\w]*$.
const uint len = line.length();
for (i=0,j=0,colon=0; i<len; i++)
|