forked from rpms/rpcbind
- Fixed a warning in pmap_svc.c
- Cleaned up warmstarts so uid are longer needed, also changed condrestarts to use warmstarts. (bz 428496)
This commit is contained in:
parent
304cd9a95d
commit
604a14b4a1
197
rpcbind-0.1.4-warmstarts-cleanup.patch
Normal file
197
rpcbind-0.1.4-warmstarts-cleanup.patch
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
commit 40009ddc661a43883d0f7841f6bbd71e0c9b530a
|
||||||
|
Author: Steve Dickson <steved@redhat.com>
|
||||||
|
Date: Fri Feb 8 14:27:57 2008 -0500
|
||||||
|
|
||||||
|
Fixed a warning in pmap_svc.c
|
||||||
|
Cleaned up read_struct().
|
||||||
|
|
||||||
|
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||||
|
diff -up rpcbind-0.1.4/src/rpcbind.c.save rpcbind-0.1.4/src/rpcbind.c
|
||||||
|
--- rpcbind-0.1.4/src/rpcbind.c.save 2008-02-11 10:10:01.000000000 -0500
|
||||||
|
+++ rpcbind-0.1.4/src/rpcbind.c 2008-02-11 10:16:14.000000000 -0500
|
||||||
|
@@ -193,11 +193,7 @@ main(int argc, char *argv[])
|
||||||
|
(void) signal(SIGHUP, SIG_IGN);
|
||||||
|
(void) signal(SIGUSR1, SIG_IGN);
|
||||||
|
(void) signal(SIGUSR2, SIG_IGN);
|
||||||
|
-#ifdef WARMSTART
|
||||||
|
- if (warmstart) {
|
||||||
|
- read_warmstart();
|
||||||
|
- }
|
||||||
|
-#endif
|
||||||
|
+
|
||||||
|
if (debugging) {
|
||||||
|
#ifdef RPCBIND_DEBUG
|
||||||
|
printf("rpcbind debugging enabled.");
|
||||||
|
@@ -226,6 +222,12 @@ main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef WARMSTART
|
||||||
|
+ if (warmstart) {
|
||||||
|
+ read_warmstart();
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
network_init();
|
||||||
|
|
||||||
|
my_svc_run();
|
||||||
|
diff -up rpcbind-0.1.4/src/warmstart.c.save rpcbind-0.1.4/src/warmstart.c
|
||||||
|
--- rpcbind-0.1.4/src/warmstart.c.save 2008-02-11 10:10:01.000000000 -0500
|
||||||
|
+++ rpcbind-0.1.4/src/warmstart.c 2008-02-11 10:16:14.000000000 -0500
|
||||||
|
@@ -45,22 +45,19 @@
|
||||||
|
#endif
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "rpcbind.h"
|
||||||
|
|
||||||
|
-/*
|
||||||
|
- * XXX this code is unsafe and is not used. It should be made safe.
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
#ifndef RPCBIND_STATEDIR
|
||||||
|
#define RPCBIND_STATEDIR "/tmp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These files keep the pmap_list and rpcb_list in XDR format */
|
||||||
|
-#define RPCBFILE RPCBIND_STATEDIR "/rpcbind.file"
|
||||||
|
+#define RPCBFILE RPCBIND_STATEDIR "/rpcbind.xdr"
|
||||||
|
#ifdef PORTMAP
|
||||||
|
-#define PMAPFILE RPCBIND_STATEDIR "/portmap.file"
|
||||||
|
+#define PMAPFILE RPCBIND_STATEDIR "/portmap.xdr"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static bool_t write_struct __P((char *, xdrproc_t, void *));
|
||||||
|
@@ -92,7 +89,7 @@ write_struct(char *filename, xdrproc_t s
|
||||||
|
xdrstdio_create(&xdrs, fp, XDR_ENCODE);
|
||||||
|
|
||||||
|
if (structproc(&xdrs, list) == FALSE) {
|
||||||
|
- syslog(LOG_ERR, "rpcbind: xdr_%s: failed", filename);
|
||||||
|
+ syslog(LOG_ERR, "xdr_%s: failed", filename);
|
||||||
|
fclose(fp);
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
@@ -107,37 +104,39 @@ read_struct(char *filename, xdrproc_t st
|
||||||
|
FILE *fp;
|
||||||
|
XDR xdrs;
|
||||||
|
struct stat sbuf;
|
||||||
|
-
|
||||||
|
- if (stat(filename, &sbuf) != 0) {
|
||||||
|
- fprintf(stderr,
|
||||||
|
- "rpcbind: cannot stat file = %s for reading\n", filename);
|
||||||
|
- goto error;
|
||||||
|
- }
|
||||||
|
- if ((sbuf.st_uid != 0) || (sbuf.st_mode & S_IRWXG) ||
|
||||||
|
- (sbuf.st_mode & S_IRWXO)) {
|
||||||
|
- fprintf(stderr,
|
||||||
|
- "rpcbind: invalid permissions on file = %s for reading\n",
|
||||||
|
- filename);
|
||||||
|
- goto error;
|
||||||
|
- }
|
||||||
|
- fp = fopen(filename, "r");
|
||||||
|
- if (fp == NULL) {
|
||||||
|
- fprintf(stderr,
|
||||||
|
- "rpcbind: cannot open file = %s for reading\n", filename);
|
||||||
|
+
|
||||||
|
+ if (debugging)
|
||||||
|
+ fprintf(stderr, "rpcbind: using '%s' startup file\n", filename);
|
||||||
|
+
|
||||||
|
+ if ((fp = fopen(filename, "r")) == NULL) {
|
||||||
|
+ syslog(LOG_ERR,
|
||||||
|
+ "Cannot open '%s' file for reading, errno %d (%s)",
|
||||||
|
+ filename, errno, strerror(errno));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- xdrstdio_create(&xdrs, fp, XDR_DECODE);
|
||||||
|
|
||||||
|
+ xdrstdio_create(&xdrs, fp, XDR_DECODE);
|
||||||
|
if (structproc(&xdrs, list) == FALSE) {
|
||||||
|
fprintf(stderr, "rpcbind: xdr_%s: failed\n", filename);
|
||||||
|
fclose(fp);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
XDR_DESTROY(&xdrs);
|
||||||
|
+
|
||||||
|
fclose(fp);
|
||||||
|
+ if (unlink(filename) < 0) {
|
||||||
|
+ syslog(LOG_ERR, "Cannot unlink '%s', errno %d (%s)",
|
||||||
|
+ filename, errno, strerror(errno));
|
||||||
|
+ }
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
-error: fprintf(stderr, "rpcbind: will start from scratch\n");
|
||||||
|
+error:
|
||||||
|
+ if (errno != ENOENT && unlink(filename) < 0) {
|
||||||
|
+ syslog(LOG_ERR, "Cannot unlink '%s', errno %d (%s)",
|
||||||
|
+ filename, errno, strerror(errno));
|
||||||
|
+ }
|
||||||
|
+ if (debugging)
|
||||||
|
+ fprintf(stderr, "rpcbind: will start from scratch\n");
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -145,9 +144,9 @@ void
|
||||||
|
write_warmstart()
|
||||||
|
{
|
||||||
|
(void) write_struct(RPCBFILE, (xdrproc_t)xdr_rpcblist_ptr, &list_rbl);
|
||||||
|
- #ifdef PORTMAP
|
||||||
|
- (void) write_struct(PMAPFILE, (xdrproc_t)xdr_pmaplist_ptr, &list_pml);
|
||||||
|
- #endif
|
||||||
|
+#ifdef PORTMAP
|
||||||
|
+ (void) write_struct(PMAPFILE, (xdrproc_t)xdr_pmaplist_ptr, &list_pml);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -158,22 +157,20 @@ read_warmstart()
|
||||||
|
#ifdef PORTMAP
|
||||||
|
struct pmaplist *tmp_pmapl = NULL;
|
||||||
|
#endif
|
||||||
|
- int ok1, ok2 = TRUE;
|
||||||
|
+ int rc;
|
||||||
|
+
|
||||||
|
+ rc = read_struct(RPCBFILE, (xdrproc_t)xdr_rpcblist_ptr, &tmp_rpcbl);
|
||||||
|
+ if (rc == TRUE) {
|
||||||
|
+ xdr_free((xdrproc_t) xdr_rpcblist_ptr, (char *)&list_rbl);
|
||||||
|
+ list_rbl = tmp_rpcbl;
|
||||||
|
+ }
|
||||||
|
+#ifdef PORTMAP
|
||||||
|
+ rc = read_struct(PMAPFILE, (xdrproc_t)xdr_pmaplist_ptr, &tmp_pmapl);
|
||||||
|
+ if (rc == TRUE) {
|
||||||
|
+ xdr_free((xdrproc_t) xdr_pmaplist_ptr, (char *)&list_pml);
|
||||||
|
+ list_pml = tmp_pmapl;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
- ok1 = read_struct(RPCBFILE, (xdrproc_t)xdr_rpcblist_ptr, &tmp_rpcbl);
|
||||||
|
- if (ok1 == FALSE)
|
||||||
|
- return;
|
||||||
|
- #ifdef PORTMAP
|
||||||
|
- ok2 = read_struct(PMAPFILE, (xdrproc_t)xdr_pmaplist_ptr, &tmp_pmapl);
|
||||||
|
- #endif
|
||||||
|
- if (ok2 == FALSE) {
|
||||||
|
- xdr_free((xdrproc_t) xdr_rpcblist_ptr, (char *)&tmp_rpcbl);
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- xdr_free((xdrproc_t) xdr_rpcblist_ptr, (char *)&list_rbl);
|
||||||
|
- list_rbl = tmp_rpcbl;
|
||||||
|
- #ifdef PORTMAP
|
||||||
|
- xdr_free((xdrproc_t) xdr_pmaplist_ptr, (char *)&list_pml);
|
||||||
|
- list_pml = tmp_pmapl;
|
||||||
|
- #endif
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
diff -up rpcbind-0.1.4/src/pmap_svc.c.save rpcbind-0.1.4/src/pmap_svc.c
|
||||||
|
--- rpcbind-0.1.4/src/pmap_svc.c.save 2008-02-11 10:15:34.000000000 -0500
|
||||||
|
+++ rpcbind-0.1.4/src/pmap_svc.c 2008-02-11 10:16:14.000000000 -0500
|
||||||
|
@@ -314,7 +314,7 @@ pmapproc_getport(struct svc_req *rqstp /
|
||||||
|
if ((pt2 = strrchr(ua, '.')) != NULL) {
|
||||||
|
*pt2 = 0;
|
||||||
|
snprintf(serveuaddr, sizeof serveuaddr,
|
||||||
|
- "%s.%d.%d", ua,
|
||||||
|
+ "%s.%ld.%ld", ua,
|
||||||
|
(fnd->pml_map.pm_port >> 8) & 0xff,
|
||||||
|
(fnd->pml_map.pm_port) & 0xff);
|
||||||
|
*pt2 = '.';
|
@ -43,7 +43,7 @@ start() {
|
|||||||
[ -f /sbin/$prog ] || exit 5
|
[ -f /sbin/$prog ] || exit 5
|
||||||
|
|
||||||
echo -n $"Starting $prog: "
|
echo -n $"Starting $prog: "
|
||||||
daemon $prog $RPCBIND_ARGS
|
daemon $prog $RPCBIND_ARGS $1
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
|
||||||
@ -81,7 +81,7 @@ case "$1" in
|
|||||||
condrestart)
|
condrestart)
|
||||||
if [ -f /var/lock/subsys/$prog ]; then
|
if [ -f /var/lock/subsys/$prog ]; then
|
||||||
$0 stop
|
$0 stop
|
||||||
$0 start
|
$0 start -w
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
10
rpcbind.spec
10
rpcbind.spec
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: rpcbind
|
Name: rpcbind
|
||||||
Version: 0.1.4
|
Version: 0.1.4
|
||||||
Release: 13%{?dist}
|
Release: 14%{?dist}
|
||||||
Summary: Universal Addresses to RPC Program Number Mapper
|
Summary: Universal Addresses to RPC Program Number Mapper
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
License: GPL
|
License: GPL
|
||||||
@ -33,6 +33,7 @@ Patch5: rpcbind-0.1.4-iff_up.patch
|
|||||||
Patch6: rpcbind-0.1.4-libwrap.patch
|
Patch6: rpcbind-0.1.4-libwrap.patch
|
||||||
Patch7: rpcbind-0.1.4-localaddr.patch
|
Patch7: rpcbind-0.1.4-localaddr.patch
|
||||||
Patch8: rpcbind-0.1.4-recvfrom-fix.patch
|
Patch8: rpcbind-0.1.4-recvfrom-fix.patch
|
||||||
|
Patch9: rpcbind-0.1.4-warmstarts-cleanup.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The rpcbind utility is a server that converts RPC program numbers into
|
The rpcbind utility is a server that converts RPC program numbers into
|
||||||
@ -54,6 +55,8 @@ RPC calls on a server on that machine.
|
|||||||
%patch7 -p1
|
%patch7 -p1
|
||||||
# 244492: New rpcbind breaks connectivity with some NIS clients
|
# 244492: New rpcbind breaks connectivity with some NIS clients
|
||||||
%patch8 -p1
|
%patch8 -p1
|
||||||
|
#428496: rpcbind-0.1.4-12.fc8.x86_64.rpm does not update properly
|
||||||
|
%patch9 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%ifarch s390 s390x
|
%ifarch s390 s390x
|
||||||
@ -133,6 +136,11 @@ fi
|
|||||||
%dir %attr(700,rpc,rpc) /var/lib/rpcbind
|
%dir %attr(700,rpc,rpc) /var/lib/rpcbind
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 11 2008 Steve Dickson <steved@redhat.com> 0.1.4-14
|
||||||
|
- Fixed a warning in pmap_svc.c
|
||||||
|
- Cleaned up warmstarts so uid are longer needed, also
|
||||||
|
changed condrestarts to use warmstarts. (bz 428496)
|
||||||
|
|
||||||
* Thu Jan 24 2008 Steve Dickson <steved@redhat.com> 0.1.4-13
|
* Thu Jan 24 2008 Steve Dickson <steved@redhat.com> 0.1.4-13
|
||||||
- Fixed connectivity with Mac OS clients by making sure handle_reply()
|
- Fixed connectivity with Mac OS clients by making sure handle_reply()
|
||||||
sets the correct fromlen in its recvfrom() call (bz 244492)
|
sets the correct fromlen in its recvfrom() call (bz 244492)
|
||||||
|
Loading…
Reference in New Issue
Block a user