core: merge branch 'th/call-id-cleanup'

(cherry picked from commit 8060c2a930)
This commit is contained in:
Thomas Haller 2017-11-24 17:02:49 +01:00
commit b61ed232f0
10 changed files with 104 additions and 110 deletions

View file

@ -104,7 +104,7 @@ typedef struct _NMDeviceEthernetPrivate {
char * s390_nettype; char * s390_nettype;
GHashTable * s390_options; GHashTable * s390_options;
NMActRequestGetSecretsCallId wired_secrets_id; NMActRequestGetSecretsCallId *wired_secrets_id;
/* PPPoE */ /* PPPoE */
NMPPPManager *ppp_manager; NMPPPManager *ppp_manager;
@ -416,7 +416,7 @@ supplicant_interface_release (NMDeviceEthernet *self)
static void static void
wired_secrets_cb (NMActRequest *req, wired_secrets_cb (NMActRequest *req,
NMActRequestGetSecretsCallId call_id, NMActRequestGetSecretsCallId *call_id,
NMSettingsConnection *connection, NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)

View file

@ -71,7 +71,7 @@ typedef struct {
gulong parent_state_id; gulong parent_state_id;
Supplicant supplicant; Supplicant supplicant;
guint supplicant_timeout_id; guint supplicant_timeout_id;
NMActRequestGetSecretsCallId macsec_secrets_id; NMActRequestGetSecretsCallId *macsec_secrets_id;
} NMDeviceMacsecPrivate; } NMDeviceMacsecPrivate;
struct _NMDeviceMacsec { struct _NMDeviceMacsec {
@ -276,7 +276,7 @@ supplicant_iface_assoc_cb (NMSupplicantInterface *iface,
static void static void
macsec_secrets_cb (NMActRequest *req, macsec_secrets_cb (NMActRequest *req,
NMActRequestGetSecretsCallId call_id, NMActRequestGetSecretsCallId *call_id,
NMSettingsConnection *connection, NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)

View file

@ -107,7 +107,7 @@ typedef struct {
NM80211Mode mode; NM80211Mode mode;
NMActRequestGetSecretsCallId wifi_secrets_id; NMActRequestGetSecretsCallId *wifi_secrets_id;
guint periodic_source_id; guint periodic_source_id;
guint link_timeout_id; guint link_timeout_id;
@ -1786,7 +1786,7 @@ cleanup_supplicant_failures (NMDeviceWifi *self)
static void static void
wifi_secrets_cb (NMActRequest *req, wifi_secrets_cb (NMActRequest *req,
NMActRequestGetSecretsCallId call_id, NMActRequestGetSecretsCallId *call_id,
NMSettingsConnection *connection, NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)

View file

@ -94,7 +94,7 @@ typedef struct _NMModemPrivate {
NMActRequest *act_request; NMActRequest *act_request;
guint32 secrets_tries; guint32 secrets_tries;
NMActRequestGetSecretsCallId secrets_id; NMActRequestGetSecretsCallId *secrets_id;
guint32 mm_ip_timeout; guint32 mm_ip_timeout;
@ -880,7 +880,7 @@ cancel_get_secrets (NMModem *self)
static void static void
modem_secrets_cb (NMActRequest *req, modem_secrets_cb (NMActRequest *req,
NMActRequestGetSecretsCallId call_id, NMActRequestGetSecretsCallId *call_id,
NMSettingsConnection *connection, NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)

View file

@ -28,6 +28,8 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include "nm-utils/c-list.h"
#include "nm-setting-wireless-security.h" #include "nm-setting-wireless-security.h"
#include "nm-setting-8021x.h" #include "nm-setting-8021x.h"
#include "devices/nm-device.h" #include "devices/nm-device.h"
@ -41,7 +43,7 @@ typedef struct {
} ShareRule; } ShareRule;
typedef struct { typedef struct {
GSList *secrets_calls; CList call_ids_lst_head;
gboolean shared; gboolean shared;
GSList *share_rules; GSList *share_rules;
} NMActRequestPrivate; } NMActRequestPrivate;
@ -90,6 +92,7 @@ nm_act_request_get_applied_connection (NMActRequest *req)
/*****************************************************************************/ /*****************************************************************************/
struct _NMActRequestGetSecretsCallId { struct _NMActRequestGetSecretsCallId {
CList call_ids_lst;
NMActRequest *self; NMActRequest *self;
NMActRequestSecretsFunc callback; NMActRequestSecretsFunc callback;
gpointer callback_data; gpointer callback_data;
@ -97,28 +100,15 @@ struct _NMActRequestGetSecretsCallId {
bool has_ref; bool has_ref;
}; };
typedef struct _NMActRequestGetSecretsCallId GetSecretsInfo;
static GetSecretsInfo *
_get_secrets_info_new (NMActRequest *self, gboolean ref_self, NMActRequestSecretsFunc callback, gpointer callback_data)
{
GetSecretsInfo *info;
info = g_slice_new0 (GetSecretsInfo);
info->has_ref = ref_self;
info->self = ref_self ? g_object_ref (self) : self;
info->callback = callback;
info->callback_data = callback_data;
return info;
}
static void static void
_get_secrets_info_free (GetSecretsInfo *info) _get_secrets_call_id_free (NMActRequestGetSecretsCallId *call_id)
{ {
if (info->has_ref) nm_assert (call_id);
g_object_unref (info->self); nm_assert (!c_list_is_linked (&call_id->call_ids_lst));
g_slice_free (GetSecretsInfo, info);
if (call_id->has_ref)
g_object_unref (call_id->self);
g_slice_free (NMActRequestGetSecretsCallId, call_id);
} }
static void static void
@ -129,25 +119,25 @@ get_secrets_cb (NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
{ {
GetSecretsInfo *info = user_data; NMActRequestGetSecretsCallId *call_id = user_data;
NMActRequestPrivate *priv; NMActRequestPrivate *priv;
g_return_if_fail (info && info->call_id == call_id_s); g_return_if_fail (call_id && call_id->call_id == call_id_s);
g_return_if_fail (NM_IS_ACT_REQUEST (info->self)); g_return_if_fail (NM_IS_ACT_REQUEST (call_id->self));
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return; return;
priv = NM_ACT_REQUEST_GET_PRIVATE (info->self); priv = NM_ACT_REQUEST_GET_PRIVATE (call_id->self);
g_return_if_fail (g_slist_find (priv->secrets_calls, info)); nm_assert (c_list_contains (&priv->call_ids_lst_head, &call_id->call_ids_lst));
priv->secrets_calls = g_slist_remove (priv->secrets_calls, info); c_list_unlink_init (&call_id->call_ids_lst);
if (info->callback) if (call_id->callback)
info->callback (info->self, info, connection, error, info->callback_data); call_id->callback (call_id->self, call_id, connection, error, call_id->callback_data);
_get_secrets_info_free (info); _get_secrets_call_id_free (call_id);
} }
/** /**
@ -171,7 +161,7 @@ get_secrets_cb (NMSettingsConnection *connection,
* *
* Returns: a call-id. * Returns: a call-id.
*/ */
NMActRequestGetSecretsCallId NMActRequestGetSecretsCallId *
nm_act_request_get_secrets (NMActRequest *self, nm_act_request_get_secrets (NMActRequest *self,
gboolean ref_self, gboolean ref_self,
const char *setting_name, const char *setting_name,
@ -181,7 +171,7 @@ nm_act_request_get_secrets (NMActRequest *self,
gpointer callback_data) gpointer callback_data)
{ {
NMActRequestPrivate *priv; NMActRequestPrivate *priv;
GetSecretsInfo *info; NMActRequestGetSecretsCallId *call_id;
NMSettingsConnectionCallId call_id_s; NMSettingsConnectionCallId call_id_s;
NMSettingsConnection *settings_connection; NMSettingsConnection *settings_connection;
NMConnection *applied_connection; NMConnection *applied_connection;
@ -194,9 +184,12 @@ nm_act_request_get_secrets (NMActRequest *self,
settings_connection = nm_act_request_get_settings_connection (self); settings_connection = nm_act_request_get_settings_connection (self);
applied_connection = nm_act_request_get_applied_connection (self); applied_connection = nm_act_request_get_applied_connection (self);
info = _get_secrets_info_new (self, ref_self, callback, callback_data); call_id = g_slice_new0 (NMActRequestGetSecretsCallId);
call_id->has_ref = ref_self;
priv->secrets_calls = g_slist_append (priv->secrets_calls, info); call_id->self = ref_self ? g_object_ref (self) : self;
call_id->callback = callback;
call_id->callback_data = callback_data;
c_list_link_tail (&priv->call_ids_lst_head, &call_id->call_ids_lst);
if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self))) if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self)))
flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED; flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED;
@ -208,32 +201,32 @@ nm_act_request_get_secrets (NMActRequest *self,
flags, flags,
hints, hints,
get_secrets_cb, get_secrets_cb,
info); call_id);
info->call_id = call_id_s; call_id->call_id = call_id_s;
g_return_val_if_fail (call_id_s, NULL); g_return_val_if_fail (call_id_s, NULL);
return info; return call_id;
} }
static void static void
_do_cancel_secrets (NMActRequest *self, GetSecretsInfo *info, gboolean is_disposing) _do_cancel_secrets (NMActRequest *self, NMActRequestGetSecretsCallId *call_id, gboolean is_disposing)
{ {
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self); NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
nm_assert (info && info->self == self); nm_assert (call_id && call_id->self == self);
nm_assert (g_slist_find (priv->secrets_calls, info)); nm_assert (c_list_contains (&priv->call_ids_lst_head, &call_id->call_ids_lst));
priv->secrets_calls = g_slist_remove (priv->secrets_calls, info); c_list_unlink_init (&call_id->call_ids_lst);
nm_settings_connection_cancel_secrets (nm_act_request_get_settings_connection (self), info->call_id); nm_settings_connection_cancel_secrets (nm_act_request_get_settings_connection (self), call_id->call_id);
if (info->callback) { if (call_id->callback) {
gs_free_error GError *error = NULL; gs_free_error GError *error = NULL;
nm_utils_error_set_cancelled (&error, is_disposing, "NMActRequest"); nm_utils_error_set_cancelled (&error, is_disposing, "NMActRequest");
info->callback (self, info, NULL, error, info->callback_data); call_id->callback (self, call_id, NULL, error, call_id->callback_data);
} }
_get_secrets_info_free (info); _get_secrets_call_id_free (call_id);
} }
/** /**
@ -247,7 +240,7 @@ _do_cancel_secrets (NMActRequest *self, GetSecretsInfo *info, gboolean is_dispos
* synchronously. * synchronously.
*/ */
void void
nm_act_request_cancel_secrets (NMActRequest *self, NMActRequestGetSecretsCallId call_id) nm_act_request_cancel_secrets (NMActRequest *self, NMActRequestGetSecretsCallId *call_id)
{ {
NMActRequestPrivate *priv; NMActRequestPrivate *priv;
@ -264,7 +257,7 @@ nm_act_request_cancel_secrets (NMActRequest *self, NMActRequestGetSecretsCallId
priv = NM_ACT_REQUEST_GET_PRIVATE (self); priv = NM_ACT_REQUEST_GET_PRIVATE (self);
if (!g_slist_find (priv->secrets_calls, call_id)) if (!c_list_is_linked (&call_id->call_ids_lst))
g_return_if_reached (); g_return_if_reached ();
_do_cancel_secrets (self, call_id, FALSE); _do_cancel_secrets (self, call_id, FALSE);
@ -537,6 +530,9 @@ get_property (GObject *object, guint prop_id,
static void static void
nm_act_request_init (NMActRequest *req) nm_act_request_init (NMActRequest *req)
{ {
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req);
c_list_init (&priv->call_ids_lst_head);
} }
/** /**
@ -582,10 +578,11 @@ dispose (GObject *object)
{ {
NMActRequest *self = NM_ACT_REQUEST (object); NMActRequest *self = NM_ACT_REQUEST (object);
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self); NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
NMActRequestGetSecretsCallId *call_id, *call_id_safe;
/* Kill any in-progress secrets requests */ /* Kill any in-progress secrets requests */
while (priv->secrets_calls) c_list_for_each_entry_safe (call_id, call_id_safe, &priv->call_ids_lst_head, call_ids_lst)
_do_cancel_secrets (self, priv->secrets_calls->data, TRUE); _do_cancel_secrets (self, call_id, TRUE);
/* Clear any share rules */ /* Clear any share rules */
if (priv->share_rules) { if (priv->share_rules) {

View file

@ -32,7 +32,7 @@
#define NM_ACT_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACT_REQUEST, NMActRequestClass)) #define NM_ACT_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACT_REQUEST, NMActRequestClass))
struct _NMActRequestGetSecretsCallId; struct _NMActRequestGetSecretsCallId;
typedef struct _NMActRequestGetSecretsCallId *NMActRequestGetSecretsCallId; typedef struct _NMActRequestGetSecretsCallId NMActRequestGetSecretsCallId;
GType nm_act_request_get_type (void); GType nm_act_request_get_type (void);
@ -58,20 +58,20 @@ void nm_act_request_add_share_rule (NMActRequest *req,
/* Secrets handling */ /* Secrets handling */
typedef void (*NMActRequestSecretsFunc) (NMActRequest *req, typedef void (*NMActRequestSecretsFunc) (NMActRequest *req,
NMActRequestGetSecretsCallId call_id, NMActRequestGetSecretsCallId *call_id,
NMSettingsConnection *connection, NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data); gpointer user_data);
NMActRequestGetSecretsCallId nm_act_request_get_secrets (NMActRequest *req, NMActRequestGetSecretsCallId *nm_act_request_get_secrets (NMActRequest *req,
gboolean take_ref, gboolean take_ref,
const char *setting_name, const char *setting_name,
NMSecretAgentGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
const char *hint, const char *hint,
NMActRequestSecretsFunc callback, NMActRequestSecretsFunc callback,
gpointer callback_data); gpointer callback_data);
void nm_act_request_cancel_secrets (NMActRequest *req, NMActRequestGetSecretsCallId call_id); void nm_act_request_cancel_secrets (NMActRequest *req, NMActRequestGetSecretsCallId *call_id);
void nm_act_request_clear_secrets (NMActRequest *self); void nm_act_request_clear_secrets (NMActRequest *self);
#endif /* __NM_ACT_REQUEST_H__ */ #endif /* __NM_ACT_REQUEST_H__ */

View file

@ -96,7 +96,7 @@ typedef struct {
NMActRequest *act_req; NMActRequest *act_req;
GDBusMethodInvocation *pending_secrets_context; GDBusMethodInvocation *pending_secrets_context;
NMActRequestGetSecretsCallId secrets_id; NMActRequestGetSecretsCallId *secrets_id;
const char *secrets_setting_name; const char *secrets_setting_name;
guint ppp_watch_id; guint ppp_watch_id;
@ -287,7 +287,7 @@ extract_details_from_connection (NMConnection *connection,
static void static void
ppp_secrets_cb (NMActRequest *req, ppp_secrets_cb (NMActRequest *req,
NMActRequestGetSecretsCallId call_id, NMActRequestGetSecretsCallId *call_id,
NMSettingsConnection *settings_connection, /* unused (we pass NULL here) */ NMSettingsConnection *settings_connection, /* unused (we pass NULL here) */
GError *error, GError *error,
gpointer user_data) gpointer user_data)

View file

@ -170,7 +170,7 @@ struct _NMAgentManagerCallId {
/* Current agent being asked for secrets */ /* Current agent being asked for secrets */
NMSecretAgent *current; NMSecretAgent *current;
NMSecretAgentCallId current_call_id; NMSecretAgentCallId *current_call_id;
/* 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;
@ -832,7 +832,7 @@ out:
static void static void
_con_get_request_done (NMSecretAgent *agent, _con_get_request_done (NMSecretAgent *agent,
NMSecretAgentCallId call_id, NMSecretAgentCallId *call_id,
GVariant *secrets, GVariant *secrets,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
@ -1276,7 +1276,7 @@ nm_agent_manager_cancel_secrets (NMAgentManager *self,
static void static void
_con_save_request_done (NMSecretAgent *agent, _con_save_request_done (NMSecretAgent *agent,
NMSecretAgentCallId call_id, NMSecretAgentCallId *call_id,
GVariant *secrets, GVariant *secrets,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
@ -1362,7 +1362,7 @@ nm_agent_manager_save_secrets (NMAgentManager *self,
static void static void
_con_del_request_done (NMSecretAgent *agent, _con_del_request_done (NMSecretAgent *agent,
NMSecretAgentCallId call_id, NMSecretAgentCallId *call_id,
GVariant *secrets, GVariant *secrets,
GError *error, GError *error,
gpointer user_data) gpointer user_data)

View file

@ -118,9 +118,7 @@ struct _NMSecretAgentCallId {
gpointer callback_data; gpointer callback_data;
}; };
typedef struct _NMSecretAgentCallId Request; static NMSecretAgentCallId *
static Request *
request_new (NMSecretAgent *self, request_new (NMSecretAgent *self,
const char *dbus_command, /* this must be a static string. */ const char *dbus_command, /* this must be a static string. */
const char *path, const char *path,
@ -128,9 +126,9 @@ request_new (NMSecretAgent *self,
NMSecretAgentCallback callback, NMSecretAgentCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
Request *r; NMSecretAgentCallId *r;
r = g_slice_new0 (Request); r = g_slice_new0 (NMSecretAgentCallId);
r->agent = self; r->agent = self;
r->path = g_strdup (path); r->path = g_strdup (path);
r->setting_name = g_strdup (setting_name); r->setting_name = g_strdup (setting_name);
@ -146,7 +144,7 @@ request_new (NMSecretAgent *self,
#define request_new(self,dbus_command,path,setting_name,callback,callback_data) request_new(self,""dbus_command"",path,setting_name,callback,callback_data) #define request_new(self,dbus_command,path,setting_name,callback,callback_data) request_new(self,""dbus_command"",path,setting_name,callback,callback_data)
static void static void
request_free (Request *r) request_free (NMSecretAgentCallId *r)
{ {
NMSecretAgent *self = r->agent; NMSecretAgent *self = r->agent;
@ -156,11 +154,11 @@ request_free (Request *r)
g_free (r->setting_name); g_free (r->setting_name);
if (r->cancellable) if (r->cancellable)
g_object_unref (r->cancellable); g_object_unref (r->cancellable);
g_slice_free (Request, r); g_slice_free (NMSecretAgentCallId, r);
} }
static gboolean static gboolean
request_check_return (Request *r) request_check_return (NMSecretAgentCallId *r)
{ {
if (!r->cancellable) if (!r->cancellable)
return FALSE; return FALSE;
@ -336,7 +334,7 @@ get_callback (GObject *proxy,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
Request *r = user_data; NMSecretAgentCallId *r = user_data;
if (request_check_return (r)) { if (request_check_return (r)) {
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent); NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent);
@ -352,7 +350,7 @@ get_callback (GObject *proxy,
request_free (r); request_free (r);
} }
NMSecretAgentCallId NMSecretAgentCallId *
nm_secret_agent_get_secrets (NMSecretAgent *self, nm_secret_agent_get_secrets (NMSecretAgent *self,
const char *path, const char *path,
NMConnection *connection, NMConnection *connection,
@ -365,7 +363,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
NMSecretAgentPrivate *priv; NMSecretAgentPrivate *priv;
static const char *no_hints[] = { NULL }; static const char *no_hints[] = { NULL };
GVariant *dict; GVariant *dict;
Request *r; NMSecretAgentCallId *r;
g_return_val_if_fail (NM_IS_SECRET_AGENT (self), NULL); g_return_val_if_fail (NM_IS_SECRET_AGENT (self), NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
@ -418,7 +416,7 @@ cancel_done (GObject *proxy, GAsyncResult *result, gpointer user_data)
} }
static void static void
do_cancel_secrets (NMSecretAgent *self, Request *r, gboolean disposing) do_cancel_secrets (NMSecretAgent *self, NMSecretAgentCallId *r, gboolean disposing)
{ {
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self); NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
GCancellable *cancellable; GCancellable *cancellable;
@ -474,9 +472,9 @@ do_cancel_secrets (NMSecretAgent *self, Request *r, gboolean disposing)
* callback before nm_secret_agent_cancel_secrets() returns. * callback before nm_secret_agent_cancel_secrets() returns.
*/ */
void void
nm_secret_agent_cancel_secrets (NMSecretAgent *self, NMSecretAgentCallId call_id) nm_secret_agent_cancel_secrets (NMSecretAgent *self, NMSecretAgentCallId *call_id)
{ {
Request *r = call_id; NMSecretAgentCallId *r = call_id;
g_return_if_fail (NM_IS_SECRET_AGENT (self)); g_return_if_fail (NM_IS_SECRET_AGENT (self));
g_return_if_fail (r); g_return_if_fail (r);
@ -496,7 +494,7 @@ agent_save_cb (GObject *proxy,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
Request *r = user_data; NMSecretAgentCallId *r = user_data;
if (request_check_return (r)) { if (request_check_return (r)) {
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent); NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent);
@ -511,7 +509,7 @@ agent_save_cb (GObject *proxy,
request_free (r); request_free (r);
} }
NMSecretAgentCallId NMSecretAgentCallId *
nm_secret_agent_save_secrets (NMSecretAgent *self, nm_secret_agent_save_secrets (NMSecretAgent *self,
const char *path, const char *path,
NMConnection *connection, NMConnection *connection,
@ -520,7 +518,7 @@ nm_secret_agent_save_secrets (NMSecretAgent *self,
{ {
NMSecretAgentPrivate *priv; NMSecretAgentPrivate *priv;
GVariant *dict; GVariant *dict;
Request *r; NMSecretAgentCallId *r;
g_return_val_if_fail (NM_IS_SECRET_AGENT (self), NULL); g_return_val_if_fail (NM_IS_SECRET_AGENT (self), NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
@ -548,7 +546,7 @@ agent_delete_cb (GObject *proxy,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
Request *r = user_data; NMSecretAgentCallId *r = user_data;
if (request_check_return (r)) { if (request_check_return (r)) {
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent); NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent);
@ -563,7 +561,7 @@ agent_delete_cb (GObject *proxy,
request_free (r); request_free (r);
} }
NMSecretAgentCallId NMSecretAgentCallId *
nm_secret_agent_delete_secrets (NMSecretAgent *self, nm_secret_agent_delete_secrets (NMSecretAgent *self,
const char *path, const char *path,
NMConnection *connection, NMConnection *connection,
@ -572,7 +570,7 @@ nm_secret_agent_delete_secrets (NMSecretAgent *self,
{ {
NMSecretAgentPrivate *priv; NMSecretAgentPrivate *priv;
GVariant *dict; GVariant *dict;
Request *r; NMSecretAgentCallId *r;
g_return_val_if_fail (NM_IS_SECRET_AGENT (self), NULL); g_return_val_if_fail (NM_IS_SECRET_AGENT (self), NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
@ -769,7 +767,7 @@ dispose (GObject *object)
again: again:
c_list_for_each (iter, &priv->requests) { c_list_for_each (iter, &priv->requests) {
c_list_unlink_init (iter); c_list_unlink_init (iter);
do_cancel_secrets (self, c_list_entry (iter, Request, lst), TRUE); do_cancel_secrets (self, c_list_entry (iter, NMSecretAgentCallId, lst), TRUE);
goto again; goto again;
} }

View file

@ -33,8 +33,7 @@
#define NM_SECRET_AGENT_DISCONNECTED "disconnected" #define NM_SECRET_AGENT_DISCONNECTED "disconnected"
typedef struct _NMSecretAgentClass NMSecretAgentClass; typedef struct _NMSecretAgentClass NMSecretAgentClass;
typedef struct _NMSecretAgentCallId NMSecretAgentCallId;
typedef struct _NMSecretAgentCallId *NMSecretAgentCallId;
GType nm_secret_agent_get_type (void); GType nm_secret_agent_get_type (void);
@ -67,12 +66,12 @@ gboolean nm_secret_agent_has_permission (NMSecretAgent *agent,
const char *permission); const char *permission);
typedef void (*NMSecretAgentCallback) (NMSecretAgent *agent, typedef void (*NMSecretAgentCallback) (NMSecretAgent *agent,
NMSecretAgentCallId call_id, NMSecretAgentCallId *call_id,
GVariant *new_secrets, /* NULL for save & delete */ GVariant *new_secrets, /* NULL for save & delete */
GError *error, GError *error,
gpointer user_data); gpointer user_data);
NMSecretAgentCallId nm_secret_agent_get_secrets (NMSecretAgent *agent, NMSecretAgentCallId *nm_secret_agent_get_secrets (NMSecretAgent *agent,
const char *path, const char *path,
NMConnection *connection, NMConnection *connection,
const char *setting_name, const char *setting_name,
@ -82,18 +81,18 @@ NMSecretAgentCallId nm_secret_agent_get_secrets (NMSecretAgent *agent,
gpointer callback_data); gpointer callback_data);
void nm_secret_agent_cancel_secrets (NMSecretAgent *agent, void nm_secret_agent_cancel_secrets (NMSecretAgent *agent,
NMSecretAgentCallId call_id); NMSecretAgentCallId *call_id);
NMSecretAgentCallId nm_secret_agent_save_secrets (NMSecretAgent *agent, NMSecretAgentCallId *nm_secret_agent_save_secrets (NMSecretAgent *agent,
const char *path, const char *path,
NMConnection *connection, NMConnection *connection,
NMSecretAgentCallback callback, NMSecretAgentCallback callback,
gpointer callback_data); gpointer callback_data);
NMSecretAgentCallId nm_secret_agent_delete_secrets (NMSecretAgent *agent, NMSecretAgentCallId *nm_secret_agent_delete_secrets (NMSecretAgent *agent,
const char *path, const char *path,
NMConnection *connection, NMConnection *connection,
NMSecretAgentCallback callback, NMSecretAgentCallback callback,
gpointer callback_data); gpointer callback_data);
#endif /* __NETWORKMANAGER_SECRET_AGENT_H__ */ #endif /* __NETWORKMANAGER_SECRET_AGENT_H__ */