Commit fbb16622 authored by Thomas Haller's avatar Thomas Haller

libnm-glib: don't fail creating connection in NMSecretAgent

The connection should be created best-effort. If the connection doesn't
validate, the connection request still can be answered by the agent.
parent 9bf39338
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "nm-secret-agent.h" #include "nm-secret-agent.h"
#include "nm-glib-enum-types.h" #include "nm-glib-enum-types.h"
#include "nm-dbus-helpers-private.h" #include "nm-dbus-helpers-private.h"
#include "nm-setting-private.h"
static void impl_secret_agent_get_secrets (NMSecretAgent *self, static void impl_secret_agent_get_secrets (NMSecretAgent *self,
GHashTable *connection_hash, GHashTable *connection_hash,
...@@ -302,7 +303,8 @@ verify_request (NMSecretAgent *self, ...@@ -302,7 +303,8 @@ verify_request (NMSecretAgent *self,
GError **error) GError **error)
{ {
NMConnection *connection = NULL; NMConnection *connection = NULL;
GError *local = NULL;
g_return_val_if_fail (out_connection, FALSE);
if (!verify_sender (self, context, error)) if (!verify_sender (self, context, error))
return FALSE; return FALSE;
...@@ -321,21 +323,11 @@ verify_request (NMSecretAgent *self, ...@@ -321,21 +323,11 @@ verify_request (NMSecretAgent *self,
} }
/* Make sure the given connection is valid */ /* Make sure the given connection is valid */
g_assert (out_connection); connection = _nm_connection_new_from_hash (connection_hash);
connection = nm_connection_new_from_hash (connection_hash, &local); nm_connection_set_path (connection, connection_path);
if (connection) { *out_connection = connection;
nm_connection_set_path (connection, connection_path);
*out_connection = connection;
} else {
g_set_error (error,
NM_SECRET_AGENT_ERROR,
NM_SECRET_AGENT_ERROR_INVALID_CONNECTION,
"Invalid connection: %s",
local->message);
g_clear_error (&local);
}
return !!connection; return TRUE;
} }
static void static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment