ppp: don't require separate bus name for pppd plugin communication

Not actually needed, and actually makes securing the daemon harder
from a D-Bus perspective, since both bus names resolve to the same
unique name anyway, and the unique name is what actually gets
matched on inside dbus.  Suggestion from Colin Walters.
This commit is contained in:
Dan Williams 2009-02-05 06:05:10 -05:00
parent 6f5560f9b7
commit 7c3063faea
4 changed files with 9 additions and 43 deletions

View file

@ -7,9 +7,8 @@
<allow send_destination="org.freedesktop.NetworkManager"/>
<allow send_interface="org.freedesktop.NetworkManager"/>
<allow own="org.freedesktop.NetworkManager.PPP"/>
<allow send_destination="org.freedesktop.NetworkManager.PPP"/>
<allow send_interface="org.freedesktop.NetworkManager.PPP"/>
<allow send_destination="org.freedesktop.NetworkManager"/>
send_interface="org.freedesktop.NetworkManager.PPP"/>
</policy>
<policy at_console="true">
<allow send_destination="org.freedesktop.NetworkManager"/>
@ -20,9 +19,8 @@
<deny send_destination="org.freedesktop.NetworkManager"/>
<deny send_interface="org.freedesktop.NetworkManager"/>
<deny own="org.freedesktop.NetworkManager.PPP"/>
<deny send_destination="org.freedesktop.NetworkManager.PPP"/>
<deny send_interface="org.freedesktop.NetworkManager.PPP"/>
<deny send_destination="org.freedesktop.NetworkManager"/>
send_interface="org.freedesktop.NetworkManager.PPP"/>
</policy>
<limit name="max_replies_per_connection">512</limit>

View file

@ -136,12 +136,11 @@ constructor (GType type,
GObject *object;
NMPPPManagerPrivate *priv;
DBusGConnection *connection;
static gboolean name_requested = FALSE;
static guint32 counter = 0;
object = G_OBJECT_CLASS (nm_ppp_manager_parent_class)->constructor (type,
n_construct_params,
construct_params);
n_construct_params,
construct_params);
if (!object)
return NULL;
@ -151,36 +150,8 @@ constructor (GType type,
g_object_unref (object);
return NULL;
}
connection = nm_dbus_manager_get_connection (priv->dbus_manager);
/* Only need to request bus name the first time */
if (!name_requested) {
DBusGProxy *proxy;
gboolean success;
guint request_name_result;
GError *err = NULL;
proxy = dbus_g_proxy_new_for_name (connection,
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus");
success = dbus_g_proxy_call (proxy, "RequestName", &err,
G_TYPE_STRING, NM_DBUS_SERVICE_PPP,
G_TYPE_UINT, 0,
G_TYPE_INVALID,
G_TYPE_UINT, &request_name_result,
G_TYPE_INVALID);
g_object_unref (proxy);
if (!success) {
nm_warning ("Failed to acquire PPP manager service: %s", err->message);
g_object_unref (object);
return NULL;
}
name_requested = TRUE;
}
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/PPP/%d", counter++);
dbus_g_connection_register_g_object (connection, priv->dbus_path, object);

View file

@ -30,6 +30,7 @@
#include <glib-object.h>
#include <dbus/dbus-glib.h>
#include "NetworkManager.h"
#include "nm-pppd-plugin.h"
#include "nm-ppp-status.h"
#include "nm-dbus-glib-types.h"
@ -319,10 +320,7 @@ plugin_init (void)
/* NM passes in the object path of the corresponding PPPManager
* object as the 'ipparam' argument to pppd.
*/
proxy = dbus_g_proxy_new_for_name (bus,
NM_DBUS_SERVICE_PPP,
ipparam,
NM_DBUS_INTERFACE_PPP);
proxy = dbus_g_proxy_new_for_name (bus, NM_DBUS_SERVICE, ipparam, NM_DBUS_INTERFACE_PPP);
dbus_g_connection_unref (bus);

View file

@ -19,7 +19,6 @@
* Copyright (C) 2008 Red Hat, Inc.
*/
#define NM_DBUS_SERVICE_PPP "org.freedesktop.NetworkManager.PPP"
#define NM_DBUS_INTERFACE_PPP "org.freedesktop.NetworkManager.PPP"
#define NM_PPP_IP4_CONFIG_INTERFACE "interface"