20264
|
1 |
--- dbus-1.2.24/dbus/dbus-sysdeps-util-unix.c-orig 2010-10-19 13:27:19.672465743 -0500
|
|
2 |
+++ dbus-1.2.24/dbus/dbus-sysdeps-util-unix.c 2010-10-19 13:28:39.691609495 -0500
|
|
3 |
@@ -45,6 +45,10 @@
|
|
4 |
#include <sys/un.h>
|
|
5 |
#include <syslog.h>
|
|
6 |
|
|
7 |
+#ifdef __sun
|
|
8 |
+#include <pwd.h>
|
|
9 |
+#endif
|
|
10 |
+
|
|
11 |
#ifdef HAVE_SYS_SYSLIMITS_H
|
|
12 |
#include <sys/syslimits.h>
|
|
13 |
#endif
|
|
14 |
@@ -496,8 +500,31 @@ _dbus_user_at_console (const char *usern
|
|
15 |
|
|
16 |
DBusString f;
|
|
17 |
dbus_bool_t result;
|
|
18 |
+#ifdef __sun
|
|
19 |
+ struct passwd *passwd_entry;
|
|
20 |
+#endif
|
|
21 |
|
|
22 |
result = FALSE;
|
|
23 |
+
|
|
24 |
+#ifdef __sun
|
|
25 |
+ passwd_entry = getpwnam (username);
|
|
26 |
+ if (passwd_entry != NULL)
|
|
27 |
+ {
|
|
28 |
+ struct stat st;
|
|
29 |
+ uid_t uid;
|
|
30 |
+
|
|
31 |
+ uid = passwd_entry->pw_uid;
|
|
32 |
+
|
|
33 |
+ if (stat ("/dev/vt/console_user", &st) == 0 && st.st_uid == uid)
|
|
34 |
+ {
|
|
35 |
+ /*
|
|
36 |
+ * Owner is allowed to take over. Before we have real
|
|
37 |
+ * ownership in HAL, assume it's the console owner.
|
|
38 |
+ */
|
|
39 |
+ result = TRUE;
|
|
40 |
+ }
|
|
41 |
+ }
|
|
42 |
+#else
|
|
43 |
if (!_dbus_string_init (&f))
|
|
44 |
{
|
|
45 |
_DBUS_SET_OOM (error);
|
|
46 |
@@ -521,6 +548,7 @@ _dbus_user_at_console (const char *usern
|
|
47 |
|
|
48 |
out:
|
|
49 |
_dbus_string_free (&f);
|
|
50 |
+#endif
|
|
51 |
|
|
52 |
return result;
|
|
53 |
}
|