up once per second.
path = g_path_get_dirname (ibus_get_socket_path ());
+ g_mkdir_with_parents (path, 0700);
+ g_chmod (path, 0700);
+
if (stat (path, &buf) == 0) {
- if (buf.st_uid != ibus_get_daemon_uid ()) {
+ if (buf.st_uid != getuid ()) {
g_warning ("The owner of %s is not %s!", path, ibus_get_user_name ());
return;
}
}
-#if 0
- else {
- if (getuid () == ibus_get_daemon_uid ()) {
- mkdir (path, 0700);
- chmod (path, 0700);
- }
- }
-#endif
ibus_bus_connect (bus);
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <pwd.h>
#include <dbus/dbus.h>
#include "ibusshare.h"
const gchar *
ibus_get_user_name (void)
{
+ return g_get_user_name ();
+#if 0
static gchar *username = NULL;
if (username == NULL) {
username = g_strdup (getlogin());
}
return username;
+#endif
}
glong
ibus_get_daemon_uid (void)
{
+ return getuid ();
+#if 0
struct passwd *pwd;
uid_t uid;
const gchar *username;
return 0;
return pwd->pw_uid;
+#endif
}
const gchar *
* @returns: UID of ibus-daemon; or 0 if UID is not available.
*
* Get UID of ibus-daemon.
+ *
+ * Deprecated: This function has been deprecated and should
+ * not be used in newly written code.
*/
-glong ibus_get_daemon_uid (void);
+glong ibus_get_daemon_uid (void) G_GNUC_DEPRECATED;
/**
* ibus_get_socket_path: