core: move secrets handling to NMSettingsConnection

It's the thing that owns the secrets anyway, and it simplifies things to
have the secrets handling there instead of half in NMActRequest and
half in NMManager.  It also means we can get rid of the ugly signals
that NMSettingsConnection had to emit to get agent's secrets, and
we can consolidate the requests for the persistent secrets that the
NMSettingsConnection owned into NMSettingsConnection itself instead
of also in NMAgentManager.

Since the NMActRequest and the NMVPNConnection classes already tracked
the underlying NMSettingsConnection representing the activation, its
trivial to just have them ask the NMSettingsConnection for secrets
instead of talking to the NMAgentManager.  Thus, only the
NMSettingsConnection now has to know about the agent manager, and it
presents a cleaner interface to other objects further up the chain,
instead of having bits of the secrets request splattered around the
activation request, the VPN connection, the NMManager, etc.
This commit is contained in:
Dan Williams
2011-01-27 10:41:02 -06:00
parent 37a9303c2e
commit 0e6a5365d4
14 changed files with 326 additions and 460 deletions

View File

@@ -25,7 +25,6 @@
#include <glib-object.h>
#include "nm-connection.h"
#include "nm-active-connection.h"
#include "nm-agent-manager.h"
#define NM_TYPE_ACT_REQUEST (nm_act_request_get_type ())
#define NM_ACT_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ACT_REQUEST, NMActRequest))
@@ -49,7 +48,6 @@ GType nm_act_request_get_type (void);
NMActRequest *nm_act_request_new (NMConnection *connection,
const char *specific_object,
NMAgentManager *agent_mgr,
gboolean user_requested,
gulong user_uid,
gboolean assumed,
@@ -93,22 +91,21 @@ typedef void (*NMActRequestSecretsFunc) (NMActRequest *req,
GError *error,
gpointer user_data);
guint32 nm_act_request_get_secrets (NMActRequest *req,
const char *setting_name,
guint32 flags,
const char *hint,
NMActRequestSecretsFunc callback,
gpointer callback_data);
/* NOTE: these values should match the NM_SECRET_AGENT_GET_SECRETS_FLAGS in
* the nm-secret-agent.xml introspection file.
*/
enum {
NM_ACT_REQUEST_GET_SECRETS_FLAG_NONE = 0x0,
NM_ACT_REQUEST_GET_SECRETS_FLAG_ALLOW_INTERACTION = 0x1,
NM_ACT_REQUEST_GET_SECRETS_FLAG_REQUEST_NEW = 0x2
};
guint32 nm_act_request_get_secrets_vpn (NMActRequest *req,
NMConnection *connection,
gboolean user_requested,
gulong user_uid,
const char *setting_name,
guint32 flags,
const char *hint,
NMActRequestSecretsFunc callback,
gpointer callback_data);
guint32 nm_act_request_get_secrets (NMActRequest *req,
const char *setting_name,
guint32 flags,
const char *hint,
NMActRequestSecretsFunc callback,
gpointer callback_data);
void nm_act_request_cancel_secrets (NMActRequest *req, guint32 call_id);