include: drop nm-settings-flags.h, move NMSecretAgentGetSecretsFlags

For some reason, the flags used by o.fd.NM.SecretAgent.GetSecrets were
defined as both NMSecretAgentGetSecretsFlags in
libnm{,-glib}/nm-secret-agent.h, and then separately as
NMSettingsGetSecretsFlags in include/nm-settings-flags.h.
(NMSettingsGetSecretsFlags also had an additional internal-use-only
value, but that was added later after the duplication already
existed.)

Fix this by moving NMSecretAgentGetSecretsFlags from libnm to
nm-dbus-interface.h, adding the internal-use-only value to it as well,
updating the core code to use that, and then removing
nm-settings-flags.h.
This commit is contained in:
Dan Winship
2014-07-07 10:11:46 -04:00
parent 9a930b3e89
commit dc1b76432b
18 changed files with 73 additions and 107 deletions

View File

@@ -4,7 +4,6 @@ EXTRA_DIST = \
nm-glib-compat.h \ nm-glib-compat.h \
nm-gvaluearray-compat.h \ nm-gvaluearray-compat.h \
nm-test-utils.h \ nm-test-utils.h \
nm-settings-flags.h \
nm-utils-internal.h nm-utils-internal.h
CLEANFILES=nm-version.h CLEANFILES=nm-version.h

View File

@@ -1,37 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright 2011 Red Hat, Inc.
*/
#ifndef NM_SETTINGS_FLAGS_H
#define NM_SETTINGS_FLAGS_H
/* NOTE: these values should match the NM_SECRET_AGENT_GET_SECRETS_FLAGS in
* the nm-secret-agent.xml introspection file; except ONLY_SYSTEM which is
* internal to NM.
*/
typedef enum {
NM_SETTINGS_GET_SECRETS_FLAG_NONE = 0x0,
NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION = 0x1,
NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW = 0x2,
NM_SETTINGS_GET_SECRETS_FLAG_USER_REQUESTED = 0x4,
/* Internal only to NM */
NM_SETTINGS_GET_SECRETS_FLAG_ONLY_SYSTEM = 0x80000000
} NMSettingsGetSecretsFlags;
#endif /* NM_SETTINGS_FLAGS_H */

View File

@@ -555,4 +555,37 @@ typedef enum {
NM_ACTIVE_CONNECTION_STATE_DEACTIVATED NM_ACTIVE_CONNECTION_STATE_DEACTIVATED
} NMActiveConnectionState; } NMActiveConnectionState;
/**
* NMSecretAgentGetSecretsFlags:
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE: no special behavior; by default no
* user interaction is allowed and requests for secrets are fulfilled from
* persistent storage, or if no secrets are available an error is returned.
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION: allows the request to
* interact with the user, possibly prompting via UI for secrets if any are
* required, or if none are found in persistent storage.
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW: explicitly prompt for new
* secrets from the user. This flag signals that NetworkManager thinks any
* existing secrets are invalid or wrong. This flag implies that interaction
* is allowed.
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED: set if the request was
* initiated by user-requested action via the D-Bus interface, as opposed to
* automatically initiated by NetworkManager in response to (for example) scan
* results or carrier changes.
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM: (Internal flag, not part of
* the D-Bus API.)
*
* #NMSecretAgentGetSecretsFlags values modify the behavior of a GetSecrets request.
*
* (Corresponds to the NM_SECRET_AGENT_GET_SECRETS_FLAGS type in nm-secret-agent.xml.)
*/
typedef enum { /*< flags >*/
NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE = 0x0,
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION = 0x1,
NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW = 0x2,
NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED = 0x4,
/* Internal to NM; not part of the D-Bus API */
NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM = 0x80000000
} NMSecretAgentGetSecretsFlags;
#endif /* NETWORK_MANAGER_H */ #endif /* NETWORK_MANAGER_H */

View File

