core: Fix idle watch not being removed properly
Luiz Augusto von Dentz
maintainerPATCH 1/4 core: Fix idle watch not being removed properly
From: Luiz Augusto von Dentz <[email protected]>
The idle watch used to dispatch authorization should be removed when waiting services to be resolved.
--- src/adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/adapter.c +1 -1
@@ -4984,7 +4984,7 @@ static gboolean process_auth_queue(gpointer user_data)/* Wait services to be resolved before asking authorization */ if (auth->svc_id >0 ) -return TRUE; +return FALSE;if (device_is_trusted (device) == TRUE) { auth->cb (NULL , auth->user_data);
Signature · 1 line
1.9.3
Luiz Augusto von Dentz
maintainerPATCH 2/4 client: Fix typo
From: Luiz Augusto von Dentz <[email protected]>
--- client/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
client/main.c +1 -1
@@ -166,7 +166,7 @@ static void print_iter(const char *label, const char *name,switch (dbus_message_iter_get_arg_type (iter)) {case DBUS_TYPE_INVALID : -rl_printf ("%s%s is inavlid\n" , label, name); +rl_printf ("%s%s is invalid\n" , label, name);break ;case DBUS_TYPE_STRING :case DBUS_TYPE_OBJECT_PATH :
Signature · 1 line
1.9.3
Luiz Augusto von Dentz
maintainerPATCH 3/4 client: Force redisplay on rl_printf
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
It seems some in some version of readline rl_redisplay does not update when rl_printf is called, so this uses rl_forced_update_display which should force the new lines to be displayed.
--- client/display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
client/display.c +1 -1
@@ -58,7 +58,7 @@ void rl_printf(const char *fmt, ...)rl_restore_prompt ();rl_replace_line (saved_line,0 ); rl_point = saved_point; -rl_redisplay (); +rl_forced_update_display ();free (saved_line); } }
Signature · 1 line
1.9.3
Luiz Augusto von Dentz
maintainerPATCH 4/4 core: Fix concurrent authorizations
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
In case multiple authorizations happen it can trigger a second call to agent_authorize_service while the first is still ongoing causing all authorization to fail.
--- src/adapter.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
src/adapter.c +14 -0
@@ -4964,6 +4964,16 @@ static void agent_auth_cb(struct agent *agent, DBusError *derr,g_free (auth); +/* Stop processing if queue is empty */ +if (g_queue_is_empty (adapter->auths)) { +if (adapter->auth_idle_id >0 ) +g_source_remove (adapter->auth_idle_id); +return ; + } + +if (adapter->auth_idle_id >0 ) +return ; + adapter->auth_idle_id =g_idle_add (process_auth_queue, adapter); }
@@ -4991,6 +5001,10 @@ static gboolean process_auth_queue(gpointer user_data) goto next; } +/* If agent is set authorization is already ongoing */ +if (auth->agent) +return FALSE; + auth->agent =agent_get (NULL );if (auth->agent ==NULL ) {warn ("Authentication attempt without agent" );
Signature · 1 line
1.9.3
Johan Hedberg
AppliedHi Luiz,
Quoted 5 lines · Luiz Augusto von Dentz
The idle watch used to dispatch authorization should be removed when waiting services to be resolved.
--- src/adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I've applied all four of these patches. Thanks.
Johan