[glib: 1/2] gdbus: Add --interactive option to `gdbus call`
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] gdbus: Add --interactive option to `gdbus call`
- Date: Mon, 22 Nov 2021 13:58:47 +0000 (UTC)
commit b75a16b048d17c392087cef02c81dab70f42b4b1
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Nov 11 10:37:43 2021 +0000
gdbus: Add --interactive option to `gdbus call`
This allows the flag to allow interactive auth to be set. Previously, it
was unconditionally unset.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
docs/reference/gio/gdbus.xml | 1 +
gio/gdbus-tool.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/docs/reference/gio/gdbus.xml b/docs/reference/gio/gdbus.xml
index 77fdfebed..60c172e05 100644
--- a/docs/reference/gio/gdbus.xml
+++ b/docs/reference/gio/gdbus.xml
@@ -71,6 +71,7 @@
<arg choice="plain">--method <replaceable>org.project.InterfaceName.MethodName</replaceable></arg>
<group>
<arg choice="plain">--timeout <replaceable>seconds</replaceable></arg>
+ <arg choice="plain">--interactive</arg>
</group>
<arg choice="plain">ARG1</arg>
<arg choice="plain" rep="repeat">ARG2</arg>
diff --git a/gio/gdbus-tool.c b/gio/gdbus-tool.c
index f44253804..42991886a 100644
--- a/gio/gdbus-tool.c
+++ b/gio/gdbus-tool.c
@@ -887,6 +887,7 @@ static gchar *opt_call_dest = NULL;
static gchar *opt_call_object_path = NULL;
static gchar *opt_call_method = NULL;
static gint opt_call_timeout = -1;
+static gboolean opt_call_interactive = FALSE;
static const GOptionEntry call_entries[] =
{
@@ -894,6 +895,7 @@ static const GOptionEntry call_entries[] =
{ "object-path", 'o', 0, G_OPTION_ARG_STRING, &opt_call_object_path, N_("Object path to invoke method
on"), NULL},
{ "method", 'm', 0, G_OPTION_ARG_STRING, &opt_call_method, N_("Method and interface name"), NULL},
{ "timeout", 't', 0, G_OPTION_ARG_INT, &opt_call_timeout, N_("Timeout in seconds"), NULL},
+ { "interactive", 'i', 0, G_OPTION_ARG_NONE, &opt_call_interactive, N_("Allow interactive authorization"),
NULL},
G_OPTION_ENTRY_NULL
};
@@ -925,6 +927,7 @@ handle_call (gint *argc,
gboolean skip_dashes;
guint parm;
guint n;
+ GDBusCallFlags flags;
ret = FALSE;
c = NULL;
@@ -1204,6 +1207,11 @@ handle_call (gint *argc,
if (parameters != NULL)
parameters = g_variant_ref_sink (parameters);
+
+ flags = G_DBUS_CALL_FLAGS_NONE;
+ if (opt_call_interactive)
+ flags |= G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION;
+
#ifdef G_OS_UNIX
result = g_dbus_connection_call_with_unix_fd_list_sync (c,
opt_call_dest,
@@ -1212,7 +1220,7 @@ handle_call (gint *argc,
method_name,
parameters,
NULL,
- G_DBUS_CALL_FLAGS_NONE,
+ flags,
opt_call_timeout > 0 ? opt_call_timeout * 1000 :
opt_call_timeout,
fd_list,
NULL,
@@ -1226,7 +1234,7 @@ handle_call (gint *argc,
method_name,
parameters,
NULL,
- G_DBUS_CALL_FLAGS_NONE,
+ flags,
opt_call_timeout > 0 ? opt_call_timeout * 1000 : opt_call_timeout,
NULL,
&error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]