author | dcarbery |
Fri, 24 Nov 2006 16:37:59 +0000 | |
branch | 217update |
changeset 19096 | d542fc2c823e |
parent 8394 | bcd58bae020d |
child 9235 | b2a55defbb7e |
permissions | -rw-r--r-- |
8394 | 1 |
--- gnome-system-tools-2.14.0.orig/src/common/gst-auth.c Tue Jan 31 06:40:32 2006 |
2 |
+++ gnome-system-tools-2.14.0/src/common/gst-auth.c Thu Oct 19 16:46:03 2006 |
|
3 |
@@ -43,10 +43,20 @@ |
|
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" |
|
24 |
@@ -53,6 +63,10 @@ |
|
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
25 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
26 |
#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
|
27 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
28 |
+#ifdef __sun |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
29 |
+#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
|
30 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
31 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
32 |
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
|
33 |
required */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
34 |
|
8394 | 35 |
@@ -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
|
36 |
return TRUE; |
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 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
39 |
+#ifdef __sun |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
40 |
+/* 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
|
41 |
+ * 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
|
42 |
+ * for the moment |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
43 |
+ */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
44 |
+#ifdef NOPTY |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
45 |
+/* |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
46 |
+ * 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
|
47 |
+ * bug 4907342. |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
48 |
+ */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
49 |
+static |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
50 |
+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
|
51 |
+{ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
52 |
+ pid_t pid; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
53 |
+ int pp[2]; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
54 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
55 |
+ pipe (pp); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
56 |
+ pid = fork (); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
57 |
+ switch (pid) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
58 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
59 |
+ case -1: /* Error */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
60 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
61 |
+ case 0: /* Child */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
62 |
+ if (setsid() < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
63 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
64 |
+ close (pp[1]); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
65 |
+ 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
|
66 |
+ return 0; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
67 |
+ default: /* Parent */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
68 |
+ close (pp[0]); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
69 |
+ *amaster = pp[1]; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
70 |
+ return pid; |
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 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
73 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
74 |
+} |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
75 |
+#else |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
76 |
+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
|
77 |
+{ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
78 |
+ 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
|
79 |
+ char *slave_name; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
80 |
+ pid_t pid; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
81 |
+ 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
|
82 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
83 |
+ 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
|
84 |
+ if (master < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
85 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
86 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
87 |
+ 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
|
88 |
+ 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
|
89 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
90 |
+ 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
|
91 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
92 |
+ return -1; |
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 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
95 |
+ 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
|
96 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
97 |
+ 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
|
98 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
99 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
100 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
101 |
+ 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
|
102 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
103 |
+ 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
|
104 |
+ 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
|
105 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
106 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
107 |
+ return -1; |
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 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
110 |
+ 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
|
111 |
+ if (slave < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
112 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
113 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
114 |
+ return -1; |
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 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
117 |
+ 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
|
118 |
+ || 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
|
119 |
+ || 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
|
120 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
121 |
+ close (slave); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
122 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
123 |
+ return -1; |
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 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
126 |
+ if (amaster) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
127 |
+ *amaster = master; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
128 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
129 |
+ if (name) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
130 |
+ 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
|
131 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
132 |
+ pid = fork (); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
133 |
+ switch (pid) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
134 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
135 |
+ case -1: /* Error */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
136 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
137 |
+ case 0: /* Child */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
138 |
+ if (setsid() < 0) |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
139 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
140 |
+ close (master); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
141 |
+ 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
|
142 |
+ 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
|
143 |
+ 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
|
144 |
+ return 0; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
145 |
+ default: /* Parent */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
146 |
+ close (slave); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
147 |
+ return pid; |
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 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
150 |
+ return -1; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
151 |
+} |
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 |
+#endif |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
154 |
+ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
155 |
/* 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
|
156 |
static void |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
157 |
gst_auth_run_term (GstTool *tool, gchar *args[]) |
8394 | 158 |
@@ -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
|
159 |
gchar *s, *str; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
160 |
gint ret; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
161 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
162 |
+#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
|
163 |
+ 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
|
164 |
+#endif |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
165 |
while (!cont) { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
166 |
+#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
|
167 |
+ 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
|
168 |
+#else |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
169 |
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
|
170 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
171 |
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
|
172 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
173 |
/* FIXME: hope that someday we can get rid of this ssh output string parsing */ |
8394 | 174 |
@@ -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
|
175 |
/* 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
|
176 |
cont = TRUE; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
177 |
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
|
178 |
+#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
|
179 |
+ } 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
|
180 |
+ cont = TRUE; |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
181 |
+ 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
|
182 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
183 |
} 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
|
184 |
/* 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
|
185 |
used to synchronize communication */ |
8394 | 186 |
@@ -286,7 +428,61 @@ |
187 |
gchar *password; |
|
188 |
gint result; |
|
189 |
struct termios t; |
|
190 |
+ GksuContext *context; |
|
191 |
+ GError *error = NULL; |
|
192 |
+ GtkWidget *gksuui_dialog; |
|
193 |
+ gint response; |
|
194 |
||
195 |
+#ifdef HAVE_GKSU |
|
196 |
+ context = gksu_context_new (); |
|
197 |
+#ifdef GST_DEBUG |
|
198 |
+ gksu_context_set_debug (context, TRUE); |
|
199 |
+#endif |
|
200 |
+ gksu_context_set_command (context, args[3]); |
|
201 |
+ gksu_context_set_wait_for_child_to_exit (context, FALSE); |
|
202 |
+ if (gksu_context_try_need_password (context) ) |
|
203 |
+ { |
|
204 |
+ password = NULL; |
|
205 |
+ gchar *pw_prompt = NULL; |
|
206 |
+ gksuui_dialog = gksuui_dialog_new (); |
|
207 |
+ gksuui_dialog_set_message (GKSUUI_DIALOG(gksuui_dialog), |
|
208 |
+ g_strdup_printf("<b>You need %s privileges to use this tool. " |
|
209 |
+ "Enter a password to modify your system configuration.</b>", |
|
210 |
+ context->user)); |
|
211 |
+ gtk_widget_show (gksuui_dialog); |
|
212 |
+ |
|
213 |
+ response = gtk_dialog_run (GTK_DIALOG(gksuui_dialog)); |
|
214 |
+ |
|
215 |
+ switch (response) { |
|
216 |
+ case GTK_RESPONSE_OK: |
|
217 |
+ break; |
|
218 |
+ default: |
|
219 |
+ /* Cancel */ |
|
220 |
+ exit (0); |
|
221 |
+ break; |
|
222 |
+ } |
|
223 |
+#ifdef GST_DEBUG |
|
224 |
+ fprintf (stderr, "response ID: %d\n", response); |
|
225 |
+#endif |
|
226 |
+ password = gksuui_dialog_get_password (GKSUUI_DIALOG(gksuui_dialog)); |
|
227 |
+ gtk_widget_destroy ( gksuui_dialog ); |
|
228 |
+ gksu_context_set_password (context, password); |
|
229 |
+ } |
|
230 |
+ |
|
231 |
+ error = NULL; |
|
232 |
+ gksu_context_run (context, &error); |
|
233 |
+ tool->read_fd = gksu_context_get_child_stdin_fd (context); |
|
234 |
+ tool->write_fd = gksu_context_get_child_stdout_fd (context); |
|
235 |
+ tool->backend_pid = gksu_context_get_child_pid (context); |
|
236 |
+ tool->timeout_id = g_timeout_add (1000, (GSourceFunc) gst_auth_wait_child, tool); |
|
237 |
+#ifdef GST_DEBUG |
|
238 |
+ fprintf (stderr, "read_fd = %d, write_fd = %d\n", tool->read_fd, tool->write_fd); |
|
239 |
+#endif |
|
240 |
+ tool->read_stream = gksu_context_get_child_stdin_file (context); |
|
241 |
+ tool->write_stream = gksu_context_get_child_stdout_file (context); |
|
242 |
+ setvbuf ( tool->read_stream, NULL, _IONBF, 0); |
|
243 |
+ fcntl (tool->read_fd, F_SETFL, 0); |
|
244 |
+#else |
|
245 |
gst_auth_run_term (tool, args); |
|
246 |
result = gst_auth_get_auth_required (tool); |
|
247 |
||
248 |
@@ -296,7 +492,14 @@ |
|
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
249 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
250 |
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
|
251 |
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
|
252 |
+#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
|
253 |
+ { |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
254 |
+ 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
|
255 |
+ g_free(s); |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
256 |
+ } |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
257 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
258 |
} |
8394 | 259 |
+#endif |
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
260 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
261 |
tool->root_access = ROOT_ACCESS_REAL; |
8394 | 262 |
|
263 |
@@ -368,7 +571,7 @@ |
|
264 |
GString *command; |
|
265 |
||
266 |
command = g_string_new (NULL); |
|
267 |
- gst_auth_save_locale (command); |
|
268 |
+// gst_auth_save_locale (command); |
|
269 |
command = g_string_append (command, tool->script_path); |
|
270 |
command = g_string_append (command, " --report"); |
|
271 |
||
272 |
@@ -378,7 +581,11 @@ |
|
7859
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
273 |
} |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
274 |
|
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
275 |
/* 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
|
276 |
+#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
|
277 |
+ 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
|
278 |
+#else |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
279 |
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
|
280 |
+#endif /* __sun */ |
8517272aace0
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff
changeset
|
281 |
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
|
282 |
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
|
283 |
su_args[3] = command->str; |