author | rohinis |
Tue, 29 Nov 2011 17:32:55 +0000 | |
branch | s11express-2010-11 |
changeset 22234 | c23e64da3e06 |
parent 15569 | f5ee708e987d |
child 21149 | fa4e4a07e832 |
child 21308 | 9a98b77f065c |
permissions | -rw-r--r-- |
9235 | 1 |
--- gnome-system-tools-2.14.0.orig/src/common/gst-auth.c 2006-01-31 06:40:32.000000000 +0800 |
14761 | 2 |
+++ gnome-system-tools-2.14.0/src/common/gst-auth.c 2008-12-12 14:10:17.161439000 +0800 |
9235 | 3 |
@@ -43,16 +43,30 @@ |
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
4 |
#ifdef __FreeBSD__ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
5 |
# include <errno.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
6 |
# include <libutil.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
7 |
+#elif defined(__sun) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
8 |
+#include <fcntl.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
9 |
+#include <unistd.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
10 |
+#include <stdlib.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
11 |
+#include <sys/ioctl.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
12 |
+#include <sys/stream.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
13 |
+#include <sys/stropts.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
14 |
#else |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
15 |
#include <pty.h> |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
16 |
#endif |
8394 | 17 |
|
18 |
+#include <gksu.h> |
|
19 |
+#include <gksuui-dialog.h> |
|
20 |
+ |
|
21 |
#include "gst-auth.h" |
|
22 |
#include "gst-tool.h" |
|
23 |
#include "gst-platform.h" |
|
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
24 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
25 |
#define GST_AUTH_RESPONSE_NP 1 |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
26 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
27 |
+#ifdef __sun |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
28 |
+#define EMBEDDED_SU "/usr/lib/embedded_su" |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
29 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
30 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
31 |
static int root; /* if we are root, no password is |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
32 |
required */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
33 |
|
8394 | 34 |
@@ -118,6 +132,122 @@ |
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
35 |
return TRUE; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
36 |
} |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
37 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
38 |
+#ifdef __sun |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
39 |
+/* forkpty() rmplacement for Solaris. |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
40 |
+ * This ignore the last two arguments |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
41 |
+ * for the moment |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
42 |
+ */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
43 |
+#ifdef NOPTY |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
44 |
+/* |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
45 |
+ * This is implemented using pipes instead of pseudo tty to avoid |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
46 |
+ * bug 4907342. |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
47 |
+ */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
48 |
+static |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
49 |
+int forkpty (int *amaster, char *name, void *unused1, void *unused2) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
50 |
+{ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
51 |
+ pid_t pid; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
52 |
+ int pp[2]; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
53 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
54 |
+ pipe (pp); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
55 |
+ pid = fork (); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
56 |
+ switch (pid) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
57 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
58 |
+ case -1: /* Error */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
59 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
60 |
+ case 0: /* Child */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
61 |
+ if (setsid() < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
62 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
63 |
+ close (pp[1]); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
64 |
+ dup2 (pp[0], 0); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
65 |
+ return 0; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
66 |
+ default: /* Parent */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
67 |
+ close (pp[0]); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
68 |
+ *amaster = pp[1]; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
69 |
+ return pid; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
70 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
71 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
72 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
73 |
+} |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
74 |
+#else |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
75 |
+int forkpty (int *amaster, char *name, void *unused1, void *unused2) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
76 |
+{ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
77 |
+ int master, slave, fd; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
78 |
+ char *slave_name; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
79 |
+ pid_t pid; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
80 |
+ void (*sig_saved)(int); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
81 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
82 |
+ master = open("/dev/ptmx", O_RDWR | O_NOCTTY); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
83 |
+ if (master < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
84 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
85 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
86 |
+ sig_saved = signal (SIGCHLD, SIG_DFL); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
87 |
+ if (grantpt (master) < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
88 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
89 |
+ signal (SIGCHLD, sig_saved); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
90 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
91 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
92 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
93 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
94 |
+ if (unlockpt (master) < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
95 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
96 |
+ signal (SIGCHLD, sig_saved); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
97 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
98 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
99 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
100 |
+ signal (SIGCHLD, sig_saved); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
101 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
102 |
+ slave_name = ptsname (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
103 |
+ if (slave_name == NULL) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
104 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
105 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
106 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
107 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
108 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
109 |
+ slave = open (slave_name, O_RDWR | O_NOCTTY); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
110 |
+ if (slave < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
111 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
112 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
113 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
114 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
115 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
116 |
+ if (ioctl (slave, I_PUSH, "ptem") < 0 |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
117 |
+ || ioctl (slave, I_PUSH, "ldterm") < 0 |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
118 |
+ || ioctl (slave, I_PUSH, "ttcompat") < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
119 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
120 |
+ close (slave); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
121 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
122 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
123 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
124 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
125 |
+ if (amaster) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
126 |
+ *amaster = master; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
127 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
128 |
+ if (name) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
129 |
+ strcpy (name, slave_name); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
130 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
131 |
+ pid = fork (); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
132 |
+ switch (pid) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
133 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
134 |
+ case -1: /* Error */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
135 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
136 |
+ case 0: /* Child */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
137 |
+ if (setsid() < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
138 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
139 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
140 |
+ dup2 (slave, STDIN_FILENO); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
141 |
+ dup2 (slave, STDOUT_FILENO); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
142 |
+ dup2 (slave, STDERR_FILENO); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
143 |
+ return 0; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
144 |
+ default: /* Parent */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
145 |
+ close (slave); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
146 |
+ return pid; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
147 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
148 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
149 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
150 |
+} |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
151 |
+#endif |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
152 |
+#endif |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
153 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
154 |
/* runs a term with su in it */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
155 |
static void |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
156 |
gst_auth_run_term (GstTool *tool, gchar *args[]) |
8394 | 157 |
@@ -177,8 +307,15 @@ |
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
158 |
gchar *s, *str; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
159 |
gint ret; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
160 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
161 |
+#if defined(__sun) && defined (EMBEDDED_SU) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
162 |
+ gst_tool_write_to_backend(tool, (gchar*)".\n"); /* Send empty text block to start conversation */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
163 |
+#endif |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
164 |
while (!cont) { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
165 |
+#if defined(__sun) && defined (EMBEDDED_SU) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
166 |
+ s = gst_tool_read_from_backend (tool, "SUCCESS", "\n.\n", NULL); /* Look for end of text block - a period (.) on a line by itself */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
167 |
+#else |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
168 |
s = gst_tool_read_from_backend (tool, "assword:", "/no)?", "\n", NULL); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
169 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
170 |
str = g_ascii_strup (s, -1); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
171 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
172 |
/* FIXME: hope that someday we can get rid of this ssh output string parsing */ |
8394 | 173 |
@@ -189,6 +326,11 @@ |
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
174 |
/* it's asking for the password */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
175 |
cont = TRUE; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
176 |
ret = GST_AUTH_PASSWORD; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
177 |
+#if defined(__sun) && defined (EMBEDDED_SU) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
178 |
+ } else if (g_strrstr (str, "SUCCESS") != NULL) { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
179 |
+ cont = TRUE; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
180 |
+ ret = GST_AUTH_PASSWORDLESS; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
181 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
182 |
} else if (g_strrstr (str, "\n") != NULL) { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
183 |
/* this is the last case to test, it's the CR |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
184 |
used to synchronize communication */ |
15569 | 185 |
@@ -286,7 +428,77 @@ |
8394 | 186 |
gchar *password; |
187 |
gint result; |
|
188 |
struct termios t; |
|
189 |
+ GksuContext *context; |
|
190 |
+ GError *error = NULL; |
|
191 |
+ GtkWidget *gksuui_dialog; |
|
192 |
+ gint response; |
|
14761 | 193 |
+ gchar *primary_text = NULL; |
194 |
+ gchar *secondary_text = NULL; |
|
195 |
+ |
|
9235 | 196 |
+ |
8394 | 197 |
+#ifdef HAVE_GKSU |
198 |
+ context = gksu_context_new (); |
|
199 |
+#ifdef GST_DEBUG |
|
200 |
+ gksu_context_set_debug (context, TRUE); |
|
201 |
+#endif |
|
202 |
+ gksu_context_set_command (context, args[3]); |
|
203 |
+ gksu_context_set_wait_for_child_to_exit (context, FALSE); |
|
204 |
+ if (gksu_context_try_need_password (context) ) |
|
205 |
+ { |
|
206 |
+ password = NULL; |
|
207 |
+ gchar *pw_prompt = NULL; |
|
208 |
+ gksuui_dialog = gksuui_dialog_new (); |
|
209 |
+ gksuui_dialog_set_message (GKSUUI_DIALOG(gksuui_dialog), |
|
15569 | 210 |
+ /* SUN_BRANDING */ |
211 |
+ g_strdup_printf(_("<b>You need %s privileges to use this tool. " |
|
212 |
+ "Enter a password to modify your system configuration.</b>"), |
|
8394 | 213 |
+ context->user)); |
214 |
+ gtk_widget_show (gksuui_dialog); |
|
215 |
+ |
|
216 |
+ response = gtk_dialog_run (GTK_DIALOG(gksuui_dialog)); |
|
217 |
+ |
|
218 |
+ switch (response) { |
|
219 |
+ case GTK_RESPONSE_OK: |
|
220 |
+ break; |
|
221 |
+ default: |
|
222 |
+ /* Cancel */ |
|
223 |
+ exit (0); |
|
224 |
+ break; |
|
225 |
+ } |
|
226 |
+#ifdef GST_DEBUG |
|
227 |
+ fprintf (stderr, "response ID: %d\n", response); |
|
228 |
+#endif |
|
229 |
+ password = gksuui_dialog_get_password (GKSUUI_DIALOG(gksuui_dialog)); |
|
230 |
+ gtk_widget_destroy ( gksuui_dialog ); |
|
231 |
+ gksu_context_set_password (context, password); |
|
232 |
+ } |
|
233 |
+ |
|
234 |
+ error = NULL; |
|
235 |
+ gksu_context_run (context, &error); |
|
14761 | 236 |
+ |
237 |
+ if (error) |
|
238 |
+ { |
|
14771 | 239 |
+ /* SUN_BRANDING */ |
14761 | 240 |
+ primary_text = g_strdup_printf (_("Authentication fails")); |
241 |
+ secondary_text = g_strdup (error->message); |
|
242 |
+ |
|
243 |
+ gst_auth_display_error_message (tool, primary_text, secondary_text); |
|
244 |
+ |
|
245 |
+ g_free (primary_text); |
|
246 |
+ g_free (secondary_text); |
|
247 |
+ exit (0); |
|
248 |
+ } |
|
249 |
||
8394 | 250 |
+ tool->read_fd = gksu_context_get_child_stdin_fd (context); |
251 |
+ tool->write_fd = gksu_context_get_child_stdout_fd (context); |
|
252 |
+ tool->backend_pid = gksu_context_get_child_pid (context); |
|
253 |
+ tool->timeout_id = g_timeout_add (1000, (GSourceFunc) gst_auth_wait_child, tool); |
|
254 |
+#ifdef GST_DEBUG |
|
255 |
+ fprintf (stderr, "read_fd = %d, write_fd = %d\n", tool->read_fd, tool->write_fd); |
|
256 |
+#endif |
|
257 |
+ tool->read_stream = gksu_context_get_child_stdin_file (context); |
|
258 |
+ tool->write_stream = gksu_context_get_child_stdout_file (context); |
|
259 |
+#else |
|
260 |
gst_auth_run_term (tool, args); |
|
261 |
result = gst_auth_get_auth_required (tool); |
|
262 |
||
15569 | 263 |
@@ -296,7 +508,14 @@ |
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
264 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
265 |
if (strlen (password) > 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
266 |
memset (password, 0, strlen (password)); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
267 |
+#if defined(__sun) && defined (EMBEDDED_SU) && 0 |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
268 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
269 |
+ gchar *s = gst_tool_read_from_backend (tool, "\n.\n", "SUCCESS", "\n", NULL); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
270 |
+ g_free(s); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
271 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
272 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
273 |
} |
8394 | 274 |
+#endif |
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
275 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
276 |
tool->root_access = ROOT_ACCESS_REAL; |
8394 | 277 |
|
15569 | 278 |
@@ -368,7 +587,7 @@ |
8394 | 279 |
GString *command; |
280 |
||
281 |
command = g_string_new (NULL); |
|
282 |
- gst_auth_save_locale (command); |
|
283 |
+// gst_auth_save_locale (command); |
|
284 |
command = g_string_append (command, tool->script_path); |
|
285 |
command = g_string_append (command, " --report"); |
|
286 |
||
15569 | 287 |
@@ -378,7 +597,11 @@ |
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
288 |
} |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
289 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
290 |
/* these are the su args */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
291 |
+#if defined(__sun) && defined (EMBEDDED_SU) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
292 |
+ su_args[0] = EMBEDDED_SU; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
293 |
+#else |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
294 |
su_args[0] = SU_PATH; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
295 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
296 |
su_args[1] = "root"; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
297 |
su_args[2] = "-c"; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
298 |
su_args[3] = command->str; |