core: get D-Bus manager during auth if not provided

This commit is contained in:
Dan Williams
2010-10-26 11:00:30 -05:00
parent 1b21949380
commit 39ed9c2956

View File

@@ -20,6 +20,7 @@
#include "nm-manager-auth.h" #include "nm-manager-auth.h"
#include "nm-logging.h" #include "nm-logging.h"
#include "nm-dbus-manager.h"
#include <dbus/dbus-glib-lowlevel.h> #include <dbus/dbus-glib-lowlevel.h>
#include <string.h> #include <string.h>
@@ -325,9 +326,14 @@ nm_auth_get_caller_uid (DBusGMethodInvocation *context,
DBusError dbus_error; DBusError dbus_error;
g_return_val_if_fail (context != NULL, FALSE); g_return_val_if_fail (context != NULL, FALSE);
g_return_val_if_fail (dbus_mgr != NULL, FALSE);
g_return_val_if_fail (out_uid != NULL, FALSE); g_return_val_if_fail (out_uid != NULL, FALSE);
if (!dbus_mgr) {
dbus_mgr = nm_dbus_manager_get ();
g_assert (dbus_mgr);
} else
g_object_ref (dbus_mgr);
*out_uid = G_MAXULONG; *out_uid = G_MAXULONG;
sender = dbus_g_method_get_sender (context); sender = dbus_g_method_get_sender (context);
@@ -356,6 +362,7 @@ nm_auth_get_caller_uid (DBusGMethodInvocation *context,
success = TRUE; success = TRUE;
out: out:
g_object_unref (dbus_mgr);
g_free (sender); g_free (sender);
return success; return success;
} }