new upstream version

This commit is contained in:
Karel Klíč 2010-02-24 11:19:36 +00:00
parent 805b79e73c
commit b148426427
5 changed files with 9 additions and 135 deletions

View File

@ -1 +1 @@
ypserv-2.21.tar.bz2
ypserv-2.23.tar.bz2

View File

@ -1 +1 @@
e94915050af69842c13a5fa79b800c3d ypserv-2.21.tar.bz2
40a871818380cbf6452e97b5fbb21879 ypserv-2.23.tar.bz2

View File

@ -1,11 +0,0 @@
diff -up ypserv-2.19/ypserv/server.c.nodbclose ypserv-2.19/ypserv/server.c
--- ypserv-2.19/ypserv/server.c.nodbclose 2010-01-26 15:40:51.000000000 +0100
+++ ypserv-2.19/ypserv/server.c 2010-01-26 18:19:33.478791025 +0100
@@ -590,7 +590,6 @@ ypproc_xfr_2_svc (ypreq_xfr *argp, ypres
log_msg ("refuse to transfer %s from %s, no trusted master",
argp->map_parms.map, inet_ntoa (rqhost->sin_addr));
- ypdb_close (dbp);
result->xfrstat = YPXFR_NODOM;
return TRUE;
}

View File

@ -1,113 +0,0 @@
diff -up ypserv-2.21/rpc.ypxfrd/ypxfrd.c.pidfile ypserv-2.21/rpc.ypxfrd/ypxfrd.c
--- ypserv-2.21/rpc.ypxfrd/ypxfrd.c.pidfile 2010-01-21 18:07:46.000000000 +0100
+++ ypserv-2.21/rpc.ypxfrd/ypxfrd.c 2010-01-21 18:49:27.107770454 +0100
@@ -59,6 +59,14 @@
#include "log_msg.h"
#include "compat.h"
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+#ifndef _PATH_VARRUN
+#define _PATH_VARRUN "/etc/"
+#endif
+#define _YPXFRD_PIDFILE _PATH_VARRUN"ypxfrd.pid"
+
extern void ypxfrd_freebsd_prog_1(struct svc_req *, SVCXPRT *);
int _rpcpmstart = 0;
@@ -118,6 +126,7 @@ static void
sig_quit (int sig UNUSED)
{
pmap_unset (YPXFRD_FREEBSD_PROG, YPXFRD_FREEBSD_VERS);
+ unlink (_YPXFRD_PIDFILE);
exit (0);
}
@@ -133,6 +142,69 @@ sig_hup (int sig UNUSED)
cached_filehandles = 0;
}
+/* Create a pidfile on startup */
+static void
+create_pidfile (void)
+{
+ int fd, left, written;
+ pid_t pid;
+ char pbuf[50], *ptr;
+ struct flock lock;
+
+ fd = open (_YPXFRD_PIDFILE, O_CREAT | O_RDWR,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ if (fd < 0)
+ {
+ log_msg ("cannot create pidfile %s", _YPXFRD_PIDFILE);
+ if (debug_flag)
+ log_msg ("\n");
+ }
+
+ lock.l_type = F_WRLCK;
+ lock.l_start = 0;
+ lock.l_whence = SEEK_SET;
+ lock.l_len = 0;
+
+ /* Is the pidfile locked by another ypserv ? */
+ if (fcntl (fd, F_GETLK, &lock) < 0)
+ {
+ log_msg ("fcntl error");
+ if (debug_flag)
+ log_msg ("\n");
+ }
+ if (lock.l_type == F_UNLCK)
+ pid = 0; /* false, region is not locked by another proc */
+ else
+ pid = lock.l_pid; /* true, return pid of lock owner */
+
+ if (0 != pid)
+ {
+ log_msg ("rpc.ypxfrd already running (pid %d) - exiting", pid);
+ if (debug_flag)
+ log_msg ("\n");
+ exit (1);
+ }
+
+ /* write lock */
+ lock.l_type = F_WRLCK;
+ lock.l_start = 0;
+ lock.l_whence = SEEK_SET;
+ lock.l_len = 0;
+ if (0 != fcntl (fd, F_SETLK, &lock))
+ log_msg ("cannot lock pidfile");
+ sprintf (pbuf, "%ld\n", (long) getpid ());
+ left = strlen (pbuf);
+ ptr = pbuf;
+ while (left > 0)
+ {
+ if ((written = write (fd, ptr, left)) <= 0)
+ return; /* error */
+ left -= written;
+ ptr += written;
+ }
+ return;
+}
+
static void
Usage (int exitcode)
{
@@ -272,6 +344,8 @@ main (int argc, char **argv)
}
}
+ create_pidfile ();
+
/* Change current directory to database location */
if (chdir(path_ypdb) < 0)
{
@@ -448,6 +522,7 @@ main (int argc, char **argv)
svc_run();
log_msg("svc_run returned");
+ unlink (_YPXFRD_PIDFILE);
exit(1);
/* NOTREACHED */
}

View File

@ -3,8 +3,8 @@
Summary: The NIS (Network Information Service) server
Url: http://www.linux-nis.org/nis/ypserv/index.html
Name: ypserv
Version: 2.21
Release: 4%{?dist}
Version: 2.23
Release: 1%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source0: ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypserv-%{version}.tar.bz2
@ -26,11 +26,6 @@ Patch3: ypserv-2.13-ypxfr-zeroresp.patch
Patch4: ypserv-2.19-inval-ports.patch
Patch5: ypserv-2.13-nonedomain.patch
Patch6: ypserv-2.19-slp-warning.patch
# Modifies rpc.ypxfrd to create pidfile.
# Improved version was accepted by upstream on 2010-01-28.
Patch7: ypserv-2.21-pidfile.patch
# Accepted by upstream on 2010-01-27.
Patch8: ypserv-2.19-nodbclose.patch
Obsoletes: yppasswd
BuildRequires: gdbm-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -60,8 +55,6 @@ machines.
%patch4 -p1 -b .ports
%patch5 -p1 -b .nonedomain
%patch6 -p1 -b .slp-warning
%patch7 -p1 -b .pidfile
%patch8 -p1 -b .nodbclose
%build
cp etc/README etc/README.etc
@ -147,6 +140,11 @@ exit 0
%{_includedir}/*/*
%changelog
* Wed Feb 24 2010 Karel Klic <kklic@redhat.com> - 2.23-1
- Updated to new upstream version
- Removed pidfile and nodbclose patches, as those were
merged by the upstream.
* Thu Jan 28 2010 Karel Klic <kklic@redhat.com> - 2.21-4
- Removed ypserv-2.21-iface.patch, because upstream refused to
merge it three times over 7 years. "Since this is