mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
Bug 619142 – Build fixes
- Fix various #include issues - Change #error to #warning for the EXTERNAL authentication mechanism. It is not clear if this should work on Win32 at all. - Call close() before unlink() for the SHA1 keyring - Change #error to #warning so we don't forget to do permission checking of the .dbus-keyrings directory - Use Win32 SID for the SHA1 auth mech - Apparently we can't use word 'interface' as an identifier - Implement a _g_dbus_win32_get_user_sid() function. For now it's private. Don't know if it should be public somewhere. Maybe in a future GCredentials support for Win32? I don't know. - GFileDescriptorBased is not available on Win32. So avoid using it in GLocalFile stuff. Now, Win32 still uses GLocalFile + friends (which works with file descriptors) so expose a private function to get the fd for an OutputStream so things still work. - Fixup gio.symbols - Fixup tests/gdbus-peer.c so it builds With this, at least things compile and the gdbus-peer.exe test case passes. Which is a great start. I've tested this by cross-compiling on a x86_64 Fedora 13 host using mingw32 and running the code on a 32-bit Windows 7 box. https://bugzilla.gnome.org/show_bug.cgi?id=619142 Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "gdbuserror.h"
|
||||
#include "gioenumtypes.h"
|
||||
#include "gioerror.h"
|
||||
#include "gdbusprivate.h"
|
||||
|
||||
#include "glibintl.h"
|
||||
#include "gioalias.h"
|
||||
@@ -280,7 +281,7 @@ ensure_keyring_directory (GError **error)
|
||||
goto out;
|
||||
}
|
||||
#else
|
||||
#error Please implement permission checking on non-UNIX platforms
|
||||
#warning Please implement permission checking on this non-UNIX platform
|
||||
#endif
|
||||
}
|
||||
goto out;
|
||||
@@ -583,16 +584,6 @@ keyring_release_lock (const gchar *path,
|
||||
|
||||
ret = FALSE;
|
||||
lock = g_strdup_printf ("%s.lock", path);
|
||||
if (g_unlink (lock) != 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
g_io_error_from_errno (errno),
|
||||
_("Error unlinking lock-file `%s': %s"),
|
||||
lock,
|
||||
strerror (errno));
|
||||
goto out;
|
||||
}
|
||||
if (close (lock_fd) != 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
@@ -603,6 +594,16 @@ keyring_release_lock (const gchar *path,
|
||||
strerror (errno));
|
||||
goto out;
|
||||
}
|
||||
if (g_unlink (lock) != 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
g_io_error_from_errno (errno),
|
||||
_("Error unlinking lock-file `%s': %s"),
|
||||
lock,
|
||||
strerror (errno));
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
@@ -953,11 +954,11 @@ mechanism_server_initiate (GDBusAuthMechanism *mechanism,
|
||||
}
|
||||
}
|
||||
#elif defined(G_OS_WIN32)
|
||||
GCredentials *credentials;
|
||||
credentials = g_credentials_new_for_process ();
|
||||
if (g_strcmp0 (g_credentials_get_windows_user (credentials), initial_response) == 0)
|
||||
gchar *sid;
|
||||
sid = _g_dbus_win32_get_user_sid ();
|
||||
if (g_strcmp0 (initial_response, sid) == 0)
|
||||
m->priv->state = G_DBUS_AUTH_MECHANISM_STATE_HAVE_DATA_TO_SEND;
|
||||
g_object_unref (credentials);
|
||||
g_free (sid);
|
||||
#else
|
||||
#error Please implement for your OS
|
||||
#endif
|
||||
@@ -1109,13 +1110,9 @@ mechanism_client_initiate (GDBusAuthMechanism *mechanism,
|
||||
#ifdef G_OS_UNIX
|
||||
initial_response = g_strdup_printf ("%" G_GINT64_FORMAT, (gint64) getuid ());
|
||||
#elif defined (G_OS_WIN32)
|
||||
{
|
||||
GCredentials *credentials;
|
||||
credentials = g_credentials_new_for_process ();
|
||||
initial_response = g_strdup (g_credentials_get_windows_user (credentials));
|
||||
g_object_unref (credentials);
|
||||
}
|
||||
initial_response = _g_dbus_win32_get_user_sid ();
|
||||
#else
|
||||
#error Please implement for your OS
|
||||
#endif
|
||||
g_assert (initial_response != NULL);
|
||||
|
||||
|
Reference in New Issue
Block a user