7853
|
1 |
diff -u -N libgksu1.2-1.3.1/libgksu.orig/gksu-run-helper.c libgksu1.2-1.3.1/libgksu/gksu-run-helper.c
|
|
2 |
--- libgksu1.2-1.3.1/libgksu.orig/gksu-run-helper.c 2006-08-01 13:54:43.132218000 +0800
|
|
3 |
+++ libgksu1.2-1.3.1/libgksu/gksu-run-helper.c 2006-08-01 13:30:10.294209000 +0800
|
|
4 |
@@ -27,6 +27,10 @@
|
|
5 |
#include <sys/stat.h>
|
|
6 |
|
|
7 |
#include <glib.h>
|
|
8 |
+#ifdef __sun
|
|
9 |
+#include "mkdtemp.c"
|
16206
|
10 |
+#include <strings.h>
|
7853
|
11 |
+#endif
|
|
12 |
|
|
13 |
#include "defines.h"
|
|
14 |
|
|
15 |
@@ -93,6 +97,9 @@
|
|
16 |
return 1;
|
|
17 |
}
|
|
18 |
|
|
19 |
+ fflush(stdout);
|
|
20 |
+ fflush(stderr);
|
|
21 |
+ usleep(10000);
|
|
22 |
fprintf (stderr, "gksu: waiting\n");
|
|
23 |
|
|
24 |
xauth_file = g_strdup_printf ("%s/.Xauthority",
|
|
25 |
@@ -129,7 +136,7 @@
|
|
26 |
setenv ("XAUTHORITY", xauth_file, TRUE);
|
|
27 |
|
|
28 |
command =
|
|
29 |
- g_strdup_printf ("/usr/X11R6/bin/xauth add %s . \"`cat %s.tmp`\""
|
|
30 |
+ g_strdup_printf ("/usr/bin/xauth add %s . \"`cat %s.tmp`\""
|
|
31 |
" > /dev/null 2>&1", xauth_display, xauth_file);
|
|
32 |
|
|
33 |
system (command);
|
|
34 |
diff -u -N libgksu1.2-1.3.1/libgksu.orig/mkdtemp.c libgksu1.2-1.3.1/libgksu/mkdtemp.c
|
|
35 |
--- libgksu1.2-1.3.1/libgksu.orig/mkdtemp.c 1970-01-01 08:00:00.000000000 +0800
|
|
36 |
+++ libgksu1.2-1.3.1/libgksu/mkdtemp.c 2006-08-01 11:40:54.843621000 +0800
|
|
37 |
@@ -0,0 +1,204 @@
|
|
38 |
+/* Copyright (C) 1999, 2001-2003 Free Software Foundation, Inc.
|
|
39 |
+ This file is part of the GNU C Library.
|
|
40 |
+
|
|
41 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
42 |
+ modify it under the terms of the GNU Library General Public License as
|
|
43 |
+ published by the Free Software Foundation; either version 2 of the
|
|
44 |
+ License, or (at your option) any later version.
|
|
45 |
+
|
|
46 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
47 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
48 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
49 |
+ Library General Public License for more details.
|
|
50 |
+
|
|
51 |
+ You should have received a copy of the GNU Library General Public
|
|
52 |
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
|
|
53 |
+ write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
54 |
+ Fifth Floor, Boston, MA 02110-1301, USA. */
|
|
55 |
+
|
|
56 |
+/* Extracted from misc/mkdtemp.c and sysdeps/posix/tempname.c. */
|
|
57 |
+
|
|
58 |
+#ifdef HAVE_CONFIG_H
|
|
59 |
+# include "config.h"
|
|
60 |
+#endif
|
|
61 |
+
|
|
62 |
+/* Specification. */
|
|
63 |
+#include "mkdtemp.h"
|
|
64 |
+
|
|
65 |
+#include <errno.h>
|
|
66 |
+#ifndef __set_errno
|
|
67 |
+# define __set_errno(Val) errno = (Val)
|
|
68 |
+#endif
|
|
69 |
+
|
|
70 |
+#include <stddef.h>
|
|
71 |
+#include <stdlib.h>
|
|
72 |
+#include <string.h>
|
|
73 |
+
|
|
74 |
+#include <stdio.h>
|
|
75 |
+#ifndef TMP_MAX
|
|
76 |
+# define TMP_MAX 238328
|
|
77 |
+#endif
|
|
78 |
+
|
|
79 |
+#if HAVE_STDINT_H || _LIBC
|
|
80 |
+# include <stdint.h>
|
|
81 |
+#endif
|
|
82 |
+#if HAVE_INTTYPES_H
|
|
83 |
+# include <inttypes.h>
|
|
84 |
+#endif
|
|
85 |
+
|
|
86 |
+#if HAVE_UNISTD_H || _LIBC
|
|
87 |
+# include <unistd.h>
|
|
88 |
+#endif
|
|
89 |
+
|
|
90 |
+#if HAVE_GETTIMEOFDAY || _LIBC
|
|
91 |
+# if HAVE_SYS_TIME_H || _LIBC
|
|
92 |
+# include <sys/time.h>
|
|
93 |
+# endif
|
|
94 |
+#else
|
|
95 |
+# if HAVE_TIME_H || _LIBC
|
|
96 |
+# include <time.h>
|
|
97 |
+# endif
|
|
98 |
+#endif
|
|
99 |
+
|
|
100 |
+#include <sys/stat.h>
|
|
101 |
+#if STAT_MACROS_BROKEN
|
|
102 |
+# undef S_ISDIR
|
|
103 |
+#endif
|
|
104 |
+#if !defined S_ISDIR && defined S_IFDIR
|
|
105 |
+# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
|
106 |
+#endif
|
|
107 |
+#if !S_IRUSR && S_IREAD
|
|
108 |
+# define S_IRUSR S_IREAD
|
|
109 |
+#endif
|
|
110 |
+#if !S_IRUSR
|
|
111 |
+# define S_IRUSR 00400
|
|
112 |
+#endif
|
|
113 |
+#if !S_IWUSR && S_IWRITE
|
|
114 |
+# define S_IWUSR S_IWRITE
|
|
115 |
+#endif
|
|
116 |
+#if !S_IWUSR
|
|
117 |
+# define S_IWUSR 00200
|
|
118 |
+#endif
|
|
119 |
+#if !S_IXUSR && S_IEXEC
|
|
120 |
+# define S_IXUSR S_IEXEC
|
|
121 |
+#endif
|
|
122 |
+#if !S_IXUSR
|
|
123 |
+# define S_IXUSR 00100
|
|
124 |
+#endif
|
|
125 |
+
|
|
126 |
+#ifdef __MINGW32__
|
|
127 |
+/* mingw's mkdir() function has 1 argument, but we pass 2 arguments.
|
|
128 |
+ Therefore we have to disable the argument count checking. */
|
|
129 |
+# define mkdir ((int (*)()) mkdir)
|
|
130 |
+#endif
|
|
131 |
+
|
|
132 |
+#if !_LIBC
|
|
133 |
+# define __getpid getpid
|
|
134 |
+# define __gettimeofday gettimeofday
|
|
135 |
+# define __mkdir mkdir
|
|
136 |
+#endif
|
|
137 |
+
|
|
138 |
+/* Use the widest available unsigned type if uint64_t is not
|
|
139 |
+ available. The algorithm below extracts a number less than 62**6
|
|
140 |
+ (approximately 2**35.725) from uint64_t, so ancient hosts where
|
|
141 |
+ uintmax_t is only 32 bits lose about 3.725 bits of randomness,
|
|
142 |
+ which is better than not having mkstemp at all. */
|
|
143 |
+#if !defined UINT64_MAX && !defined uint64_t
|
|
144 |
+# define uint64_t uintmax_t
|
|
145 |
+#endif
|
|
146 |
+
|
|
147 |
+/* These are the characters used in temporary filenames. */
|
|
148 |
+static const char letters[] =
|
|
149 |
+"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
150 |
+
|
|
151 |
+/* Generate a temporary file name based on TMPL. TMPL must match the
|
|
152 |
+ rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
|
|
153 |
+ does not exist at the time of the call to __gen_tempname. TMPL is
|
|
154 |
+ overwritten with the result.
|
|
155 |
+
|
|
156 |
+ KIND is:
|
|
157 |
+ __GT_DIR: create a directory, which will be mode 0700.
|
|
158 |
+
|
|
159 |
+ We use a clever algorithm to get hard-to-predict names. */
|
|
160 |
+static int
|
|
161 |
+gen_tempname (char *tmpl)
|
|
162 |
+{
|
|
163 |
+ int len;
|
|
164 |
+ char *XXXXXX;
|
|
165 |
+ static uint64_t value;
|
|
166 |
+ uint64_t random_time_bits;
|
|
167 |
+ int count, fd = -1;
|
|
168 |
+ int save_errno = errno;
|
|
169 |
+
|
|
170 |
+ len = strlen (tmpl);
|
|
171 |
+ if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
|
|
172 |
+ {
|
|
173 |
+ __set_errno (EINVAL);
|
|
174 |
+ return -1;
|
|
175 |
+ }
|
|
176 |
+
|
|
177 |
+ /* This is where the Xs start. */
|
|
178 |
+ XXXXXX = &tmpl[len - 6];
|
|
179 |
+
|
|
180 |
+ /* Get some more or less random data. */
|
|
181 |
+#ifdef RANDOM_BITS
|
|
182 |
+ RANDOM_BITS (random_time_bits);
|
|
183 |
+#else
|
|
184 |
+# if HAVE_GETTIMEOFDAY || _LIBC
|
|
185 |
+ {
|
|
186 |
+ struct timeval tv;
|
|
187 |
+ __gettimeofday (&tv, NULL);
|
|
188 |
+ random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
|
|
189 |
+ }
|
|
190 |
+# else
|
|
191 |
+ random_time_bits = time (NULL);
|
|
192 |
+# endif
|
|
193 |
+#endif
|
|
194 |
+ value += random_time_bits ^ __getpid ();
|
|
195 |
+
|
|
196 |
+ for (count = 0; count < TMP_MAX; value += 7777, ++count)
|
|
197 |
+ {
|
|
198 |
+ uint64_t v = value;
|
|
199 |
+
|
|
200 |
+ /* Fill in the random bits. */
|
|
201 |
+ XXXXXX[0] = letters[v % 62];
|
|
202 |
+ v /= 62;
|
|
203 |
+ XXXXXX[1] = letters[v % 62];
|
|
204 |
+ v /= 62;
|
|
205 |
+ XXXXXX[2] = letters[v % 62];
|
|
206 |
+ v /= 62;
|
|
207 |
+ XXXXXX[3] = letters[v % 62];
|
|
208 |
+ v /= 62;
|
|
209 |
+ XXXXXX[4] = letters[v % 62];
|
|
210 |
+ v /= 62;
|
|
211 |
+ XXXXXX[5] = letters[v % 62];
|
|
212 |
+
|
|
213 |
+ fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
|
|
214 |
+
|
|
215 |
+ if (fd >= 0)
|
|
216 |
+ {
|
|
217 |
+ __set_errno (save_errno);
|
|
218 |
+ return fd;
|
|
219 |
+ }
|
|
220 |
+ else if (errno != EEXIST)
|
|
221 |
+ return -1;
|
|
222 |
+ }
|
|
223 |
+
|
|
224 |
+ /* We got out of the loop because we ran out of combinations to try. */
|
|
225 |
+ __set_errno (EEXIST);
|
|
226 |
+ return -1;
|
|
227 |
+}
|
|
228 |
+
|
|
229 |
+/* Generate a unique temporary directory from TEMPLATE.
|
|
230 |
+ The last six characters of TEMPLATE must be "XXXXXX";
|
|
231 |
+ they are replaced with a string that makes the filename unique.
|
|
232 |
+ The directory is created, mode 700, and its name is returned.
|
|
233 |
+ (This function comes from OpenBSD.) */
|
|
234 |
+char *
|
|
235 |
+mkdtemp (char *template)
|
|
236 |
+{
|
|
237 |
+ if (gen_tempname (template))
|
|
238 |
+ return NULL;
|
|
239 |
+ else
|
|
240 |
+ return template;
|
|
241 |
+}
|
|
242 |
diff -u -N libgksu1.2-1.3.1/libgksu.orig/mkdtemp.h libgksu1.2-1.3.1/libgksu/mkdtemp.h
|
|
243 |
--- libgksu1.2-1.3.1/libgksu.orig/mkdtemp.h 1970-01-01 08:00:00.000000000 +0800
|
|
244 |
+++ libgksu1.2-1.3.1/libgksu/mkdtemp.h 2006-08-01 11:40:54.850134000 +0800
|
|
245 |
@@ -0,0 +1,40 @@
|
|
246 |
+/* Creating a private temporary directory.
|
|
247 |
+ Copyright (C) 2001 Free Software Foundation, Inc.
|
|
248 |
+
|
|
249 |
+ This program is free software; you can redistribute it and/or modify
|
|
250 |
+ it under the terms of the GNU General Public License as published by
|
|
251 |
+ the Free Software Foundation; either version 2, or (at your option)
|
|
252 |
+ any later version.
|
|
253 |
+
|
|
254 |
+ This program is distributed in the hope that it will be useful,
|
|
255 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
256 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
257 |
+ GNU General Public License for more details.
|
|
258 |
+
|
|
259 |
+ You should have received a copy of the GNU General Public License
|
|
260 |
+ along with this program; if not, write to the Free Software Foundation,
|
|
261 |
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
262 |
+
|
|
263 |
+#ifndef PARAMS
|
|
264 |
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
|
265 |
+# define PARAMS(Args) Args
|
|
266 |
+# else
|
|
267 |
+# define PARAMS(Args) ()
|
|
268 |
+# endif
|
|
269 |
+#endif
|
|
270 |
+
|
|
271 |
+#if HAVE_MKDTEMP
|
|
272 |
+
|
|
273 |
+/* Get mkdtemp() declaration. */
|
|
274 |
+#include <stdlib.h>
|
|
275 |
+
|
|
276 |
+#else
|
|
277 |
+
|
|
278 |
+/* Create a unique temporary directory from TEMPLATE.
|
|
279 |
+ The last six characters of TEMPLATE must be "XXXXXX";
|
|
280 |
+ they are replaced with a string that makes the directory name unique.
|
|
281 |
+ Returns TEMPLATE, or a null pointer if it cannot get a unique name.
|
|
282 |
+ The directory is created mode 700. */
|
|
283 |
+extern char * mkdtemp PARAMS ((char *template));
|
|
284 |
+
|
|
285 |
+#endif
|