File nm-remove-ppp-dbus-interface.patch of Package NetworkManager
commit 6339f974bba40925440b32dc88fd2a9e604e48aa
Author: Dan Williams <dcbw@redhat.com>
Date: Thu Feb 5 06:05:10 2009 -0500
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.
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index 0a9c951..92e3b3c 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -135,12 +135,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;
@@ -150,36 +149,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;
- }
+ connection = nm_dbus_manager_get_connection (priv->dbus_manager);
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/PPP/%d", counter++);
dbus_g_connection_register_g_object (connection, priv->dbus_path, object);
diff --git a/src/ppp-manager/nm-pppd-plugin.c b/src/ppp-manager/nm-pppd-plugin.c
index fcc7a03..ddde0a4 100644
--- a/src/ppp-manager/nm-pppd-plugin.c
+++ b/src/ppp-manager/nm-pppd-plugin.c
@@ -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);
diff --git a/src/ppp-manager/nm-pppd-plugin.h b/src/ppp-manager/nm-pppd-plugin.h
index b2acd5e..95a2a18 100644
--- a/src/ppp-manager/nm-pppd-plugin.h
+++ b/src/ppp-manager/nm-pppd-plugin.h
@@ -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"