2006-02-28 Robert Love <rml@novell.com>
* src/NetworkManagerSystem.h: Add nm_system_should_modify_resolv_conf. * src/backends/NetworkManagerSuSE.c: Implement the interface nm_system_should_modify_resolv_conf() for SUSE. * src/backends/NetworkManagerDebian.c, src/backends/NetworkManagerGentoo.c, src/backends/NetworkManagerRedHat.c, src/backends/NetworkManagerSlackware.c: Add stub. * src/named-manager/Makefile.am: Grab includes from src. * src/named-manager/nm-named-manager.c: Allow backends to disable the automatic updating of resolv.conf. This is useful for testing, broken static configurations, and administrator lock-down. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1524 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
||||
2006-02-28 Robert Love <rml@novell.com>
|
||||
|
||||
* src/NetworkManagerSystem.h: Add nm_system_should_modify_resolv_conf.
|
||||
* src/backends/NetworkManagerSuSE.c: Implement the interface
|
||||
nm_system_should_modify_resolv_conf() for SUSE.
|
||||
* src/backends/NetworkManagerDebian.c,
|
||||
src/backends/NetworkManagerGentoo.c,
|
||||
src/backends/NetworkManagerRedHat.c,
|
||||
src/backends/NetworkManagerSlackware.c: Add stub.
|
||||
* src/named-manager/Makefile.am: Grab includes from src.
|
||||
* src/named-manager/nm-named-manager.c: Allow backends to disable the
|
||||
automatic updating of resolv.conf. This is useful for testing,
|
||||
broken static configurations, and administrator lock-down.
|
||||
|
||||
2006-02-28 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-device-802-11-wireless.c
|
||||
|
@@ -81,4 +81,6 @@ void nm_system_set_hostname (NMIP4Config *config);
|
||||
void nm_system_activate_nis (NMIP4Config *config);
|
||||
void nm_system_shutdown_nis (void);
|
||||
|
||||
gboolean nm_system_should_modify_resolv_conf (void);
|
||||
|
||||
#endif
|
||||
|
@@ -672,3 +672,12 @@ void nm_system_set_hostname (NMIP4Config *config)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* nm_system_should_modify_resolv_conf
|
||||
*
|
||||
* Can NM update resolv.conf, or is it locked down?
|
||||
*/
|
||||
gboolean nm_system_should_modify_resolv_conf (void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -574,3 +574,12 @@ void nm_system_set_hostname (NMIP4Config *config)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* nm_system_should_modify_resolv_conf
|
||||
*
|
||||
* Can NM update resolv.conf, or is it locked down?
|
||||
*/
|
||||
gboolean nm_system_should_modify_resolv_conf (void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -920,3 +920,13 @@ void nm_system_set_hostname (NMIP4Config *config)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_should_modify_resolv_conf
|
||||
*
|
||||
* Can NM update resolv.conf, or is it locked down?
|
||||
*/
|
||||
gboolean nm_system_should_modify_resolv_conf (void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -414,3 +414,12 @@ void nm_system_set_hostname (NMIP4Config *config)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* nm_system_should_modify_resolv_conf
|
||||
*
|
||||
* Can NM update resolv.conf, or is it locked down?
|
||||
*/
|
||||
gboolean nm_system_should_modify_resolv_conf (void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -337,12 +337,12 @@ void nm_system_device_add_ip6_link_address (NMDevice *dev)
|
||||
}
|
||||
|
||||
|
||||
typedef struct SuSESystemConfigData
|
||||
typedef struct SuSEDeviceConfigData
|
||||
{
|
||||
NMIP4Config * config;
|
||||
gboolean use_dhcp;
|
||||
gboolean system_disabled;
|
||||
} SuSESystemConfigData;
|
||||
} SuSEDeviceConfigData;
|
||||
|
||||
/*
|
||||
* set_ip4_config_from_resolv_conf
|
||||
@@ -435,7 +435,7 @@ void *nm_system_device_get_system_config (NMDevice *dev)
|
||||
struct stat statbuf;
|
||||
shvarFile *file;
|
||||
char *buf = NULL;
|
||||
SuSESystemConfigData *sys_data = NULL;
|
||||
SuSEDeviceConfigData *sys_data = NULL;
|
||||
struct ether_addr hw_addr;
|
||||
FILE *f = NULL;
|
||||
char buffer[512];
|
||||
@@ -446,7 +446,7 @@ void *nm_system_device_get_system_config (NMDevice *dev)
|
||||
|
||||
g_return_val_if_fail (dev != NULL, NULL);
|
||||
|
||||
sys_data = g_malloc0 (sizeof (SuSESystemConfigData));
|
||||
sys_data = g_malloc0 (sizeof (SuSEDeviceConfigData));
|
||||
sys_data->use_dhcp = TRUE;
|
||||
|
||||
if (nm_device_is_802_3_ethernet (dev))
|
||||
@@ -643,7 +643,7 @@ out:
|
||||
*/
|
||||
void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data)
|
||||
{
|
||||
SuSESystemConfigData *sys_data = (SuSESystemConfigData *)system_config_data;
|
||||
SuSEDeviceConfigData *sys_data = (SuSEDeviceConfigData *)system_config_data;
|
||||
|
||||
g_return_if_fail (dev != NULL);
|
||||
|
||||
@@ -664,7 +664,7 @@ void nm_system_device_free_system_config (NMDevice *dev, void *system_config_dat
|
||||
*/
|
||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
||||
{
|
||||
SuSESystemConfigData *sys_data;
|
||||
SuSEDeviceConfigData *sys_data;
|
||||
|
||||
g_return_val_if_fail (dev != NULL, FALSE);
|
||||
|
||||
@@ -683,7 +683,7 @@ gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
||||
*/
|
||||
gboolean nm_system_device_get_disabled (NMDevice *dev)
|
||||
{
|
||||
SuSESystemConfigData *sys_data;
|
||||
SuSEDeviceConfigData *sys_data;
|
||||
|
||||
g_return_val_if_fail (dev != NULL, FALSE);
|
||||
|
||||
@@ -697,7 +697,7 @@ gboolean nm_system_device_get_disabled (NMDevice *dev)
|
||||
|
||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
||||
{
|
||||
SuSESystemConfigData *sys_data;
|
||||
SuSEDeviceConfigData *sys_data;
|
||||
NMIP4Config *new_config = NULL;
|
||||
|
||||
g_return_val_if_fail (dev != NULL, NULL);
|
||||
@@ -1080,3 +1080,36 @@ out_close:
|
||||
out_gfree:
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* nm_system_should_modify_resolv_conf
|
||||
*
|
||||
* Can NM update resolv.conf, or is it locked down?
|
||||
*/
|
||||
gboolean nm_system_should_modify_resolv_conf (void)
|
||||
{
|
||||
char *name, *buf;
|
||||
shvarFile *file;
|
||||
gboolean ret = TRUE;
|
||||
|
||||
name = g_strdup_printf (SYSCONFDIR"/sysconfig/network/config");
|
||||
file = svNewFile (name);
|
||||
if (!file)
|
||||
goto out_gfree;
|
||||
|
||||
buf = svGetValue (file, "MODIFY_RESOLV_CONF_DYNAMICALLY");
|
||||
if (!buf)
|
||||
goto out_close;
|
||||
|
||||
if (strcmp (buf, "no") == 0)
|
||||
ret = FALSE;
|
||||
|
||||
free (buf);
|
||||
out_close:
|
||||
svCloseFile (file);
|
||||
out_gfree:
|
||||
g_free (name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
INCLUDES = -I${top_srcdir}/utils -I${top_srcdir}/src
|
||||
INCLUDES = -I${top_srcdir}/utils -I${top_srcdir}/src -I${top_srcdir}/include
|
||||
|
||||
noinst_LTLIBRARIES = libnamed-manager.la
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "nm-named-manager.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -34,8 +35,10 @@
|
||||
#include <syslog.h>
|
||||
#include <glib.h>
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-utils.h"
|
||||
#include "NetworkManagerSystem.h"
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
@@ -51,10 +54,6 @@
|
||||
#define NAMED_DBUS_PATH "/com/redhat/named"
|
||||
#endif
|
||||
|
||||
|
||||
/* From NetworkManagerSystem.h/.c */
|
||||
void nm_system_update_dns (void);
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@@ -358,6 +357,13 @@ rewrite_resolv_conf (NMNamedManager *mgr, NMIP4Config *config, GError **error)
|
||||
if (!config)
|
||||
return TRUE;
|
||||
|
||||
/* If the sysadmin disabled modifying resolv.conf, exit silently */
|
||||
if (!nm_system_should_modify_resolv_conf ())
|
||||
{
|
||||
nm_info ("DHCP returned name servers but system has disabled dynamic modification!");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((f = fopen (tmp_resolv_conf, "w")) == NULL)
|
||||
goto lose;
|
||||
|
||||
|
Reference in New Issue
Block a user