Commit e59eda1c authored by Colin Walters's avatar Colin Walters Committed by Colin Walters
Browse files

2005-01-14 Colin Walters <walters@redhat.com>

	* configure.in: Make named support require passing --with-named.

	* named/nm-named-manager.c: Support writing resolv.conf directly
	without running named.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@375 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 2b5062ba
2005-01-14 Colin Walters <walters@redhat.com>
* configure.in: Make named support require passing --with-named.
* named/nm-named-manager.c: Support writing resolv.conf directly
without running named.
2005-01-13 Dan Williams <dcbw@redhat.com>
* named/nm-named-manager.c
......
......@@ -159,10 +159,7 @@ AC_DEFINE_UNQUOTED(DBUS_SYSTEMD_DIR, "$DBUS_SYS_DIR", [Where system.d dir for DB
AC_ARG_WITH(named, AC_HELP_STRING([--with-named=<path>], [path to the named binary]))
if test "x${with_named}" = x; then
AC_PATH_PROG(with_named, [named], no)
if test "x${with_named}" = xno; then
AC_MSG_ERROR([must specify path to named binary with --with-named])
fi
AC_DEFINE(NM_NO_NAMED,,[Define if you want to disable named support])
fi
AC_DEFINE_UNQUOTED(NM_NAMED_BINARY_PATH, "$with_named", [Define to path of named binary])
......
......@@ -220,6 +220,7 @@ compute_domain_zones (NMNamedManager *mgr)
gboolean
generate_named_conf (NMNamedManager *mgr, GError **error)
{
#ifndef NM_NO_NAMED
char *filename = NULL;
int out_fd;
char *config_contents_str;
......@@ -346,6 +347,9 @@ write_lose:
unlink (filename);
g_free (filename);
return FALSE;
#else
return rewrite_resolv_conf (mgr, error);
#endif
}
static void
......@@ -373,6 +377,7 @@ watch_cb (GPid pid, gint status, gpointer data)
gboolean
nm_named_manager_start (NMNamedManager *mgr, GError **error)
{
#ifndef NM_NO_NAMED
GPid pid;
const char *named_binary;
GPtrArray *named_argv;
......@@ -420,6 +425,7 @@ nm_named_manager_start (NMNamedManager *mgr, GError **error)
g_source_remove (mgr->priv->child_watch_id);
mgr->priv->child_watch_id = g_child_watch_add (pid, watch_cb, mgr);
#endif
if (!rewrite_resolv_conf (mgr, error))
{
safer_kill (mgr->priv->named_realpath_binary, mgr->priv->named_pid, SIGTERM);
......@@ -435,6 +441,7 @@ reload_named (NMNamedManager *mgr, GError **error)
/* FIXME - handle error */
if (!generate_named_conf (mgr, error))
return FALSE;
#ifndef NM_NO_NAMED
if (safer_kill (mgr->priv->named_realpath_binary, mgr->priv->named_pid, SIGHUP) < 0) {
g_set_error (error,
NM_NAMED_MANAGER_ERROR,
......@@ -443,6 +450,7 @@ reload_named (NMNamedManager *mgr, GError **error)
g_strerror (errno));
return FALSE;
}
#endif
return TRUE;
}
......@@ -488,6 +496,19 @@ compute_domain_searches (NMNamedManager *mgr)
return g_string_free (str, FALSE);
}
#ifdef NM_NO_NAMED
static void
write_nameserver (gpointer key, gpointer value, gpointer data)
{
guint id = GPOINTER_TO_UINT (key);
const char *server = value;
FILE *f = data;
fprintf (f, "nameserver %s\n", server);
}
#endif
static gboolean
rewrite_resolv_conf (NMNamedManager *mgr, GError **error)
{
......@@ -499,11 +520,19 @@ rewrite_resolv_conf (NMNamedManager *mgr, GError **error)
goto lose;
searches = compute_domain_searches (mgr);
if (fprintf (f, "%s%s%s",
"; generated by NetworkManager, do not edit!\n; Use a local caching nameserver controlled by NetworkManager\n", searches, "\nnameserver 127.0.0.1\n") < 0) {
if (fprintf (f, "%s"," ; generated by NetworkManager, do not edit!\n") < 0) {
g_free (searches);
goto lose;
}
#ifndef NM_NO_NAMED
if (fprintf (f, "%s", "; Use a local caching nameserver controlled by NetworkManager\n", searches, "\nnameserver 127.0.0.1\n") < 0) {
goto lose;
}
#else
g_hash_table_foreach (mgr->priv->global_ipv4_nameservers,
write_nameserver,
f);
#endif
g_free (searches);
if (fclose (f) < 0)
goto lose;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment