874
|
1 |
diff -ru PolicyKit-0.7.orig/config.h.in PolicyKit-0.7/config.h.in
|
|
2 |
--- PolicyKit-0.7.orig/config.h.in Sat Dec 1 09:43:35 2007
|
|
3 |
+++ PolicyKit-0.7/config.h.in Fri Jan 25 14:44:43 2008
|
|
4 |
@@ -54,6 +54,9 @@
|
|
5 |
/* SELinux support */
|
|
6 |
#undef HAVE_SELINUX
|
|
7 |
|
|
8 |
+/* Is this a Solaris system? */
|
|
9 |
+#undef HAVE_SOLARIS
|
|
10 |
+
|
|
11 |
/* Define to 1 if you have the <stdint.h> header file. */
|
|
12 |
#undef HAVE_STDINT_H
|
|
13 |
|
|
14 |
diff -ru PolicyKit-0.7.orig/configure.in PolicyKit-0.7/configure.in
|
|
15 |
--- PolicyKit-0.7.orig/configure.in Mon Nov 26 04:43:40 2007
|
|
16 |
+++ PolicyKit-0.7/configure.in Fri Jan 25 14:43:04 2008
|
|
17 |
@@ -370,7 +370,7 @@
|
|
18 |
|
|
19 |
AC_SUBST(PAM_MODULE_DIR)
|
|
20 |
|
|
21 |
-AC_ARG_WITH(os-type, [ --with-os-type=<os> distribution or OS (redhat/suse/gentoo/pardus)])
|
|
22 |
+AC_ARG_WITH(os-type, [ --with-os-type=<os> distribution or OS (redhat/suse/gentoo/pardus/solaris)])
|
|
23 |
|
|
24 |
#### Check our operating system (distro-tweaks required)
|
|
25 |
if test "z$with_os_type" = "z"; then
|
|
26 |
@@ -395,6 +395,8 @@
|
|
27 |
with_os_type=gentoo
|
|
28 |
elif test x$operating_system = xpardus ; then
|
|
29 |
with_os_type=pardus
|
|
30 |
+ elif test x$operating_system = xsolaris ; then
|
|
31 |
+ with_os_type=solaris
|
|
32 |
else
|
|
33 |
with_os_type=unknown
|
|
34 |
fi
|
|
35 |
@@ -406,6 +408,7 @@
|
|
36 |
AM_CONDITIONAL(OS_TYPE_SUSE, test x$with_os_type = xsuse, [Running on SUSE OS'es])
|
|
37 |
AM_CONDITIONAL(OS_TYPE_GENTOO, test x$with_os_type = xgentoo, [Running on Gentoo OS'es])
|
|
38 |
AM_CONDITIONAL(OS_TYPE_PARDUS, test x$with_os_type = xpardus, [Running on Pardus OS'es])
|
|
39 |
+AM_CONDITIONAL(OS_TYPE_SALARIS, test x$with_os_type = xsolaris, [Running os Solaris OS'es])
|
|
40 |
|
|
41 |
AC_ARG_WITH(pam-include, [ --with-pam-include=<file> pam file to include])
|
|
42 |
|
|
43 |
@@ -420,7 +423,7 @@
|
|
44 |
PAM_FILE_INCLUDE_ACCOUNT=system-auth
|
|
45 |
PAM_FILE_INCLUDE_PASSWORD=system-auth
|
|
46 |
PAM_FILE_INCLUDE_SESSION=system-auth
|
|
47 |
-elif test x$with_os_type = xsuse ; then
|
|
48 |
+elif test x$with_os_type = xsuse -o x$with_os_type - xsolaris ; then
|
|
49 |
PAM_FILE_INCLUDE_AUTH=common-auth
|
|
50 |
PAM_FILE_INCLUDE_ACCOUNT=common-account
|
|
51 |
PAM_FILE_INCLUDE_PASSWORD=common-password
|
|
52 |
@@ -441,6 +444,17 @@
|
|
53 |
AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_PASSWORD, "$PAM_FILE_INCLUDE_PASSWORD", [pam file password])
|
|
54 |
AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_SESSION, "$PAM_FILE_INCLUDE_SESSION", [pam file session])
|
|
55 |
|
|
56 |
+dnl ---------------------------------------------------------------------------
|
|
57 |
+dnl - check OS
|
|
58 |
+dnl ---------------------------------------------------------------------------
|
|
59 |
+case "$host_os" in
|
|
60 |
+ *linux*)
|
|
61 |
+ ;;
|
|
62 |
+ *solaris*)
|
|
63 |
+ AC_DEFINE([HAVE_SOLARIS], 1, [Is this a Solaris system?])
|
|
64 |
+ ;;
|
|
65 |
+esac
|
|
66 |
+
|
|
67 |
# ********************
|
|
68 |
# Internationalisation
|
|
69 |
# ********************
|
|
70 |
diff -ru PolicyKit-0.7.orig/src/kit/kit-file.h PolicyKit-0.7/src/kit/kit-file.h
|
|
71 |
--- PolicyKit-0.7.orig/src/kit/kit-file.h Thu Nov 29 05:32:39 2007
|
|
72 |
+++ PolicyKit-0.7/src/kit/kit-file.h Fri Jan 25 15:15:28 2008
|
|
73 |
@@ -35,6 +35,9 @@
|
|
74 |
#define KIT_FILE_H
|
|
75 |
|
|
76 |
#include <kit/kit.h>
|
|
77 |
+#ifdef HAVE_SOLARIS
|
|
78 |
+#include <sys/types.h>
|
|
79 |
+#endif
|
|
80 |
|
|
81 |
KIT_BEGIN_DECLS
|
|
82 |
|
|
83 |
diff -ru PolicyKit-0.7.orig/src/kit/kit-spawn.c PolicyKit-0.7/src/kit/kit-spawn.c
|
|
84 |
--- PolicyKit-0.7.orig/src/kit/kit-spawn.c Thu Nov 29 05:32:22 2007
|
|
85 |
+++ PolicyKit-0.7/src/kit/kit-spawn.c Fri Jan 25 15:35:28 2008
|
|
86 |
@@ -156,9 +156,9 @@
|
|
87 |
* @flags: A combination of flags from #KitSpawnFlags
|
|
88 |
* @argv: #NULL terminated argument vector
|
|
89 |
* @envp: #NULL terminated environment or #NULL to inherit parents;
|
|
90 |
- * @stdin: String to write to stdin of child or #NULL
|
|
91 |
- * @stdout: Return location for stdout from child or #NULL. Free with kit_free().
|
|
92 |
- * @stderr: Return location for stderr from child or #NULL. Free with kit_free().
|
|
93 |
+ * @stdinp: String to write to stdin of child or #NULL
|
|
94 |
+ * @stdoutp: Return location for stdout from child or #NULL. Free with kit_free().
|
|
95 |
+ * @stderrp: Return location for stderr from child or #NULL. Free with kit_free().
|
|
96 |
* @out_exit_status: Return location for exit status
|
|
97 |
*
|
|
98 |
* Executes a child process and waits for the child process to exit
|
|
99 |
@@ -175,9 +175,9 @@
|
|
100 |
KitSpawnFlags flags,
|
|
101 |
char **argv,
|
|
102 |
char **envp,
|
|
103 |
- char *stdin,
|
|
104 |
- char **stdout,
|
|
105 |
- char **stderr,
|
|
106 |
+ char *stdinp,
|
|
107 |
+ char **stdoutp,
|
|
108 |
+ char **stderrp,
|
|
109 |
int *out_exit_status)
|
|
110 |
{
|
|
111 |
kit_bool_t ret;
|
|
112 |
@@ -191,28 +191,28 @@
|
|
113 |
|
|
114 |
kit_return_val_if_fail (argv != NULL, FALSE);
|
|
115 |
kit_return_val_if_fail (out_exit_status != NULL, FALSE);
|
|
116 |
- kit_return_val_if_fail (! ((flags & KIT_SPAWN_CHILD_INHERITS_STDIN) && stdin != NULL), FALSE);
|
|
117 |
- kit_return_val_if_fail (! ((flags & KIT_SPAWN_STDOUT_TO_DEV_NULL) && stdout != NULL), FALSE);
|
|
118 |
- kit_return_val_if_fail (! ((flags & KIT_SPAWN_STDERR_TO_DEV_NULL) && stderr != NULL), FALSE);
|
|
119 |
+ kit_return_val_if_fail (! ((flags & KIT_SPAWN_CHILD_INHERITS_STDIN) && stdinp != NULL), FALSE);
|
|
120 |
+ kit_return_val_if_fail (! ((flags & KIT_SPAWN_STDOUT_TO_DEV_NULL) && stdoutp != NULL), FALSE);
|
|
121 |
+ kit_return_val_if_fail (! ((flags & KIT_SPAWN_STDERR_TO_DEV_NULL) && stderrp != NULL), FALSE);
|
|
122 |
|
|
123 |
- if (stdout != NULL)
|
|
124 |
- *stdout = NULL;
|
|
125 |
- if (stderr != NULL)
|
|
126 |
- *stderr = NULL;
|
|
127 |
+ if (stdoutp != NULL)
|
|
128 |
+ *stdoutp = NULL;
|
|
129 |
+ if (stderrp != NULL)
|
|
130 |
+ *stderrp = NULL;
|
|
131 |
|
|
132 |
- if (stdin != NULL) {
|
|
133 |
+ if (stdinp != NULL) {
|
|
134 |
if (pipe (stdin_pipe) != 0) {
|
|
135 |
goto out;
|
|
136 |
}
|
|
137 |
}
|
|
138 |
|
|
139 |
- if (stdout != NULL) {
|
|
140 |
+ if (stdoutp != NULL) {
|
|
141 |
if (pipe (stdout_pipe) != 0) {
|
|
142 |
goto out;
|
|
143 |
}
|
|
144 |
}
|
|
145 |
|
|
146 |
- if (stderr != NULL) {
|
|
147 |
+ if (stderrp != NULL) {
|
|
148 |
if (pipe (stderr_pipe) != 0) {
|
|
149 |
goto out;
|
|
150 |
}
|
|
151 |
@@ -260,9 +260,9 @@
|
|
152 |
}
|
|
153 |
}
|
|
154 |
|
|
155 |
- /* set stdin, stdout and stderr */
|
|
156 |
+ /* set stdinp, stdoutp and stderrp */
|
|
157 |
|
|
158 |
- if (stdin != NULL) {
|
|
159 |
+ if (stdinp != NULL) {
|
|
160 |
if (_sane_dup2 (stdin_pipe[0], 0) < 0) {
|
|
161 |
exit (128 + errno);
|
|
162 |
}
|
|
163 |
@@ -272,7 +272,7 @@
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
- if (stdout != NULL) {
|
|
168 |
+ if (stdoutp != NULL) {
|
|
169 |
if (_sane_dup2 (stdout_pipe[1], 1) < 0) {
|
|
170 |
exit (128 + errno);
|
|
171 |
}
|
|
172 |
@@ -282,7 +282,7 @@
|
|
173 |
}
|
|
174 |
}
|
|
175 |
|
|
176 |
- if (stderr != NULL) {
|
|
177 |
+ if (stderrp != NULL) {
|
|
178 |
if (_sane_dup2 (stderr_pipe[1], 2) < 0) {
|
|
179 |
exit (128 + errno);
|
|
180 |
}
|
|
181 |
@@ -322,7 +322,7 @@
|
|
182 |
close (stderr_pipe[1]);
|
|
183 |
}
|
|
184 |
|
|
185 |
- wp = stdin;
|
|
186 |
+ wp = stdinp;
|
|
187 |
|
|
188 |
while (stdin_pipe[1] != -1 || stdout_pipe[0] != -1 || stderr_pipe[0] != -1) {
|
|
189 |
int ret;
|
|
190 |
@@ -375,7 +375,7 @@
|
|
191 |
}
|
|
192 |
|
|
193 |
if (stdout_pipe[0] != -1) {
|
|
194 |
- num_read = _read_from (stdout_pipe[0], stdout);
|
|
195 |
+ num_read = _read_from (stdout_pipe[0], stdoutp);
|
|
196 |
if (num_read == 0) {
|
|
197 |
close (stdout_pipe[0]);
|
|
198 |
stdout_pipe[0] = -1;
|
|
199 |
@@ -385,7 +385,7 @@
|
|
200 |
}
|
|
201 |
|
|
202 |
if (stderr_pipe[0] != -1) {
|
|
203 |
- num_read = _read_from (stderr_pipe[0], stderr);
|
|
204 |
+ num_read = _read_from (stderr_pipe[0], stderrp);
|
|
205 |
if (num_read == 0) {
|
|
206 |
close (stderr_pipe[0]);
|
|
207 |
stderr_pipe[0] = -1;
|
|
208 |
@@ -424,13 +424,13 @@
|
|
209 |
close (stderr_pipe[0]);
|
|
210 |
|
|
211 |
if (!ret) {
|
|
212 |
- if (stdout != NULL) {
|
|
213 |
- kit_free (*stdout);
|
|
214 |
- *stdout = NULL;
|
|
215 |
+ if (stdoutp != NULL) {
|
|
216 |
+ kit_free (*stdoutp);
|
|
217 |
+ *stdoutp = NULL;
|
|
218 |
}
|
|
219 |
- if (stderr != NULL) {
|
|
220 |
- kit_free (*stderr);
|
|
221 |
- *stderr = NULL;
|
|
222 |
+ if (stderrp != NULL) {
|
|
223 |
+ kit_free (*stderrp);
|
|
224 |
+ *stderrp = NULL;
|
|
225 |
}
|
|
226 |
}
|
|
227 |
|
|
228 |
@@ -483,8 +483,8 @@
|
|
229 |
"echo -n \"$value\"" "\n"
|
|
230 |
"exit 0" "\n";
|
|
231 |
char *argv[] = {"/tmp/kit-spawn-test", NULL};
|
|
232 |
- char *stdout;
|
|
233 |
- char *stderr;
|
|
234 |
+ char *stdoutp;
|
|
235 |
+ char *stderrp;
|
|
236 |
int exit_status;
|
|
237 |
struct stat statbuf;
|
|
238 |
|
|
239 |
@@ -495,14 +495,14 @@
|
|
240 |
argv,
|
|
241 |
NULL,
|
|
242 |
NULL,
|
|
243 |
- &stdout,
|
|
244 |
- &stderr,
|
|
245 |
+ &stdoutp,
|
|
246 |
+ &stderrp,
|
|
247 |
&exit_status)) {
|
|
248 |
kit_assert (WEXITSTATUS (exit_status) == 42);
|
|
249 |
- kit_assert (stdout != NULL && strcmp (stdout, "Hello World\n") == 0);
|
|
250 |
- kit_assert (stderr != NULL && strcmp (stderr, "Goodbye World\n") == 0);
|
|
251 |
- kit_free (stdout);
|
|
252 |
- kit_free (stderr);
|
|
253 |
+ kit_assert (stdoutp != NULL && strcmp (stdoutp, "Hello World\n") == 0);
|
|
254 |
+ kit_assert (stderrp != NULL && strcmp (stderrp, "Goodbye World\n") == 0);
|
|
255 |
+ kit_free (stdoutp);
|
|
256 |
+ kit_free (stderrp);
|
|
257 |
}
|
|
258 |
|
|
259 |
if (kit_spawn_sync ("/",
|
|
260 |
@@ -526,12 +526,12 @@
|
|
261 |
argv,
|
|
262 |
NULL,
|
|
263 |
NULL,
|
|
264 |
- &stdout,
|
|
265 |
- &stderr,
|
|
266 |
+ &stdoutp,
|
|
267 |
+ &stderrp,
|
|
268 |
&exit_status)) {
|
|
269 |
kit_assert (WEXITSTATUS (exit_status) == 43);
|
|
270 |
- kit_assert (stdout == NULL);
|
|
271 |
- kit_assert (stderr == NULL);
|
|
272 |
+ kit_assert (stdoutp == NULL);
|
|
273 |
+ kit_assert (stderrp == NULL);
|
|
274 |
}
|
|
275 |
|
|
276 |
kit_assert (unlink (path) == 0);
|
|
277 |
@@ -546,12 +546,12 @@
|
|
278 |
argv,
|
|
279 |
envp,
|
|
280 |
NULL,
|
|
281 |
- &stdout,
|
|
282 |
+ &stdoutp,
|
|
283 |
NULL,
|
|
284 |
&exit_status)) {
|
|
285 |
kit_assert (WEXITSTATUS (exit_status) == 0);
|
|
286 |
- kit_assert (stdout != NULL && strcmp (stdout, "some_value") == 0);
|
|
287 |
- kit_free (stdout);
|
|
288 |
+ kit_assert (stdoutp != NULL && strcmp (stdoutp, "some_value") == 0);
|
|
289 |
+ kit_free (stdoutp);
|
|
290 |
}
|
|
291 |
|
|
292 |
kit_assert (unlink (path) == 0);
|
|
293 |
@@ -606,12 +606,12 @@
|
|
294 |
argv,
|
|
295 |
NULL,
|
|
296 |
NULL,
|
|
297 |
- &stdout,
|
|
298 |
+ &stdoutp,
|
|
299 |
NULL,
|
|
300 |
&exit_status)) {
|
|
301 |
kit_assert (WEXITSTATUS (exit_status) == 0);
|
|
302 |
- kit_assert (stdout != NULL && strcmp (stdout, "/tmp\n") == 0);
|
|
303 |
- kit_free (stdout);
|
|
304 |
+ kit_assert (stdoutp != NULL && strcmp (stdoutp, "/tmp\n") == 0);
|
|
305 |
+ kit_free (stdoutp);
|
|
306 |
}
|
|
307 |
|
|
308 |
kit_assert (stat ("/usr", &statbuf) == 0 && S_ISDIR (statbuf.st_mode));
|
|
309 |
@@ -620,12 +620,12 @@
|
|
310 |
argv,
|
|
311 |
NULL,
|
|
312 |
NULL,
|
|
313 |
- &stdout,
|
|
314 |
+ &stdoutp,
|
|
315 |
NULL,
|
|
316 |
&exit_status)) {
|
|
317 |
kit_assert (WEXITSTATUS (exit_status) == 0);
|
|
318 |
- kit_assert (stdout != NULL && strcmp (stdout, "/usr\n") == 0);
|
|
319 |
- kit_free (stdout);
|
|
320 |
+ kit_assert (stdoutp != NULL && strcmp (stdoutp, "/usr\n") == 0);
|
|
321 |
+ kit_free (stdoutp);
|
|
322 |
}
|
|
323 |
|
|
324 |
kit_assert (unlink (path) == 0);
|
|
325 |
@@ -650,12 +650,12 @@
|
|
326 |
argv,
|
|
327 |
NULL,
|
|
328 |
"foobar0\nfoobar1",
|
|
329 |
- &stdout,
|
|
330 |
+ &stdoutp,
|
|
331 |
NULL,
|
|
332 |
&exit_status)) {
|
|
333 |
kit_assert (WEXITSTATUS (exit_status) == 0);
|
|
334 |
- kit_assert (stdout != NULL && strcmp (stdout, "foobar0 foobar1") == 0);
|
|
335 |
- kit_free (stdout);
|
|
336 |
+ kit_assert (stdoutp != NULL && strcmp (stdoutp, "foobar0 foobar1") == 0);
|
|
337 |
+ kit_free (stdoutp);
|
|
338 |
}
|
|
339 |
|
|
340 |
kit_assert (unlink (path) == 0);
|
|
341 |
diff -ru PolicyKit-0.7.orig/src/kit/kit-spawn.h PolicyKit-0.7/src/kit/kit-spawn.h
|
|
342 |
--- PolicyKit-0.7.orig/src/kit/kit-spawn.h Thu Nov 29 05:31:32 2007
|
|
343 |
+++ PolicyKit-0.7/src/kit/kit-spawn.h Fri Jan 25 15:00:55 2008
|
|
344 |
@@ -57,9 +57,9 @@
|
|
345 |
KitSpawnFlags flags,
|
|
346 |
char **argv,
|
|
347 |
char **envp,
|
|
348 |
- char *stdin,
|
|
349 |
- char **stdout,
|
|
350 |
- char **stderr,
|
|
351 |
+ char *stdinp,
|
|
352 |
+ char **stdoutp,
|
|
353 |
+ char **stderrp,
|
|
354 |
int *out_exit_status);
|
|
355 |
|
|
356 |
KIT_END_DECLS
|
|
357 |
diff -ru PolicyKit-0.7.orig/src/kit/kit-string.c PolicyKit-0.7/src/kit/kit-string.c
|
|
358 |
--- PolicyKit-0.7.orig/src/kit/kit-string.c Thu Dec 6 10:25:37 2007
|
|
359 |
+++ PolicyKit-0.7/src/kit/kit-string.c Fri Jan 25 16:18:03 2008
|
|
360 |
@@ -127,6 +127,26 @@
|
|
361 |
|
|
362 |
#endif /* KIT_BUILD_TESTS */
|
|
363 |
|
|
364 |
+#ifdef HAVE_SOLARIS
|
|
365 |
+int vasprintf(char **strp, const char *fmt, va_list ap)
|
|
366 |
+{
|
|
367 |
+ int size;
|
|
368 |
+ va_list ap2;
|
|
369 |
+ char s;
|
|
370 |
+
|
|
371 |
+ *strp = NULL;
|
|
372 |
+ va_copy(ap2, ap);
|
|
373 |
+ size = vsnprintf(&s, 1, fmt, ap2);
|
|
374 |
+ va_end(ap2);
|
|
375 |
+ *strp = malloc(size + 1);
|
|
376 |
+ if (!*strp)
|
|
377 |
+ return -1;
|
|
378 |
+ vsnprintf(*strp, size + 1, fmt, ap);
|
|
379 |
+
|
|
380 |
+ return size;
|
|
381 |
+}
|
|
382 |
+#endif
|
|
383 |
+
|
|
384 |
/**
|
|
385 |
* kit_strdup_printf:
|
|
386 |
* @format: sprintf(3) format string
|
|
387 |
diff -ru PolicyKit-0.7.orig/src/kit/kit-test.c PolicyKit-0.7/src/kit/kit-test.c
|
|
388 |
--- PolicyKit-0.7.orig/src/kit/kit-test.c Thu Nov 29 05:32:34 2007
|
|
389 |
+++ PolicyKit-0.7.good/src/kit/kit-test.c Fri Jan 25 18:30:16 2008
|
|
390 |
@@ -27,8 +27,15 @@
|
|
391 |
*
|
|
392 |
**************************************************************************/
|
|
393 |
|
|
394 |
+#ifdef HAVE_CONFIG_H
|
|
395 |
+# include <config.h>
|
|
396 |
+#endif
|
|
397 |
+
|
|
398 |
#include <stdio.h>
|
|
399 |
#include <stdlib.h>
|
|
400 |
+#ifdef HAVE_SOLARIS
|
|
401 |
+#include <sys/types.h>
|
|
402 |
+#endif
|
|
403 |
#include <kit/kit-test.h>
|
|
404 |
#include <kit/kit-memory.h>
|
|
405 |
|
|
406 |
|
|
407 |
diff -ru PolicyKit-0.7.orig/src/kit/kit.h PolicyKit-0.7/src/kit/kit.h
|
|
408 |
--- PolicyKit-0.7.orig/src/kit/kit.h Thu Nov 29 12:59:43 2007
|
|
409 |
+++ PolicyKit-0.7/src/kit/kit.h Fri Jan 25 15:17:53 2008
|
|
410 |
@@ -72,6 +72,9 @@
|
|
411 |
|
|
412 |
void kit_print_backtrace (void);
|
|
413 |
|
|
414 |
+#ifdef HAVE_SOLARIS
|
|
415 |
+#define __PRETTY_FUNCTION__ __func__
|
|
416 |
+#endif
|
|
417 |
/**
|
|
418 |
* kit_assert:
|
|
419 |
* @expr: expression
|
|
420 |
@@ -136,6 +139,9 @@
|
|
421 |
|
|
422 |
#define _KIT_INSIDE_KIT_H 1
|
|
423 |
|
|
424 |
+#ifdef HAVE_SOLARIS
|
|
425 |
+#include <sys/types.h>
|
|
426 |
+#endif
|
|
427 |
#include <kit/kit-memory.h>
|
|
428 |
#include <kit/kit-string.h>
|
|
429 |
#include <kit/kit-list.h>
|
|
430 |
diff -ru PolicyKit-0.7.orig/src/polkit/polkit-config.c PolicyKit-0.7/src/polkit/polkit-config.c
|
|
431 |
--- PolicyKit-0.7.orig/src/polkit/polkit-config.c Thu Nov 29 11:21:19 2007
|
|
432 |
+++ PolicyKit-0.7/src/polkit/polkit-config.c Fri Jan 25 15:53:24 2008
|
|
433 |
@@ -39,7 +39,12 @@
|
|
434 |
#include <grp.h>
|
|
435 |
#include <unistd.h>
|
|
436 |
#include <errno.h>
|
|
437 |
+#ifdef HAVE_SOLARIS
|
|
438 |
+#include <port.h>
|
|
439 |
+#include <sys/stat.h>
|
|
440 |
+#else
|
|
441 |
#include <sys/inotify.h>
|
|
442 |
+#endif
|
|
443 |
#include <regex.h>
|
|
444 |
#include <syslog.h>
|
|
445 |
#include <regex.h>
|
|
446 |
diff -ru PolicyKit-0.7.orig/src/polkit/polkit-context.c PolicyKit-0.7/src/polkit/polkit-context.c
|
|
447 |
--- PolicyKit-0.7.orig/src/polkit/polkit-context.c Wed Dec 5 09:22:41 2007
|
|
448 |
+++ PolicyKit-0.7/src/polkit/polkit-context.c Fri Jan 25 15:48:51 2008
|
|
449 |
@@ -39,7 +39,12 @@
|
|
450 |
#include <grp.h>
|
|
451 |
#include <unistd.h>
|
|
452 |
#include <errno.h>
|
|
453 |
+#ifdef HAVE_SOLARIS
|
|
454 |
+#include <port.h>
|
|
455 |
+#include <sys/stat.h>
|
|
456 |
+#else
|
|
457 |
#include <sys/inotify.h>
|
|
458 |
+#endif
|
|
459 |
#include <syslog.h>
|
|
460 |
|
|
461 |
#include "polkit-config.h"
|
|
462 |
@@ -153,7 +158,60 @@
|
|
463 |
|
|
464 |
/* NOTE: we don't load the configuration file until it's needed */
|
|
465 |
|
|
466 |
+#ifdef HAVE_SOLARIS
|
|
467 |
if (pk_context->io_add_watch_func != NULL) {
|
|
468 |
+ pk_context->inotify_fd = port_create ();
|
|
469 |
+ if (pk_context->inotify_fd < 0) {
|
|
470 |
+ _pk_debug ("failed to port_create: %s", strerror (errno));
|
|
471 |
+ /* TODO: set error */
|
|
472 |
+ goto error;
|
|
473 |
+ }
|
|
474 |
+
|
|
475 |
+ /* Watch the /etc/PolicyKit/PolicyKit.conf file */
|
|
476 |
+ pk_context->inotify_config_wd = port_add_watch (pk_context->inotify_fd,
|
|
477 |
+ PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf",
|
|
478 |
+ FILE_MODIFIED | FILE_ATTRIB);
|
|
479 |
+ if (pk_context->inotify_config_wd < 0) {
|
|
480 |
+ _pk_debug ("failed to add watch on file '" PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf': %s",
|
|
481 |
+ strerror (errno));
|
|
482 |
+ /* TODO: set error */
|
|
483 |
+ goto error;
|
|
484 |
+ }
|
|
485 |
+
|
|
486 |
+ /* Watch the /usr/share/PolicyKit/policy directory */
|
|
487 |
+ pk_context->inotify_policy_wd = port_add_watch (pk_context->inotify_fd,
|
|
488 |
+ PACKAGE_DATA_DIR "/PolicyKit/policy",
|
|
489 |
+ FILE_MODIFIED | FILE_ATTRIB);
|
|
490 |
+ if (pk_context->inotify_policy_wd < 0) {
|
|
491 |
+ _pk_debug ("failed to add watch on directory '" PACKAGE_DATA_DIR "/PolicyKit/policy': %s",
|
|
492 |
+ strerror (errno));
|
|
493 |
+ /* TODO: set error */
|
|
494 |
+ goto error;
|
|
495 |
+ }
|
|
496 |
+
|
|
497 |
+#ifdef POLKIT_AUTHDB_DEFAULT
|
|
498 |
+ /* Watch the /var/lib/misc/PolicyKit.reload file */
|
|
499 |
+ pk_context->inotify_grant_perm_wd = port_add_watch (pk_context->inotify_fd,
|
|
500 |
+ PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload",
|
|
501 |
+ FILE_MODIFIED | FILE_ATTRIB);
|
|
502 |
+ if (pk_context->inotify_grant_perm_wd < 0) {
|
|
503 |
+ _pk_debug ("failed to add watch on file '" PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload': %s",
|
|
504 |
+ strerror (errno));
|
|
505 |
+ /* TODO: set error */
|
|
506 |
+ goto error;
|
|
507 |
+ }
|
|
508 |
+#endif
|
|
509 |
+
|
|
510 |
+ pk_context->inotify_fd_watch_id = pk_context->io_add_watch_func (pk_context, pk_context->inotify_fd);
|
|
511 |
+ if (pk_context->inotify_fd_watch_id == 0) {
|
|
512 |
+ _pk_debug ("failed to add io watch");
|
|
513 |
+ /* TODO: set error */
|
|
514 |
+ goto error;
|
|
515 |
+ }
|
|
516 |
+ }
|
|
517 |
+
|
|
518 |
+#else
|
|
519 |
+ if (pk_context->io_add_watch_func != NULL) {
|
|
520 |
pk_context->inotify_fd = inotify_init ();
|
|
521 |
if (pk_context->inotify_fd < 0) {
|
|
522 |
_pk_debug ("failed to initialize inotify: %s", strerror (errno));
|
|
523 |
@@ -203,6 +261,7 @@
|
|
524 |
goto error;
|
|
525 |
}
|
|
526 |
}
|
|
527 |
+#endif
|
|
528 |
|
|
529 |
return TRUE;
|
|
530 |
error:
|
|
531 |
@@ -209,7 +268,72 @@
|
|
532 |
return FALSE;
|
|
533 |
}
|
|
534 |
|
|
535 |
+#ifdef HAVE_SOLARIS
|
|
536 |
+
|
|
537 |
+struct fileportinfo {
|
|
538 |
+ struct file_obj fobj;
|
|
539 |
+ int events;
|
|
540 |
+ int port;
|
|
541 |
+};
|
|
542 |
+
|
|
543 |
/**
|
|
544 |
+ * port_add_watch:
|
|
545 |
+ * @port: the port object
|
|
546 |
+ * @name: filename which will be added to the port
|
|
547 |
+ * @events: the event which will be watched for
|
|
548 |
+ *
|
|
549 |
+ * add file watch .
|
|
550 |
+ *
|
|
551 |
+ * Returns: the object
|
|
552 |
+ **/
|
|
553 |
+int
|
|
554 |
+port_add_watch (int port, const char *name, uint32_t events)
|
|
555 |
+{
|
|
556 |
+ struct fileportinfo *fpi;
|
|
557 |
+
|
|
558 |
+ if ( (fpi = kit_malloc (sizeof(struct fileportinfo)) ) == NULL ) {
|
|
559 |
+ _pk_debug ("Faile to kit_malloc!");
|
|
560 |
+ /* TODO: set error */
|
|
561 |
+ return -1;
|
|
562 |
+ }
|
|
563 |
+
|
|
564 |
+ fpi->fobj.fo_name = strdup (name);
|
|
565 |
+ fpi->events = events;
|
|
566 |
+ fpi->port = port;
|
|
567 |
+
|
|
568 |
+ if ( file_associate (fpi, events) < 0 ) {
|
|
569 |
+ _pk_debug ("Failed to associate with file %s: %s", fpi->fobj.fo_name, strerror (errno));
|
|
570 |
+ /* TODO: set error */
|
|
571 |
+ return -1;
|
|
572 |
+ }
|
|
573 |
+ return 0;
|
|
574 |
+}
|
|
575 |
+
|
|
576 |
+int
|
|
577 |
+file_associate (struct fileportinfo *fpinfo, int events)
|
|
578 |
+{
|
|
579 |
+ struct stat sb;
|
|
580 |
+
|
|
581 |
+ if ( stat (fpinfo->fobj.fo_name, &sb) == -1) {
|
|
582 |
+ _pk_debug ("Failed to stat file %s: %s", fpinfo->fobj.fo_name, strerror (errno));
|
|
583 |
+ /* TODO: set error */
|
|
584 |
+ return -1;
|
|
585 |
+ }
|
|
586 |
+
|
|
587 |
+ fpinfo->fobj.fo_atime = sb.st_atim;
|
|
588 |
+ fpinfo->fobj.fo_mtime = sb.st_mtim;
|
|
589 |
+ fpinfo->fobj.fo_ctime = sb.st_ctim;
|
|
590 |
+
|
|
591 |
+ if ( port_associate (fpinfo->port, PORT_SOURCE_FILE, (uintptr_t)&(fpinfo->fobj), events, (void *)fpinfo ) == -1) {
|
|
592 |
+ _pk_debug ("Failed to register file %s: %s", fpinfo->fobj.fo_name, strerror (errno));
|
|
593 |
+ /* TODO: set error */
|
|
594 |
+ return -1;
|
|
595 |
+ }
|
|
596 |
+ return 0;
|
|
597 |
+}
|
|
598 |
+#endif
|
|
599 |
+
|
|
600 |
+/**
|
|
601 |
* polkit_context_ref:
|
|
602 |
* @pk_context: the context object
|
|
603 |
*
|
|
604 |
@@ -296,7 +420,32 @@
|
|
605 |
|
|
606 |
config_changed = FALSE;
|
|
607 |
|
|
608 |
+#ifdef HAVE_SOLARIS
|
|
609 |
if (fd == pk_context->inotify_fd) {
|
|
610 |
+ port_event_t pe;
|
|
611 |
+ struct file_obj *fobjp;
|
|
612 |
+ struct fileportinfo *fpip;
|
|
613 |
+
|
|
614 |
+ while ( !port_get (fd, &pe, NULL) ) {
|
|
615 |
+ switch (pe.portev_source) {
|
|
616 |
+ case PORT_SOURCE_FILE:
|
|
617 |
+ fpip = (struct fileportinfo *)pe.portev_object;
|
|
618 |
+ fobjp = &fpip->fobj;
|
|
619 |
+ _pk_debug ("filename = %s, events = %d", fobjp->fo_name, pe.portev_events);
|
|
620 |
+ config_changed = TRUE;
|
|
621 |
+ _pk_debug ("Config changed");
|
|
622 |
+ file_associate ((struct fileportinfo *)pe.portev_object, pe.portev_events);
|
|
623 |
+ break;
|
|
624 |
+ default:
|
|
625 |
+ _pk_debug ("Event from unexpected source");
|
|
626 |
+ }
|
|
627 |
+ if ( config_changed )
|
|
628 |
+ break;
|
|
629 |
+ }
|
|
630 |
+ }
|
|
631 |
+
|
|
632 |
+#else
|
|
633 |
+ if (fd == pk_context->inotify_fd) {
|
|
634 |
/* size of the event structure, not counting name */
|
|
635 |
#define EVENT_SIZE (sizeof (struct inotify_event))
|
|
636 |
/* reasonable guess as to size of 1024 events */
|
|
637 |
@@ -327,6 +476,7 @@
|
|
638 |
i += EVENT_SIZE + event->len;
|
|
639 |
}
|
|
640 |
}
|
|
641 |
+#endif
|
|
642 |
|
|
643 |
if (config_changed) {
|
|
644 |
polkit_context_force_reload (pk_context);
|
|
645 |
diff -ru PolicyKit-0.7.orig/src/polkit/polkit-policy-cache.c PolicyKit-0.7/src/polkit/polkit-policy-cache.c
|
|
646 |
--- PolicyKit-0.7.orig/src/polkit/polkit-policy-cache.c Thu Nov 29 14:14:09 2007
|
|
647 |
+++ PolicyKit-0.7/src/polkit/polkit-policy-cache.c Fri Jan 25 15:50:48 2008
|
|
648 |
@@ -127,8 +127,10 @@
|
|
649 |
char *filename;
|
|
650 |
static const char suffix[] = ".policy";
|
|
651 |
|
|
652 |
+#ifndef HAVE_SOLARIS
|
|
653 |
if (d->d_type != DT_REG)
|
|
654 |
continue;
|
|
655 |
+#endif
|
|
656 |
|
|
657 |
filename = d->d_name;
|
|
658 |
name_len = strlen (filename);
|
|
659 |
diff -ru PolicyKit-0.7.orig/src/polkit/polkit-policy-file.c PolicyKit-0.7/src/polkit/polkit-policy-file.c
|
|
660 |
--- PolicyKit-0.7.orig/src/polkit/polkit-policy-file.c Thu Nov 29 11:30:38 2007
|
|
661 |
+++ PolicyKit-0.7/src/polkit/polkit-policy-file.c Fri Jan 25 16:21:09 2008
|
|
662 |
@@ -804,7 +804,27 @@
|
|
663 |
|
|
664 |
return FALSE;
|
|
665 |
}
|
|
666 |
+#ifdef HAVE_SOLARIS
|
|
667 |
+char *strndup ( const char *s, size_t n)
|
|
668 |
+{
|
|
669 |
+ size_t nAvail;
|
|
670 |
+ char *p;
|
|
671 |
|
|
672 |
+ if ( !s )
|
|
673 |
+ return 0;
|
|
674 |
+
|
|
675 |
+ if ( strlen(s) > n )
|
|
676 |
+ nAvail = n + 1;
|
|
677 |
+ else
|
|
678 |
+ nAvail = strlen(s) + 1;
|
|
679 |
+ p = malloc ( nAvail );
|
|
680 |
+ memcpy ( p, s, nAvail );
|
|
681 |
+ p[nAvail - 1] = '\0';
|
|
682 |
+
|
|
683 |
+ return p;
|
|
684 |
+}
|
|
685 |
+#endif
|
|
686 |
+
|
|
687 |
#ifdef POLKIT_BUILD_TESTS
|
|
688 |
|
|
689 |
/* this checks that the policy descriptions read from test-valid-3-lang.policy are correct */
|
|
690 |
diff -ru PolicyKit-0.7.orig/src/polkit/polkit-sysdeps.c PolicyKit-0.7/src/polkit/polkit-sysdeps.c
|
|
691 |
--- PolicyKit-0.7.orig/src/polkit/polkit-sysdeps.c Thu Nov 29 05:26:14 2007
|
|
692 |
+++ PolicyKit-0.7/src/polkit/polkit-sysdeps.c Fri Jan 25 15:43:42 2008
|
|
693 |
@@ -39,7 +39,20 @@
|
|
694 |
#include <grp.h>
|
|
695 |
#include <unistd.h>
|
|
696 |
#include <errno.h>
|
|
697 |
+
|
|
698 |
+#ifdef HAVE_SOLARIS
|
|
699 |
+#include <fcntl.h>
|
|
700 |
+#include <sys/time.h>
|
|
701 |
+#if _FILE_OFFSET_BITS==64
|
|
702 |
+#undef _FILE_OFFSET_BITS
|
|
703 |
+#include <procfs.h>
|
|
704 |
+#define _FILE_OFFSET_BITS 64
|
|
705 |
+#else
|
|
706 |
+#include <procfs.h>
|
|
707 |
+#endif
|
|
708 |
+#else
|
|
709 |
#include <sys/inotify.h>
|
|
710 |
+#endif
|
|
711 |
#include <syslog.h>
|
|
712 |
|
|
713 |
#include "polkit-sysdeps.h"
|
|
714 |
@@ -74,14 +87,24 @@
|
|
715 |
char *contents;
|
|
716 |
size_t length;
|
|
717 |
polkit_uint64_t start_time;
|
|
718 |
+#ifdef HAVE_SOLARIS
|
|
719 |
+ struct psinfo info;
|
|
720 |
+#else
|
|
721 |
char **tokens;
|
|
722 |
size_t num_tokens;
|
|
723 |
char *p;
|
|
724 |
char *endp;
|
|
725 |
+#endif
|
|
726 |
|
|
727 |
start_time = 0;
|
|
728 |
contents = NULL;
|
|
729 |
|
|
730 |
+#ifdef HAVE_SOLARIS
|
|
731 |
+ if (polkit_sysdeps_pid_psinfo ( pid, &info)) {
|
|
732 |
+ goto out;
|
|
733 |
+ }
|
|
734 |
+ start_time = (unsigned long long) (info.pr_start.tv_sec);
|
|
735 |
+#else
|
|
736 |
filename = kit_strdup_printf ("/proc/%d/stat", pid);
|
|
737 |
if (filename == NULL) {
|
|
738 |
errno = ENOMEM;
|
|
739 |
@@ -118,10 +141,13 @@
|
|
740 |
}
|
|
741 |
|
|
742 |
kit_strfreev (tokens);
|
|
743 |
+#endif
|
|
744 |
|
|
745 |
out:
|
|
746 |
+#ifndef HAVE_SOLARIS
|
|
747 |
kit_free (filename);
|
|
748 |
kit_free (contents);
|
|
749 |
+#endif
|
|
750 |
return start_time;
|
|
751 |
}
|
|
752 |
|
|
753 |
@@ -153,6 +179,15 @@
|
|
754 |
|
|
755 |
ret = 0;
|
|
756 |
|
|
757 |
+#ifdef HAVE_SOLARIS
|
|
758 |
+ struct psinfo info;
|
|
759 |
+
|
|
760 |
+ if (polkit_sysdeps_pid_psinfo (pid, &info)) {
|
|
761 |
+ goto out;
|
|
762 |
+ }
|
|
763 |
+ ret = strlen (info.pr_psargs);
|
|
764 |
+ strncpy (out_buf, info.pr_psargs, ret);
|
|
765 |
+#else
|
|
766 |
snprintf (proc_name, sizeof (proc_name), "/proc/%d/exe", pid);
|
|
767 |
ret = readlink (proc_name, out_buf, buf_size - 1);
|
|
768 |
if (ret == -1) {
|
|
769 |
@@ -159,6 +194,7 @@
|
|
770 |
strncpy (out_buf, "(unknown)", buf_size);
|
|
771 |
goto out;
|
|
772 |
}
|
|
773 |
+#endif
|
|
774 |
kit_assert (ret >= 0 && ret < (int) buf_size - 1);
|
|
775 |
out_buf[ret] = '\0';
|
|
776 |
|
|
777 |
@@ -166,6 +202,26 @@
|
|
778 |
return ret;
|
|
779 |
}
|
|
780 |
|
|
781 |
+#ifdef HAVE_SOLARIS
|
|
782 |
+int
|
|
783 |
+polkit_sysdeps_pid_psinfo (pid_t pid, struct psinfo *ps)
|
|
784 |
+{
|
|
785 |
+ char pname[32];
|
|
786 |
+ int procfd;
|
|
787 |
+
|
|
788 |
+ (void) snprintf(pname, sizeof(pname), "/proc/%d/psinfo", pid);
|
|
789 |
+ if ((procfd = open(pname, O_RDONLY)) == -1) {
|
|
790 |
+ return -1;
|
|
791 |
+ }
|
|
792 |
+ if (read(procfd, ps, sizeof(struct psinfo)) < 0) {
|
|
793 |
+ (void) close(procfd);
|
|
794 |
+ return -1;
|
|
795 |
+ }
|
|
796 |
+ (void) close(procfd);
|
|
797 |
+ return 0;
|
|
798 |
+}
|
|
799 |
+#endif
|
|
800 |
+
|
|
801 |
#ifdef POLKIT_BUILD_TESTS
|
|
802 |
|
|
803 |
static polkit_bool_t
|
|
804 |
diff -ru PolicyKit-0.7.orig/src/polkit-dbus/polkit-read-auth-helper.c PolicyKit-0.7/src/polkit-dbus/polkit-read-auth-helper.c
|
|
805 |
--- PolicyKit-0.7.orig/src/polkit-dbus/polkit-read-auth-helper.c Thu Nov 29 12:33:10 2007
|
|
806 |
+++ PolicyKit-0.7/src/polkit-dbus/polkit-read-auth-helper.c Fri Jan 25 16:31:42 2008
|
|
807 |
@@ -49,6 +49,10 @@
|
|
808 |
#include <utime.h>
|
|
809 |
#include <fcntl.h>
|
|
810 |
#include <dirent.h>
|
|
811 |
+#ifdef HAVE_SOLARIS
|
|
812 |
+#include <limits.h>
|
|
813 |
+#define LOG_AUTHPRIV (10<<3)
|
|
814 |
+#endif
|
|
815 |
|
|
816 |
#include <polkit-dbus/polkit-dbus.h>
|
|
817 |
#include <polkit/polkit-private.h>
|
|
818 |
@@ -183,8 +187,10 @@
|
|
819 |
static const char suffix[] = ".auths";
|
|
820 |
struct passwd *pw;
|
|
821 |
|
|
822 |
+#ifndef HAVE_SOLARIS
|
|
823 |
if (d->d_type != DT_REG)
|
|
824 |
continue;
|
|
825 |
+#endif
|
|
826 |
|
|
827 |
if (d->d_name == NULL)
|
|
828 |
continue;
|
|
829 |
@@ -282,8 +288,15 @@
|
|
830 |
|
|
831 |
#ifndef POLKIT_BUILD_TESTS
|
|
832 |
/* clear the entire environment to avoid attacks using with libraries honoring environment variables */
|
|
833 |
+#ifdef HAVE_SOLARIS
|
|
834 |
+ extern char **environ;
|
|
835 |
+
|
|
836 |
+ if (environ != NULL)
|
|
837 |
+ environ[0] = NULL;
|
|
838 |
+#else
|
|
839 |
if (clearenv () != 0)
|
|
840 |
goto out;
|
|
841 |
+#endif
|
|
842 |
/* set a minimal environment */
|
|
843 |
setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
|
|
844 |
#endif
|
|
845 |
diff -ru PolicyKit-0.7.orig/src/polkit-dbus/polkit-set-default-helper.c PolicyKit-0.7/src/polkit-dbus/polkit-set-default-helper.c
|
|
846 |
--- PolicyKit-0.7.orig/src/polkit-dbus/polkit-set-default-helper.c Thu Nov 29 05:30:30 2007
|
|
847 |
+++ PolicyKit-0.7/src/polkit-dbus/polkit-set-default-helper.c Fri Jan 25 16:34:17 2008
|
|
848 |
@@ -55,6 +55,10 @@
|
|
849 |
#include <polkit/polkit-private.h>
|
|
850 |
#include <polkit-dbus/polkit-dbus.h>
|
|
851 |
|
|
852 |
+#ifdef HAVE_SOLARIS
|
|
853 |
+#define LOG_AUTHPRIV (10<<3)
|
|
854 |
+#endif
|
|
855 |
+
|
|
856 |
static polkit_bool_t
|
|
857 |
set_default (const char *action_id, const char *any, const char *inactive, const char *active)
|
|
858 |
{
|
|
859 |
@@ -127,8 +131,15 @@
|
|
860 |
|
|
861 |
ret = 1;
|
|
862 |
/* clear the entire environment to avoid attacks using with libraries honoring environment variables */
|
|
863 |
+#ifdef HAVE_SOLARIS
|
|
864 |
+ extern char **environ;
|
|
865 |
+
|
|
866 |
+ if (environ != NULL)
|
|
867 |
+ environ[0] = NULL;
|
|
868 |
+#else
|
|
869 |
if (clearenv () != 0)
|
|
870 |
goto out;
|
|
871 |
+#endif
|
|
872 |
/* set a minimal environment */
|
|
873 |
setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
|
|
874 |
|
|
875 |
diff -ru PolicyKit-0.7.orig/src/polkit-grant/polkit-explicit-grant-helper.c PolicyKit-0.7/src/polkit-grant/polkit-explicit-grant-helper.c
|
|
876 |
--- PolicyKit-0.7.orig/src/polkit-grant/polkit-explicit-grant-helper.c Thu Dec 6 09:34:02 2007
|
|
877 |
+++ PolicyKit-0.7/src/polkit-grant/polkit-explicit-grant-helper.c Fri Jan 25 17:12:10 2008
|
|
878 |
@@ -53,6 +53,10 @@
|
|
879 |
#include <polkit-dbus/polkit-dbus.h>
|
|
880 |
#include <polkit/polkit-private.h>
|
|
881 |
|
|
882 |
+#ifdef HAVE_SOLARIS
|
|
883 |
+#define LOG_AUTHPRIV (10<<3)
|
|
884 |
+#endif
|
|
885 |
+
|
|
886 |
int
|
|
887 |
main (int argc, char *argv[])
|
|
888 |
{
|
|
889 |
@@ -67,8 +71,15 @@
|
|
890 |
ret = 1;
|
|
891 |
|
|
892 |
/* clear the entire environment to avoid attacks using with libraries honoring environment variables */
|
|
893 |
+#ifdef HAVE_SOLARIS
|
|
894 |
+ extern char **environ;
|
|
895 |
+
|
|
896 |
+ if (environ != NULL)
|
|
897 |
+ environ[0] = NULL;
|
|
898 |
+#else
|
|
899 |
if (clearenv () != 0)
|
|
900 |
goto out;
|
|
901 |
+#endif
|
|
902 |
/* set a minimal environment */
|
|
903 |
setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
|
|
904 |
|
|
905 |
diff -ru PolicyKit-0.7.orig/src/polkit-grant/polkit-grant-helper-pam.c PolicyKit-0.7/src/polkit-grant/polkit-grant-helper-pam.c
|
|
906 |
--- PolicyKit-0.7.orig/src/polkit-grant/polkit-grant-helper-pam.c Thu Nov 29 05:28:31 2007
|
|
907 |
+++ PolicyKit-0.7/src/polkit-grant/polkit-grant-helper-pam.c Fri Jan 25 17:10:54 2008
|
|
908 |
@@ -28,6 +28,9 @@
|
|
909 |
**************************************************************************/
|
|
910 |
|
|
911 |
/* TODO: FIXME: XXX: this code needs security review before it can be released! */
|
|
912 |
+#ifdef HAVE_CONFIG_H
|
|
913 |
+# include <config.h>
|
|
914 |
+#endif
|
|
915 |
|
|
916 |
#include <stdio.h>
|
|
917 |
#include <stdlib.h>
|
|
918 |
@@ -38,6 +41,10 @@
|
|
919 |
#include <syslog.h>
|
|
920 |
#include <security/pam_appl.h>
|
|
921 |
|
|
922 |
+#ifdef HAVE_SOLARIS
|
|
923 |
+#define LOG_AUTHPRIV (10<<3)
|
|
924 |
+#endif
|
|
925 |
+
|
|
926 |
/* Development aid: define PGH_DEBUG to get debugging output. Do _NOT_
|
|
927 |
* enable this in production builds; it may leak passwords and other
|
|
928 |
* sensitive information.
|
|
929 |
@@ -60,8 +67,15 @@
|
|
930 |
pam_h = NULL;
|
|
931 |
|
|
932 |
/* clear the entire environment to avoid attacks using with libraries honoring environment variables */
|
|
933 |
+#ifdef HAVE_SOLARIS
|
|
934 |
+ extern char **environ;
|
|
935 |
+
|
|
936 |
+ if (environ != NULL)
|
|
937 |
+ environ[0] = NULL;
|
|
938 |
+#else
|
|
939 |
if (clearenv () != 0)
|
|
940 |
goto error;
|
|
941 |
+#endif
|
|
942 |
/* set a minimal environment */
|
|
943 |
setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
|
|
944 |
|
|
945 |
diff -ru PolicyKit-0.7.orig/src/polkit-grant/polkit-grant-helper.c PolicyKit-0.7/src/polkit-grant/polkit-grant-helper.c
|
|
946 |
--- PolicyKit-0.7.orig/src/polkit-grant/polkit-grant-helper.c Thu Dec 6 10:48:36 2007
|
|
947 |
+++ PolicyKit-0.7/src/polkit-grant/polkit-grant-helper.c Fri Jan 25 16:35:50 2008
|
|
948 |
@@ -52,6 +52,10 @@
|
|
949 |
#include <polkit-dbus/polkit-dbus.h>
|
|
950 |
// #include <polkit/polkit-grant-database.h>
|
|
951 |
|
|
952 |
+#ifdef HAVE_SOLARIS
|
|
953 |
+#define LOG_AUTHPRIV (10<<3)
|
|
954 |
+#endif
|
|
955 |
+
|
|
956 |
/* Development aid: define PGH_DEBUG to get debugging output. Do _NOT_
|
|
957 |
* enable this in production builds; it may leak passwords and other
|
|
958 |
* sensitive information.
|
|
959 |
@@ -546,8 +550,15 @@
|
|
960 |
ret = 3;
|
|
961 |
|
|
962 |
/* clear the entire environment to avoid attacks using with libraries honoring environment variables */
|
|
963 |
+#ifdef HAVE_SOLARIS
|
|
964 |
+ extern char **environ;
|
|
965 |
+
|
|
966 |
+ if (environ != NULL)
|
|
967 |
+ environ[0] = NULL;
|
|
968 |
+#else
|
|
969 |
if (clearenv () != 0)
|
|
970 |
goto out;
|
|
971 |
+#endif
|
|
972 |
/* set a minimal environment */
|
|
973 |
setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
|
|
974 |
|
|
975 |
diff -ru PolicyKit-0.7.orig/src/polkit-grant/polkit-grant.c PolicyKit-0.7/src/polkit-grant/polkit-grant.c
|
|
976 |
--- PolicyKit-0.7.orig/src/polkit-grant/polkit-grant.c Thu Nov 29 05:29:25 2007
|
|
977 |
+++ PolicyKit-0.7/src/polkit-grant/polkit-grant.c Fri Jan 25 16:40:18 2008
|
|
978 |
@@ -35,6 +35,7 @@
|
|
979 |
#include <stdio.h>
|
|
980 |
#include <stdlib.h>
|
|
981 |
#include <string.h>
|
|
982 |
+#include <errno.h>
|
|
983 |
#include <sys/types.h>
|
|
984 |
#include <unistd.h>
|
|
985 |
#include <sys/wait.h>
|
|
986 |
@@ -542,6 +543,49 @@
|
|
987 |
return FALSE;
|
|
988 |
}
|
|
989 |
|
|
990 |
+#ifdef HAVE_SOLARIS
|
|
991 |
+#define BUFFER_LEN 256
|
|
992 |
+
|
|
993 |
+ssize_t getline (char **lineptr, size_t *n, FILE *f)
|
|
994 |
+{
|
|
995 |
+ char ch;
|
|
996 |
+ size_t m = 0;
|
|
997 |
+ ssize_t buf_len = 0;
|
|
998 |
+ char * buf = NULL;
|
|
999 |
+ char * p = NULL;
|
|
1000 |
+
|
|
1001 |
+
|
|
1002 |
+ while ( (ch = getc(f)) !=EOF )
|
|
1003 |
+ {
|
|
1004 |
+ if (errno != 0)
|
|
1005 |
+ return -1;
|
|
1006 |
+ if ( m++ >= buf_len )
|
|
1007 |
+ {
|
|
1008 |
+ buf_len += BUFFER_LEN;
|
|
1009 |
+ buf = (char *) realloc(buf, buf_len + 1);
|
|
1010 |
+ if ( buf == NULL )
|
|
1011 |
+ {
|
|
1012 |
+ return -1;
|
|
1013 |
+ }
|
|
1014 |
+ p = buf + buf_len - BUFFER_LEN;
|
|
1015 |
+ }
|
|
1016 |
+ if ( ch == '\n' )
|
|
1017 |
+ break;
|
|
1018 |
+ *p = ch;
|
|
1019 |
+ p++;
|
|
1020 |
+ }
|
|
1021 |
+ if ( m == 0 )
|
|
1022 |
+ {
|
|
1023 |
+ return -1;
|
|
1024 |
+ } else {
|
|
1025 |
+ *p = '\0';
|
|
1026 |
+ *lineptr = buf;
|
|
1027 |
+ *n = m;
|
|
1028 |
+ return m;
|
|
1029 |
+ }
|
|
1030 |
+}
|
|
1031 |
+#endif
|
|
1032 |
+
|
|
1033 |
#ifdef POLKIT_BUILD_TESTS
|
|
1034 |
|
|
1035 |
static polkit_bool_t
|
|
1036 |
diff -ru PolicyKit-0.7.orig/src/polkit-grant/polkit-revoke-helper.c PolicyKit-0.7/src/polkit-grant/polkit-revoke-helper.c
|
|
1037 |
--- PolicyKit-0.7.orig/src/polkit-grant/polkit-revoke-helper.c Thu Nov 29 13:28:35 2007
|
|
1038 |
+++ PolicyKit-0.7/src/polkit-grant/polkit-revoke-helper.c Fri Jan 25 17:12:46 2008
|
|
1039 |
@@ -52,6 +52,10 @@
|
|
1040 |
#include <polkit-dbus/polkit-dbus.h>
|
|
1041 |
#include <polkit/polkit-private.h>
|
|
1042 |
|
|
1043 |
+#ifdef HAVE_SOLARIS
|
|
1044 |
+#define LOG_AUTHPRIV (10<<3)
|
|
1045 |
+#endif
|
|
1046 |
+
|
|
1047 |
static int
|
|
1048 |
_write_to_fd (int fd, const char *str, ssize_t str_len)
|
|
1049 |
{
|
|
1050 |
@@ -109,8 +113,15 @@
|
|
1051 |
|
|
1052 |
#ifndef POLKIT_BUILD_TESTS
|
|
1053 |
/* clear the entire environment to avoid attacks using with libraries honoring environment variables */
|
|
1054 |
+#ifdef HAVE_SOLARIS
|
|
1055 |
+ extern char **environ;
|
|
1056 |
+
|
|
1057 |
+ if (environ != NULL)
|
|
1058 |
+ environ[0] = NULL;
|
|
1059 |
+#else
|
|
1060 |
if (clearenv () != 0)
|
|
1061 |
goto out;
|
|
1062 |
+#endif
|
|
1063 |
/* set a minimal environment */
|
|
1064 |
setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
|
|
1065 |
#endif
|
|
1066 |
diff -ru PolicyKit-0.7.orig/tools/polkit-auth.c PolicyKit-0.7/tools/polkit-auth.c
|
|
1067 |
--- PolicyKit-0.7.orig/tools/polkit-auth.c Thu Dec 6 11:30:18 2007
|
|
1068 |
+++ PolicyKit-0.7/tools/polkit-auth.c Fri Jan 25 17:19:42 2008
|
|
1069 |
@@ -37,6 +37,9 @@
|
|
1070 |
#include <stdlib.h>
|
|
1071 |
#include <string.h>
|
|
1072 |
#include <sys/types.h>
|
|
1073 |
+#ifdef HAVE_SOLARIS
|
|
1074 |
+#include <sys/wait.h>
|
|
1075 |
+#endif
|
|
1076 |
#include <pwd.h>
|
|
1077 |
#include <grp.h>
|
|
1078 |
#include <unistd.h>
|
|
1079 |
Only in PolicyKit-0.7/tools: polkit-auth.o
|
|
1080 |
Only in PolicyKit-0.7/tools: polkit-config-file-validate
|
|
1081 |
Only in PolicyKit-0.7/tools: polkit-config-file-validate.o
|
|
1082 |
Only in PolicyKit-0.7/tools: polkit-policy-file-validate
|
|
1083 |
Only in PolicyKit-0.7/tools: polkit-policy-file-validate.o
|