Commit bcae3129 authored by Dan Williams's avatar Dan Williams

2008-08-07 Dan Williams <dcbw@redhat.com>

	* introspection/nm-ip4-config.xml
	  libnm-glib/libnm-glib-test.c
	  libnm-glib/nm-ip4-config.c
	  libnm-glib/nm-ip4-config.h
	  src/NetworkManagerSystem.h
	  src/backends/NetworkManagerArch.c
	  src/backends/NetworkManagerDebian.c
	  src/backends/NetworkManagerFrugalware.c
	  src/backends/NetworkManagerGeneric.c
	  src/backends/NetworkManagerGeneric.h
	  src/backends/NetworkManagerGentoo.c
	  src/backends/NetworkManagerMandriva.c
	  src/backends/NetworkManagerPaldo.c
	  src/backends/NetworkManagerRedHat.c
	  src/backends/NetworkManagerSlackware.c
	  src/backends/NetworkManagerSuSE.c
	  src/dhcp-manager/nm-dhcp-manager.c
	  src/nm-device.c
	  src/nm-ip4-config.c
	  src/nm-ip4-config.h
		- Remove NIS logic; should be done from dispatcher scripts instead



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3909 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 1fa67151
2008-08-07 Dan Williams <dcbw@redhat.com>
* introspection/nm-ip4-config.xml
libnm-glib/libnm-glib-test.c
libnm-glib/nm-ip4-config.c
libnm-glib/nm-ip4-config.h
src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGeneric.c
src/backends/NetworkManagerGeneric.h
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
src/dhcp-manager/nm-dhcp-manager.c
src/nm-device.c
src/nm-ip4-config.c
src/nm-ip4-config.h
- Remove NIS logic; should be done from dispatcher scripts instead
2008-08-07 Dan Williams <dcbw@redhat.com>
* src/dhcp-manager/nm-dhcp-manager.c
......
......@@ -14,12 +14,6 @@
<property name="Domains" type="as" access="read">
<tp:docstring>A list of domains this address belongs to.</tp:docstring>
</property>
<property name="NisDomain" type="s" access="read">
<tp:docstring>The NIS domain this address belongs to.</tp:docstring>
</property>
<property name="NisServers" type="au" access="read">
<tp:docstring>The NIS servers associated with this address.</tp:docstring>
</property>
<property name="Routes" type="aau" access="read">
<tp:docstring>Tuples of IPv4 route/prefix/next-hop/metric.</tp:docstring>
</property>
......
......@@ -106,18 +106,6 @@ dump_ip4_config (NMIP4Config *cfg)
for (i = 0; i < ptr_array->len; i++)
g_print ("\t%s\n", (const char *) g_ptr_array_index (ptr_array, i));
}
g_print ("IP4 NIS domain: %s\n", nm_ip4_config_get_nis_domain (cfg));
array = nm_ip4_config_get_nis_servers (cfg);
if (array) {
g_print ("IP4 NIS servers:\n");
for (i = 0; i < array->len; i++) {
tmp = ip4_address_as_string (g_array_index (array, guint32, i));
g_print ("\t%s\n", tmp);
g_free (tmp);
}
}
}
static void
......
......@@ -17,8 +17,6 @@ typedef struct {
char *hostname;
GArray *nameservers;
GPtrArray *domains;
char *nis_domain;
GArray *nis_servers;
GSList *routes;
} NMIP4ConfigPrivate;
......@@ -28,8 +26,6 @@ enum {
PROP_HOSTNAME,
PROP_NAMESERVERS,
PROP_DOMAINS,
PROP_NIS_DOMAIN,
PROP_NIS_SERVERS,
PROP_ROUTES,
LAST_PROP
......@@ -63,8 +59,6 @@ demarshal_ip4_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointe
if (!strcmp (pspec->name, NM_IP4_CONFIG_NAMESERVERS))
nm_object_queue_notify (object, NM_IP4_CONFIG_NAMESERVERS);
else if (!strcmp (pspec->name, NM_IP4_CONFIG_NIS_SERVERS))
nm_object_queue_notify (object, NM_IP4_CONFIG_NAMESERVERS);
return TRUE;
}
......@@ -102,8 +96,6 @@ register_for_property_changed (NMIP4Config *config)
{ NM_IP4_CONFIG_HOSTNAME, nm_object_demarshal_generic, &priv->hostname },
{ NM_IP4_CONFIG_NAMESERVERS, demarshal_ip4_array, &priv->nameservers },
{ NM_IP4_CONFIG_DOMAINS, demarshal_domains, &priv->domains },
{ NM_IP4_CONFIG_NIS_DOMAIN, nm_object_demarshal_generic, &priv->nis_domain },
{ NM_IP4_CONFIG_NIS_SERVERS, demarshal_ip4_array, &priv->nis_servers },
{ NM_IP4_CONFIG_ROUTES, demarshal_ip4_routes_array, &priv->routes },
{ NULL },
};
......@@ -153,11 +145,8 @@ finalize (GObject *object)
g_slist_free (priv->routes);
g_free (priv->hostname);
g_free (priv->nis_domain);
if (priv->nameservers)
g_array_free (priv->nameservers, TRUE);
if (priv->nis_servers)
g_array_free (priv->nis_servers, TRUE);
if (priv->domains) {
g_ptr_array_foreach (priv->domains, (GFunc) g_free, NULL);
......@@ -189,12 +178,6 @@ get_property (GObject *object,
case PROP_DOMAINS:
g_value_set_boxed (value, nm_ip4_config_get_domains (self));
break;
case PROP_NIS_DOMAIN:
g_value_set_string (value, nm_ip4_config_get_nis_domain (self));
break;
case PROP_NIS_SERVERS:
g_value_set_boxed (value, nm_ip4_config_get_nis_servers (self));
break;
case PROP_ROUTES:
nm_utils_ip4_routes_to_gvalue (priv->routes, value);
break;
......@@ -248,22 +231,6 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
NM_TYPE_STRING_ARRAY,
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_NIS_DOMAIN,
g_param_spec_string (NM_IP4_CONFIG_NIS_DOMAIN,
"NIS domain",
"NIS domain",
NULL,
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_NIS_SERVERS,
g_param_spec_boxed (NM_IP4_CONFIG_NIS_SERVERS,
"NIS servers",
"NIS servers",
NM_TYPE_UINT_ARRAY,
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_ROUTES,
g_param_spec_pointer (NM_IP4_CONFIG_ROUTES,
......@@ -380,50 +347,6 @@ nm_ip4_config_get_domains (NMIP4Config *config)
return handle_ptr_array_return (priv->domains);
}
const char *
nm_ip4_config_get_nis_domain (NMIP4Config *config)
{
NMIP4ConfigPrivate *priv;
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
if (!priv->nis_domain) {
priv->nis_domain = nm_object_get_string_property (NM_OBJECT (config),
NM_DBUS_INTERFACE_IP4_CONFIG,
"NisDomain");
}
return priv->nis_domain;
}
const GArray *
nm_ip4_config_get_nis_servers (NMIP4Config *config)
{
NMIP4ConfigPrivate *priv;
GArray *array = NULL;
GValue value = {0,};
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
if (!priv->nis_servers) {
if (nm_object_get_property (NM_OBJECT (config),
NM_DBUS_INTERFACE_IP4_CONFIG,
"NisServers",
&value)) {
array = (GArray *) g_value_get_boxed (&value);
if (array && array->len) {
priv->nis_servers = g_array_sized_new (FALSE, TRUE, sizeof (guint32), array->len);
g_array_append_vals (priv->nis_servers, array->data, array->len);
}
g_value_unset (&value);
}
}
return priv->nis_servers;
}
const GSList *
nm_ip4_config_get_routes (NMIP4Config *config)
{
......
......@@ -27,8 +27,6 @@ typedef struct {
#define NM_IP4_CONFIG_HOSTNAME "hostname"
#define NM_IP4_CONFIG_NAMESERVERS "nameservers"
#define NM_IP4_CONFIG_DOMAINS "domains"
#define NM_IP4_CONFIG_NIS_DOMAIN "nis-domain"
#define NM_IP4_CONFIG_NIS_SERVERS "nis-servers"
#define NM_IP4_CONFIG_ROUTES "routes"
GType nm_ip4_config_get_type (void);
......@@ -39,8 +37,6 @@ const GSList * nm_ip4_config_get_addresses (NMIP4Config *config);
const char * nm_ip4_config_get_hostname (NMIP4Config *config);
const GArray * nm_ip4_config_get_nameservers (NMIP4Config *config);
const GPtrArray *nm_ip4_config_get_domains (NMIP4Config *config);
const char * nm_ip4_config_get_nis_domain (NMIP4Config *config);
const GArray * nm_ip4_config_get_nis_servers (NMIP4Config *config);
const GSList * nm_ip4_config_get_routes (NMIP4Config *config);
G_END_DECLS
......
......@@ -63,8 +63,6 @@ gboolean nm_system_device_is_up (NMDevice *device);
gboolean nm_system_device_is_up_with_iface (const char *iface);
void nm_system_set_hostname (NMIP4Config *config);
void nm_system_activate_nis (NMIP4Config *config);
void nm_system_shutdown_nis (void);
gboolean nm_system_device_set_mtu (const char *iface, guint32 mtu);
......
......@@ -78,16 +78,6 @@ void nm_system_update_dns (void)
}
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_should_modify_resolv_conf
*
......@@ -98,16 +88,6 @@ gboolean nm_system_should_modify_resolv_conf (void)
return TRUE;
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -64,26 +64,6 @@ void nm_system_update_dns (void)
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -62,26 +62,6 @@ void nm_system_update_dns (void)
/* I'm not running nscd */
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -229,26 +229,6 @@ NMIP4Config *nm_generic_device_new_ip4_system_config (NMDevice *dev)
return NULL;
}
/*
* nm_generic_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_generic_activate_nis (NMIP4Config *config)
{
}
/*
* nm_generic_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_generic_shutdown_nis (void)
{
}
/*
* nm_generic_set_hostname
*
......
......@@ -51,8 +51,6 @@ gboolean nm_generic_device_set_up_down (NMDevice *dev, gboolean up);
gboolean nm_generic_device_set_up_down_with_iface (NMDevice *dev, const char *iface, gboolean up);
void nm_generic_set_hostname (NMIP4Config *config);
void nm_generic_activate_nis (NMIP4Config *config);
void nm_generic_shutdown_nis (void);
gboolean nm_generic_should_modify_resolv_conf (void);
......
......@@ -71,26 +71,6 @@ void nm_system_update_dns (void)
#endif
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -65,26 +65,6 @@ void nm_system_update_dns (void)
}
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -64,26 +64,6 @@ void nm_system_update_dns (void)
nm_spawn_process ("/usr/sbin/nscd -i hosts");
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -63,26 +63,6 @@ void nm_system_update_dns (void)
}
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -60,26 +60,6 @@ void nm_system_update_dns (void)
/* I'm not running nscd */
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -70,101 +70,6 @@ void nm_system_update_dns (void)
nm_spawn_process ("/usr/sbin/nscd -i hosts");
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
shvarFile *file;
const char *nis_domain;
char *name, *buf;
struct in_addr temp_addr;
int i;
FILE *ypconf = NULL;
char addr_buf[INET_ADDRSTRLEN+1];
memset (&addr_buf, '\0', sizeof (addr_buf));
g_return_if_fail (config != NULL);
nis_domain = nm_ip4_config_get_nis_domain(config);
name = g_strdup_printf (SYSCONFDIR"/sysconfig/network/dhcp");
file = svNewFile (name);
if (!file)
goto out_gfree;
buf = svGetValue (file, "DHCLIENT_SET_DOMAINNAME");
if (!buf)
goto out_close;
if ((!strcmp (buf, "yes")) && nis_domain && (setdomainname (nis_domain, strlen (nis_domain)) < 0))
nm_warning ("Could not set nis domain name.");
free (buf);
buf = svGetValue (file, "DHCLIENT_MODIFY_NIS_CONF");
if (!buf)
goto out_close;
if (!strcmp (buf, "yes")) {
int num_nis_servers;
num_nis_servers = nm_ip4_config_get_num_nis_servers(config);
if (num_nis_servers > 0)
{
struct stat sb;
/* write out yp.conf and restart the daemon */
ypconf = fopen ("/etc/yp.conf", "w");
if (ypconf)
{
fprintf (ypconf, "# generated by NetworkManager, do not edit!\n\n");
for (i = 0; i < num_nis_servers; i++) {
temp_addr.s_addr = nm_ip4_config_get_nis_server (config, i);
if (!inet_ntop (AF_INET, &temp_addr, addr_buf, INET_ADDRSTRLEN))
nm_warning ("%s: error converting IP4 address 0x%X",
__func__, ntohl (temp_addr.s_addr));
else
fprintf (ypconf, "domain %s server %s\n", nis_domain, addr_buf);
}
fprintf (ypconf, "\n");
fclose (ypconf);
} else
nm_warning ("Could not commit NIS changes to /etc/yp.conf.");
if (stat ("/usr/sbin/rcautofs", &sb) != -1)
{
nm_info ("Restarting autofs.");
nm_spawn_process ("/usr/sbin/rcautofs reload");
}
}
}
free (buf);
out_close:
svCloseFile (file);
out_gfree:
g_free (name);
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
......
......@@ -811,27 +811,6 @@ nm_dhcp_manager_get_ip4_config (NMDHCPManager *manager,
g_strfreev (searches);
}
str = g_hash_table_lookup (device->options, "new_nis_domain");
if (str) {
nm_ip4_config_set_nis_domain (ip4_config, str);
nm_info (" nis domain '%s'", str);
}
str = g_hash_table_lookup (device->options, "new_nis_servers");
if (str) {
char **searches = g_strsplit (str, " ", 0);
char **s;
for (s = searches; *s; s++) {
if (inet_pton (AF_INET, *s, &tmp_addr) > 0) {
nm_ip4_config_add_nis_server (ip4_config, tmp_addr.s_addr);
nm_info (" nis server '%s'", *s);
} else
nm_warning ("Ignoring invalid nis server '%s'", *s);
}
g_strfreev (searches);
}
str = g_hash_table_lookup (device->options, "new_static_routes");
if (str) {
char **searches = g_strsplit (str, " ", 0);
......
......@@ -1329,8 +1329,6 @@ nm_device_deactivate_quickly (NMDevice *self)
priv = NM_DEVICE_GET_PRIVATE (self);
nm_system_shutdown_nis ();
/* Break the activation chain */
if (priv->act_source_id) {
g_source_remove (priv->act_source_id);
......@@ -1760,7 +1758,6 @@ nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, NMDeviceStateReas
if (success) {
nm_device_update_ip4_address (self);
nm_system_set_hostname (config);
nm_system_activate_nis (config);
}
g_object_notify (G_OBJECT (self), NM_DEVICE_INTERFACE_IP4_CONFIG);
......
......@@ -56,8 +56,6 @@ typedef struct {
GPtrArray *searches;
gchar *hostname;
gchar *nis_domain;
GArray *nis_servers;
GSList *routes;
} NMIP4ConfigPrivate;
......@@ -68,8 +66,6 @@ enum {
PROP_HOSTNAME,
PROP_NAMESERVERS,
PROP_DOMAINS,
PROP_NIS_DOMAIN,
PROP_NIS_SERVERS,
PROP_ROUTES,
LAST_PROP
......@@ -95,56 +91,6 @@ nm_ip4_config_new (void)
return (NMIP4Config *) object;