Updated to the latest upstream version ypbind-mt-1.29.91

This commit is contained in:
Karel Klíč 2009-10-29 08:15:38 +00:00
parent 1d71d048fc
commit a53b68b6a9
10 changed files with 45 additions and 447 deletions

View File

@ -1,2 +1 @@
ypbind-mt-1.19.tar.bz2
ypbind-mt-1.20.4.tar.bz2
ypbind-mt-1.29.91.tar.bz2

View File

@ -1 +1 @@
266d2fb625d5511c4c5cc54a03bea00a ypbind-mt-1.20.4.tar.bz2
ab196dbb9474481e1e879f3d8cc94e30 ypbind-mt-1.29.91.tar.bz2

View File

@ -1,25 +0,0 @@
--- ypbind-mt-1.11/src/ypbind-mt.c.broadcast Tue Jun 11 06:50:48 2002
+++ ypbind-mt-1.11/src/ypbind-mt.c Tue Jun 11 06:54:34 2002
@@ -545,19 +545,9 @@
exit (1);
}
- if (!use_broadcast)
- {
- 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);
- }
- }
- else
+ if (!use_broadcast && (load_config (0) != 0))
+ use_broadcast = 1;
+ if (use_broadcast)
add_server (domain, NULL, 0);
unlink_bindingdir ();

View File

