core: add method to start authentication with a D-Bus sender
This commit is contained in:
@@ -80,12 +80,13 @@ _auth_chain_new (PolkitAuthority *authority,
|
|||||||
DBusGMethodInvocation *context,
|
DBusGMethodInvocation *context,
|
||||||
DBusGProxy *proxy,
|
DBusGProxy *proxy,
|
||||||
DBusMessage *message,
|
DBusMessage *message,
|
||||||
|
const char *dbus_sender,
|
||||||
NMAuthChainResultFunc done_func,
|
NMAuthChainResultFunc done_func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMAuthChain *self;
|
NMAuthChain *self;
|
||||||
|
|
||||||
g_return_val_if_fail (context || proxy || message, NULL);
|
g_return_val_if_fail (context || proxy || message || dbus_sender, NULL);
|
||||||
|
|
||||||
self = g_malloc0 (sizeof (NMAuthChain));
|
self = g_malloc0 (sizeof (NMAuthChain));
|
||||||
self->refcount = 1;
|
self->refcount = 1;
|
||||||
@@ -102,6 +103,8 @@ _auth_chain_new (PolkitAuthority *authority,
|
|||||||
self->owner = dbus_g_method_get_sender (context);
|
self->owner = dbus_g_method_get_sender (context);
|
||||||
else if (message)
|
else if (message)
|
||||||
self->owner = g_strdup (dbus_message_get_sender (message));
|
self->owner = g_strdup (dbus_message_get_sender (message));
|
||||||
|
else if (dbus_sender)
|
||||||
|
self->owner = g_strdup (dbus_sender);
|
||||||
|
|
||||||
if (!self->owner) {
|
if (!self->owner) {
|
||||||
/* Need an owner */
|
/* Need an owner */
|
||||||
@@ -120,7 +123,7 @@ nm_auth_chain_new (PolkitAuthority *authority,
|
|||||||
NMAuthChainResultFunc done_func,
|
NMAuthChainResultFunc done_func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
return _auth_chain_new (authority, context, proxy, NULL, done_func, user_data);
|
return _auth_chain_new (authority, context, proxy, NULL, NULL, done_func, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
NMAuthChain *
|
NMAuthChain *
|
||||||
@@ -129,7 +132,16 @@ nm_auth_chain_new_raw_message (PolkitAuthority *authority,
|
|||||||
NMAuthChainResultFunc done_func,
|
NMAuthChainResultFunc done_func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
return _auth_chain_new (authority, NULL, NULL, message, done_func, user_data);
|
return _auth_chain_new (authority, NULL, NULL, message, NULL, done_func, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
NMAuthChain *
|
||||||
|
nm_auth_chain_new_dbus_sender (PolkitAuthority *authority,
|
||||||
|
const char *dbus_sender,
|
||||||
|
NMAuthChainResultFunc done_func,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
return _auth_chain_new (authority, NULL, NULL, NULL, dbus_sender, done_func, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
|
@@ -72,6 +72,11 @@ NMAuthChain *nm_auth_chain_new_raw_message (PolkitAuthority *authority,
|
|||||||
NMAuthChainResultFunc done_func,
|
NMAuthChainResultFunc done_func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
NMAuthChain *nm_auth_chain_new_dbus_sender (PolkitAuthority *authority,
|
||||||
|
const char *dbus_sender,
|
||||||
|
NMAuthChainResultFunc done_func,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
gpointer nm_auth_chain_get_data (NMAuthChain *chain, const char *tag);
|
gpointer nm_auth_chain_get_data (NMAuthChain *chain, const char *tag);
|
||||||
|
|
||||||
void nm_auth_chain_set_data (NMAuthChain *chain,
|
void nm_auth_chain_set_data (NMAuthChain *chain,
|
||||||
|
Reference in New Issue
Block a user