libnm: ensure auto-registration only when not yet registered

Calling nm_secret_agent_register() on an already registered
instance leads to a warning. Ensure to call register during
auto-registration only when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=727923

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-08-24 16:16:30 +02:00
parent 509ac4cae7
commit 86ffea8004
2 changed files with 4 additions and 2 deletions

View File

@ -702,7 +702,8 @@ auto_register_cb (gpointer user_data)
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
priv->auto_register_id = 0;
if (priv->auto_register && !priv->suppress_auto && (priv->reg_call == NULL))
if (priv->auto_register && !priv->suppress_auto &&
(priv->reg_call == NULL && !priv->registered))
nm_secret_agent_register (self);
return FALSE;
}

View File

@ -703,7 +703,8 @@ auto_register_cb (gpointer user_data)
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
priv->auto_register_id = 0;
if (priv->auto_register && !priv->suppress_auto && (priv->reg_call == NULL))
if (priv->auto_register && !priv->suppress_auto &&
(priv->reg_call == NULL && !priv->registered))
nm_secret_agent_register (self);
return FALSE;
}