diff options
| author | Michael Biebl <biebl@debian.org> | 2011-03-18 20:26:17 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2011-03-18 20:26:17 +0100 |
| commit | 13c6735461465cc207235f595fdc699118fc39d2 (patch) | |
| tree | c35070634b8c6c646ff83d0ee9f866dc2f294bf4 | |
| parent | dcca62857c0371c0f968ec8f881eee10ff0027d0 (diff) | |
Remove patches (merged upstream)
- d/p/40-umanaged-interfaces.patch - d/p/50-bridge-interfaces.patch - d/p/51-normalized-keys.patch - d/p/60-policy-stop-touching-etc-hosts.patch - d/p/70-install-nm-online.patch - d/p/80-keyfile-ignore-temporary-files.patch - d/p/81-keyfile-quiet-keyfile-plugin-when-re-read-connection.patch - d/p/82-core-handle-device-removal.patch - d/p/83-dnsmasq-send-no-config-file-instead-of-a-bogus-one.patch
| -rw-r--r-- | debian/changelog | 11 | ||||
| -rw-r--r-- | debian/patches/40-umanaged-interfaces.patch | 34 | ||||
| -rw-r--r-- | debian/patches/50-bridge-interfaces.patch | 72 | ||||
| -rw-r--r-- | debian/patches/51-normalized-keys.patch | 37 | ||||
| -rw-r--r-- | debian/patches/60-policy-stop-touching-etc-hosts.patch | 1703 | ||||
| -rw-r--r-- | debian/patches/70-install-nm-online.patch | 40 | ||||
| -rw-r--r-- | debian/patches/80-keyfile-ignore-temporary-files.patch | 261 | ||||
| -rw-r--r-- | debian/patches/81-keyfile-quiet-keyfile-plugin-when-re-read-connection.patch | 48 | ||||
| -rw-r--r-- | debian/patches/82-core-handle-device-removal.patch | 37 | ||||
| -rw-r--r-- | debian/patches/83-dnsmasq-send-no-config-file-instead-of-a-bogus-one.patch | 44 | ||||
| -rw-r--r-- | debian/patches/series | 9 |
11 files changed, 11 insertions, 2285 deletions
diff --git a/debian/changelog b/debian/changelog index 93b711c2..3018b9cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,17 @@ network-manager (0.8.3.998-1) UNRELEASED; urgency=low * New upstream release (0.8.4 rc1). * Bump debhelper compatibility level to 8. + * Remove patches (merged upstream) + - d/p/40-umanaged-interfaces.patch + - d/p/50-bridge-interfaces.patch + - d/p/51-normalized-keys.patch + - d/p/60-policy-stop-touching-etc-hosts.patch + - d/p/70-install-nm-online.patch + - d/p/80-keyfile-ignore-temporary-files.patch + - d/p/81-keyfile-quiet-keyfile-plugin-when-re-read-connection.patch + - d/p/82-core-handle-device-removal.patch + - d/p/83-dnsmasq-send-no-config-file-instead-of-a-bogus-one.patch + -- Michael Biebl <biebl@debian.org> Fri, 18 Mar 2011 20:18:32 +0100 diff --git a/debian/patches/40-umanaged-interfaces.patch b/debian/patches/40-umanaged-interfaces.patch deleted file mode 100644 index a0c33d59..00000000 --- a/debian/patches/40-umanaged-interfaces.patch +++ /dev/null @@ -1,34 +0,0 @@ -Description: Correctly mark unmanaged devices - Add interface (iface ...) to well_known_interface no matter if we find a - valid connection configuration or not. This way interfaces are correctly - marked unmanaged for configurations NM does not understand. -Author: Michael Biebl <biebl@debian.org> -Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=569215 -Index: network-manager/system-settings/plugins/ifupdown/plugin.c -=================================================================== ---- network-manager.orig/system-settings/plugins/ifupdown/plugin.c 2010-12-05 04:24:58.153750890 +0100 -+++ network-manager/system-settings/plugins/ifupdown/plugin.c 2010-12-05 04:27:03.157754436 +0100 -@@ -368,6 +368,7 @@ - /* Remove any connection for this block that was previously found */ - exported = g_hash_table_lookup (priv->iface_connections, block->name); - if (exported) { -+ PLUGIN_PRINT("SCPlugin-Ifupdown", "deleting %s from iface_connections", block->name); - nm_settings_connection_interface_delete (NM_SETTINGS_CONNECTION_INTERFACE (exported), - ignore_cb, - NULL); -@@ -377,11 +378,14 @@ - /* add the new connection */ - exported = nm_ifupdown_connection_new (block); - if (exported) { -+ PLUGIN_PRINT("SCPlugin-Ifupdown", "adding %s to iface_connections", block->name); - g_hash_table_insert (priv->iface_connections, block->name, exported); -- g_hash_table_insert (priv->well_known_interfaces, block->name, "known"); - } -+ PLUGIN_PRINT("SCPlugin-Ifupdown", "adding iface %s to well_known_interfaces", block->name); -+ g_hash_table_insert (priv->well_known_interfaces, block->name, "known"); - } else if (!strcmp ("mapping", block->type)) { - g_hash_table_insert (priv->well_known_interfaces, block->name, "known"); -+ PLUGIN_PRINT("SCPlugin-Ifupdown", "adding mapping %s to well_known_interfaces", block->name); - } - block = block->next; - } diff --git a/debian/patches/50-bridge-interfaces.patch b/debian/patches/50-bridge-interfaces.patch deleted file mode 100644 index 6f4faeaa..00000000 --- a/debian/patches/50-bridge-interfaces.patch +++ /dev/null @@ -1,72 +0,0 @@ -Description: Allow to unmanage bridge ports - Parse bridge configurations in /etc/network/interfaces and add - interfaces defined via bridge_ports to well_known_interfaces. This - allows to mark those interfaces as unmanaged if managed=false. - The "all" keyword and regexes are not supported and simply skipped. -Author: Michael Biebl <biebl@debian.org> -Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530335 -Index: network-manager/system-settings/plugins/ifupdown/plugin.c -=================================================================== ---- network-manager.orig/system-settings/plugins/ifupdown/plugin.c 2011-03-07 01:40:12.576352746 +0100 -+++ network-manager/system-settings/plugins/ifupdown/plugin.c 2011-03-07 01:40:35.916352746 +0100 -@@ -362,9 +362,51 @@ - while (block) { - if(!strcmp ("auto", block->type) || !strcmp ("allow-hotplug", block->type)) - g_hash_table_insert (auto_ifaces, block->name, GUINT_TO_POINTER (1)); -- else if (!strcmp ("iface", block->type) && strcmp ("lo", block->name)) { -+ else if (!strcmp ("iface", block->type)) { - NMIfupdownConnection *exported; - -+ /* Bridge configuration */ -+ if(!strncmp ("br", block->name, 2)) { -+ /* Try to find bridge ports */ -+ const char *ports = ifparser_getkey (block, "bridge_ports"); -+ if (ports) { -+ int i; -+ int state = 0; -+ char **port_ifaces; -+ -+ PLUGIN_PRINT("SCPlugin-Ifupdown", "found bridge ports %s for %s", ports, block->name); -+ -+ port_ifaces = g_strsplit_set (ports, " \t", -1); -+ for (i = 0; i < g_strv_length (port_ifaces); i++) { -+ char *token = port_ifaces[i]; -+ /* Skip crazy stuff like regex or all */ -+ if (!strcmp ("all", token)) { -+ continue; -+ } -+ /* Small SM to skip everything inside regex */ -+ if (!strcmp ("regex", token)) { -+ state++; -+ continue; -+ } -+ if (!strcmp ("noregex", token)) { -+ state--; -+ continue; -+ } -+ if (state == 0 && strlen (token) > 0) { -+ PLUGIN_PRINT("SCPlugin-Ifupdown", "adding bridge port %s to well_known_interfaces", token); -+ g_hash_table_insert (priv->well_known_interfaces, g_strdup (token), "known"); -+ } -+ } -+ g_strfreev (port_ifaces); -+ } -+ goto next; -+ } -+ -+ /* Skip loopback configuration */ -+ if(!strcmp ("lo", block->name)) { -+ goto next; -+ } -+ - /* Remove any connection for this block that was previously found */ - exported = g_hash_table_lookup (priv->iface_connections, block->name); - if (exported) { -@@ -387,6 +429,7 @@ - g_hash_table_insert (priv->well_known_interfaces, block->name, "known"); - PLUGIN_PRINT("SCPlugin-Ifupdown", "adding mapping %s to well_known_interfaces", block->name); - } -+ next: - block = block->next; - } - diff --git a/debian/patches/51-normalized-keys.patch b/debian/patches/51-normalized-keys.patch deleted file mode 100644 index f0404913..00000000 --- a/debian/patches/51-normalized-keys.patch +++ /dev/null @@ -1,37 +0,0 @@ -Index: network-manager/system-settings/plugins/ifupdown/interface_parser.c -=================================================================== ---- network-manager.orig/system-settings/plugins/ifupdown/interface_parser.c 2011-03-07 01:42:18.420352746 +0100 -+++ network-manager/system-settings/plugins/ifupdown/interface_parser.c 2011-03-07 01:42:25.152352746 +0100 -@@ -51,6 +51,7 @@ - void add_data(const char *key,const char *data) - { - if_data *ret; -+ char *idx; - - // Check if there is a block where we can attach our data - if (first == NULL) -@@ -58,6 +59,11 @@ - - ret = (if_data*) calloc(1,sizeof(struct _if_data)); - ret->key = g_strdup(key); -+ // Normalize keys. Convert '_' to '-', as ifupdown accepts both variants. -+ // When querying keys via ifparser_getkey(), use '-'. -+ while ((idx = strrchr(ret->key, '_'))) { -+ *idx = '-'; -+ } - ret->data = g_strdup(data); - - if (last->info == NULL) -Index: network-manager/system-settings/plugins/ifupdown/plugin.c -=================================================================== ---- network-manager.orig/system-settings/plugins/ifupdown/plugin.c 2011-03-07 01:42:23.988352746 +0100 -+++ network-manager/system-settings/plugins/ifupdown/plugin.c 2011-03-07 01:42:25.156352746 +0100 -@@ -368,7 +368,7 @@ - /* Bridge configuration */ - if(!strncmp ("br", block->name, 2)) { - /* Try to find bridge ports */ -- const char *ports = ifparser_getkey (block, "bridge_ports"); -+ const char *ports = ifparser_getkey (block, "bridge-ports"); - if (ports) { - int i; - int state = 0; diff --git a/debian/patches/60-policy-stop-touching-etc-hosts.patch b/debian/patches/60-policy-stop-touching-etc-hosts.patch deleted file mode 100644 index f0063ad8..00000000 --- a/debian/patches/60-policy-stop-touching-etc-hosts.patch +++ /dev/null @@ -1,1703 +0,0 @@ -From c14d4a91d8546e6ff4101857bcc65297afa2092c Mon Sep 17 00:00:00 2001 -From: Dan Williams <dcbw@redhat.com> -Date: Fri, 17 Dec 2010 09:22:11 -0600 -Subject: [PATCH] policy: stop touching /etc/hosts - -Handling of /etc/hosts is highly site- and admin- specific in -many more complex cases, and it's exceedingly hard and error- -prone for NetworkManager to handle all those cases. So remove -this functionality entirely. That's not a big loss, as it -turns out there's a much more elegant solution. - -The only requirement is that the machine's hostname map back -to an IP address owned by the machine. That requirement can -be satisifed by nss-myhostname or even possibly the distro's -installer. If the user does not want nss-myhostname then it -can be uninstalled. Distros should use a "recommends" feature -in their packaging system so that the NetworkManager package -does *not* have a hard requirement on nss-myhostname. Thus -everyone is happy; things Just Work when nss-myhostname is -installed, but more advanced users can uninstall it and -customize /etc/hosts as they wish. - -Another alternative is a dispatcher script that listents for -the 'hostname' event, and updates /etc/hosts according to the -administrator's preference. ---- - src/main.c | 4 + - src/nm-policy-hostname.c | 56 +--- - src/nm-policy-hostname.h | 5 +- - src/nm-policy-hosts.c | 520 ++-------------------------- - src/nm-policy-hosts.h | 20 +- - src/nm-policy.c | 42 +--- - src/tests/test-policy-hosts.c | 761 ++--------------------------------------- - 7 files changed, 76 insertions(+), 1332 deletions(-) - -diff --git a/src/main.c b/src/main.c -index 7e75f05..2db7345 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -49,6 +49,7 @@ - #include "nm-netlink-monitor.h" - #include "nm-vpn-manager.h" - #include "nm-logging.h" -+#include "nm-policy-hosts.h" - - #if !defined(NM_DIST_VERSION) - # define NM_DIST_VERSION VERSION -@@ -713,6 +714,9 @@ main (int argc, char *argv[]) - goto done; - } - -+ /* Clean leftover "# Added by NetworkManager" entries from /etc/hosts */ -+ nm_policy_hosts_clean_etc_hosts (); -+ - nm_manager_start (manager); - - /* Bring up the loopback interface. */ -diff --git a/src/nm-policy-hostname.c b/src/nm-policy-hostname.c -index 42a2e0f..4fe69c5 100644 ---- a/src/nm-policy-hostname.c -+++ b/src/nm-policy-hostname.c -@@ -30,7 +30,6 @@ - - #include "nm-logging.h" - #include "nm-policy-hostname.h" --#include "nm-policy-hosts.h" - - /************************************************************************/ - -@@ -206,74 +205,39 @@ hostname_thread_is_dead (HostnameThread *ht) - /************************************************************************/ - - #define FALLBACK_HOSTNAME4 "localhost.localdomain" --#define FALLBACK_HOSTNAME6 "localhost6.localdomain6" - - gboolean --nm_policy_set_system_hostname (const char *new_hostname, -- const char *ip4_addr, -- const char *ip6_addr, -- const char *msg) -+nm_policy_set_system_hostname (const char *new_hostname, const char *msg) - { - char old_hostname[HOST_NAME_MAX + 1]; -- int ret = 0; - const char *name; -- gboolean set_hostname = TRUE, changed = FALSE, old_valid = TRUE; -+ int ret; - - if (new_hostname) - g_warn_if_fail (strlen (new_hostname)); - -- name = (new_hostname && strlen (new_hostname)) ? new_hostname : FALLBACK_HOSTNAME4; -- - old_hostname[HOST_NAME_MAX] = '\0'; - errno = 0; - ret = gethostname (old_hostname, HOST_NAME_MAX); - if (ret != 0) { - nm_log_warn (LOGD_DNS, "couldn't get the system hostname: (%d) %s", - errno, strerror (errno)); -- old_valid = FALSE; - } else { - /* Don't set the hostname if it isn't actually changing */ - if ( (new_hostname && !strcmp (old_hostname, new_hostname)) - || (!new_hostname && !strcmp (old_hostname, FALLBACK_HOSTNAME4))) -- set_hostname = FALSE; -- -- if (old_hostname[0] == '\0') -- old_valid = FALSE; -- } -- -- if (set_hostname) { -- nm_log_info (LOGD_DNS, "Setting system hostname to '%s' (%s)", name, msg); -- ret = sethostname (name, strlen (name)); -- if (ret != 0) { -- nm_log_warn (LOGD_DNS, "couldn't set the system hostname to '%s': (%d) %s", -- name, errno, strerror (errno)); - return FALSE; -- } - } - -- /* But even if the hostname isn't changing, always try updating /etc/hosts -- * just in case the hostname changed while NM wasn't running; we need to -- * make sure that /etc/hosts has valid mappings for '127.0.0.1' and the -- * current system hostname. If those exist, -- * nm_policy_hosts_update_etc_hosts() will just return and won't touch -- * /etc/hosts at all. -- */ -- if (!nm_policy_hosts_update_etc_hosts (name, -- old_valid ? old_hostname : NULL, -- FALLBACK_HOSTNAME4, -- FALLBACK_HOSTNAME6, -- ip4_addr, -- ip6_addr, -- &changed)) { -- /* error updating /etc/hosts; fallback to localhost.localdomain */ -- nm_log_info (LOGD_DNS, "Setting system hostname to '" FALLBACK_HOSTNAME4 "' (error updating /etc/hosts)"); -- ret = sethostname (FALLBACK_HOSTNAME4, strlen (FALLBACK_HOSTNAME4)); -- if (ret != 0) { -- nm_log_warn (LOGD_DNS, "couldn't set the fallback system hostname (%s): (%d) %s", -- FALLBACK_HOSTNAME4, errno, strerror (errno)); -- } -+ name = (new_hostname && strlen (new_hostname)) ? new_hostname : FALLBACK_HOSTNAME4; -+ -+ nm_log_info (LOGD_DNS, "Setting system hostname to '%s' (%s)", name, msg); -+ ret = sethostname (name, strlen (name)); -+ if (ret != 0) { -+ nm_log_warn (LOGD_DNS, "couldn't set the system hostname to '%s': (%d) %s", -+ name, errno, strerror (errno)); - } - -- return changed; -+ return (ret == 0); - } - -diff --git a/src/nm-policy-hostname.h b/src/nm-policy-hostname.h -index 9c76884..e76713f 100644 ---- a/src/nm-policy-hostname.h -+++ b/src/nm-policy-hostname.h -@@ -24,10 +24,7 @@ - - #include <glib.h> - --gboolean nm_policy_set_system_hostname (const char *new_hostname, -- const char *ip4_addr, -- const char *ip6_addr, -- const char *msg); -+gboolean nm_policy_set_system_hostname (const char *new_hostname, const char *msg); - - - typedef struct HostnameThread HostnameThread; -diff --git a/src/nm-policy-hosts.c b/src/nm-policy-hosts.c -index 7f9cff8..8bbd1d3 100644 ---- a/src/nm-policy-hosts.c -+++ b/src/nm-policy-hosts.c -@@ -20,526 +20,74 @@ - - #include <config.h> - #include <string.h> --#include <unistd.h> --#include <errno.h> --#include <netdb.h> --#include <ctype.h> --#include <arpa/inet.h> - - #include "nm-policy-hosts.h" - #include "nm-logging.h" - --#define IP4_LH "127.0.0.1" --#define IP6_LH "::1" -- --gboolean --nm_policy_hosts_find_token (const char *line, const char *token) --{ -- const char *start = line, *p = line; -- -- g_return_val_if_fail (line != NULL, FALSE); -- g_return_val_if_fail (token != NULL, FALSE); -- g_return_val_if_fail (strlen (token) > 0, FALSE); -- -- /* Walk through the line to find the next whitespace character */ -- while (p <= line + strlen (line)) { -- if (isblank (*p) || (*p == '\0')) { -- /* Token starts with 'start' and ends with 'end' */ -- if ((p > start) && *start && (p - start == strlen (token)) && !strncmp (start, token, (p - start))) -- return TRUE; /* found */ -- -- /* not found; advance start and continue looking */ -- start = p + 1; -- } -- p++; -- } -- -- return FALSE; --} -- --static gboolean --is_local_mapping (const char *str, gboolean ip6, const char *hostname) --{ -- const char *addr = ip6 ? IP6_LH : IP4_LH; -- const char *fallback = ip6 ? "localhost6" : "localhost"; -- -- return ( !strncmp (str, addr, strlen (addr)) -- && nm_policy_hosts_find_token (str, hostname ? hostname : fallback)); --} -- --static gboolean --is_ip4_addr (const char *str) --{ -- struct in_addr found; -- char buf[INET_ADDRSTRLEN + 2]; -- const char *p = str; -- guint32 i = 0; -- -- memset (buf, 0, sizeof (buf)); -- while (*p && !isblank (*p) && (i < sizeof (buf))) -- buf[i++] = *p++; -- -- return inet_pton (AF_INET, buf, &found) == 1 ? TRUE : FALSE; --} -- --static gboolean --ip4_addr_matches (const char *str, const char *ip4_addr) --{ -- struct in_addr found, given; -- char buf[INET_ADDRSTRLEN + 2]; -- const char *p = str; -- guint32 i = 0; -- -- g_return_val_if_fail (ip4_addr != NULL, FALSE); -- -- memset (buf, 0, sizeof (buf)); -- while (*p && !isblank (*p) && (i < sizeof (buf))) -- buf[i++] = *p++; -- -- if (inet_pton (AF_INET, buf, &found) != 1) -- return FALSE; -- if (inet_pton (AF_INET, ip4_addr, &given) != 1) -- return FALSE; -- -- return memcmp (&found, &given, sizeof (found)) == 0; --} -- --static gboolean --is_ip6_addr (const char *str) --{ -- struct in6_addr found; -- char buf[INET6_ADDRSTRLEN + 2]; -- const char *p = str; -- guint32 i = 0; -- -- memset (buf, 0, sizeof (buf)); -- while (*p && !isblank (*p) && (i < sizeof (buf))) -- buf[i++] = *p++; -- -- return inet_pton (AF_INET6, buf, &found) == 1 ? TRUE : FALSE; --} -- --static gboolean --ip6_addr_matches (const char *str, const char *ip6_addr) --{ -- struct in6_addr found, given; -- char buf[INET6_ADDRSTRLEN + 2]; -- const char *p = str; -- guint32 i = 0; -- -- g_return_val_if_fail (ip6_addr != NULL, FALSE); -- -- memset (buf, 0, sizeof (buf)); -- while (*p && !isblank (*p) && (i < sizeof (buf))) -- buf[i++] = *p++; -- -- if (inet_pton (AF_INET6, buf, &found) != 1) -- return FALSE; -- if (inet_pton (AF_INET6, ip6_addr, &given) != 1) -- return FALSE; -- -- return memcmp (&found, &given, sizeof (found)) == 0; --} -- --static char * --get_custom_hostnames (const char *line, -- const char *hostname, -- const char *old_hostname, -- const char *short_hostname, -- const char *fallback_hostname) --{ -- char **items = NULL, **iter; -- guint start = 0; -- GString *str = NULL; -- char *custom = NULL; -- -- g_return_val_if_fail (line != NULL, NULL); -- -- if (!strncmp (line, IP4_LH, strlen (IP4_LH))) -- start = strlen (IP4_LH); -- else if (!strncmp (line, IP6_LH, strlen (IP6_LH))) -- start = strlen (IP6_LH); -- -- g_return_val_if_fail (start > 0, NULL); -- -- /* Split the line into tokens */ -- items = g_strsplit_set (line + start, " \t", -1); -- if (!items) -- return NULL; -- -- str = g_string_sized_new (50); -- /* Ignore current & old hostnames, and localhost-anything */ -- for (iter = items; iter && *iter; iter++) { -- if (*iter[0] == '\0') -- continue; -- if (hostname && !strcmp (*iter, hostname)) -- continue; -- if (old_hostname && !strcmp (*iter, old_hostname)) -- continue; -- if (short_hostname && !strcmp (*iter, short_hostname)) -- continue; -- if (fallback_hostname && !strcmp (*iter, fallback_hostname)) -- continue; -- if (!strcmp (*iter, "localhost")) -- continue; -- if (!strcmp (*iter, "localhost6")) -- continue; -- if (!strcmp (*iter, "localhost.localdomain")) -- continue; -- if (!strcmp (*iter, "localhost4.localdomain4")) -- continue; -- if (!strcmp (*iter, "localhost6.localdomain6")) -- continue; -- -- /* Found a custom hostname */ -- g_string_append_c (str, '\t'); -- g_string_append (str, *iter); -- } -- -- if (str->len) -- custom = g_string_free (str, FALSE); -- else -- g_string_free (str, TRUE); -- -- g_strfreev (items); -- return custom; --} -- - #define ADDED_TAG "# Added by NetworkManager" - - GString * --nm_policy_get_etc_hosts (const char **lines, -- gsize existing_len, -- const char *hostname, -- const char *old_hostname, -- const char *fallback_hostname4, -- const char *fallback_hostname6, -- const char *ip4_addr, -- const char *ip6_addr, -- GError **error) -+nm_policy_get_etc_hosts (const char *contents, gsize contents_len) - { -- GString *contents = NULL; -- const char **line; -- gboolean found_localhost4 = FALSE; -- gboolean found_localhost6 = FALSE; -- gboolean found_host4 = FALSE; -- gboolean found_host6 = FALSE; -- gboolean found_user_host4 = FALSE; -- gboolean found_user_host6 = FALSE; -- gboolean initial_comments = TRUE; -- gboolean added = FALSE; -- gboolean hostname4_is_fallback; -- gboolean hostname6_is_fallback; -- gboolean host4_before = FALSE; -- gboolean host6_before = FALSE; -- gboolean no_stale = TRUE; -- char *short_hostname = NULL; -- char *custom4 = NULL; -- char *custom6 = NULL; -- -- g_return_val_if_fail (lines != NULL, FALSE); -- g_return_val_if_fail (hostname != NULL, FALSE); -- -- hostname4_is_fallback = !strcmp (hostname, fallback_hostname4); -- hostname6_is_fallback = !strcmp (hostname, fallback_hostname6); -- -- /* Find the short hostname, like 'foo' from 'foo.bar.baz'; we want to -- * make sure that the entries we add for this host also include the short -- * hostname too so that if the resolver does not answer queries for the -- * machine's actual hostname/domain, that stuff like 'ping foo' still works. -- */ -- if (!hostname4_is_fallback || !hostname6_is_fallback) { -- char *dot; -- -- short_hostname = g_strdup (hostname); -- dot = strchr (short_hostname, '.'); -- if (dot && *(dot+1)) -- *dot = '\0'; -- else { -- g_free (short_hostname); -- short_hostname = NULL; -- } -- } -- -- /* We need the following in /etc/hosts: -- * -- * 1) current hostname mapped to current IPv4 addresses if IPv4 is active -- * 2) current hostname mapped to current IPv6 addresses if IPv6 is active -- * 3) 'localhost' mapped to 127.0.0.1 -- * 4) 'localhost6' mapped to ::1 -- * -- * If all these things exist we don't need to bother updating the file. -- */ -- -- if (!ip4_addr) -- host4_before = TRUE; -- if (!ip6_addr) -- host6_before = TRUE; -- -- /* Look for the four cases from above */ -- for (line = lines; lines && *line; line++) { -- gboolean found_hostname = FALSE; -- -- if ((*line[0] == '\0') || (*line[0] == '#')) -- continue; -+ char **lines = NULL, **iter; -+ GString *new_contents = NULL; - -- found_hostname = nm_policy_hosts_find_token (*line, hostname); -- if (found_hostname) { -- /* Found the current hostname on this line */ -- if (ip4_addr && ip4_addr_matches (*line, ip4_addr)) { -- found_host4 = TRUE; -- if (strstr (*line, ADDED_TAG)) { -- if (!host4_before) -- host4_before = !found_localhost4; -- } else { -- found_user_host4 = TRUE; -- host4_before = TRUE; /* Ignore if user added mapping manually */ -- } -- } else if (!ip4_addr && strstr (*line, ADDED_TAG)) { -- /* If this is a stale NM-added IPv4 entry we need to remove it, -- * so make sure we update /etc/hosts. -- */ -- if (is_ip4_addr (*line)) -- no_stale = FALSE; -- } -+ if (contents_len == 0 || !strstr (contents, ADDED_TAG)) -+ return NULL; - -- if (ip6_addr && ip6_addr_matches (*line, ip6_addr)) { -- found_host6 = TRUE; -- if (strstr (*line, ADDED_TAG)) { -- if (!host6_before) -- host6_before = !found_localhost6; -- } else { -- found_user_host6 = TRUE; -- host6_before = TRUE; /* Ignore if user added mapping manually */ -- } -- } else if (!ip6_addr && strstr (*line, ADDED_TAG)) { -- /* If this is a stale NM-added IPv6 entry we need to remove it, -- * so make sure we update /etc/hosts. -- */ -- if (is_ip6_addr (*line)) -- no_stale = FALSE; -- } -- } -+ new_contents = g_string_sized_new (contents_len); - -- if (is_local_mapping (*line, FALSE, "localhost")) { -- /* a 127.0.0.1 line containing 'localhost' */ -- found_localhost4 = TRUE; -- custom4 = get_custom_hostnames (*line, hostname, old_hostname, short_hostname, fallback_hostname4); -- if (!ip4_addr) { -- /* If there's no IP-specific mapping for the current hostname -- * but that hostname is present on in the local mapping line, -- * we've found our IPv4 hostname mapping. If the hostname is -- * the fallback *IPv6* hostname it's not going to show up in -- * the IPv4 local mapping though, so fake it. -- */ -- if (hostname6_is_fallback || found_hostname) -- found_host4 = TRUE; -- } -- } else if (is_local_mapping (*line, TRUE, "localhost6")) { -- /* a ::1 line containing 'localhost6' */ -- found_localhost6 = TRUE; -- custom6 = get_custom_hostnames (*line, hostname, old_hostname, short_hostname, fallback_hostname6); -- if (!ip6_addr) { -- /* If there's no IP-specific mapping for the current hostname -- * but that hostname is present on in the local mapping line, -- * we've found our IPv6 hostname mapping. If the hostname is -- * the fallback *IPv4* hostname it's not going to show up in -- * the IPv6 local mapping though, so fake it. -- */ -- if (hostname4_is_fallback || found_hostname) -- found_host6 = TRUE; -- } -+ /* Remove "# Added ..." lines */ -+ lines = g_strsplit_set (contents, "\n\r", -1); -+ for (iter = lines; iter && *iter; iter++) { -+ if (!strstr (*iter, ADDED_TAG)) { -+ g_string_append (new_contents, *iter); -+ g_string_append_c (new_contents, '\n'); - } -- -- if ( found_localhost4 -- && found_host4 -- && found_localhost6 -- && found_host6 -- && host4_before -- && host6_before -- && no_stale) -- goto out; /* No update required */ -- } -- -- contents = g_string_sized_new (existing_len ? existing_len + 100 : 200); -- if (!contents) { -- g_set_error_literal (error, 0, 0, "not enough memory"); -- goto out; - } -+ g_strfreev (lines); - -- /* Construct the new hosts file; replace any 127.0.0.1/::1 entry that is -- * at the beginning of the file or right after initial comments and contains -- * the string 'localhost' (for IPv4) or 'localhost6' (for IPv6). If there -- * is no 127.0.0.1 or ::1 entry at the beginning or after initial comments -- * that contains 'localhost' or 'localhost6', add one there -- * and ignore any other 127.0.0.1/::1 entries that contain 'localhost' or -- * 'localhost6'. -+ /* Remove last blank line at end of file, if one exists; this is -+ * an artifact of how g_strsplit_set() works. - */ -- for (line = lines, initial_comments = TRUE; lines && *line; line++) { -- /* This is the first line after the initial comments */ -- if (strlen (*line) && initial_comments && (*line[0] != '#')) { -- initial_comments = FALSE; -- -- /* If the user added their own mapping for the hostname, just make -- * a simple 'localhost' mapping and assume the user knows what they -- * are doing with their manual hostname entry. Otherwise if the -- * hostname wasn't found somewhere else, add it to the localhost -- * mapping line to make sure it's mapped to something. -- */ -- -- /* Add the address mappings first so they take precedence */ -- if (!hostname4_is_fallback && ip4_addr && !found_user_host4) { -- g_string_append_printf (contents, "%s\t%s", ip4_addr, hostname); -- if (short_hostname) -- g_string_append_printf (contents, "\t%s", short_hostname); -- g_string_append_printf (contents, "\t%s\n", ADDED_TAG); -- } -- if (!hostname6_is_fallback && ip6_addr && !found_user_host6) { -- g_string_append_printf (contents, "%s\t%s", ip6_addr, hostname); -- if (short_hostname) -- g_string_append_printf (contents, "\t%s", short_hostname); -- g_string_append_printf (contents, "\t%s\n", ADDED_TAG); -- } -+ if ( (new_contents->len > 2) -+ && (new_contents->str[new_contents->len - 1] == '\n')) -+ g_string_truncate (new_contents, new_contents->len - 1); - -- /* IPv4 localhost line */ -- g_string_append (contents, "127.0.0.1"); -- if (!hostname4_is_fallback && !ip4_addr && !found_user_host4) { -- g_string_append_printf (contents, "\t%s", hostname); -- if (short_hostname) -- g_string_append_printf (contents, "\t%s", short_hostname); -- } -- g_string_append_printf (contents, "\t%s\tlocalhost", fallback_hostname4); -- if (custom4) -- g_string_append (contents, custom4); -- g_string_append_c (contents, '\n'); -- -- /* IPv6 localhost line */ -- g_string_append (contents, "::1"); -- if (!hostname6_is_fallback && !hostname4_is_fallback && !ip6_addr && !found_user_host6) { -- g_string_append_printf (contents, "\t%s", hostname); -- if (short_hostname) -- g_string_append_printf (contents, "\t%s", short_hostname); -- } -- g_string_append_printf (contents, "\t%s\tlocalhost6", fallback_hostname6); -- if (custom6) -- g_string_append (contents, custom6); -- g_string_append_c (contents, '\n'); -- -- added = TRUE; -- } -- -- /* Don't add the original line if it is a localhost mapping */ -- if ( !is_local_mapping (*line, FALSE, "localhost") -- && !is_local_mapping (*line, FALSE, fallback_hostname4) -- && !is_local_mapping (*line, FALSE, hostname) -- && !is_local_mapping (*line, TRUE, "localhost6") -- && !is_local_mapping (*line, TRUE, fallback_hostname6) -- && !is_local_mapping (*line, TRUE, hostname) -- && !strstr (*line, ADDED_TAG)) { -- -- g_string_append (contents, *line); -- /* Only append the new line if this isn't the last line in the file */ -- if (*(line+1)) -- g_string_append_c (contents, '\n'); -- } -- } -- -- /* Hmm, /etc/hosts was empty for some reason */ -- if (!added) { -- g_string_append (contents, "# Do not remove the following lines, or various programs\n"); -- g_string_append (contents, "# that require network functionality will fail.\n"); -- -- /* Add the address mappings first so they take precedence */ -- if (!hostname4_is_fallback && ip4_addr) { -- g_string_append_printf (contents, "%s\t%s", ip4_addr, hostname); -- if (short_hostname) -- g_string_append_printf (contents, "\t%s", short_hostname); -- g_string_append_printf (contents, "\t%s\n", ADDED_TAG); -- } -- if (!hostname6_is_fallback && ip6_addr) { -- g_string_append_printf (contents, "%s\t%s", ip6_addr, hostname); -- if (short_hostname) -- g_string_append_printf (contents, "\t%s", short_hostname); -- g_string_append_printf (contents, "\t%s\n", ADDED_TAG); -- } -- -- g_string_append_printf (contents, "127.0.0.1\t%s\tlocalhost\n", fallback_hostname4); -- g_string_append_printf (contents, "::1\t%s\tlocalhost6\n", fallback_hostname6); -- } -- --out: -- g_free (custom4); -- g_free (custom6); -- g_free (short_hostname); -- return contents; -+ return new_contents; - } - --gboolean --nm_policy_hosts_update_etc_hosts (const char *hostname, -- const char *old_hostname, -- const char *fallback_hostname4, -- const char *fallback_hostname6, -- const char *ip4_addr, -- const char *ip6_addr, -- gboolean *out_changed) -+/* remove any leftover "# Added by NetworkManager" lines */ -+void -+nm_policy_hosts_clean_etc_hosts (void) - { - char *contents = NULL; -- char **lines = NULL; -- GError *error = NULL; -- GString *new_contents = NULL; - gsize contents_len = 0; -- gboolean success = FALSE; -- -- g_return_val_if_fail (hostname != NULL, FALSE); -- g_return_val_if_fail (out_changed != NULL, FALSE); -+ GError *error = NULL; -+ GString *new; - - if (!g_file_get_contents (SYSCONFDIR "/hosts", &contents, &contents_len, &error)) { - nm_log_warn (LOGD_DNS, "couldn't read " SYSCONFDIR "/hosts: (%d) %s", - error ? error->code : 0, - (error && error->message) ? error->message : "(unknown)"); - g_clear_error (&error); -- return FALSE; -+ return; - } - -- /* Get the new /etc/hosts contents */ -- lines = g_strsplit_set (contents, "\n\r", 0); -- new_contents = nm_policy_get_etc_hosts ((const char **) lines, -- contents_len, -- hostname, -- old_hostname, -- fallback_hostname4, -- fallback_hostname6, -- ip4_addr, -- ip6_addr, -- &error); -- g_strfreev (lines); -- g_free (contents); -- -- if (new_contents) { -- nm_log_info (LOGD_DNS, "Updating /etc/hosts with new system hostname"); -+ new = nm_policy_get_etc_hosts (contents, contents_len); -+ if (new && new->len) { -+ nm_log_info (LOGD_DNS, "Cleaning leftovers from /etc/hosts"); - - g_clear_error (&error); -- /* And actually update /etc/hosts */ -- if (!g_file_set_contents (SYSCONFDIR "/hosts", new_contents->str, -1, &error)) { -- nm_log_warn (LOGD_DNS, "couldn't update " SYSCONFDIR "/hosts: (%d) %s", -- error ? error->code : 0, -- (error && error->message) ? error->message : "(unknown)"); -+ if (!g_file_set_contents (SYSCONFDIR "/hosts", new->str, -1, &error)) { -+ nm_log_dbg (LOGD_DNS, "couldn't update " SYSCONFDIR "/hosts: (%d) %s", -+ error ? error->code : 0, -+ (error && error->message) ? error->message : "(unknown)"); - g_clear_error (&error); -- } else { -- success = TRUE; -- *out_changed = TRUE; - } -- -- g_string_free (new_contents, TRUE); -- } else if (!error) { -- /* No change required */ -- success = TRUE; -- } else { -- nm_log_warn (LOGD_DNS, "couldn't read " SYSCONFDIR "/hosts: (%d) %s", -- error->code, error->message ? error->message : "(unknown)"); -- g_clear_error (&error); - } - -- return success; -+ if (new) -+ g_string_free (new, TRUE); - } - -diff --git a/src/nm-policy-hosts.h b/src/nm-policy-hosts.h -index ebaaf0f..9f4bf9a 100644 ---- a/src/nm-policy-hosts.h -+++ b/src/nm-policy-hosts.h -@@ -23,26 +23,10 @@ - - #include <glib.h> - --gboolean nm_policy_hosts_update_etc_hosts (const char *hostname, -- const char *old_hostname, -- const char *fallback_hostname4, -- const char *fallback_hostname6, -- const char *ip4_addr, -- const char *ip6_addr, -- gboolean *out_changed); -+void nm_policy_hosts_clean_etc_hosts (void); - - /* Only for testcases; don't use outside of nm-policy-hosts.c */ --gboolean nm_policy_hosts_find_token (const char *line, const char *token); -- --GString *nm_policy_get_etc_hosts (const char **lines, -- gsize existing_len, -- const char *hostname, -- const char *old_hostname, -- const char *fallback_hostname4, -- const char *fallback_hostname6, -- const char *ip4_addr, -- const char *ip6_addr, -- GError **error); -+GString *nm_policy_get_etc_hosts (const char *contents, gsize contents_len); - - #endif /* NM_POLICY_HOSTS_H */ - -diff --git a/src/nm-policy.c b/src/nm-policy.c -index e8a18d0..709be09 100644 ---- a/src/nm-policy.c -+++ b/src/nm-policy.c -@@ -42,7 +42,6 @@ - #include "nm-system.h" - #include "nm-dns-manager.h" - #include "nm-vpn-manager.h" --#include "nm-policy-hosts.h" - #include "nm-policy-hostname.h" - - struct NMPolicy { -@@ -233,9 +232,6 @@ _set_hostname (NMPolicy *policy, - const char *new_hostname, - const char *msg) - { -- char ip4_addr[INET_ADDRSTRLEN + 1]; -- char ip6_addr[INET6_ADDRSTRLEN + 1]; -- - if (change_hostname) { - NMDnsManager *dns_mgr; - -@@ -247,43 +243,7 @@ _set_hostname (NMPolicy *policy, - g_object_unref (dns_mgr); - } - -- /* Get the default IPv4 and IPv6 addresses so we can assign -- * the hostname to them in /etc/hosts. -- */ -- memset (ip4_addr, 0, sizeof (ip4_addr)); -- if (policy->default_device4) { -- NMIP4Config *config = NULL; -- NMIP4Address *addr = NULL; -- -- config = nm_device_get_ip4_config (policy->default_device4); -- if (config) -- addr = nm_ip4_config_get_address (config, 0); -- -- if (addr) { -- struct in_addr tmp; -- -- tmp.s_addr = nm_ip4_address_get_address (addr); -- inet_ntop (AF_INET, &tmp, ip4_addr, sizeof (ip4_addr)); -- } -- } -- -- memset (ip6_addr, 0, sizeof (ip6_addr)); -- if (policy->default_device6) { -- NMIP6Config *config = NULL; -- NMIP6Address *addr = NULL; -- -- config = nm_device_get_ip6_config (policy->default_device6); -- if (config) -- addr = nm_ip6_config_get_address (config, 0); -- -- if (addr) -- inet_ntop (AF_INET6, nm_ip6_address_get_address (addr), ip6_addr, sizeof (ip6_addr)); -- } -- -- if (nm_policy_set_system_hostname (policy->cur_hostname, -- strlen (ip4_addr) ? ip4_addr : NULL, -- strlen (ip6_addr) ? ip6_addr : NULL, -- msg)) -+ if (nm_policy_set_system_hostname (policy->cur_hostname, msg)) - nm_utils_call_dispatcher ("hostname", NULL, NULL, NULL); - } - -diff --git a/src/tests/test-policy-hosts.c b/src/tests/test-policy-hosts.c -index 8865c42..62862e7 100644 ---- a/src/tests/test-policy-hosts.c -+++ b/src/tests/test-policy-hosts.c -@@ -23,41 +23,17 @@ - - #include "nm-policy-hosts.h" - --#define FALLBACK_HOSTNAME4 "localhost.localdomain" --#define FALLBACK_HOSTNAME6 "localhost6.localdomain6" -- --#define DEBUG 0 -+#define DEBUG 1 - - static void --test_generic (const char *before, -- const char *after, -- const char *hostname, -- const char *ip4_addr, -- const char *ip6_addr, -- gboolean expect_error) -+test_generic (const char *before, const char *after) - { -- char **lines; - GString *newc; -- GError *error = NULL; - - /* Get the new /etc/hosts contents */ -- lines = g_strsplit_set (before, "\n\r", 0); -- newc = nm_policy_get_etc_hosts ((const char **) lines, -- strlen (before), -- hostname, -- NULL, -- FALLBACK_HOSTNAME4, -- FALLBACK_HOSTNAME6, -- ip4_addr, -- ip6_addr, -- &error); -- g_strfreev (lines); -+ newc = nm_policy_get_etc_hosts (before, strlen (before)); - -- if (expect_error) { -- g_assert (newc == NULL); -- g_assert (error != NULL); -- g_clear_error (&error); -- } else if (after == NULL) { -+ if (after == NULL) { - /* No change to /etc/hosts required */ - #if DEBUG - if (newc != NULL) { -@@ -68,10 +44,8 @@ test_generic (const char *before, - } - #endif - g_assert (newc == NULL); -- g_assert (error == NULL); - } else { - g_assert (newc != NULL); -- g_assert (error == NULL); - - #if DEBUG - g_message ("\n- NEW ---------------------------------\n" -@@ -81,7 +55,6 @@ test_generic (const char *before, - "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", - newc->str, after); - #endif -- g_assert (strlen (newc->str) == strlen (after)); - g_assert (strcmp (newc->str, after) == 0); - g_string_free (newc, TRUE); - } -@@ -99,7 +72,7 @@ static const char *generic_before = \ - static void - test_hosts_generic (void) - { -- test_generic (generic_before, NULL, "localhost.localdomain", NULL, NULL, FALSE); -+ test_generic (generic_before, NULL); - } - - /*******************************************/ -@@ -112,311 +85,25 @@ static const char *generic_no_boilerplate_before = \ - static void - test_hosts_generic_no_boilerplate (void) - { -- test_generic (generic_no_boilerplate_before, NULL, "localhost.localdomain", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *generic_no_boilerplate_no_lh_before = \ -- "127.0.0.1 localhost.localdomain\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *generic_no_boilerplate_no_lh_after = \ -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_generic_no_boilerplate_no_lh (void) --{ -- test_generic (generic_no_boilerplate_no_lh_before, -- generic_no_boilerplate_no_lh_after, -- "localhost.localdomain", -- NULL, -- NULL, -- FALSE); --} -- --/*******************************************/ -- -- --static const char *generic_no_boilerplate_no_lh_no_host_before = \ -- "127.0.0.1 localhost.localdomain\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *generic_no_boilerplate_no_lh_no_host_after = \ -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_generic_no_boilerplate_no_lh_no_host (void) --{ -- test_generic (generic_no_boilerplate_no_lh_no_host_before, -- generic_no_boilerplate_no_lh_no_host_after, -- "comet", -- NULL, -- NULL, -- FALSE); --} -- --/*******************************************/ --static const char *named_generic_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 playboy localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *named_generic_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 playboy localhost.localdomain localhost\n" -- "::1 playboy localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_named_generic (void) --{ -- test_generic (named_generic_before, named_generic_after, "playboy", NULL, NULL, FALSE); -+ test_generic (generic_no_boilerplate_before, NULL); - } - - /*******************************************/ - --static const char *named4_non127_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 tomcat localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "192.168.1.2 tomcat\n"; -- --static void --test_hosts_named4_non127 (void) --{ -- test_generic (named4_non127_before, NULL, "tomcat", "192.168.1.2", NULL, FALSE); --} -- --/*******************************************/ -- --static const char *named6_non127_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 tomcat localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "3001:abba::3234 tomcat\n"; -- --static void --test_hosts_named6_non127 (void) --{ -- test_generic (named6_non127_before, NULL, "tomcat", NULL, "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *named4_non127_more_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 tomcat localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "192.168.1.2 tomcat\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "127.0.0.1 srx.main.ebayrtm.com\n" -- "127.0.0.1 cdn5.tribalfusion.com\n"; -- --static void --test_hosts_named4_non127_more (void) --{ -- test_generic (named4_non127_more_before, NULL, "tomcat", "192.168.1.2", NULL, FALSE); --} -- --/*******************************************/ -- --static const char *named6_non127_more_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 tomcat localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "3001:abba::3234 tomcat\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "127.0.0.1 srx.main.ebayrtm.com\n" -- "127.0.0.1 cdn5.tribalfusion.com\n"; -- --static void --test_hosts_named6_non127_more (void) --{ -- test_generic (named6_non127_more_before, NULL, "tomcat", NULL, "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *named_no_lh_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "192.168.1.2 tomcat\n"; -- --static const char *named_no_lh_after = \ -+static const char *leftover_before = \ - "# Do not remove the following line, or various programs\n" - "# that require network functionality will fail.\n" -+ "192.168.1.2 comet # Added by NetworkManager\n" - "127.0.0.1 localhost.localdomain localhost\n" -- "::1 tomcat localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "192.168.1.2 tomcat\n"; -- --static void --test_hosts_named_no_localhost (void) --{ -- test_generic (named_no_lh_before, named_no_lh_after, "tomcat", "192.168.1.2", NULL, FALSE); --} -- --/*******************************************/ -- --static const char *no_lh_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 tomcat\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *no_lh_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 tomcat localhost.localdomain localhost\n" -- "::1 tomcat localhost6.localdomain6 localhost6\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_no_localhost (void) --{ -- test_generic (no_lh_before, no_lh_after, "tomcat", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *named_last_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 sparcbook.ausil.us\n" -- "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 sparcbook.ausil.us\n"; -- --static void --test_hosts_named_last (void) --{ -- test_generic (named_last_before, NULL, "sparcbook.ausil.us", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *no_host4_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "127.0.0.1 srx.main.ebayrtm.com\n" -- "127.0.0.1 cdn5.tribalfusion.com\n" -- "127.0.0.1 a.tribalfusion.com\n"; -- --static const char *no_host4_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "127.0.0.1 srx.main.ebayrtm.com\n" -- "127.0.0.1 cdn5.tribalfusion.com\n" -- "127.0.0.1 a.tribalfusion.com\n"; -- --static void --test_hosts_no_host4 (void) --{ -- test_generic (no_host4_before, no_host4_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *no_host6_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *no_host6_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_no_host6 (void) --{ -- test_generic (no_host6_before, no_host6_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *named46_non127_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.2 comet\n" -- "3001:abba::3234 comet\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_named46_non127 (void) --{ -- test_generic (named46_non127_before, NULL, "comet", "192.168.1.2", "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *named46_non127_long_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.2 comet.space comet\n" -- "3001:abba::3234 comet.space comet\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_named46_non127_long (void) --{ -- test_generic (named46_non127_long_before, NULL, "comet.space", "192.168.1.2", "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *named46_non127_other4_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" - "::1 localhost6.localdomain6 localhost6\n" - "192.168.1.3 comet\n" - "3001:abba::3234 comet\n" - "\n" - "127.0.0.1 lcmd.us.intellitxt.com\n"; - --static const char *named46_non127_other4_after = \ -+static const char *leftover_after = \ - "# Do not remove the following line, or various programs\n" - "# that require network functionality will fail.\n" -- "192.168.1.2 comet # Added by NetworkManager\n" - "127.0.0.1 localhost.localdomain localhost\n" - "::1 localhost6.localdomain6 localhost6\n" - "192.168.1.3 comet\n" -@@ -425,416 +112,44 @@ static const char *named46_non127_other4_after = \ - "127.0.0.1 lcmd.us.intellitxt.com\n"; - - static void --test_hosts_named46_non127_other4 (void) -+test_hosts_leftover (void) - { -- test_generic (named46_non127_other4_before, named46_non127_other4_after, "comet", "192.168.1.2", "3001:abba::3234", FALSE); -+ test_generic (leftover_before, leftover_after); - } - - /*******************************************/ - --static const char *named46_non127_other4_long_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.3 comet.space\n" -- "3001:abba::3234 comet.space\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *named46_non127_other4_long_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "192.168.1.2 comet.space comet # Added by NetworkManager\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.3 comet.space\n" -- "3001:abba::3234 comet.space\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_named46_non127_other4_long (void) --{ -- test_generic (named46_non127_other4_long_before, named46_non127_other4_long_after, "comet.space", "192.168.1.2", "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *named46_non127_other6_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.2 comet\n" -- "3001:abba::9675 comet\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *named46_non127_other6_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "3001:abba::3234 comet # Added by NetworkManager\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.2 comet\n" -- "3001:abba::9675 comet\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_named46_non127_other6 (void) --{ -- test_generic (named46_non127_other6_before, named46_non127_other6_after, "comet", "192.168.1.2", "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *named46_non127_other6_long_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.2 comet.space\n" -- "3001:abba::9675 comet.space\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *named46_non127_other6_long_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "3001:abba::3234 comet.space comet # Added by NetworkManager\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.2 comet.space\n" -- "3001:abba::9675 comet.space\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_named46_non127_other6_long (void) --{ -- test_generic (named46_non127_other6_long_before, named46_non127_other6_long_after, "comet.space", "192.168.1.2", "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *unnamed46_non127_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *unnamed46_non127_after = \ -+static const char *leftover_double_newline_before = \ - "# Do not remove the following line, or various programs\n" - "# that require network functionality will fail.\n" - "192.168.1.2 comet # Added by NetworkManager\n" -- "3001:abba::3234 comet # Added by NetworkManager\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_unnamed46_non127 (void) --{ -- test_generic (unnamed46_non127_before, unnamed46_non127_after, "comet", "192.168.1.2", "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *unnamed46_non127_long_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static const char *unnamed46_non127_long_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "192.168.1.2 comet.space comet # Added by NetworkManager\n" -- "3001:abba::3234 comet.space comet # Added by NetworkManager\n" - "127.0.0.1 localhost.localdomain localhost\n" - "::1 localhost6.localdomain6 localhost6\n" -+ "192.168.1.3 comet\n" -+ "3001:abba::3234 comet\n" - "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_unnamed46_non127_long (void) --{ -- test_generic (unnamed46_non127_long_before, unnamed46_non127_long_after, "comet.space", "192.168.1.2", "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *named46_non127_wrong_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "192.168.1.3 comet # Added by NetworkManager\n" -- "3001:abba::9876 comet # Added by NetworkManager\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -+ "127.0.0.1 lcmd.us.intellitxt.com\n" -+ "\n"; - --static const char *named46_non127_wrong_after = \ -+static const char *leftover_double_newline_after = \ - "# Do not remove the following line, or various programs\n" - "# that require network functionality will fail.\n" -- "192.168.1.2 comet # Added by NetworkManager\n" -- "3001:abba::3234 comet # Added by NetworkManager\n" - "127.0.0.1 localhost.localdomain localhost\n" - "::1 localhost6.localdomain6 localhost6\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n"; -- --static void --test_hosts_named46_non127_wrong (void) --{ -- test_generic (named46_non127_wrong_before, named46_non127_wrong_after, "comet", "192.168.1.2", "3001:abba::3234", FALSE); --} -- --/*******************************************/ -- --static const char *long_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost comet\n" -- "::1 localhost6.localdomain6 localhost6\n" -- "\n" -- "127.0.0.1 lcmd.us.intellitxt.com\n" -- "127.0.0.1 adserver.adtech.de\n" -- "127.0.0.1 a.as-us.falkag.net\n" -- "127.0.0.1 a.as-eu.falkag.net\n" -- "127.0.0.1 ads.doubleclick.com\n" -- "\n" -- "# random comment\n" -- "127.0.0.1 m1.2mdn.net\n" -- "127.0.0.1 ds.serving-sys.com\n" -- "127.0.0.1 pagead2.googlesyndication.com\n" -- "127.0.0.1 ad.doubleclick.com\n" -- "127.0.0.1 ad.doubleclick.net\n" -- "127.0.0.1 oascentral.movietickets.com\n" -- "127.0.0.1 view.atdmt.com\n" -- "127.0.0.1 ads.chumcity.com\n"; -- --static const char *long_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6\n" -+ "192.168.1.3 comet\n" -+ "3001:abba::3234 comet\n" - "\n" - "127.0.0.1 lcmd.us.intellitxt.com\n" -- "127.0.0.1 adserver.adtech.de\n" -- "127.0.0.1 a.as-us.falkag.net\n" -- "127.0.0.1 a.as-eu.falkag.net\n" -- "127.0.0.1 ads.doubleclick.com\n" -- "\n" -- "# random comment\n" -- "127.0.0.1 m1.2mdn.net\n" -- "127.0.0.1 ds.serving-sys.com\n" -- "127.0.0.1 pagead2.googlesyndication.com\n" -- "127.0.0.1 ad.doubleclick.com\n" -- "127.0.0.1 ad.doubleclick.net\n" -- "127.0.0.1 oascentral.movietickets.com\n" -- "127.0.0.1 view.atdmt.com\n" -- "127.0.0.1 ads.chumcity.com\n"; -- --static void --test_hosts_long (void) --{ -- test_generic (long_before, long_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *custom4_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost pintglass\n" -- "::1 localhost6.localdomain6 localhost6\n"; -- --static const char *custom4_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost pintglass\n" -- "::1 comet localhost6.localdomain6 localhost6\n"; -- --static void --test_hosts_custom4 (void) --{ -- test_generic (custom4_before, custom4_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *custom6_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6 pintglass\n"; -- --static const char *custom6_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6 pintglass\n"; -- --static void --test_hosts_custom6 (void) --{ -- test_generic (custom6_before, custom6_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *custom46_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost shotglass\n" -- "::1 localhost6.localdomain6 localhost6 pintglass\n"; -- --static const char *custom46_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost shotglass\n" -- "::1 comet localhost6.localdomain6 localhost6 pintglass\n"; -- --static void --test_hosts_custom46 (void) --{ -- test_generic (custom46_before, custom46_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *custom46_mixed_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 localhost.localdomain localhost shotglass\n" -- "::1 localhost6.localdomain6 localhost6 pintglass\n"; -- --static const char *custom46_mixed_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost shotglass\n" -- "::1 comet localhost6.localdomain6 localhost6 pintglass\n"; -- --static void --test_hosts_custom46_mixed (void) --{ -- test_generic (custom46_mixed_before, custom46_mixed_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *stale4_removed_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "1.2.3.4 comet # Added by NetworkManager\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6\n"; -- --static const char *stale4_removed_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6\n"; -+ "\n"; - - static void --test_hosts_stale4_removed (void) -+test_hosts_leftover_double_newline (void) - { -- test_generic (stale4_removed_before, stale4_removed_after, "comet", NULL, NULL, FALSE); -+ test_generic (leftover_double_newline_before, leftover_double_newline_after); - } - - /*******************************************/ - --static const char *stale6_removed_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "3001:abba::3234 comet # Added by NetworkManager\n" -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n"; -- --static const char *stale6_removed_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6\n"; -- --static void --test_hosts_stale6_removed (void) --{ -- test_generic (stale6_removed_before, stale6_removed_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --static const char *stale46_removed_before = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "1.2.3.4 comet # Added by NetworkManager\n" -- "3001:abba::3234 comet # Added by NetworkManager\n" -- "127.0.0.1 localhost.localdomain localhost\n" -- "::1 localhost6.localdomain6 localhost6\n"; -- --static const char *stale46_removed_after = \ -- "# Do not remove the following line, or various programs\n" -- "# that require network functionality will fail.\n" -- "127.0.0.1 comet localhost.localdomain localhost\n" -- "::1 comet localhost6.localdomain6 localhost6\n"; -- --static void --test_hosts_stale46_removed (void) --{ -- test_generic (stale46_removed_before, stale46_removed_after, "comet", NULL, NULL, FALSE); --} -- --/*******************************************/ -- --typedef struct { -- const char *line; -- const char *token; -- gboolean expected; --} Foo; -- --static Foo foo[] = { -- /* Using \t here to easily differentiate tabs vs. spaces for testing */ -- { "127.0.0.1\tfoobar\tblah", "blah", TRUE }, -- { "", "blah", FALSE }, -- { "1.1.1.1\tbork\tfoo", "blah", FALSE }, -- { "127.0.0.1 foobar\tblah", "blah", TRUE }, -- { "127.0.0.1 foobar blah", "blah", TRUE }, -- { "127.0.0.1 localhost", "localhost.localdomain", FALSE }, -- { "192.168.1.1 blah borkbork", "blah", TRUE }, -- { "192.168.1.1 foobar\tblah borkbork", "blah", TRUE }, -- { "192.168.1.1\tfoobar\tblah\tborkbork", "blah", TRUE }, -- { "192.168.1.1 \tfoobar \tblah \tborkbork\t ", "blah", TRUE }, -- { "\t\t\t\t \t\t\tasdfadf a\t\t\t\t\t \t\t\t\t\t ", "blah", FALSE }, -- { NULL, NULL, FALSE } --}; -- --static void --test_find_token (void) --{ -- Foo *iter = &foo[0]; -- -- while (iter->line) { -- gboolean found; -- -- found = nm_policy_hosts_find_token (iter->line, iter->token); -- if (found != iter->expected) { -- g_warning ("find-token: unexpected token result %d for '%s' <= '%s' (expected %d)", -- found, iter->line, iter->token, iter->expected); -- } -- g_assert (found == iter->expected); -- iter++; -- } --} -- - #if GLIB_CHECK_VERSION(2,25,12) - typedef GTestFixtureFunc TCFunc; - #else -@@ -851,38 +166,10 @@ int main (int argc, char **argv) - - suite = g_test_get_root (); - -- g_test_suite_add (suite, TESTCASE (test_find_token, NULL)); - g_test_suite_add (suite, TESTCASE (test_hosts_generic, NULL)); - g_test_suite_add (suite, TESTCASE (test_hosts_generic_no_boilerplate, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_generic_no_boilerplate_no_lh, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_generic_no_boilerplate_no_lh_no_host, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named_generic, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named4_non127, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named6_non127, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named4_non127_more, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named6_non127_more, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named46_non127, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named46_non127_long, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named46_non127_other4, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named46_non127_other4_long, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named46_non127_other6, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named46_non127_other6_long, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named46_non127_wrong, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_unnamed46_non127, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_unnamed46_non127_long, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named_no_localhost, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_no_localhost, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_named_last, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_no_host4, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_no_host6, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_long, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_custom4, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_custom6, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_custom46, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_custom46_mixed, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_stale4_removed, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_stale6_removed, NULL)); -- g_test_suite_add (suite, TESTCASE (test_hosts_stale46_removed, NULL)); -+ g_test_suite_add (suite, TESTCASE (test_hosts_leftover, NULL)); -+ g_test_suite_add (suite, TESTCASE (test_hosts_leftover_double_newline, NULL)); - - return g_test_run (); - } --- -1.7.2.3 - diff --git a/debian/patches/70-install-nm-online.patch b/debian/patches/70-install-nm-online.patch deleted file mode 100644 index af5d67ad..00000000 --- a/debian/patches/70-install-nm-online.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 3619b3b834b9227628a5d73583401f404e2c46aa Mon Sep 17 00:00:00 2001 -From: Michael Biebl <biebl@debian.org> -Date: Sat, 18 Dec 2010 12:04:07 +0100 -Subject: [PATCH] Install nm-online to bindir - ---- - test/Makefile.am | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -Index: network-manager/test/Makefile.am -=================================================================== ---- network-manager.orig/test/Makefile.am 2010-11-29 00:51:00.710135988 +0100 -+++ network-manager/test/Makefile.am 2010-12-18 12:38:17.333677825 +0100 -@@ -10,9 +10,9 @@ - -DNM_RUN_DIR=\"$(rundir)\" \ - -DDATADIR=\"$(datadir)\" - --bin_PROGRAMS = nm-tool -+bin_PROGRAMS = nm-tool nm-online - --noinst_PROGRAMS = nm-online libnm-glib-test -+noinst_PROGRAMS = libnm-glib-test - - nm_tool_SOURCES = nm-tool.c - nm_tool_LDADD = \ -Index: network-manager/test/Makefile.in -=================================================================== ---- network-manager.orig/test/Makefile.in 2010-12-18 12:38:31.881683944 +0100 -+++ network-manager/test/Makefile.in 2010-12-18 12:39:35.693688720 +0100 -@@ -34,8 +34,8 @@ - POST_UNINSTALL = : - build_triplet = @build@ - host_triplet = @host@ --bin_PROGRAMS = nm-tool$(EXEEXT) --noinst_PROGRAMS = nm-online$(EXEEXT) libnm-glib-test$(EXEEXT) -+bin_PROGRAMS = nm-tool$(EXEEXT) nm-online$(EXEEXT) -+noinst_PROGRAMS = libnm-glib-test$(EXEEXT) - subdir = test - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 diff --git a/debian/patches/80-keyfile-ignore-temporary-files.patch b/debian/patches/80-keyfile-ignore-temporary-files.patch deleted file mode 100644 index 75bc4fbb..00000000 --- a/debian/patches/80-keyfile-ignore-temporary-files.patch +++ /dev/null @@ -1,261 +0,0 @@ -From 6ab5d4488e6365525684e542645f4b7adb428e70 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com> -Date: Wed, 10 Nov 2010 16:21:25 +0100 -Subject: [PATCH] keyfile: ignore temporary files (bgo #602868) - -Ignore temporary files created by vim editor and temporary files created -internally by g_file_set_contents() (mkstemp()) when writing connections. ---- - system-settings/plugins/keyfile/Makefile.am | 2 + - system-settings/plugins/keyfile/common.h | 3 + - system-settings/plugins/keyfile/plugin.c | 9 +++ - system-settings/plugins/keyfile/utils.c | 97 +++++++++++++++++++++++++++ - system-settings/plugins/keyfile/utils.h | 30 ++++++++ - 5 files changed, 141 insertions(+), 0 deletions(-) - create mode 100644 system-settings/plugins/keyfile/utils.c - create mode 100644 system-settings/plugins/keyfile/utils.h - -Index: network-manager/system-settings/plugins/keyfile/Makefile.am -=================================================================== ---- network-manager.orig/system-settings/plugins/keyfile/Makefile.am 2010-12-22 00:15:34.626168878 +0100 -+++ network-manager/system-settings/plugins/keyfile/Makefile.am 2010-12-22 00:16:23.682172387 +0100 -@@ -16,6 +16,8 @@ - writer.c \ - writer.h \ - errors.c \ -+ utils.c \ -+ utils.h \ - common.h - - libkeyfile_io_la_CPPFLAGS = \ -Index: network-manager/system-settings/plugins/keyfile/common.h -=================================================================== ---- network-manager.orig/system-settings/plugins/keyfile/common.h 2010-12-22 00:15:34.542170745 +0100 -+++ network-manager/system-settings/plugins/keyfile/common.h 2010-12-22 00:16:23.682172387 +0100 -@@ -23,6 +23,9 @@ - - #include <glib.h> - -+#define SWP_TAG ".swp" -+#define SWPX_TAG ".swpx" -+ - #define KEYFILE_PLUGIN_NAME "keyfile" - #define KEYFILE_PLUGIN_INFO "(c) 2007 - 2010 Red Hat, Inc. To report bugs please use the NetworkManager mailing list." - -Index: network-manager/system-settings/plugins/keyfile/plugin.c -=================================================================== ---- network-manager.orig/system-settings/plugins/keyfile/plugin.c 2010-12-22 00:15:34.566171289 +0100 -+++ network-manager/system-settings/plugins/keyfile/plugin.c 2010-12-22 00:16:23.682172387 +0100 -@@ -39,6 +39,7 @@ - #include "nm-keyfile-connection.h" - #include "writer.h" - #include "common.h" -+#include "utils.h" - - #define CONF_FILE SYSCONFDIR "/NetworkManager/NetworkManager.conf" - #define OLD_CONF_FILE SYSCONFDIR "/NetworkManager/nm-system-settings.conf" -@@ -89,6 +90,9 @@ - NMKeyfileConnection *connection; - char *full_path; - -+ if (utils_should_ignore_file (item)) -+ continue; -+ - full_path = g_build_filename (KEYFILE_DIR, item, NULL); - PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, "parsing %s ... ", item); - connection = nm_keyfile_connection_new (full_path, &error); -@@ -192,6 +196,11 @@ - GError *error = NULL; - - name = g_file_get_path (file); -+ if (utils_should_ignore_file (name)) { -+ g_free (name); -+ return; -+ } -+ - connection = g_hash_table_lookup (priv->hash, name); - - switch (event_type) { -Index: network-manager/system-settings/plugins/keyfile/utils.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ network-manager/system-settings/plugins/keyfile/utils.c 2010-12-22 00:16:23.682172387 +0100 -@@ -0,0 +1,97 @@ -+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -+/* NetworkManager system settings service -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * (C) Copyright 2010 Red Hat, Inc. -+ */ -+ -+#include <glib.h> -+#include <stdlib.h> -+#include <string.h> -+#include "utils.h" -+ -+ -+static const char temp_letters[] = -+"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; -+ -+/* -+ * Check '.[a-zA-Z0-9]{6}' file suffix used for temporary files by g_file_set_contents() (mkstemp()). -+ */ -+static gboolean -+check_mkstemp_suffix (const char *path) -+{ -+ const char *ptr; -+ -+ g_return_val_if_fail (path != NULL, FALSE); -+ -+ /* Matches *.[a-zA-Z0-9]{6} suffix of mkstemp()'s temporary files */ -+ ptr = strrchr (path, '.'); -+ if (ptr && (strspn (ptr + 1, temp_letters) == 6) && (! ptr[7])) -+ return TRUE; -+ return FALSE; -+} -+ -+static gboolean -+check_prefix (const char *base, const char *tag) -+{ -+ int len, tag_len; -+ -+ g_return_val_if_fail (base != NULL, TRUE); -+ g_return_val_if_fail (tag != NULL, TRUE); -+ -+ len = strlen (base); -+ tag_len = strlen (tag); -+ if ((len > tag_len) && !strncasecmp (base, tag, tag_len)) -+ return TRUE; -+ return FALSE; -+} -+ -+static gboolean -+check_suffix (const char *base, const char *tag) -+{ -+ int len, tag_len; -+ -+ g_return_val_if_fail (base != NULL, TRUE); -+ g_return_val_if_fail (tag != NULL, TRUE); -+ -+ len = strlen (base); -+ tag_len = strlen (tag); -+ if ((len > tag_len) && !strcasecmp (base + len - tag_len, tag)) -+ return TRUE; -+ return FALSE; -+} -+ -+gboolean -+utils_should_ignore_file (const char *filename) -+{ -+ char *base; -+ gboolean ignore = FALSE; -+ -+ g_return_val_if_fail (filename != NULL, TRUE); -+ -+ base = g_path_get_basename (filename); -+ g_return_val_if_fail (base != NULL, TRUE); -+ -+ /* Ignore files with certain patterns */ -+ if ( (check_prefix (base, ".") && check_suffix (base, SWP_TAG)) /* vim temporary files: .filename.swp */ -+ || (check_prefix (base, ".") && check_suffix (base, SWPX_TAG)) /* vim temporary files: .filename.swpx */ -+ || check_mkstemp_suffix (base)) /* temporary files created by mkstemp() */ -+ ignore = TRUE; -+ -+ g_free (base); -+ return ignore; -+} -+ -Index: network-manager/system-settings/plugins/keyfile/utils.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ network-manager/system-settings/plugins/keyfile/utils.h 2010-12-22 00:16:23.686171220 +0100 -@@ -0,0 +1,30 @@ -+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -+/* NetworkManager system settings service -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * (C) Copyright 2010 Red Hat, Inc. -+ */ -+ -+#ifndef _UTILS_H_ -+#define _UTILS_H_ -+ -+#include <glib.h> -+#include "common.h" -+ -+gboolean utils_should_ignore_file (const char *filename); -+ -+#endif /* _UTILS_H_ */ -+ -Index: network-manager/system-settings/plugins/keyfile/Makefile.in -=================================================================== ---- network-manager.orig/system-settings/plugins/keyfile/Makefile.in 2010-12-22 00:16:33.014165791 +0100 -+++ network-manager/system-settings/plugins/keyfile/Makefile.in 2010-12-22 00:16:56.402165785 +0100 -@@ -75,7 +75,8 @@ - am__DEPENDENCIES_1 = - libkeyfile_io_la_DEPENDENCIES = $(am__DEPENDENCIES_1) - am_libkeyfile_io_la_OBJECTS = libkeyfile_io_la-reader.lo \ -- libkeyfile_io_la-writer.lo libkeyfile_io_la-errors.lo -+ libkeyfile_io_la-writer.lo libkeyfile_io_la-errors.lo \ -+ libkeyfile_io_la-utils.lo - libkeyfile_io_la_OBJECTS = $(am_libkeyfile_io_la_OBJECTS) - AM_V_lt = $(am__v_lt_$(V)) - am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) -@@ -361,6 +362,8 @@ - writer.c \ - writer.h \ - errors.c \ -+ utils.c \ -+ utils.h \ - common.h - - libkeyfile_io_la_CPPFLAGS = \ -@@ -480,6 +483,7 @@ - - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyfile_io_la-errors.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyfile_io_la-reader.Plo@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyfile_io_la-utils.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkeyfile_io_la-writer.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_keyfile_la-nm-keyfile-connection.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_keyfile_la-plugin.Plo@am__quote@ -@@ -535,6 +539,14 @@ - @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyfile_io_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkeyfile_io_la-errors.lo `test -f 'errors.c' || echo '$(srcdir)/'`errors.c - -+libkeyfile_io_la-utils.lo: utils.c -+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyfile_io_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libkeyfile_io_la-utils.lo -MD -MP -MF $(DEPDIR)/libkeyfile_io_la-utils.Tpo -c -o libkeyfile_io_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c -+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libkeyfile_io_la-utils.Tpo $(DEPDIR)/libkeyfile_io_la-utils.Plo -+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='libkeyfile_io_la-utils.lo' libtool=yes @AMDEPBACKSLASH@ -+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -+@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkeyfile_io_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkeyfile_io_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c -+ - libnm_settings_plugin_keyfile_la-nm-keyfile-connection.lo: nm-keyfile-connection.c - @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnm_settings_plugin_keyfile_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnm_settings_plugin_keyfile_la-nm-keyfile-connection.lo -MD -MP -MF $(DEPDIR)/libnm_settings_plugin_keyfile_la-nm-keyfile-connection.Tpo -c -o libnm_settings_plugin_keyfile_la-nm-keyfile-connection.lo `test -f 'nm-keyfile-connection.c' || echo '$(srcdir)/'`nm-keyfile-connection.c - @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnm_settings_plugin_keyfile_la-nm-keyfile-connection.Tpo $(DEPDIR)/libnm_settings_plugin_keyfile_la-nm-keyfile-connection.Plo diff --git a/debian/patches/81-keyfile-quiet-keyfile-plugin-when-re-read-connection.patch b/debian/patches/81-keyfile-quiet-keyfile-plugin-when-re-read-connection.patch deleted file mode 100644 index 2c8b47cb..00000000 --- a/debian/patches/81-keyfile-quiet-keyfile-plugin-when-re-read-connection.patch +++ /dev/null @@ -1,48 +0,0 @@ -From d06dc31df31a5a872f82b142d862bc44429ebd53 Mon Sep 17 00:00:00 2001 -From: Dan Williams <dcbw@redhat.com> -Date: Wed, 10 Nov 2010 16:14:51 +0100 -Subject: [PATCH] keyfile: quiet keyfile plugin when re-read connection is the same as in-memory one - -It occurs, for example, when NM updates connection's timestamp. ---- - system-settings/plugins/keyfile/plugin.c | 11 ++++++++--- - 1 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/system-settings/plugins/keyfile/plugin.c b/system-settings/plugins/keyfile/plugin.c -index 7257638..5a927ce 100644 ---- a/system-settings/plugins/keyfile/plugin.c -+++ b/system-settings/plugins/keyfile/plugin.c -@@ -212,15 +212,18 @@ dir_changed (GFileMonitor *monitor, - break; - case G_FILE_MONITOR_EVENT_CREATED: - case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: -- PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, "updating %s", name); -- - if (connection) { - /* Update */ - NMKeyfileConnection *tmp; - - tmp = nm_keyfile_connection_new (name, &error); - if (tmp) { -- update_connection_settings (connection, tmp); -+ if (!nm_connection_compare (NM_CONNECTION (connection), -+ NM_CONNECTION (tmp), -+ NM_SETTING_COMPARE_FLAG_EXACT)) { -+ PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, "updating %s", name); -+ update_connection_settings (connection, tmp); -+ } - g_object_unref (tmp); - } else { - /* Error; remove the connection */ -@@ -230,6 +233,8 @@ dir_changed (GFileMonitor *monitor, - remove_connection (SC_PLUGIN_KEYFILE (config), connection, name); - } - } else { -+ PLUGIN_PRINT (KEYFILE_PLUGIN_NAME, "updating %s", name); -+ - /* New */ - connection = nm_keyfile_connection_new (name, &error); - if (connection) { --- -1.7.2.3 - diff --git a/debian/patches/82-core-handle-device-removal.patch b/debian/patches/82-core-handle-device-removal.patch deleted file mode 100644 index deac3a69..00000000 --- a/debian/patches/82-core-handle-device-removal.patch +++ /dev/null @@ -1,37 +0,0 @@ -From aff8f48190458c7dc894ad0ec07c935dc530abab Mon Sep 17 00:00:00 2001 -From: Dan Williams <dcbw@redhat.com> -Date: Tue, 23 Nov 2010 13:10:01 -0600 -Subject: [PATCH] core: handle device removal when properties are unreadable - -By the time we get the udev device removal notification we may not -be able to read properties, since the device has already been -removed from sysfs. That means we can't get the ifindex, so we need -to fall back to the interface name. But we always want to prefer -the ifindex since that will never change as long as the device is -connected, unlike the interface name. ---- - src/nm-manager.c | 8 ++++++++ - 1 files changed, 8 insertions(+), 0 deletions(-) - -diff --git a/src/nm-manager.c b/src/nm-manager.c -index eb393fa..48f2173 100644 ---- a/src/nm-manager.c -+++ b/src/nm-manager.c -@@ -2426,6 +2426,14 @@ udev_device_removed_cb (NMUdevManager *manager, - - ifindex = g_udev_device_get_property_as_int (udev_device, "IFINDEX"); - device = find_device_by_ifindex (self, ifindex); -+ if (!device) { -+ /* On removal we won't always be able to read properties anymore, as -+ * they may have already been removed from sysfs. Instead, we just -+ * have to fall back to the device's interface name. -+ */ -+ device = find_device_by_iface (self, g_udev_device_get_name (udev_device)); -+ } -+ - if (device) - priv->devices = remove_one_device (self, priv->devices, device, FALSE); - } --- -1.7.2.3 - diff --git a/debian/patches/83-dnsmasq-send-no-config-file-instead-of-a-bogus-one.patch b/debian/patches/83-dnsmasq-send-no-config-file-instead-of-a-bogus-one.patch deleted file mode 100644 index 96a179a7..00000000 --- a/debian/patches/83-dnsmasq-send-no-config-file-instead-of-a-bogus-one.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6bf63e913c8246345167f937963c2c14da59ee23 Mon Sep 17 00:00:00 2001 -From: Dan Williams <dcbw@redhat.com> -Date: Fri, 4 Mar 2011 23:52:44 -0600 -Subject: [PATCH] dnsmasq: send no config file instead of a bogus one (lp:725041) (debian #615082) - ---- - src/dnsmasq-manager/nm-dnsmasq-manager.c | 12 ++---------- - 1 files changed, 2 insertions(+), 10 deletions(-) - -diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c -index 701c078..ca2f9dc 100644 ---- a/src/dnsmasq-manager/nm-dnsmasq-manager.c -+++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c -@@ -254,7 +254,6 @@ create_dm_cmd_line (const char *iface, - struct in_addr addr; - char buf[INET_ADDRSTRLEN + 15]; - char localaddr[INET_ADDRSTRLEN + 1]; -- int i; - - dm_binary = nm_find_dnsmasq (); - if (!dm_binary) { -@@ -278,17 +277,10 @@ create_dm_cmd_line (const char *iface, - /* dnsmasq may read from it's default config file location, which if that - * location is a valid config file, it will combine with the options here - * and cause undesirable side-effects. Like sending bogus IP addresses -- * as the gateway or whatever. So give dnsmasq a bogus config file -- * location to avoid screwing up the configuration we're passing to it. -+ * as the gateway or whatever. So tell dnsmasq not to use any config file -+ * at all. - */ -- memset (buf, 0, sizeof (buf)); -- strcpy (buf, "/tmp/"); -- for (i = 5; i < 15; i++) -- buf[i] = (char) (g_random_int_range ((guint32) 'a', (guint32) 'z') & 0xFF); -- strcat (buf, ".conf"); -- - nm_cmd_line_add_string (cmd, "--conf-file"); -- nm_cmd_line_add_string (cmd, buf); - - nm_cmd_line_add_string (cmd, "--no-hosts"); - nm_cmd_line_add_string (cmd, "--keep-in-foreground"); --- -1.7.4.1 - diff --git a/debian/patches/series b/debian/patches/series index dead3eb6..fc215f9c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,12 +1,3 @@ # Debian patches for network-manager 02-dbus_access_network_manager.patch 03-systemd.patch -40-umanaged-interfaces.patch -50-bridge-interfaces.patch -51-normalized-keys.patch -60-policy-stop-touching-etc-hosts.patch -70-install-nm-online.patch -80-keyfile-ignore-temporary-files.patch -81-keyfile-quiet-keyfile-plugin-when-re-read-connection.patch -82-core-handle-device-removal.patch -83-dnsmasq-send-no-config-file-instead-of-a-bogus-one.patch |