agent-manager: remove @asked field from request

This code was unused, because we never enqueued any hashes
to the @asked list. Note that hashing also might give wrong
hash collisions, so this was buggy anyway.

Also, note that impl_agent_manager_register_with_capabilities()
already ensures that duplicate agents are not registered
in the first place (find_agent_by_identifier_and_uid()).
This commit is contained in:
Thomas Haller 2015-08-21 15:11:54 +02:00
parent e5c59d1f38
commit ea14cd45f1
3 changed files with 0 additions and 26 deletions

View file

@ -401,12 +401,6 @@ struct _Request {
/* Stores the sorted list of NMSecretAgents which will be asked for secrets */ /* Stores the sorted list of NMSecretAgents which will be asked for secrets */
GSList *pending; GSList *pending;
/* Stores the list of NMSecretAgent hashes that we've already
* asked for secrets, so that we don't ask the same agent twice
* if it quits and re-registers during this secrets request.
*/
GSList *asked;
guint32 idle_id; guint32 idle_id;
RequestAddAgentFunc add_agent_callback; RequestAddAgentFunc add_agent_callback;
@ -466,7 +460,6 @@ request_free (Request *req)
g_free (req->detail); g_free (req->detail);
g_free (req->verb); g_free (req->verb);
g_slist_free_full (req->pending, g_object_unref); g_slist_free_full (req->pending, g_object_unref);
g_slist_free (req->asked);
memset (req, 0, sizeof (Request)); memset (req, 0, sizeof (Request));
g_free (req); g_free (req);
} }
@ -535,9 +528,6 @@ request_add_agent (Request *req, NMSecretAgent *agent)
g_return_if_fail (req != NULL); g_return_if_fail (req != NULL);
g_return_if_fail (agent != NULL); g_return_if_fail (agent != NULL);
if (g_slist_find (req->asked, GUINT_TO_POINTER (nm_secret_agent_get_hash (agent))))
return;
if (req->add_agent_callback && !req->add_agent_callback (req, agent)) if (req->add_agent_callback && !req->add_agent_callback (req, agent))
return; return;

View file

@ -45,7 +45,6 @@ typedef struct {
char *owner_username; char *owner_username;
char *dbus_owner; char *dbus_owner;
NMSecretAgentCapabilities capabilities; NMSecretAgentCapabilities capabilities;
guint32 hash;
GSList *permissions; GSList *permissions;
@ -190,14 +189,6 @@ nm_secret_agent_get_capabilities (NMSecretAgent *agent)
return NM_SECRET_AGENT_GET_PRIVATE (agent)->capabilities; return NM_SECRET_AGENT_GET_PRIVATE (agent)->capabilities;
} }
guint32
nm_secret_agent_get_hash (NMSecretAgent *agent)
{
g_return_val_if_fail (NM_IS_SECRET_AGENT (agent), 0);
return NM_SECRET_AGENT_GET_PRIVATE (agent)->hash;
}
NMAuthSubject * NMAuthSubject *
nm_secret_agent_get_subject (NMSecretAgent *agent) nm_secret_agent_get_subject (NMSecretAgent *agent)
{ {
@ -565,7 +556,6 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
{ {
NMSecretAgent *self; NMSecretAgent *self;
NMSecretAgentPrivate *priv; NMSecretAgentPrivate *priv;
char *hash_str;
struct passwd *pw; struct passwd *pw;
GDBusProxy *proxy; GDBusProxy *proxy;
char *owner_username = NULL; char *owner_username = NULL;
@ -588,10 +578,6 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
priv->capabilities = capabilities; priv->capabilities = capabilities;
priv->subject = g_object_ref (subject); priv->subject = g_object_ref (subject);
hash_str = g_strdup_printf ("%16lu%s", nm_auth_subject_get_unix_process_uid (subject), identifier);
priv->hash = g_str_hash (hash_str);
g_free (hash_str);
proxy = nm_bus_manager_new_proxy (nm_bus_manager_get (), proxy = nm_bus_manager_new_proxy (nm_bus_manager_get (),
context, context,
NMDBUS_TYPE_SECRET_AGENT_PROXY, NMDBUS_TYPE_SECRET_AGENT_PROXY,

View file

@ -66,8 +66,6 @@ gulong nm_secret_agent_get_pid (NMSecretAgent *agent);
NMSecretAgentCapabilities nm_secret_agent_get_capabilities (NMSecretAgent *agent); NMSecretAgentCapabilities nm_secret_agent_get_capabilities (NMSecretAgent *agent);
guint32 nm_secret_agent_get_hash (NMSecretAgent *agent);
NMAuthSubject *nm_secret_agent_get_subject (NMSecretAgent *agent); NMAuthSubject *nm_secret_agent_get_subject (NMSecretAgent *agent);
void nm_secret_agent_add_permission (NMSecretAgent *agent, void nm_secret_agent_add_permission (NMSecretAgent *agent,