g_unix_set_fd_nonblocking: New API to control file descriptor blocking state
[platform/upstream/glib.git] / gio / gdbusauthmechanismexternal.c
index 526023f..3fcb1ee 100644 (file)
@@ -1,6 +1,6 @@
 /* GDBus - GLib D-Bus Library
  *
- * Copyright (C) 2008-2009 Red Hat, Inc.
+ * Copyright (C) 2008-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include "config.h"
 
 #include <string.h>
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #include "gdbusauthmechanismexternal.h"
 #include "gcredentials.h"
 #include "gdbuserror.h"
 #include "gioenumtypes.h"
 
-#ifdef G_OS_UNIX
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
 #include "glibintl.h"
-#include "gioalias.h"
 
 struct _GDBusAuthMechanismExternalPrivate
 {
@@ -351,11 +349,11 @@ mechanism_client_initiate (GDBusAuthMechanism   *mechanism,
 
   /* return the uid */
 #if defined(G_OS_UNIX)
-  initial_response = g_strdup_printf ("%" G_GINT64_FORMAT, g_credentials_get_unix_user (credentials, NULL));
+  initial_response = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) g_credentials_get_unix_user (credentials, NULL));
 #elif defined(G_OS_WIN32)
-  initial_response = g_strdup_printf ("%s", g_credentials_get_windows_user ());
-#else
-#warning Dont know how to send credentials on this OS. Please implement.
+#ifdef __GNUC__
+#warning Dont know how to send credentials on this OS. The EXTERNAL D-Bus authentication mechanism will not work.
+#endif
   m->priv->state = G_DBUS_AUTH_MECHANISM_STATE_REJECTED;
 #endif
   return initial_response;
@@ -404,6 +402,3 @@ mechanism_client_shutdown (GDBusAuthMechanism   *mechanism)
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
-
-#define __G_DBUS_AUTH_MECHANISM_EXTERNAL_C__
-#include "gioaliasdef.c"