diff options
author | Thomas Haller <thaller@redhat.com> | 2017-10-13 16:12:35 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-10-18 13:05:00 +0200 |
commit | 3434261811b6edde77689983ac4c4e70cd2ca39a (patch) | |
tree | dbed62d0331f640721493ab4ff5528487553fdfe /clients/common/nm-secret-agent-simple.c | |
parent | 0e9e35e30913ccd01857bb104880976b63404049 (diff) | |
download | NetworkManager-3434261811b6edde77689983ac4c4e70cd2ca39a.tar.gz |
core,clients: use our own string hashing function nm_str_hash()
Replace the usage of g_str_hash() with our own nm_str_hash().
GLib's g_str_hash() uses djb2 hashing function, just like we
do at the moment. The only difference is, that we use a diffrent
seed value.
Note, that we initialize the hash seed with random data (by calling
getrandom() or reading /dev/urandom). That is a change compared to
before.
This change of the hashing function and accessing the random pool
might be undesired for libnm/libnm-core. Hence, the change is not
done there as it possibly changes behavior for public API. Maybe
we should do that later though.
At this point, there isn't much of a change. This patch becomes
interesting, if we decide to use a different hashing algorithm.
Diffstat (limited to 'clients/common/nm-secret-agent-simple.c')
-rw-r--r-- | clients/common/nm-secret-agent-simple.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c index 0faf68a567..c08f7fe244 100644 --- a/clients/common/nm-secret-agent-simple.c +++ b/clients/common/nm-secret-agent-simple.c @@ -33,6 +33,8 @@ #include <string.h> +#include "nm-utils/nm-hash-utils.h" + #include "NetworkManager.h" #include "nm-vpn-service-plugin.h" @@ -86,7 +88,7 @@ nm_secret_agent_simple_init (NMSecretAgentSimple *agent) { NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (agent); - priv->requests = g_hash_table_new_full (g_str_hash, g_str_equal, + priv->requests = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, nm_secret_agent_simple_request_free); } @@ -694,7 +696,7 @@ nm_secret_agent_simple_response (NMSecretAgentSimple *self, g_variant_builder_init (&vpn_secrets_builder, G_VARIANT_TYPE ("a{ss}")); - settings = g_hash_table_new (g_str_hash, g_str_equal); + settings = g_hash_table_new (nm_str_hash, g_str_equal); for (i = 0; i < secrets->len; i++) { NMSecretAgentSimpleSecretReal *secret = secrets->pdata[i]; |