Proposed PATCH: enable NetworkManager to use static data at boot time

Hello everybody.

I propose the present patch for inclusion in NetworkManager.

With this patch, NM will look for files in
and read network information from them, at startup time. This way, if the
administrator puts a file there, he may have network at boot time and may share
networks between users without exposing the secret key. The target audience of
NM, however, will never know such a functionnality exists and this patch won't
change anything for them.

So: big advantage for power users, and zero disadvantage for other users. How
to refuse the patch ?

A configuration file in /var/cache/NetworkManager/system/wireless looks like

# the name of the file is not important, except that it must end with
# .conf

# 			essid: required field
essid = my_ap
#			 timestamp, as in: date +"%s"
timestamp = 1130490970
#			addresses, of the form xx:xx:xx:xx:xx:xx
#			put multiple addresses lines if you need
addresses = 00:01:02:03:04:05
addresses = 06:07:08:09:0a:0b
#			auth_method, one of "unknown", "none",
#			"open_system", "shared_key", "wpa_psk". You can
#			also give a numerical constant (unknown=0, etc.)
auth_method = open_systen
#			key_type, one of "unknown", "none",
#			hexa, ascii or passphrase. Numerical constant are
#			also possible.
key_type = passphrase
#			key. Verrrry secret. Use quote if there are
#			spaces
key = "This is not actually my real key"

(end of example file). As you see, one cannot do simpler. (Writing a parser was
a nice exercise...)

The patch itself is

--- NetworkManager.c.orig	2005-10-26 21:34:36.000000000 +0200
+++ NetworkManager.c	2005-10-28 11:36:30.000000000 +0200
@@ -48,6 +48,7 @@
 #include "nm-dbus-vpn.h"
 #include "nm-netlink-monitor.h"
 #include "nm-dhcp-manager.h"
+#include "nm-systemwide.h"
@@ -912,6 +913,9 @@
 	nm_data->dhcp_manager = nm_dhcp_manager_new (nm_data);
 	nm_data->named_manager = nm_named_manager_new (nm_data->dbus_connection);
+	/* static data */
+	read_system_wide_info(nm_data);
 	/* If NMI is running, grab allowed wireless network lists from it ASAP */
 	if (nm_dbus_is_info_daemon_running (nm_data->dbus_connection))

and there are four new files parser.c, parser.h, nm-systemwide.c and nm-systemwide.h.

Those four files and the patch can be downloaded from

Enjoy !

Éric Brunet

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]