secret-agent: drop unused private-socket code from secret-agent
In the past, we had a private unix socket. That is long gone. Drop the remains in "nm-secret-agent.c". The request here really always comes from the main D-Bus connection. Maybe the private unix socket makes sense and we might resurrect it one day. But at that point it would be an entire rewrite and the existing code is probably not useful either way. Drop it.
This commit is contained in:
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "nm-glib-aux/nm-dbus-aux.h"
|
#include "nm-glib-aux/nm-dbus-aux.h"
|
||||||
#include "nm-dbus-interface.h"
|
#include "nm-dbus-interface.h"
|
||||||
#include "nm-dbus-manager.h"
|
|
||||||
#include "nm-core-internal.h"
|
#include "nm-core-internal.h"
|
||||||
#include "nm-auth-subject.h"
|
#include "nm-auth-subject.h"
|
||||||
#include "nm-simple-connection.h"
|
#include "nm-simple-connection.h"
|
||||||
@@ -51,14 +50,9 @@ typedef struct {
|
|||||||
NMSecretAgentCapabilities capabilities;
|
NMSecretAgentCapabilities capabilities;
|
||||||
GSList *permissions;
|
GSList *permissions;
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
NMDBusManager *bus_mgr;
|
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
CList requests;
|
CList requests;
|
||||||
union {
|
guint on_disconnected_id;
|
||||||
gulong obj_signal;
|
|
||||||
guint dbus_signal;
|
|
||||||
} on_disconnected_id;
|
|
||||||
bool connection_is_private:1;
|
|
||||||
} NMSecretAgentPrivate;
|
} NMSecretAgentPrivate;
|
||||||
|
|
||||||
struct _NMSecretAgent {
|
struct _NMSecretAgent {
|
||||||
@@ -617,33 +611,10 @@ nm_secret_agent_delete_secrets (NMSecretAgent *self,
|
|||||||
static void
|
static void
|
||||||
_on_disconnected_cleanup (NMSecretAgentPrivate *priv)
|
_on_disconnected_cleanup (NMSecretAgentPrivate *priv)
|
||||||
{
|
{
|
||||||
if (priv->connection_is_private) {
|
nm_clear_g_dbus_connection_signal (priv->connection,
|
||||||
nm_clear_g_signal_handler (priv->bus_mgr,
|
&priv->on_disconnected_id);
|
||||||
&priv->on_disconnected_id.obj_signal);
|
|
||||||
} else {
|
|
||||||
nm_clear_g_dbus_connection_signal (priv->connection,
|
|
||||||
&priv->on_disconnected_id.dbus_signal);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_object (&priv->connection);
|
g_clear_object (&priv->connection);
|
||||||
g_clear_object (&priv->proxy);
|
g_clear_object (&priv->proxy);
|
||||||
g_clear_object (&priv->bus_mgr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_on_disconnected_private_connection (NMDBusManager *mgr,
|
|
||||||
GDBusConnection *connection,
|
|
||||||
NMSecretAgent *self)
|
|
||||||
{
|
|
||||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
if (priv->connection != connection)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_LOGt ("private connection disconnected");
|
|
||||||
|
|
||||||
_on_disconnected_cleanup (priv);
|
|
||||||
g_signal_emit (self, signals[DISCONNECTED], 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -693,6 +664,7 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
|
|||||||
char buf_caps[150];
|
char buf_caps[150];
|
||||||
gulong uid;
|
gulong uid;
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
|
gs_free_error GError *error = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (context != NULL, NULL);
|
g_return_val_if_fail (context != NULL, NULL);
|
||||||
g_return_val_if_fail (NM_IS_AUTH_SUBJECT (subject), NULL);
|
g_return_val_if_fail (NM_IS_AUTH_SUBJECT (subject), NULL);
|
||||||
@@ -715,15 +687,12 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
|
|||||||
|
|
||||||
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
||||||
|
|
||||||
priv->bus_mgr = g_object_ref (nm_dbus_manager_get ());
|
|
||||||
priv->connection = g_object_ref (connection);
|
priv->connection = g_object_ref (connection);
|
||||||
priv->connection_is_private = !!nm_dbus_manager_connection_get_private_name (priv->bus_mgr, connection);
|
|
||||||
|
|
||||||
_LOGT ("constructed: %s, owner=%s%s%s (%s), private-connection=%d, unique-name=%s%s%s, capabilities=%s",
|
_LOGT ("constructed: %s, owner=%s%s%s (%s), unique-name=%s%s%s, capabilities=%s",
|
||||||
(description = _create_description (dbus_owner, identifier, uid)),
|
(description = _create_description (dbus_owner, identifier, uid)),
|
||||||
NM_PRINT_FMT_QUOTE_STRING (owner_username),
|
NM_PRINT_FMT_QUOTE_STRING (owner_username),
|
||||||
nm_auth_subject_to_string (subject, buf_subject, sizeof (buf_subject)),
|
nm_auth_subject_to_string (subject, buf_subject, sizeof (buf_subject)),
|
||||||
priv->connection_is_private,
|
|
||||||
NM_PRINT_FMT_QUOTE_STRING (g_dbus_connection_get_unique_name (priv->connection)),
|
NM_PRINT_FMT_QUOTE_STRING (g_dbus_connection_get_unique_name (priv->connection)),
|
||||||
_capabilities_to_string (capabilities, buf_caps, sizeof (buf_caps)));
|
_capabilities_to_string (capabilities, buf_caps, sizeof (buf_caps)));
|
||||||
|
|
||||||
@@ -734,28 +703,29 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
|
|||||||
priv->capabilities = capabilities;
|
priv->capabilities = capabilities;
|
||||||
priv->subject = g_object_ref (subject);
|
priv->subject = g_object_ref (subject);
|
||||||
|
|
||||||
priv->proxy = nm_dbus_manager_new_proxy (priv->bus_mgr,
|
priv->proxy = g_dbus_proxy_new_sync (priv->connection,
|
||||||
priv->connection,
|
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
|
||||||
G_TYPE_DBUS_PROXY,
|
| G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
|
||||||
priv->dbus_owner,
|
NULL,
|
||||||
NM_DBUS_PATH_SECRET_AGENT,
|
priv->dbus_owner,
|
||||||
NM_DBUS_INTERFACE_SECRET_AGENT);
|
NM_DBUS_PATH_SECRET_AGENT,
|
||||||
|
NM_DBUS_INTERFACE_SECRET_AGENT,
|
||||||
/* we cannot subscribe to notify::g-name-owner because that doesn't work
|
NULL,
|
||||||
* for unique names and it doesn't work for private connections. */
|
&error);
|
||||||
if (priv->connection_is_private) {
|
if (!priv->proxy) {
|
||||||
priv->on_disconnected_id.obj_signal = g_signal_connect (priv->bus_mgr,
|
_LOGW ("could not create proxy for %s on connection %s: %s",
|
||||||
NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED,
|
NM_DBUS_INTERFACE_SECRET_AGENT,
|
||||||
G_CALLBACK (_on_disconnected_private_connection),
|
priv->dbus_owner,
|
||||||
self);
|
error->message);
|
||||||
} else {
|
g_clear_error (&error);
|
||||||
priv->on_disconnected_id.dbus_signal = nm_dbus_connection_signal_subscribe_name_owner_changed (priv->connection,
|
|
||||||
priv->dbus_owner,
|
|
||||||
_on_disconnected_name_owner_changed,
|
|
||||||
self,
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv->on_disconnected_id = nm_dbus_connection_signal_subscribe_name_owner_changed (priv->connection,
|
||||||
|
priv->dbus_owner,
|
||||||
|
_on_disconnected_name_owner_changed,
|
||||||
|
self,
|
||||||
|
NULL);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -823,4 +793,3 @@ nm_secret_agent_class_init (NMSecretAgentClass *config_class)
|
|||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user