@ -1,53 +0,0 @@
--- ypbind-mt-1.19/src/serv_list.c.orig 2005-07-02 05:24:15.000000000 -0400
+++ ypbind-mt-1.19/src/serv_list.c 2006-11-30 11:41:06.000000000 -0500
@@ -1043,6 +1043,7 @@ int
test_bindings_once (int lastcheck, const char *req_domain)
{
int i;
+ int active;
/* Since we need the write lock later, getting the read lock here is
not enough. During the time, where we wait for the write lock, the
@@ -1070,7 +1071,8 @@ test_bindings_once (int lastcheck, const
req_domain, domain);
continue;
}
-
+retry:
+ active = domainlist[i].active;
/* We should never run into this. For debugging. */
if (domainlist[i].client_handle == NULL && domainlist[i].active != -1)
{
@@ -1153,9 +1155,14 @@ test_bindings_once (int lastcheck, const
the write lock again. */
pthread_rdwr_wunlock_np (&domainlock);
pthread_mutex_lock (&search_lock);
- if (!ping_all (&domainlist[i]) &&
- domainlist[i].use_broadcast)
- do_broadcast (&domainlist[i]);
+ /* Make sure the active has not changed while we
+ were sleeping. If it has, just punt on this for now */
+ if (domainlist[i].active == -1)
+ {
+ if (!ping_all (&domainlist[i]) &&
+ domainlist[i].use_broadcast)
+ do_broadcast (&domainlist[i]);
+ }
pthread_mutex_unlock (&search_lock);
pthread_rdwr_wlock_np (&domainlock);
}
@@ -1166,6 +1173,14 @@ test_bindings_once (int lastcheck, const
server */
pthread_rdwr_wunlock_np (&domainlock);
pthread_mutex_lock (&search_lock);
+ /* see if the active state has change while we were
+ sleeping. If so start again */
+ if (active != domainlist[i].active)
+ {
+ pthread_mutex_unlock (&search_lock);
+ pthread_rdwr_wlock_np (&domainlock);
+ goto retry;
+ }
if (!ping_all (&domainlist[i]) && domainlist[i].use_broadcast)
do_broadcast (&domainlist[i]);
pthread_mutex_unlock (&search_lock);

View File

@ -1,178 +0,0 @@
diff -up ypbind-mt-1.20.4/man/ypbind.8.log-binds ypbind-mt-1.20.4/man/ypbind.8
--- ypbind-mt-1.20.4/man/ypbind.8.log-binds 2006-10-04 17:26:33.000000000 +0200
+++ ypbind-mt-1.20.4/man/ypbind.8 2008-12-03 13:59:23.000000000 +0100
@@ -14,7 +14,7 @@
ypbind \- NIS binding process
.SH "SYNOPSIS"
.HP 7
-\fBypbind\fR [\-c] [\-d | \-debug] [\-broadcast] [\-broken\-server] [\-ypset] [\-ypsetme] [\-no\-ping] [\-f\ \fIconfigfile\fR] [\-local\-only] [\-ping\-interval\ \fIping\-interval\fR] [\-no\-dbus]
+\fBypbind\fR [\-c] [\-d | \-debug] [\-verbose] [\-broadcast] [\-broken\-server] [\-ypset] [\-ypsetme] [\-no\-ping] [\-f\ \fIconfigfile\fR] [\-local\-only] [\-ping\-interval\ \fIping\-interval\fR] [\-no\-dbus]
.HP 7
\fBypbind\fR \-\-version
.SH "DESCRIPTION"
@@ -122,6 +122,11 @@ in debug mode.
\fBypbind\fR
will not put itself into background, and error messages and debug output are written to standard error.
.TP 3n
+\fB\-verbose\fR
+Causes
+\fBypbind\fR
+to syslog(2) any and all changes in the server its bound to.
+.TP 3n
\fB\-broken\-server\fR
lets
\fBypbind\fR
diff -up ypbind-mt-1.20.4/src/serv_list.c.log-binds ypbind-mt-1.20.4/src/serv_list.c
--- ypbind-mt-1.20.4/src/serv_list.c.log-binds 2008-12-03 13:51:05.000000000 +0100
+++ ypbind-mt-1.20.4/src/serv_list.c 2008-12-03 13:51:05.000000000 +0100
@@ -50,6 +50,8 @@
#include "local.h"
#include "pthread_np.h"
+extern int verbose_flag;
+
#if (defined(__sun__) || defined(sun)) && defined(__svr4__)
typedef uint32_t u_int32_t;
#endif
@@ -80,6 +82,22 @@ struct binding
struct bound_server ypset;
CLIENT *client_handle;
};
+static inline char *
+bound_host(struct binding *bptr)
+{
+ struct bound_server *sptr;
+
+ if (bptr->active >= 0)
+ sptr = &bptr->server[bptr->active];
+ else if (bptr->active == -2)
+ sptr = &bptr->ypset;
+ else
+ return "Unknown Host";
+
+ if (sptr->host != NULL)
+ return(sptr->host);
+ return (inet_ntoa(sptr->addr));
+}
static struct binding *domainlist = NULL;
static int max_domains = 0;
@@ -224,6 +242,12 @@ change_binding (const char *domain, ypbi
pthread_rdwr_rlock_np (&domainlock);
update_bindingfile (&domainlist[i]);
pthread_rdwr_runlock_np (&domainlock);
+ if (verbose_flag)
+ {
+ log_msg (LOG_NOTICE, "NIS server set to '%s'"
+ " for domain '%s'",
+ bound_host(&domainlist[i]), domainlist[i].domain);
+ }
return;
}
@@ -797,6 +821,10 @@ ping_all (struct binding *list)
list->server[i].port = s_in.sin_port;
if (s_in.sin_port == 0)
{
+ if (verbose_flag && list->active == i)
+ log_msg (LOG_NOTICE, "NIS server '%s' not repsonding "
+ "for domain '%s'", list->server[i].host, list->domain);
+
if (debug_flag)
log_msg (LOG_DEBUG, _("host '%s' doesn't answer."),
list->server[i].host);
@@ -1001,13 +1029,21 @@ ping_all (struct binding *list)
void
do_binding (void)
{
- int i;
+ int i, active;
pthread_mutex_lock (&search_lock);
for (i = 0; i < max_domains; ++i)
{
+ if (verbose_flag)
+ active = domainlist[i].active;
if (!ping_all (&domainlist[i]) && domainlist[i].use_broadcast)
do_broadcast (&domainlist[i]);
+ if (verbose_flag &&
+ domainlist[i].active >= 0 && active != domainlist[i].active)
+ {
+ log_msg (LOG_NOTICE, "NIS server is '%s' for domain '%s'",
+ bound_host(&domainlist[i]), domainlist[i].domain);
+ }
}
pthread_mutex_unlock (&search_lock);
}
@@ -1038,7 +1074,8 @@ test_bindings (void *param __attribute__
pthread_exit (&success);
lastcheck += ping_interval;
- if (lastcheck >= 900) /* 900 = 15min. */
+ //if (lastcheck >= 900) /* 900 = 15min. */
+ if (lastcheck >= 60) /* 900 = 15min. */
lastcheck = 0;
#if USE_DBUS_NM
@@ -1091,6 +1128,7 @@ retry:
domainlist[i].active = -1;
}
+ active = domainlist[i].active;
if (domainlist[i].active != -1)
{
/* The binding is in use, check if it is still valid and
@@ -1107,6 +1145,10 @@ retry:
YPPROC_DOMAIN, (xdrproc_t) ypbind_xdr_domainname,
(caddr_t) &domain, (xdrproc_t) xdr_bool,
(caddr_t) &out, time_out);
+ if (verbose_flag && status != RPC_SUCCESS)
+ log_msg (LOG_NOTICE, "NIS server '%s' not responding"
+ " for domain '%s'", bound_host(&domainlist[i]),
+ domainlist[i].domain);
}
/* time to search a new fastest server, but only if the current
@@ -1196,6 +1238,12 @@ retry:
pthread_mutex_unlock (&search_lock);
pthread_rdwr_wlock_np (&domainlock);
}
+ if (verbose_flag &&
+ domainlist[i].active >= 0 && active != domainlist[i].active)
+ {
+ log_msg (LOG_NOTICE, "NIS server is '%s' for domain '%s'",
+ bound_host(&domainlist[i]), domainlist[i].domain);
+ }
} /* end for () all domains */
pthread_rdwr_wunlock_np (&domainlock);
diff -up ypbind-mt-1.20.4/src/ypbind-mt.c.log-binds ypbind-mt-1.20.4/src/ypbind-mt.c
--- ypbind-mt-1.20.4/src/ypbind-mt.c.log-binds 2008-12-03 13:51:05.000000000 +0100
+++ ypbind-mt-1.20.4/src/ypbind-mt.c 2008-12-03 13:51:05.000000000 +0100
@@ -466,6 +466,7 @@ sig_handler (void *v_param __attribute_
}
}
}
+int verbose_flag;
static void
usage (int ret)
@@ -478,7 +479,7 @@ usage (int ret)
output = stdout;
fputs (_("Usage:\n"), output);
- fputs (_("\typbind [-broadcast | -ypset | -ypsetme] [-p port] [-f configfile]\n\t [-no-ping] [-broken-server] [-local-only] [-i ping-interval] [-debug]\n"), output);
+ fputs (_("\typbind [-broadcast | -ypset | -ypsetme] [-p port] [-f configfile]\n\t [-no-ping] [-broken-server] [-local-only] [-i ping-interval] [-debug] [-verbose]\n"), output);
#ifdef USE_DBUS_NM
fputs (_("\t [-no-dbus]\n"), output);
#endif
@@ -656,6 +657,9 @@ main (int argc, char **argv)
else if (strcmp ("-d", argv[i]) == 0 ||
strcmp ("-debug", argv[i]) == 0)
debug_flag = 1;
+ else if (strcmp ("-v", argv[i]) == 0 ||
+ strcmp ("-verbose", argv[i]) == 0)
+ verbose_flag = 1;
else if (strcmp ("-broken-server", argv[i]) == 0 ||
strcmp ("-broken_server", argv[i]) == 0)
broken_server = 1;

View File

@ -1,26 +0,0 @@
diff -up ypbind-mt-1.20.4/man/ypbind.8_old ypbind-mt-1.20.4/man/ypbind.8
--- ypbind-mt-1.20.4/man/ypbind.8_old 2008-12-03 14:13:46.000000000 +0100
+++ ypbind-mt-1.20.4/man/ypbind.8 2008-12-03 14:15:56.000000000 +0100
@@ -14,7 +14,7 @@
ypbind \- NIS binding process
.SH "SYNOPSIS"
.HP 7
-\fBypbind\fR [\-c] [\-d | \-debug] [\-verbose] [\-broadcast] [\-broken\-server] [\-ypset] [\-ypsetme] [\-no\-ping] [\-f\ \fIconfigfile\fR] [\-local\-only] [\-ping\-interval\ \fIping\-interval\fR] [\-no\-dbus]
+\fBypbind\fR [\-c] [\-d | \-debug] [\-verbose] [\-broadcast] [\-broken\-server] [\-ypset] [\-ypsetme] [\-no\-ping] [\-p \fIport\fR] [\-f\ \fIconfigfile\fR] [\-local\-only] [\-ping\-interval\ \fIping\-interval\fR] [\-no\-dbus]
.HP 7
\fBypbind\fR \-\-version
.SH "DESCRIPTION"
@@ -140,6 +140,13 @@ will not check if the binding is alive.
\fBypbind\fR
from keeping the connection unnessecarily open or causing autodials.
.TP 3n
+\fB\-p\fR port
+\fBypbind\fR
+will bind itself to this port.
+This makes it possible to have a router filter packets
+to the NIS ports, so that access to this service from
+hosts on the Internet can be restricted.
+.TP 3n
\fB\-f\fR configfile
\fBypbind\fR
will use

View File

@ -1,44 +0,0 @@
diff -up ypbind-mt-1.20.4/src/ypbind_dbus_nm.c.nm ypbind-mt-1.20.4/src/ypbind_dbus_nm.c
--- ypbind-mt-1.20.4/src/ypbind_dbus_nm.c.nm 2007-02-14 14:01:57.000000000 +0100
+++ ypbind-mt-1.20.4/src/ypbind_dbus_nm.c 2009-01-26 16:05:58.000000000 +0100
@@ -320,13 +320,13 @@ dbus_init (void)
if (check_online (connection) == 1)
{
if (debug_flag)
- log_msg (LOG_DEBUG, "Are already online");
- is_online = 1;
+ log_msg (LOG_DEBUG, "Network is available now");
+ go_online();
}
else
{
if (debug_flag)
- log_msg (LOG_DEBUG, "Are offline");
+ log_msg (LOG_DEBUG, "No network is available now");
is_online = 0;
}
return 1;
diff -up ypbind-mt-1.20.4/src/ypbind-mt.c.nm ypbind-mt-1.20.4/src/ypbind-mt.c
--- ypbind-mt-1.20.4/src/ypbind-mt.c.nm 2009-01-26 16:05:58.000000000 +0100
+++ ypbind-mt-1.20.4/src/ypbind-mt.c 2009-01-26 16:05:58.000000000 +0100
@@ -765,9 +765,17 @@ main (int argc, char **argv)
BINDINGDIR, strerror (errno));
exit (1);
}
-
- if (!use_broadcast && (load_config (0) != 0))
- use_broadcast = 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)
add_server (domain, NULL, 0);

