2008-08-12 18:39:03 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2008-04-22 14:48:02 +00:00
|
|
|
|
2008-05-11 20:12:18 +00:00
|
|
|
#include <config.h>
|
2008-04-22 14:48:02 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/types.h>
|
2008-08-27 03:09:14 +00:00
|
|
|
#include <string.h>
|
2008-04-22 14:48:02 +00:00
|
|
|
#include <gmodule.h>
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <glib/gstdio.h>
|
|
|
|
|
#include <nm-connection.h>
|
|
|
|
|
#include <nm-setting.h>
|
|
|
|
|
#include <nm-setting-connection.h>
|
|
|
|
|
|
2008-05-11 20:12:18 +00:00
|
|
|
#ifndef NO_GIO
|
|
|
|
|
#include <gio/gio.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <gfilemonitor/gfilemonitor.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-04-22 14:48:02 +00:00
|
|
|
#include "plugin.h"
|
|
|
|
|
#include "nm-system-config-interface.h"
|
2008-05-07 09:48:12 +00:00
|
|
|
#include "nm-keyfile-connection.h"
|
2008-04-22 14:48:02 +00:00
|
|
|
#include "writer.h"
|
|
|
|
|
|
|
|
|
|
#define KEYFILE_PLUGIN_NAME "keyfile"
|
|
|
|
|
#define KEYFILE_PLUGIN_INFO "(c) 2007 - 2008 Red Hat, Inc. To report bugs please use the NetworkManager mailing list."
|
|
|
|
|
|
2008-09-24 15:03:33 +00:00
|
|
|
#define CONF_FILE SYSCONFDIR "/NetworkManager/nm-system-settings.conf"
|
|
|
|
|
|
|
|
|
|
static char *plugin_get_hostname (SCPluginKeyfile *plugin);
|
2008-04-22 14:48:02 +00:00
|
|
|
static void system_config_interface_init (NMSystemConfigInterface *system_config_interface_class);
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_EXTENDED (SCPluginKeyfile, sc_plugin_keyfile, G_TYPE_OBJECT, 0,
|
|
|
|
|
G_IMPLEMENT_INTERFACE (NM_TYPE_SYSTEM_CONFIG_INTERFACE,
|
|
|
|
|
system_config_interface_init))
|
|
|
|
|
|
|
|
|
|
#define SC_PLUGIN_KEYFILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SC_TYPE_PLUGIN_KEYFILE, SCPluginKeyfilePrivate))
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GHashTable *hash;
|
|
|
|
|
|
|
|
|
|
GFileMonitor *monitor;
|
|
|
|
|
guint monitor_id;
|
|
|
|
|
|
2008-09-24 15:03:33 +00:00
|
|
|
GFileMonitor *conf_file_monitor;
|
|
|
|
|
guint conf_file_monitor_id;
|
|
|
|
|
|
|
|
|
|
char *hostname;
|
|
|
|
|
|
2008-04-22 14:48:02 +00:00
|
|
|
gboolean disposed;
|
|
|
|
|
} SCPluginKeyfilePrivate;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
read_connections (NMSystemConfigInterface *config)
|
|
|
|
|
{
|
2008-08-27 03:09:14 +00:00
|
|
|
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config);
|
2008-04-22 14:48:02 +00:00
|
|
|
GDir *dir;
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
|
|
dir = g_dir_open (KEYFILE_DIR, 0, &err);
|
|
|
|
|
if (dir) {
|
|
|
|
|
const char *item;
|
|
|
|
|
|
2008-05-07 09:48:12 +00:00
|
|
|
while ((item = g_dir_read_name (dir))) {
|
2008-08-27 03:09:14 +00:00
|
|
|
NMKeyfileConnection *connection;
|
2008-05-07 09:48:12 +00:00
|
|
|
char *full_path;
|
|
|
|
|
|
|
|
|
|
full_path = g_build_filename (KEYFILE_DIR, item, NULL);
|
2008-08-27 03:09:14 +00:00
|
|
|
connection = nm_keyfile_connection_new (full_path);
|
|
|
|
|
if (connection) {
|
|
|
|
|
g_hash_table_insert (priv->hash,
|
|
|
|
|
(gpointer) nm_keyfile_connection_get_filename (connection),
|
|
|
|
|
connection);
|
|
|
|
|
}
|
2008-05-07 09:48:12 +00:00
|
|
|
g_free (full_path);
|
|
|
|
|
}
|
2008-04-22 14:48:02 +00:00
|
|
|
|
|
|
|
|
g_dir_close (dir);
|
|
|
|
|
} else {
|
|
|
|
|
g_warning ("Can not read directory '%s': %s", KEYFILE_DIR, err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-27 03:09:14 +00:00
|
|
|
typedef struct {
|
|
|
|
|
const char *uuid;
|
|
|
|
|
NMKeyfileConnection *found;
|
|
|
|
|
} FindByUUIDInfo;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
find_by_uuid (gpointer key, gpointer data, gpointer user_data)
|
|
|
|
|
{
|
2008-09-17 04:41:01 +00:00
|
|
|
NMKeyfileConnection *keyfile = NM_KEYFILE_CONNECTION (data);
|
2008-08-27 03:09:14 +00:00
|
|
|
FindByUUIDInfo *info = user_data;
|
|
|
|
|
NMConnection *connection;
|
|
|
|
|
NMSettingConnection *s_con;
|
|
|
|
|
|
|
|
|
|
if (info->found)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (keyfile));
|
|
|
|
|
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
|
|
|
|
|
if (s_con && s_con->uuid) {
|
|
|
|
|
if (!strcmp (info->uuid, s_con->uuid))
|
|
|
|
|
info->found = keyfile;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-11 09:43:21 +00:00
|
|
|
static void
|
2008-08-27 03:09:14 +00:00
|
|
|
update_connection_settings (NMExportedConnection *orig,
|
2008-09-11 09:43:21 +00:00
|
|
|
NMExportedConnection *new)
|
2008-08-27 03:09:14 +00:00
|
|
|
{
|
2008-09-11 09:43:21 +00:00
|
|
|
NMConnection *wrapped;
|
|
|
|
|
GHashTable *new_settings;
|
|
|
|
|
|
|
|
|
|
new_settings = nm_connection_to_hash (nm_exported_connection_get_connection (new));
|
|
|
|
|
wrapped = nm_exported_connection_get_connection (orig);
|
|
|
|
|
nm_connection_replace_settings (wrapped, new_settings);
|
|
|
|
|
nm_exported_connection_signal_updated (orig, new_settings);
|
|
|
|
|
g_hash_table_destroy (new_settings);
|
2008-08-27 03:09:14 +00:00
|
|
|
}
|
|
|
|
|
|
2008-04-22 14:48:02 +00:00
|
|
|
/* Monitoring */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
dir_changed (GFileMonitor *monitor,
|
|
|
|
|
GFile *file,
|
|
|
|
|
GFile *other_file,
|
|
|
|
|
GFileMonitorEvent event_type,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMSystemConfigInterface *config = NM_SYSTEM_CONFIG_INTERFACE (user_data);
|
|
|
|
|
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config);
|
|
|
|
|
char *name;
|
2008-05-07 09:48:12 +00:00
|
|
|
NMKeyfileConnection *connection;
|
2008-04-22 14:48:02 +00:00
|
|
|
|
2008-05-07 09:48:12 +00:00
|
|
|
name = g_file_get_path (file);
|
2008-04-22 14:48:02 +00:00
|
|
|
connection = g_hash_table_lookup (priv->hash, name);
|
|
|
|
|
|
|
|
|
|
switch (event_type) {
|
|
|
|
|
case G_FILE_MONITOR_EVENT_DELETED:
|
|
|
|
|
if (connection) {
|
2008-08-27 03:09:14 +00:00
|
|
|
/* Removing from the hash table should drop the last reference */
|
|
|
|
|
g_object_ref (connection);
|
2008-04-22 14:48:02 +00:00
|
|
|
g_hash_table_remove (priv->hash, name);
|
2008-05-07 09:48:12 +00:00
|
|
|
nm_exported_connection_signal_removed (NM_EXPORTED_CONNECTION (connection));
|
2008-08-27 03:09:14 +00:00
|
|
|
g_object_unref (connection);
|
2008-04-22 14:48:02 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2008-05-09 06:33:30 +00:00
|
|
|
case G_FILE_MONITOR_EVENT_CREATED:
|
2008-04-22 14:48:02 +00:00
|
|
|
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
|
|
|
|
if (connection) {
|
|
|
|
|
/* Update */
|
2008-05-07 09:48:12 +00:00
|
|
|
NMExportedConnection *tmp;
|
2008-04-22 14:48:02 +00:00
|
|
|
|
2008-05-07 09:48:12 +00:00
|
|
|
tmp = (NMExportedConnection *) nm_keyfile_connection_new (name);
|
2008-04-22 14:48:02 +00:00
|
|
|
if (tmp) {
|
2008-09-11 09:43:21 +00:00
|
|
|
update_connection_settings (NM_EXPORTED_CONNECTION (connection), tmp);
|
2008-04-22 14:48:02 +00:00
|
|
|
g_object_unref (tmp);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* New */
|
2008-08-27 03:09:14 +00:00
|
|
|
connection = nm_keyfile_connection_new (name);
|
|
|
|
|
if (connection) {
|
|
|
|
|
NMConnection *tmp;
|
|
|
|
|
NMSettingConnection *s_con;
|
|
|
|
|
NMKeyfileConnection *found = NULL;
|
|
|
|
|
|
|
|
|
|
/* Connection renames will show up as different files but with
|
|
|
|
|
* the same UUID. Try to find the original connection.
|
|
|
|
|
*/
|
|
|
|
|
tmp = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (connection));
|
|
|
|
|
s_con = (NMSettingConnection *) nm_connection_get_setting (tmp, NM_TYPE_SETTING_CONNECTION);
|
|
|
|
|
if (s_con && s_con->uuid) {
|
|
|
|
|
FindByUUIDInfo info = { .found = NULL, .uuid = s_con->uuid };
|
|
|
|
|
|
|
|
|
|
g_hash_table_foreach (priv->hash, find_by_uuid, &info);
|
|
|
|
|
found = info.found;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A connection rename is treated just like an update except
|
|
|
|
|
* there's a bit more housekeeping with the hash table.
|
|
|
|
|
*/
|
|
|
|
|
if (found) {
|
|
|
|
|
const char *old_filename = nm_keyfile_connection_get_filename (connection);
|
|
|
|
|
|
|
|
|
|
/* Removing from the hash table should drop the last reference,
|
|
|
|
|
* but of course we want to keep the connection around.
|
|
|
|
|
*/
|
|
|
|
|
g_object_ref (found);
|
|
|
|
|
g_hash_table_remove (priv->hash, old_filename);
|
|
|
|
|
|
|
|
|
|
/* Updating settings should update the NMKeyfileConnection's
|
|
|
|
|
* filename property too.
|
|
|
|
|
*/
|
2008-09-11 09:43:21 +00:00
|
|
|
update_connection_settings (NM_EXPORTED_CONNECTION (found),
|
|
|
|
|
NM_EXPORTED_CONNECTION (connection));
|
2008-08-27 03:09:14 +00:00
|
|
|
|
|
|
|
|
/* Re-insert the connection back into the hash with the new filename */
|
|
|
|
|
g_hash_table_insert (priv->hash,
|
|
|
|
|
(gpointer) nm_keyfile_connection_get_filename (found),
|
|
|
|
|
found);
|
|
|
|
|
|
|
|
|
|
/* Get rid of the temporary connection */
|
|
|
|
|
g_object_unref (connection);
|
|
|
|
|
} else {
|
|
|
|
|
g_hash_table_insert (priv->hash,
|
|
|
|
|
(gpointer) nm_keyfile_connection_get_filename (connection),
|
|
|
|
|
connection);
|
|
|
|
|
g_signal_emit_by_name (config, "connection-added", connection);
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-04-22 14:48:02 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (name);
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-24 15:03:33 +00:00
|
|
|
static void
|
|
|
|
|
conf_file_changed (GFileMonitor *monitor,
|
|
|
|
|
GFile *file,
|
|
|
|
|
GFile *other_file,
|
|
|
|
|
GFileMonitorEvent event_type,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (data);
|
|
|
|
|
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (self);
|
|
|
|
|
char *tmp;
|
|
|
|
|
|
|
|
|
|
switch (event_type) {
|
|
|
|
|
case G_FILE_MONITOR_EVENT_DELETED:
|
|
|
|
|
case G_FILE_MONITOR_EVENT_CREATED:
|
|
|
|
|
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
|
|
|
|
|
g_signal_emit_by_name (self, "unmanaged-devices-changed");
|
|
|
|
|
|
|
|
|
|
/* hostname */
|
|
|
|
|
tmp = plugin_get_hostname (self);
|
|
|
|
|
if ((tmp && !priv->hostname)
|
|
|
|
|
|| (!tmp && priv->hostname)
|
|
|
|
|
|| (priv->hostname && tmp && strcmp (priv->hostname, tmp))) {
|
|
|
|
|
|
|
|
|
|
g_free (priv->hostname);
|
|
|
|
|
priv->hostname = tmp;
|
|
|
|
|
tmp = NULL;
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_SYSTEM_CONFIG_INTERFACE_HOSTNAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-22 14:48:02 +00:00
|
|
|
static void
|
|
|
|
|
setup_monitoring (NMSystemConfigInterface *config)
|
|
|
|
|
{
|
|
|
|
|
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config);
|
|
|
|
|
GFile *file;
|
|
|
|
|
GFileMonitor *monitor;
|
|
|
|
|
|
2008-05-07 09:48:12 +00:00
|
|
|
priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
|
2008-04-22 14:48:02 +00:00
|
|
|
|
|
|
|
|
file = g_file_new_for_path (KEYFILE_DIR);
|
|
|
|
|
monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);
|
|
|
|
|
g_object_unref (file);
|
|
|
|
|
|
|
|
|
|
if (monitor) {
|
|
|
|
|
priv->monitor_id = g_signal_connect (monitor, "changed", G_CALLBACK (dir_changed), config);
|
|
|
|
|
priv->monitor = monitor;
|
|
|
|
|
}
|
2008-09-24 15:03:33 +00:00
|
|
|
|
|
|
|
|
file = g_file_new_for_path (CONF_FILE);
|
|
|
|
|
monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
|
|
|
|
|
g_object_unref (file);
|
|
|
|
|
|
|
|
|
|
if (monitor) {
|
|
|
|
|
priv->conf_file_monitor_id = g_signal_connect (monitor, "changed", G_CALLBACK (conf_file_changed), config);
|
|
|
|
|
priv->conf_file_monitor = monitor;
|
|
|
|
|
}
|
2008-04-22 14:48:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
hash_to_slist (gpointer key, gpointer value, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GSList **list = (GSList **) user_data;
|
|
|
|
|
|
|
|
|
|
*list = g_slist_prepend (*list, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Plugin */
|
|
|
|
|
|
|
|
|
|
static GSList *
|
|
|
|
|
get_connections (NMSystemConfigInterface *config)
|
|
|
|
|
{
|
|
|
|
|
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config);
|
|
|
|
|
GSList *connections = NULL;
|
|
|
|
|
|
|
|
|
|
if (!priv->hash) {
|
|
|
|
|
setup_monitoring (config);
|
|
|
|
|
read_connections (config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_hash_table_foreach (priv->hash, hash_to_slist, &connections);
|
|
|
|
|
|
|
|
|
|
return connections;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-16 07:37:10 +00:00
|
|
|
static gboolean
|
2008-08-12 18:39:03 +00:00
|
|
|
add_connection (NMSystemConfigInterface *config,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
GError **error)
|
2008-04-22 14:48:02 +00:00
|
|
|
{
|
2008-08-27 03:09:14 +00:00
|
|
|
return write_connection (connection, NULL, error);
|
2008-04-22 14:48:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-09-24 15:03:33 +00:00
|
|
|
static GSList *
|
|
|
|
|
get_unmanaged_devices (NMSystemConfigInterface *config)
|
|
|
|
|
{
|
|
|
|
|
GKeyFile *key_file;
|
|
|
|
|
GSList *unmanaged_devices = NULL;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
key_file = g_key_file_new ();
|
|
|
|
|
if (g_key_file_load_from_file (key_file, CONF_FILE, G_KEY_FILE_NONE, &error)) {
|
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
|
|
str = g_key_file_get_value (key_file, "keyfile", "unmanaged-devices", NULL);
|
|
|
|
|
if (str) {
|
|
|
|
|
char **udis;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
udis = g_strsplit (str, ";", -1);
|
|
|
|
|
g_free (str);
|
|
|
|
|
|
|
|
|
|
for (i = 0; udis[i] != NULL; i++)
|
|
|
|
|
unmanaged_devices = g_slist_append (unmanaged_devices, udis[i]);
|
|
|
|
|
|
|
|
|
|
g_free (udis); /* Yes, g_free, not g_strfreev because we need the strings in the list */
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
g_warning ("Error parsing file '%s': %s", CONF_FILE, error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_key_file_free (key_file);
|
|
|
|
|
|
|
|
|
|
return unmanaged_devices;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
plugin_get_hostname (SCPluginKeyfile *plugin)
|
|
|
|
|
{
|
|
|
|
|
GKeyFile *key_file;
|
|
|
|
|
char *hostname;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
key_file = g_key_file_new ();
|
|
|
|
|
if (g_key_file_load_from_file (key_file, CONF_FILE, G_KEY_FILE_NONE, &error))
|
|
|
|
|
hostname = g_key_file_get_value (key_file, "keyfile", "hostname", NULL);
|
|
|
|
|
else {
|
|
|
|
|
g_warning ("Error parsing file '%s': %s", CONF_FILE, error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_key_file_free (key_file);
|
|
|
|
|
|
|
|
|
|
return hostname;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
plugin_set_hostname (SCPluginKeyfile *plugin, const char *hostname)
|
|
|
|
|
{
|
|
|
|
|
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (plugin);
|
|
|
|
|
GKeyFile *key_file;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
|
|
|
|
key_file = g_key_file_new ();
|
|
|
|
|
if (g_key_file_load_from_file (key_file, CONF_FILE, G_KEY_FILE_NONE, &error)) {
|
|
|
|
|
char *data;
|
|
|
|
|
gsize len;
|
|
|
|
|
|
|
|
|
|
g_key_file_set_string (key_file, "keyfile", "hostname", hostname);
|
|
|
|
|
|
|
|
|
|
data = g_key_file_to_data (key_file, &len, &error);
|
|
|
|
|
if (data) {
|
|
|
|
|
g_file_set_contents (CONF_FILE, data, len, &error);
|
|
|
|
|
g_free (data);
|
|
|
|
|
|
|
|
|
|
g_free (priv->hostname);
|
|
|
|
|
priv->hostname = hostname ? g_strdup (hostname) : NULL;
|
|
|
|
|
result = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
|
g_warning ("Error saving hostname: %s", error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
g_warning ("Error parsing file '%s': %s", CONF_FILE, error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_key_file_free (key_file);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-22 14:48:02 +00:00
|
|
|
/* GObject */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sc_plugin_keyfile_init (SCPluginKeyfile *plugin)
|
|
|
|
|
{
|
2008-09-24 15:03:33 +00:00
|
|
|
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (plugin);
|
|
|
|
|
|
|
|
|
|
priv->hostname = plugin_get_hostname (plugin);
|
2008-04-22 14:48:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_property (GObject *object, guint prop_id,
|
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME:
|
|
|
|
|
g_value_set_string (value, KEYFILE_PLUGIN_NAME);
|
|
|
|
|
break;
|
|
|
|
|
case NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO:
|
|
|
|
|
g_value_set_string (value, KEYFILE_PLUGIN_INFO);
|
|
|
|
|
break;
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
case NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES:
|
2008-09-24 15:03:33 +00:00
|
|
|
g_value_set_uint (value, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS |
|
|
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_HOSTNAME);
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
break;
|
|
|
|
|
case NM_SYSTEM_CONFIG_INTERFACE_PROP_HOSTNAME:
|
2008-09-24 15:03:33 +00:00
|
|
|
g_value_set_string (value, SC_PLUGIN_KEYFILE_GET_PRIVATE (object)->hostname);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_property (GObject *object, guint prop_id,
|
|
|
|
|
const GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
const char *hostname;
|
|
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case NM_SYSTEM_CONFIG_INTERFACE_PROP_HOSTNAME:
|
|
|
|
|
hostname = g_value_get_string (value);
|
|
|
|
|
if (hostname && strlen (hostname) < 1)
|
|
|
|
|
hostname = NULL;
|
|
|
|
|
plugin_set_hostname (SC_PLUGIN_KEYFILE (object), hostname);
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
break;
|
2008-04-22 14:48:02 +00:00
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
dispose (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (object);
|
|
|
|
|
|
|
|
|
|
if (priv->disposed)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
priv->disposed = TRUE;
|
|
|
|
|
|
|
|
|
|
if (priv->monitor) {
|
|
|
|
|
if (priv->monitor_id)
|
|
|
|
|
g_signal_handler_disconnect (priv->monitor, priv->monitor_id);
|
|
|
|
|
|
|
|
|
|
g_file_monitor_cancel (priv->monitor);
|
|
|
|
|
g_object_unref (priv->monitor);
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-24 15:03:33 +00:00
|
|
|
if (priv->conf_file_monitor) {
|
|
|
|
|
if (priv->conf_file_monitor_id)
|
|
|
|
|
g_signal_handler_disconnect (priv->conf_file_monitor, priv->conf_file_monitor_id);
|
|
|
|
|
|
|
|
|
|
g_file_monitor_cancel (priv->conf_file_monitor);
|
|
|
|
|
g_object_unref (priv->conf_file_monitor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (priv->hostname);
|
|
|
|
|
|
2008-05-08 00:55:21 +00:00
|
|
|
if (priv->hash)
|
|
|
|
|
g_hash_table_destroy (priv->hash);
|
2008-04-22 14:48:02 +00:00
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (sc_plugin_keyfile_parent_class)->dispose (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sc_plugin_keyfile_class_init (SCPluginKeyfileClass *req_class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
|
|
|
|
|
|
|
|
|
|
g_type_class_add_private (req_class, sizeof (SCPluginKeyfilePrivate));
|
|
|
|
|
|
|
|
|
|
object_class->dispose = dispose;
|
|
|
|
|
object_class->get_property = get_property;
|
2008-09-24 15:03:33 +00:00
|
|
|
object_class->set_property = set_property;
|
2008-04-22 14:48:02 +00:00
|
|
|
|
|
|
|
|
g_object_class_override_property (object_class,
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME,
|
|
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_NAME);
|
|
|
|
|
|
|
|
|
|
g_object_class_override_property (object_class,
|
|
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO,
|
|
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_INFO);
|
|
|
|
|
|
|
|
|
|
g_object_class_override_property (object_class,
|
|
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES,
|
|
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES);
|
2008-04-22 14:48:02 +00:00
|
|
|
|
|
|
|
|
g_object_class_override_property (object_class,
|
2008-09-18 Dan Williams <dcbw@redhat.com>
Implement support for honoring configured and automatic hostnames, and for
setting the configured hostname.
* introspection/nm-ip4-config.xml
src/nm-ip4-config.c
src/nm-ip4-config.h
src/dhcp-manager/nm-dhcp-manager.c
- Remove useless hostname property; it's not really part of the IPv4
config
* introspection/nm-settings-system.xml
libnm-glib/nm-dbus-settings-system.c
libnm-glib/nm-dbus-settings-system.h
- Add SetHostname() call to system settings D-Bus interface
- Add Hostname property to system settings D-Bus interface
- (nm_dbus_settings_system_save_hostname,
nm_dbus_settings_system_get_hostname): implement
* src/nm-device.c
src/nm-device.h
- (nm_device_get_dhcp4_config): implement
* src/nm-manager.c
src/nm-manager.h
- Fetch and track system settings service hostname changes, and proxy
the changes via a GObject property of the manager
* system-settings/src/nm-system-config-interface.c
system-settings/src/nm-system-config-interface.h
- Replace nm_system_config_interface_supports_add() with a capabilities
bitfield
* system-settings/src/nm-system-config-error.c
system-settings/src/nm-system-config-error.h
- Add additional errors
* system-settings/src/dbus-settings.c
system-settings/src/dbus-settings.h
- (get_property, nm_sysconfig_settings_class_init): add hostname
property; first plugin returning a hostname wins
- (impl_settings_add_connection): use plugin capabilities instead of
nm_system_config_interface_supports_add()
- (impl_settings_save_hostname): implement hostname saving
* src/NetworkManagerPolicy.c
- (lookup_thread_run_cb, lookup_thread_worker, lookup_thread_new,
lookup_thread_die): implement an asynchronous hostname lookup thread
which given an IPv4 address tries to look up the hostname for that
address with reverse DNS
- (get_best_device): split out best device code from
update_routing_and_dns()
- (update_etc_hosts): update /etc/hosts with the machine's new hostname
to preserve the 127.0.0.1 reverse mapping that so many things require
- (set_system_hostname): set a given hostname
- (update_system_hostname): implement hostname policy; a configured
hostname (from the system settings service) is used if available,
otherwise an automatically determined hostname from DHCP, VPN, etc.
If there was no automatically determined hostname, reverse DNS of
the best device's IP address will be used, and as a last resort the
hostname 'localhost.localdomain' is set.
- (update_routing_and_dns): use get_best_device(); update the system
hostname when the network config changes
- (hostname_changed): update system hostname if the system settings
service signals a hostname change
- (nm_policy_new): list for system settings service hostname changes
- (nm_policy_destroy): ensure that an in-progress hostname lookup thread
gets told to die
* system-settings/plugins/keyfile/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
- (get_property, sc_plugin_ifcfg_class_init): implement hostname and
capabilities properties
* system-settings/plugins/ifcfg-fedora/shvar.c
- (svOpenFile): re-enable R/W access of ifcfg files since the plugin
writes out /etc/sysconfig/network now
* system-settings/plugins/ifcfg-fedora/plugin.c
- (plugin_get_hostname): get hostname from /etc/sysconfig/network
- (plugin_set_hostname): save hostname to /etc/sysconfig/network
- (sc_network_changed_cb): handle changes to /etc/sysconfig/network
- (sc_plugin_ifcfg_init): monitor /etc/sysconfig/network for changes
- (get_property, set_property, sc_plugin_ifcfg_class_init): implement
hostname get/set and capabilities get
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-18 15:16:44 +00:00
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_PROP_HOSTNAME,
|
|
|
|
|
NM_SYSTEM_CONFIG_INTERFACE_HOSTNAME);
|
2008-04-22 14:48:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
system_config_interface_init (NMSystemConfigInterface *system_config_interface_class)
|
|
|
|
|
{
|
|
|
|
|
/* interface implementation */
|
|
|
|
|
system_config_interface_class->get_connections = get_connections;
|
|
|
|
|
system_config_interface_class->add_connection = add_connection;
|
2008-09-24 15:03:33 +00:00
|
|
|
system_config_interface_class->get_unmanaged_devices = get_unmanaged_devices;
|
2008-04-22 14:48:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
G_MODULE_EXPORT GObject *
|
|
|
|
|
nm_system_config_factory (void)
|
|
|
|
|
{
|
|
|
|
|
static SCPluginKeyfile *singleton = NULL;
|
|
|
|
|
|
|
|
|
|
if (!singleton)
|
|
|
|
|
singleton = SC_PLUGIN_KEYFILE (g_object_new (SC_TYPE_PLUGIN_KEYFILE, NULL));
|
|
|
|
|
else
|
|
|
|
|
g_object_ref (singleton);
|
|
|
|
|
|
|
|
|
|
return G_OBJECT (singleton);
|
|
|
|
|
}
|