@@ -741,6 +741,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
g_return_if_fail (nm_connection_get_path (connection)); g_return_if_fail (nm_connection_get_path (connection));
g_return_if_fail (setting_name != NULL); g_return_if_fail (setting_name != NULL);
g_return_if_fail (strlen (setting_name) > 0); g_return_if_fail (strlen (setting_name) > 0);
g_return_if_fail (!(flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM));
g_return_if_fail (callback != NULL); g_return_if_fail (callback != NULL);
NM_SECRET_AGENT_GET_CLASS (self)->get_secrets (self, NM_SECRET_AGENT_GET_CLASS (self)->get_secrets (self,

View File

@@ -73,32 +73,6 @@ typedef enum /*< flags >*/ {
NM_SECRET_AGENT_CAPABILITY_LAST = NM_SECRET_AGENT_CAPABILITY_VPN_HINTS NM_SECRET_AGENT_CAPABILITY_LAST = NM_SECRET_AGENT_CAPABILITY_VPN_HINTS
} NMSecretAgentCapabilities; } NMSecretAgentCapabilities;
/**
* NMSecretAgentGetSecretsFlags:
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE: no special behavior; by default no
* user interaction is allowed and requests for secrets are fulfilled from
* persistent storage, or if no secrets are available an error is returned.
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION: allows the request to
* interact with the user, possibly prompting via UI for secrets if any are
* required, or if none are found in persistent storage.
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW: explicitly prompt for new
* secrets from the user. This flag signals that NetworkManager thinks any
* existing secrets are invalid or wrong. This flag implies that interaction
* is allowed.
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED: set if the request was
* initiated by user-requested action via the D-Bus interface, as opposed to
* automatically initiated by NetworkManager in response to (for example) scan
* results or carrier changes.
*
* #NMSecretAgentGetSecretsFlags values modify the behavior of a GetSecrets request.
*/
typedef enum /*< flags >*/ {
NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE = 0x0,
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION = 0x1,
NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW = 0x2,
NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED = 0x4
} NMSecretAgentGetSecretsFlags;
#define NM_TYPE_SECRET_AGENT (nm_secret_agent_get_type ()) #define NM_TYPE_SECRET_AGENT (nm_secret_agent_get_type ())
#define NM_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgent)) #define NM_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgent))
#define NM_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SECRET_AGENT, NMSecretAgentClass)) #define NM_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SECRET_AGENT, NMSecretAgentClass))

View File

@@ -646,7 +646,7 @@ link_timeout_cb (gpointer user_data)
nm_device_state_changed (dev, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT); nm_device_state_changed (dev, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT);
nm_act_request_get_secrets (req, nm_act_request_get_secrets (req,
setting_name, setting_name,
NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW, NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW,
NULL, NULL,
wired_secrets_cb, wired_secrets_cb,
self); self);
@@ -826,10 +826,10 @@ handle_auth_or_fail (NMDeviceEthernet *self,
nm_connection_clear_secrets (connection); nm_connection_clear_secrets (connection);
setting_name = nm_connection_need_secrets (connection, NULL); setting_name = nm_connection_need_secrets (connection, NULL);
if (setting_name) { if (setting_name) {
NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION; NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
if (new_secrets) if (new_secrets)
flags |= NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW; flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
nm_act_request_get_secrets (req, setting_name, flags, NULL, wired_secrets_cb, self); nm_act_request_get_secrets (req, setting_name, flags, NULL, wired_secrets_cb, self);
g_object_set_data (G_OBJECT (connection), WIRED_SECRETS_TRIES, GUINT_TO_POINTER (++tries)); g_object_set_data (G_OBJECT (connection), WIRED_SECRETS_TRIES, GUINT_TO_POINTER (++tries));

View File

@@ -2167,8 +2167,8 @@ handle_8021x_or_psk_auth_fail (NMDeviceWifi *self,
nm_device_state_changed (device, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT); nm_device_state_changed (device, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT);
nm_act_request_get_secrets (req, nm_act_request_get_secrets (req,
setting_name, setting_name,
NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
| NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW, | NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW,
NULL, NULL,
wifi_secrets_cb, wifi_secrets_cb,
self); self);
@@ -2396,10 +2396,10 @@ handle_auth_or_fail (NMDeviceWifi *self,
nm_connection_clear_secrets (connection); nm_connection_clear_secrets (connection);
setting_name = nm_connection_need_secrets (connection, NULL); setting_name = nm_connection_need_secrets (connection, NULL);
if (setting_name) { if (setting_name) {
NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION; NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
if (new_secrets) if (new_secrets)
flags |= NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW; flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
nm_act_request_get_secrets (req, setting_name, flags, NULL, wifi_secrets_cb, self); nm_act_request_get_secrets (req, setting_name, flags, NULL, wifi_secrets_cb, self);
g_object_set_data (G_OBJECT (connection), WIRELESS_SECRETS_TRIES, GUINT_TO_POINTER (++tries)); g_object_set_data (G_OBJECT (connection), WIRELESS_SECRETS_TRIES, GUINT_TO_POINTER (++tries));

View File

@@ -727,12 +727,12 @@ nm_modem_get_secrets (NMModem *self,
const char *hint) const char *hint)
{ {
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION; NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
cancel_get_secrets (self); cancel_get_secrets (self);
if (request_new) if (request_new)
flags |= NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW; flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
priv->secrets_id = nm_act_request_get_secrets (priv->act_request, priv->secrets_id = nm_act_request_get_secrets (priv->act_request,
setting_name, setting_name,
flags, flags,
@@ -765,7 +765,7 @@ nm_modem_act_stage1_prepare (NMModem *self,
NMActStageReturn ret; NMActStageReturn ret;
GPtrArray *hints = NULL; GPtrArray *hints = NULL;
const char *setting_name = NULL; const char *setting_name = NULL;
NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION; NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
NMConnection *connection; NMConnection *connection;
if (priv->act_request) if (priv->act_request)
@@ -784,7 +784,7 @@ nm_modem_act_stage1_prepare (NMModem *self,
/* Secrets required... */ /* Secrets required... */
if (priv->secrets_tries++) if (priv->secrets_tries++)
flags |= NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW; flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
priv->secrets_id = nm_act_request_get_secrets (req, priv->secrets_id = nm_act_request_get_secrets (req,
setting_name, setting_name,

View File

@@ -106,7 +106,7 @@ get_secrets_cb (NMSettingsConnection *connection,
guint32 guint32
nm_act_request_get_secrets (NMActRequest *self, nm_act_request_get_secrets (NMActRequest *self,
const char *setting_name, const char *setting_name,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
const char *hint, const char *hint,
NMActRequestSecretsFunc callback, NMActRequestSecretsFunc callback,
gpointer callback_data) gpointer callback_data)
@@ -128,7 +128,7 @@ nm_act_request_get_secrets (NMActRequest *self,
info->callback_data = callback_data; info->callback_data = callback_data;
if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self))) if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self)))
flags |= NM_SETTINGS_GET_SECRETS_FLAG_USER_REQUESTED; flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED;
connection = nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (self)); connection = nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (self));
call_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (connection), call_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (connection),

View File

@@ -27,7 +27,6 @@
#include "nm-types.h" #include "nm-types.h"
#include "nm-connection.h" #include "nm-connection.h"
#include "nm-active-connection.h" #include "nm-active-connection.h"
#include "nm-settings-flags.h"
#define NM_TYPE_ACT_REQUEST (nm_act_request_get_type ()) #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)) #define NM_ACT_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ACT_REQUEST, NMActRequest))
@@ -72,7 +71,7 @@ typedef void (*NMActRequestSecretsFunc) (NMActRequest *req,
guint32 nm_act_request_get_secrets (NMActRequest *req, guint32 nm_act_request_get_secrets (NMActRequest *req,
const char *setting_name, const char *setting_name,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
const char *hint, const char *hint,
NMActRequestSecretsFunc callback, NMActRequestSecretsFunc callback,
gpointer callback_data); gpointer callback_data);

View File

@@ -466,7 +466,7 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
guint32 tries; guint32 tries;
GPtrArray *hints = NULL; GPtrArray *hints = NULL;
GError *error = NULL; GError *error = NULL;
NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION; NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
connection = nm_act_request_get_connection (priv->act_req); connection = nm_act_request_get_connection (priv->act_req);
@@ -492,7 +492,7 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
*/ */
tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), PPP_MANAGER_SECRET_TRIES)); tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), PPP_MANAGER_SECRET_TRIES));
if (tries > 1) if (tries > 1)
flags |= NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW; flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
priv->secrets_id = nm_act_request_get_secrets (priv->act_req, priv->secrets_id = nm_act_request_get_secrets (priv->act_req,
priv->secrets_setting_name, priv->secrets_setting_name,

View File

@@ -673,7 +673,7 @@ request_start (gpointer user_data)
typedef struct { typedef struct {
Request parent; Request parent;
NMSettingsGetSecretsFlags flags; NMSecretAgentGetSecretsFlags flags;
NMConnection *connection; NMConnection *connection;
char *setting_name; char *setting_name;
char **hints; char **hints;
@@ -733,7 +733,7 @@ connection_request_new_get (NMConnection *connection,
GHashTable *existing_secrets, GHashTable *existing_secrets,
const char *setting_name, const char *setting_name,
const char *verb, const char *verb,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
const char **hints, const char **hints,
NMAgentSecretsResultFunc callback, NMAgentSecretsResultFunc callback,
gpointer callback_data, gpointer callback_data,
@@ -1036,7 +1036,7 @@ get_next_cb (Request *parent)
* secrets to the agent. We shouldn't leak system-owned secrets to * secrets to the agent. We shouldn't leak system-owned secrets to
* unprivileged users. * unprivileged users.
*/ */
if ( (req->flags != NM_SETTINGS_GET_SECRETS_FLAG_NONE) if ( (req->flags != NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)
&& (req->existing_secrets || has_system_secrets (req->connection))) { && (req->existing_secrets || has_system_secrets (req->connection))) {
nm_log_dbg (LOGD_AGENTS, "(%p/%s/%s) request has system secrets; checking agent %s for MODIFY", nm_log_dbg (LOGD_AGENTS, "(%p/%s/%s) request has system secrets; checking agent %s for MODIFY",
req, parent->detail, req->setting_name, agent_dbus_owner); req, parent->detail, req->setting_name, agent_dbus_owner);
@@ -1084,7 +1084,7 @@ get_start (gpointer user_data)
if (setting_secrets && g_hash_table_size (setting_secrets)) { if (setting_secrets && g_hash_table_size (setting_secrets)) {
NMConnection *tmp; NMConnection *tmp;
GError *error = NULL; GError *error = NULL;
gboolean new_secrets = (req->flags & NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW); gboolean new_secrets = (req->flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW);
/* The connection already had secrets; check if any more are required. /* The connection already had secrets; check if any more are required.
* If no more are required, we're done. If secrets are still needed, * If no more are required, we're done. If secrets are still needed,
@@ -1099,7 +1099,7 @@ get_start (gpointer user_data)
g_clear_error (&error); g_clear_error (&error);
} else { } else {
/* Do we have everything we need? */ /* Do we have everything we need? */
if ( (req->flags & NM_SETTINGS_GET_SECRETS_FLAG_ONLY_SYSTEM) if ( (req->flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM)
|| ((nm_connection_need_secrets (tmp, NULL) == NULL) && (new_secrets == FALSE))) { || ((nm_connection_need_secrets (tmp, NULL) == NULL) && (new_secrets == FALSE))) {
nm_log_dbg (LOGD_AGENTS, "(%p/%s/%s) system settings secrets sufficient", nm_log_dbg (LOGD_AGENTS, "(%p/%s/%s) system settings secrets sufficient",
req, parent->detail, req->setting_name); req, parent->detail, req->setting_name);
@@ -1171,7 +1171,7 @@ nm_agent_manager_get_secrets (NMAgentManager *self,
NMAuthSubject *subject, NMAuthSubject *subject,
GHashTable *existing_secrets, GHashTable *existing_secrets,
const char *setting_name, const char *setting_name,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
const char **hints, const char **hints,
NMAgentSecretsResultFunc callback, NMAgentSecretsResultFunc callback,
gpointer callback_data, gpointer callback_data,
@@ -1217,7 +1217,7 @@ nm_agent_manager_get_secrets (NMAgentManager *self,
g_hash_table_insert (priv->requests, GUINT_TO_POINTER (parent->reqid), req); g_hash_table_insert (priv->requests, GUINT_TO_POINTER (parent->reqid), req);
/* Kick off the request */ /* Kick off the request */
if (!(req->flags & NM_SETTINGS_GET_SECRETS_FLAG_ONLY_SYSTEM)) if (!(req->flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM))
request_add_agents (self, parent); request_add_agents (self, parent);
parent->idle_id = g_idle_add (get_start, req); parent->idle_id = g_idle_add (get_start, req);
return parent->reqid; return parent->reqid;

View File

@@ -24,7 +24,6 @@
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
#include <nm-connection.h> #include <nm-connection.h>
#include "nm-settings-flags.h"
#include "nm-secret-agent.h" #include "nm-secret-agent.h"
#include "nm-types.h" #include "nm-types.h"
@@ -68,7 +67,7 @@ typedef void (*NMAgentSecretsResultFunc) (NMAgentManager *manager,
const char *agent_uname, const char *agent_uname,
gboolean agent_has_modify, gboolean agent_has_modify,
const char *setting_name, const char *setting_name,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
GHashTable *secrets, GHashTable *secrets,
GError *error, GError *error,
gpointer user_data, gpointer user_data,
@@ -80,7 +79,7 @@ guint32 nm_agent_manager_get_secrets (NMAgentManager *manager,
NMAuthSubject *subject, NMAuthSubject *subject,
GHashTable *existing_secrets, GHashTable *existing_secrets,
const char *setting_name, const char *setting_name,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
const char **hints, const char **hints,
NMAgentSecretsResultFunc callback, NMAgentSecretsResultFunc callback,
gpointer callback_data, gpointer callback_data,

View File

@@ -277,7 +277,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
NMConnection *connection, NMConnection *connection,
const char *setting_name, const char *setting_name,
const char **hints, const char **hints,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
NMSecretAgentCallback callback, NMSecretAgentCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
@@ -295,7 +295,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL); hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ALL);
/* Mask off the private ONLY_SYSTEM flag if present */ /* Mask off the private ONLY_SYSTEM flag if present */
flags &= ~NM_SETTINGS_GET_SECRETS_FLAG_ONLY_SYSTEM; flags &= ~NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM;
r = request_new (self, nm_connection_get_path (connection), setting_name, callback, callback_data); r = request_new (self, nm_connection_get_path (connection), setting_name, callback, callback_data);
r->call = dbus_g_proxy_begin_call_with_timeout (priv->proxy, r->call = dbus_g_proxy_begin_call_with_timeout (priv->proxy,

View File

@@ -28,7 +28,6 @@
#include <nm-connection.h> #include <nm-connection.h>
#include "nm-types.h" #include "nm-types.h"
#include "nm-settings-flags.h"
/* NOTE: ensure these capabilities match those in introspection/nm-secret-agent.xml and /* NOTE: ensure these capabilities match those in introspection/nm-secret-agent.xml and
* libnm/nm-secret-agent.h. * libnm/nm-secret-agent.h.
@@ -95,7 +94,7 @@ gconstpointer nm_secret_agent_get_secrets (NMSecretAgent *agent,
NMConnection *connection, NMConnection *connection,
const char *setting_name, const char *setting_name,
const char **hints, const char **hints,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
NMSecretAgentCallback callback, NMSecretAgentCallback callback,
gpointer callback_data); gpointer callback_data);

View File

@@ -714,7 +714,7 @@ agent_secrets_done_cb (NMAgentManager *manager,
const char *agent_username, const char *agent_username,
gboolean agent_has_modify, gboolean agent_has_modify,
const char *setting_name, const char *setting_name,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
GHashTable *secrets, GHashTable *secrets,
GError *error, GError *error,
gpointer user_data, gpointer user_data,
@@ -766,7 +766,7 @@ agent_secrets_done_cb (NMAgentManager *manager,
*/ */
for_each_secret (NM_CONNECTION (self), secrets, has_system_owned_secrets, &agent_had_system); for_each_secret (NM_CONNECTION (self), secrets, has_system_owned_secrets, &agent_had_system);
if (agent_had_system) { if (agent_had_system) {
if (flags == NM_SETTINGS_GET_SECRETS_FLAG_NONE) { if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) {
/* No user interaction was allowed when requesting secrets; the /* No user interaction was allowed when requesting secrets; the
* agent is being bad. Remove system-owned secrets. * agent is being bad. Remove system-owned secrets.
*/ */
@@ -804,7 +804,7 @@ agent_secrets_done_cb (NMAgentManager *manager,
/* If no user interaction was allowed, make sure that no "unsaved" secrets /* If no user interaction was allowed, make sure that no "unsaved" secrets
* came back. Unsaved secrets by definition require user interaction. * came back. Unsaved secrets by definition require user interaction.
*/ */
if (flags == NM_SETTINGS_GET_SECRETS_FLAG_NONE) if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)
for_each_secret (NM_CONNECTION (self), secrets, clear_unsaved_secrets, NULL); for_each_secret (NM_CONNECTION (self), secrets, clear_unsaved_secrets, NULL);
/* Update the connection with our existing secrets from backing storage */ /* Update the connection with our existing secrets from backing storage */
@@ -884,7 +884,7 @@ guint32
nm_settings_connection_get_secrets (NMSettingsConnection *self, nm_settings_connection_get_secrets (NMSettingsConnection *self,
NMAuthSubject *subject, NMAuthSubject *subject,
const char *setting_name, const char *setting_name,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
const char **hints, const char **hints,
NMSettingsConnectionSecretsFunc callback, NMSettingsConnectionSecretsFunc callback,
gpointer callback_data, gpointer callback_data,
@@ -1533,7 +1533,7 @@ dbus_secrets_auth_cb (NMSettingsConnection *self,
call_id = nm_settings_connection_get_secrets (self, call_id = nm_settings_connection_get_secrets (self,
subject, subject,
setting_name, setting_name,
NM_SETTINGS_GET_SECRETS_FLAG_USER_REQUESTED, NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED,
NULL, NULL,
dbus_get_agent_secrets_cb, dbus_get_agent_secrets_cb,
context, context,

View File

@@ -25,7 +25,6 @@
#include <net/ethernet.h> #include <net/ethernet.h>
#include <nm-connection.h> #include <nm-connection.h>
#include "nm-settings-flags.h"
#include "nm-types.h" #include "nm-types.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -110,7 +109,7 @@ typedef void (*NMSettingsConnectionSecretsFunc) (NMSettingsConnection *connectio
guint32 nm_settings_connection_get_secrets (NMSettingsConnection *connection, guint32 nm_settings_connection_get_secrets (NMSettingsConnection *connection,
NMAuthSubject *subject, NMAuthSubject *subject,
const char *setting_name, const char *setting_name,
NMSettingsGetSecretsFlags flags, NMSecretAgentGetSecretsFlags flags,
const char **hints, const char **hints,
NMSettingsConnectionSecretsFunc callback, NMSettingsConnectionSecretsFunc callback,
gpointer callback_data, gpointer callback_data,

View File

@@ -1821,7 +1821,7 @@ get_secrets (NMVpnConnection *self,
const char **hints) const char **hints)
{ {
NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self); NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self);
NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_NONE; NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE;
GError *error = NULL; GError *error = NULL;
g_return_if_fail (secrets_idx < SECRETS_REQ_LAST); g_return_if_fail (secrets_idx < SECRETS_REQ_LAST);
@@ -1834,21 +1834,21 @@ get_secrets (NMVpnConnection *self,
switch (priv->secrets_idx) { switch (priv->secrets_idx) {
case SECRETS_REQ_SYSTEM: case SECRETS_REQ_SYSTEM:
flags = NM_SETTINGS_GET_SECRETS_FLAG_ONLY_SYSTEM; flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ONLY_SYSTEM;
break; break;
case SECRETS_REQ_EXISTING: case SECRETS_REQ_EXISTING:
flags = NM_SETTINGS_GET_SECRETS_FLAG_NONE; flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE;
break; break;
case SECRETS_REQ_NEW: case SECRETS_REQ_NEW:
case SECRETS_REQ_INTERACTIVE: case SECRETS_REQ_INTERACTIVE:
flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION; flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION;
break; break;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
} }
if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self))) if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self)))
flags |= NM_SETTINGS_GET_SECRETS_FLAG_USER_REQUESTED; flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED;
priv->secrets_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (priv->connection), priv->secrets_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (priv->connection),
nm_active_connection_get_subject (NM_ACTIVE_CONNECTION (self)), nm_active_connection_get_subject (NM_ACTIVE_CONNECTION (self)),