View File

@ -1,102 +0,0 @@
diff -up ypbind-mt-1.20.4/src/serv_list.c_old ypbind-mt-1.20.4/src/serv_list.c
--- ypbind-mt-1.20.4/src/serv_list.c_old 2008-10-21 11:37:59.000000000 +0200
+++ ypbind-mt-1.20.4/src/serv_list.c 2008-10-21 11:38:20.000000000 +0200
@@ -81,6 +81,7 @@ struct binding
struct bound_server server[_MAXSERVER];
struct bound_server ypset;
CLIENT *client_handle;
+ struct bound_server last; /* last written */
};
static inline char *
bound_host(struct binding *bptr)
@@ -133,26 +134,44 @@ update_bindingfile (struct binding *entr
sprintf (path1, "%s/%s.1", BINDINGDIR, entry->domain);
sprintf (path2, "%s/%s.2", BINDINGDIR, entry->domain);
- iov[0].iov_base = (caddr_t) &sport;
- iov[0].iov_len = sizeof (sport);
- iov[1].iov_base = (caddr_t) &ybres;
- iov[1].iov_len = sizeof ybres;
-
memset(&ybres, 0, sizeof (ybres));
ybres.ypbind_status = YPBIND_SUCC_VAL;
if (entry->active >= 0)
{
+ if (entry->last.host &&
+ !memcmp(&entry->server[entry->active].addr, &entry->last.addr,
+ sizeof(struct in_addr)) &&
+ entry->server[entry->active].port == entry->last.port)
+ {
+ if (debug_flag)
+ log_msg (LOG_DEBUG, "Entry for %s unchanged, skipping writeout",
+ entry->domain);
+ return;
+ }
+
memcpy (&ybres.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr,
&entry->server[entry->active].addr, sizeof (struct in_addr));
memcpy (&ybres.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port,
&entry->server[entry->active].port, sizeof (unsigned short int));
+ entry->last= entry->server[entry->active];
}
else if (entry->active == -2) /* ypset was used */
{
+ if (entry->last.host &&
+ !memcmp(&entry->ypset.addr, &entry->last.addr,
+ sizeof(struct in_addr)) &&
+ entry->ypset.port == entry->last.port)
+ {
+ if (debug_flag)
+ log_msg (LOG_DEBUG, "Entry for %s unchanged, skipping writeout",
+ entry->domain);
+ return;
+ }
memcpy (&ybres.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr,
&entry->ypset.addr, sizeof (struct in_addr));
memcpy (&ybres.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port,
&entry->ypset.port, sizeof (unsigned short int));
+ entry->last= entry->ypset;
}
else
{
@@ -160,10 +179,16 @@ update_bindingfile (struct binding *entr
libc will query ypbind direct. */
unlink (path1);
unlink (path2);
+ entry->last.host = NULL;
log_msg (LOG_ERR, "INTERNAL ERROR: update_bindingfile called without valid data!");
return;
}
+ iov[0].iov_base = (caddr_t) &sport;
+ iov[0].iov_len = sizeof (sport);
+ iov[1].iov_base = (caddr_t) &ybres;
+ iov[1].iov_len = sizeof ybres;
+
len = iov[0].iov_len + iov[1].iov_len;
if ((fd = open(path1, O_CREAT | O_RDWR | O_TRUNC, FILE_MODE )) != -1)
@@ -171,6 +196,7 @@ update_bindingfile (struct binding *entr
if (writev (fd, iov, 2) != len )
{
log_msg (LOG_ERR, "writev (%s): %s", path1, strerror (errno));
+ entry->last.host = NULL;
unlink (path1);
}
close (fd);
@@ -183,6 +209,7 @@ update_bindingfile (struct binding *entr
if (writev (fd, iov, 2) != len )
{
log_msg (LOG_ERR, "writev (%s): %s", path2, strerror (errno));
+ entry->last.host = NULL;
unlink (path2);
}
close (fd);
@@ -403,6 +430,7 @@ get_entry (const char *domain, struct bi
domainlist[max_domains - 1].ypset.host = NULL;
domainlist[max_domains - 1].active = (-1);
domainlist[max_domains - 1].use_broadcast = FALSE;
+ domainlist[max_domains - 1].last.host = NULL;
memset (domainlist[max_domains - 1].server, 0,
(_MAXSERVER * sizeof (struct bound_server)));
*entry = &domainlist[max_domains - 1];

View File

@ -0,0 +1,27 @@
diff -up ypbind-mt-1.29.91/man/ypbind.8.xml.man-port ypbind-mt-1.29.91/man/ypbind.8.xml
--- ypbind-mt-1.29.91/man/ypbind.8.xml.man-port 2009-06-15 16:29:18.000000000 +0200
+++ ypbind-mt-1.29.91/man/ypbind.8.xml 2009-10-26 17:55:32.000000000 +0100
@@ -47,6 +47,7 @@
<arg choice='opt'>-ypset </arg>
<arg choice='opt'>-ypsetme </arg>
<arg choice='opt'>-no-ping </arg>
+ <arg choice='opt'>-p <replaceable>port</replaceable></arg>
<arg choice='opt'>-f <replaceable>configfile</replaceable></arg>
<arg choice='opt'>-local-only </arg>
<arg choice='opt'>-ping-interval <replaceable>ping-interval</replaceable></arg>
@@ -238,6 +239,15 @@ from keeping the connection unnecessaril
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>-p</option> port</term>
+ <listitem>
+<para><command>ypbind</command>
+will bind itself to this port. This makes it possible to have a router
+filtering packets to the NIS ports, so that access to this service from
+hosts on the Internet can be restricted.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>-f</option> configfile</term>
<listitem>
<para><command>ypbind</command>

View File

@ -1,20 +1,15 @@
Summary: The NIS daemon which binds NIS clients to an NIS domain
Name: ypbind
Version: 1.20.4
Release: 19%{?dist}
Version: 1.29.91
Release: 1%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
Url: http://www.linux-nis.org/nis/ypbind-mt/index.html
Source1: ypbind.init
Source2: nis.sh
Patch1: ypbind-1.11-broadcast.patch
Patch2: ypbind-1.11-gettextdomain.patch
Patch3: ypbind-mt-1.19-port-leak.patch
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
Patch1: ypbind-1.11-gettextdomain.patch
Patch2: ypbind-mt-1.29.91-man-port.patch
Requires(post): chkconfig
Requires(preun): chkconfig
@ -46,13 +41,8 @@ also need to install the ypserv package to a machine on your network.
%prep
%setup -q -n ypbind-mt-%{version}
%patch1 -p1 -b .broadcast
%patch2 -p1 -b .gettextdomain
%patch3 -p1 -b .port-leak
%patch4 -p1 -b .log-binds
%patch5 -p1 -b .smartwrite
%patch6 -p1 -b .man-port
%patch7 -p1 -b .nm
%patch1 -p1 -b .gettextdomain
%patch2 -p1 -b .man-port
%build
%configure --sbindir=/sbin
@ -97,6 +87,16 @@ fi
%doc README NEWS
%changelog
* Mon Oct 26 2009 Karel Klic <kklic@redhat.com> - 3:1.29.91-1
- Updated to 1.29.91 from upstream
- Removed 1.19-port-leak patch because the upstream source code has
been changed and the port leaks should not happen anymore
- Removed 1.20.4-smartwrite patch because it was merged by upstream
- Removed 1.20.4-nm patch as the upstream merged the important part
- Removed 1.20.4-log-binds patch because it was merged by upstream
- Ported 1.20.4-man-port patch to the new release, sent to Thorsten Kukuk
- Removed 1.11-broadcast patch
* 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