agent-manager: cancel pending auth chain for the disappearing agent

If the current agent disappears and we already triggered the permission check
for it then the callback for that permission check will fire after we
progressed to the next agent:

  # nmcli c --wait 0 up vpn

When another agent, such as GNOME Shell is registered, then get_done_cb() for
the nmcli will be called after we started the permission check for GNOME Shell,
resulting in an assertion fail:

  get_done_cb: assertion 'call_id == parent->current_call_id' failed
This commit is contained in:
Lubomir Rintel 2015-10-20 17:54:00 +02:00
parent aa05d25bef
commit 553c15410e

View file

@ -767,6 +767,20 @@ request_remove_agent (Request *req, NMSecretAgent *agent, GSList **pending_reqs)
_LOGD (agent, "current agent removed from secrets request "LOG_REQ_FMT,
LOG_REQ_ARG (req));
switch (req->request_type) {
case REQUEST_TYPE_CON_GET:
case REQUEST_TYPE_CON_SAVE:
case REQUEST_TYPE_CON_DEL:
if (req->con.chain) {
/* This cancels the pending authorization requests. */
nm_auth_chain_unref (req->con.chain);
req->con.chain = NULL;
}
default:
g_assert_not_reached ();
}
*pending_reqs = g_slist_prepend (*pending_reqs, req);
} else if (g_slist_find (req->pending, agent)) {
req->pending = g_slist_remove (req->pending, agent);