summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-09-13 14:54:08 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-09-13 15:03:31 +0200
commit3bc41dfa74f918a889d817d6c683394218878a8b (patch)
treefb4573816ff8c0a3afe926e9c8206a32c3340d29
parentf15e2bcd180329f8da1598917c23ffcf8fd73448 (diff)
downloadNetworkManager-bg/client-agent-conn-match-rh1351272.tar.gz
clients: fix matching of connection pathbg/client-agent-conn-match-rh1351272
Since we use g_str_has_prefix() to match a request_id with the connection path, there can be wrong matches. For example: request_id: /org/freedesktop/NetworkManager/Settings/10/802-1x connection: /org/freedesktop/NetworkManager/Settings/1 would match. Add a trailing slash to the connection path stored in the agent to prevent this.
-rw-r--r--clients/common/nm-secret-agent-simple.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c
index d15fb63392..1e3ec5cedd 100644
--- a/clients/common/nm-secret-agent-simple.c
+++ b/clients/common/nm-secret-agent-simple.c
@@ -755,10 +755,14 @@ nm_secret_agent_simple_enable (NMSecretAgentSimple *self, const char *path)
{
NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (self);
GList *requests, *iter;
+ gs_free char *path_full = NULL;
- if (g_strcmp0 (path, priv->path) != 0) {
+ path_full = path ? g_strdup_printf ("%s/", path) : NULL;
+
+ if (g_strcmp0 (path_full, priv->path) != 0) {
g_free (priv->path);
- priv->path = g_strdup (path);
+ priv->path = path_full;
+ path_full = NULL;
}
if (priv->enabled)