Bind to domain even if not using NetworkManager

This commit is contained in:
Karel Klíč 2009-10-29 14:03:56 +00:00
parent 11888c8840
commit 5a60cdbb17
2 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,63 @@
diff -up ypbind-mt-1.20.4/src/ypbind-mt.c.network ypbind-mt-1.20.4/src/ypbind-mt.c
--- ypbind-mt-1.20.4/src/ypbind-mt.c.network 2009-10-29 11:53:00.265296485 +0100
+++ ypbind-mt-1.20.4/src/ypbind-mt.c 2009-10-29 11:53:00.269297063 +0100
@@ -297,6 +299,25 @@ load_config (int check_syntax)
return 0;
}
+
+/* Load the configuration, exiting if there's an error */
+static void
+load_config_or_exit(void)
+{
+ if (load_config (0) != 0)
+ {
+ fputs (_("No NIS server and no -broadcast option specified.\n"),
+ stderr);
+ fprintf (stderr,
+ _("Add a NIS server to the %s configuration file,\n"),
+ configfile);
+ fputs (_("or start ypbind with the -broadcast option.\n"),
+ stderr);
+ exit (1);
+ }
+}
+
+
/* Create a pidfile on startup */
static void
create_pidfile (void)
@@ -765,18 +803,22 @@ main (int argc, char **argv)
BINDINGDIR, strerror (errno));
exit (1);
}
- /*
- * Load config if we're not using DBUS/NetworkManager, since we
- * assume the network is available now. If we're using NetworkManager,
- * the config will be loaded when a network becomes available.
- */
- if (disable_dbus)
- {
- /* Load the configuration. If the load fails, set up broadcast mode. */
- if (!use_broadcast && (load_config (0) != 0))
- use_broadcast = 1;
+
+ if (!use_broadcast)
+ {
+#ifdef USE_DBUS_NM
+ /* If we don't use DBUS, exit with an error if we cannot load the
+ config. Else load the config, maybe there is a network already
+ running. */
+ if (disable_dbus)
+ load_config_or_exit ();
+ else
+ load_config (0);
+#else
+ load_config_or_exit ();
+#endif
}
- if (use_broadcast)
+ else
add_server (domain, NULL, 0);
unlink_bindingdir ();

View File

@ -1,7 +1,7 @@
Summary: The NIS daemon which binds NIS clients to an NIS domain
Name: ypbind
Version: 1.20.4
Release: 19%{?dist}
Release: 20%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
@ -15,6 +15,7 @@ Patch4: ypbind-mt-1.20.4-log-binds.patch
Patch5: ypbind-mt-1.20.4-smartwrite.patch
Patch6: ypbind-mt-1.20.4-man-port.patch
Patch7: ypbind-mt-1.20.4-nm.patch
Patch8: ypbind-mt-1.20.4-network.patch
Requires(post): chkconfig
Requires(preun): chkconfig
@ -53,6 +54,7 @@ also need to install the ypserv package to a machine on your network.
%patch5 -p1 -b .smartwrite
%patch6 -p1 -b .man-port
%patch7 -p1 -b .nm
%patch8 -p1 -b .network
%build
%configure --sbindir=/sbin
@ -97,6 +99,11 @@ fi
%doc README NEWS
%changelog
* Thu Oct 29 2009 Karel Klic <kklic@redhat.com> - 3:1.20.4-20
- Bind to domain even if not using NetworkManager
The fix uses only the code from upstream ypbind-mt-1.29.91
Resolves: #531398
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3:1.20.4-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild