- Fixed mutex lock problem in clnt_raw_create()
- Ignore the return value of snprintf() and use strlen() instead to bump the pointer in clnt_sperror() - A couple ntohs() were needed in bindresvport_sa() - Added IP_RECVERR processing with to clnt_dg_call() so application will see errors instead of timing out
This commit is contained in:
parent
3ff2697d01
commit
808a248167
29
libtirpc-0.1.7-bindresvport-ntohs.patch
Normal file
29
libtirpc-0.1.7-bindresvport-ntohs.patch
Normal file
@ -0,0 +1,29 @@
|
||||
commit 83cb8b02f87fe6fd7bbd903e4825f7cb38e59ec4
|
||||
Author: Steve Dickson <steved@redhat.com>
|
||||
Date: Fri May 4 12:19:27 2007 -0400
|
||||
|
||||
A couple ntohs() were needed in bindresvport_sa()
|
||||
|
||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||
|
||||
diff --git a/src/bindresvport.c b/src/bindresvport.c
|
||||
index bc75d29..6aac03c 100644
|
||||
--- a/src/bindresvport.c
|
||||
+++ b/src/bindresvport.c
|
||||
@@ -101,14 +101,14 @@ bindresvport_sa(sd, sa)
|
||||
case AF_INET:
|
||||
sin = (struct sockaddr_in *)sa;
|
||||
salen = sizeof(struct sockaddr_in);
|
||||
- port = sin->sin_port;
|
||||
+ port = ntohs(sin->sin_port);
|
||||
portp = &sin->sin_port;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
sin6 = (struct sockaddr_in6 *)sa;
|
||||
salen = sizeof(struct sockaddr_in6);
|
||||
- port = sin6->sin6_port;
|
||||
+ port = ntohs(sin6->sin6_port);
|
||||
portp = &sin6->sin6_port;
|
||||
break;
|
||||
#endif
|
28
libtirpc-0.1.7-clnt_raw-mutex.patch
Normal file
28
libtirpc-0.1.7-clnt_raw-mutex.patch
Normal file
@ -0,0 +1,28 @@
|
||||
commit 419d35db75ab8bd8f79c424f529a6c2f7c4f5fa7
|
||||
Author: Steve Dickson <steved@redhat.com>
|
||||
Date: Fri May 4 09:27:00 2007 -0400
|
||||
|
||||
Fixed mutex locking problem in clnt_raw.c. One should grab the
|
||||
clntraw_lock before accessing at clntraw_private, not after.
|
||||
|
||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||
|
||||
diff --git a/src/clnt_raw.c b/src/clnt_raw.c
|
||||
index 153dd87..36035c8 100644
|
||||
--- a/src/clnt_raw.c
|
||||
+++ b/src/clnt_raw.c
|
||||
@@ -82,12 +82,13 @@ clnt_raw_create(prog, vers)
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
{
|
||||
- struct clntraw_private *clp = clntraw_private;
|
||||
+ struct clntraw_private *clp;
|
||||
struct rpc_msg call_msg;
|
||||
XDR *xdrs = &clp->xdr_stream;
|
||||
CLIENT *client = &clp->client_object;
|
||||
|
||||
mutex_lock(&clntraw_lock);
|
||||
+ clp = clntraw_private;
|
||||
if (clp == NULL) {
|
||||
clp = (struct clntraw_private *)calloc(1, sizeof (*clp));
|
||||
if (clp == NULL) {
|
98
libtirpc-0.1.7-dgcall-iprecverr.patch
Normal file
98
libtirpc-0.1.7-dgcall-iprecverr.patch
Normal file
@ -0,0 +1,98 @@
|
||||
commit 40ab0c28e995786d5844bd490a31b788ecabf546
|
||||
Author: Steve Dickson <steved@redhat.com>
|
||||
Date: Fri May 4 14:26:56 2007 -0400
|
||||
|
||||
Added IP_RECVERR processing with to clnt_dg_call() so
|
||||
application will see errors instead of timing out
|
||||
|
||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||
|
||||
diff --git a/src/clnt_dg.c b/src/clnt_dg.c
|
||||
index 151b449..0e35742 100644
|
||||
--- a/src/clnt_dg.c
|
||||
+++ b/src/clnt_dg.c
|
||||
@@ -55,6 +55,13 @@
|
||||
#include <err.h>
|
||||
#include "rpc_com.h"
|
||||
|
||||
+#ifdef IP_RECVERR
|
||||
+#include <asm/types.h>
|
||||
+#include <linux/errqueue.h>
|
||||
+#include <sys/uio.h>
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
#define MAX_DEFAULT_FDS 20000
|
||||
|
||||
static struct clnt_ops *clnt_dg_ops(void);
|
||||
@@ -246,6 +253,12 @@ clnt_dg_create(fd, svcaddr, program, version, sendsz, recvsz)
|
||||
#if 0
|
||||
(void)bindresvport_sa(fd, (struct sockaddr *)svcaddr->buf);
|
||||
#endif
|
||||
+#ifdef IP_RECVERR
|
||||
+ {
|
||||
+ int on = 1;
|
||||
+ setsockopt(fd, SOL_IP, IP_RECVERR, &on, sizeof(on));
|
||||
+ }
|
||||
+#endif
|
||||
ioctl(fd, FIONBIO, (char *)(void *)&one);
|
||||
/*
|
||||
* By default, closeit is always FALSE. It is users responsibility
|
||||
@@ -352,7 +365,7 @@ call_again:
|
||||
xid++;
|
||||
*(u_int32_t *)(void *)(cu->cu_outbuf) = htonl(xid);
|
||||
|
||||
- if ((! XDR_PUTINT32(xdrs, &proc)) ||
|
||||
+ if ((! XDR_PUTINT32(xdrs, (int32_t *)&proc)) ||
|
||||
(! AUTH_MARSHALL(cl->cl_auth, xdrs)) ||
|
||||
(! (*xargs)(xdrs, argsp))) {
|
||||
cu->cu_error.re_status = RPC_CANTENCODEARGS;
|
||||
@@ -404,6 +417,48 @@ get_reply:
|
||||
}
|
||||
break;
|
||||
}
|
||||
+#ifdef IP_RECVERR
|
||||
+ if (fd.revents & POLLERR)
|
||||
+ {
|
||||
+ struct msghdr msg;
|
||||
+ struct cmsghdr *cmsg;
|
||||
+ struct sock_extended_err *e;
|
||||
+ struct sockaddr_in err_addr;
|
||||
+ struct sockaddr_in *sin = (struct sockaddr_in *)&cu->cu_raddr;
|
||||
+ struct iovec iov;
|
||||
+ char *cbuf = (char *) alloca (outlen + 256);
|
||||
+ int ret;
|
||||
+
|
||||
+ iov.iov_base = cbuf + 256;
|
||||
+ iov.iov_len = outlen;
|
||||
+ msg.msg_name = (void *) &err_addr;
|
||||
+ msg.msg_namelen = sizeof (err_addr);
|
||||
+ msg.msg_iov = &iov;
|
||||
+ msg.msg_iovlen = 1;
|
||||
+ msg.msg_flags = 0;
|
||||
+ msg.msg_control = cbuf;
|
||||
+ msg.msg_controllen = 256;
|
||||
+ ret = recvmsg (cu->cu_fd, &msg, MSG_ERRQUEUE);
|
||||
+ if (ret >= 0
|
||||
+ && memcmp (cbuf + 256, cu->cu_outbuf, ret) == 0
|
||||
+ && (msg.msg_flags & MSG_ERRQUEUE)
|
||||
+ && ((msg.msg_namelen == 0
|
||||
+ && ret >= 12)
|
||||
+ || (msg.msg_namelen == sizeof (err_addr)
|
||||
+ && err_addr.sin_family == AF_INET
|
||||
+ && memcmp (&err_addr.sin_addr, &sin->sin_addr,
|
||||
+ sizeof (err_addr.sin_addr)) == 0
|
||||
+ && err_addr.sin_port == sin->sin_port)))
|
||||
+ for (cmsg = CMSG_FIRSTHDR (&msg); cmsg;
|
||||
+ cmsg = CMSG_NXTHDR (&msg, cmsg))
|
||||
+ if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR)
|
||||
+ {
|
||||
+ e = (struct sock_extended_err *) CMSG_DATA(cmsg);
|
||||
+ cu->cu_error.re_errno = e->ee_errno;
|
||||
+ return (cu->cu_error.re_status = RPC_CANTRECV);
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
/* We have some data now */
|
||||
do {
|
150
libtirpc-0.1.7-snprintf.patch
Normal file
150
libtirpc-0.1.7-snprintf.patch
Normal file
@ -0,0 +1,150 @@
|
||||
commit a3a3a4e5157932c254200e3b31a78739f5878071
|
||||
Author: Steve Dickson <steved@redhat.com>
|
||||
Date: Fri May 4 11:27:43 2007 -0400
|
||||
|
||||
Ignore the return value of snprintf() and use strlen() instead
|
||||
to bump the pointer in clnt_sperror()
|
||||
|
||||
Also removed calls to assert(), not needed.
|
||||
|
||||
Signed-off-by: Steve Dickson <steved@redhat.com>
|
||||
|
||||
diff --git a/src/clnt_perror.c b/src/clnt_perror.c
|
||||
index e46d95f..8f53f8e 100644
|
||||
--- a/src/clnt_perror.c
|
||||
+++ b/src/clnt_perror.c
|
||||
@@ -36,7 +36,6 @@
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*
|
||||
*/
|
||||
-#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -75,8 +74,8 @@ clnt_sperror(rpch, s)
|
||||
char *strstart;
|
||||
size_t len, i;
|
||||
|
||||
- assert(rpch != NULL);
|
||||
- assert(s != NULL);
|
||||
+ if (rpch == NULL || s == NULL)
|
||||
+ return(0);
|
||||
|
||||
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
|
||||
if (str == 0)
|
||||
@@ -85,7 +84,8 @@ clnt_sperror(rpch, s)
|
||||
strstart = str;
|
||||
CLNT_GETERR(rpch, &e);
|
||||
|
||||
- if ((i = snprintf(str, len, "%s: ", s)) > 0) {
|
||||
+ if (snprintf(str, len, "%s: ", s) > 0) {
|
||||
+ i = strlen(str);
|
||||
str += i;
|
||||
len -= i;
|
||||
}
|
||||
@@ -113,7 +113,8 @@ clnt_sperror(rpch, s)
|
||||
|
||||
case RPC_CANTSEND:
|
||||
case RPC_CANTRECV:
|
||||
- i = snprintf(str, len, "; errno = %s", strerror(e.re_errno));
|
||||
+ snprintf(str, len, "; errno = %s", strerror(e.re_errno));
|
||||
+ i = strlen(str);
|
||||
if (i > 0) {
|
||||
str += i;
|
||||
len -= i;
|
||||
@@ -121,8 +122,9 @@ clnt_sperror(rpch, s)
|
||||
break;
|
||||
|
||||
case RPC_VERSMISMATCH:
|
||||
- i = snprintf(str, len, "; low version = %u, high version = %u",
|
||||
+ snprintf(str, len, "; low version = %u, high version = %u",
|
||||
e.re_vers.low, e.re_vers.high);
|
||||
+ i = strlen(str);
|
||||
if (i > 0) {
|
||||
str += i;
|
||||
len -= i;
|
||||
@@ -131,18 +133,20 @@ clnt_sperror(rpch, s)
|
||||
|
||||
case RPC_AUTHERROR:
|
||||
err = auth_errmsg(e.re_why);
|
||||
- i = snprintf(str, len, "; why = ");
|
||||
+ snprintf(str, len, "; why = ");
|
||||
+ i = strlen(str);
|
||||
if (i > 0) {
|
||||
str += i;
|
||||
len -= i;
|
||||
}
|
||||
if (err != NULL) {
|
||||
- i = snprintf(str, len, "%s",err);
|
||||
+ snprintf(str, len, "%s",err);
|
||||
} else {
|
||||
- i = snprintf(str, len,
|
||||
+ snprintf(str, len,
|
||||
"(unknown authentication error - %d)",
|
||||
(int) e.re_why);
|
||||
}
|
||||
+ i = strlen(str);
|
||||
if (i > 0) {
|
||||
str += i;
|
||||
len -= i;
|
||||
@@ -150,8 +154,9 @@ clnt_sperror(rpch, s)
|
||||
break;
|
||||
|
||||
case RPC_PROGVERSMISMATCH:
|
||||
- i = snprintf(str, len, "; low version = %u, high version = %u",
|
||||
+ snprintf(str, len, "; low version = %u, high version = %u",
|
||||
e.re_vers.low, e.re_vers.high);
|
||||
+ i = strlen(str);
|
||||
if (i > 0) {
|
||||
str += i;
|
||||
len -= i;
|
||||
@@ -159,8 +164,9 @@ clnt_sperror(rpch, s)
|
||||
break;
|
||||
|
||||
default: /* unknown */
|
||||
- i = snprintf(str, len, "; s1 = %u, s2 = %u",
|
||||
+ snprintf(str, len, "; s1 = %u, s2 = %u",
|
||||
e.re_lb.s1, e.re_lb.s2);
|
||||
+ i = strlen(str);
|
||||
if (i > 0) {
|
||||
str += i;
|
||||
len -= i;
|
||||
@@ -177,8 +183,8 @@ clnt_perror(rpch, s)
|
||||
const char *s;
|
||||
{
|
||||
|
||||
- assert(rpch != NULL);
|
||||
- assert(s != NULL);
|
||||
+ if (rpch == NULL || s == NULL)
|
||||
+ return;
|
||||
|
||||
(void) fprintf(stderr, "%s\n", clnt_sperror(rpch,s));
|
||||
}
|
||||
@@ -236,13 +242,15 @@ clnt_spcreateerror(s)
|
||||
char *str;
|
||||
size_t len, i;
|
||||
|
||||
- assert(s != NULL);
|
||||
+ if (s == NULL)
|
||||
+ return(0);
|
||||
|
||||
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
|
||||
if (str == 0)
|
||||
return(0);
|
||||
len = CLNT_PERROR_BUFLEN;
|
||||
- i = snprintf(str, len, "%s: ", s);
|
||||
+ snprintf(str, len, "%s: ", s);
|
||||
+ i = strlen(str);
|
||||
if (i > 0)
|
||||
len -= i;
|
||||
(void)strncat(str, clnt_sperrno(rpc_createerr.cf_stat), len - 1);
|
||||
@@ -287,7 +295,8 @@ clnt_pcreateerror(s)
|
||||
const char *s;
|
||||
{
|
||||
|
||||
- assert(s != NULL);
|
||||
+ if (s == NULL)
|
||||
+ return;
|
||||
|
||||
(void) fprintf(stderr, "%s\n", clnt_spcreateerror(s));
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
Name: libtirpc
|
||||
Version: 0.1.7
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: Transport Independent RPC Library
|
||||
Group: System Environment/Libraries
|
||||
License: GPL
|
||||
@ -30,14 +30,18 @@ Group: Development/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: pkgconfig
|
||||
|
||||
Patch1: libtirpc-0.1.7-netconfig.patch
|
||||
Patch2: libtirpc-0.1.7-gssapi.patch
|
||||
Patch3: libtirpc-0.1.7-svcauthnone.patch
|
||||
Patch4: libtirpc-0.1.7-ppc64.patch
|
||||
Patch5: libtirpc-0.1.7-svcauthdestroy.patch
|
||||
Patch6: libtirpc-0.1.7-xdr_bufferoverlow.patch
|
||||
Patch7: libtirpc-0.1.7-bindresvport_ports.patch
|
||||
Patch8: libtirpc-0.1.7-svc-run.patch
|
||||
Patch1: libtirpc-0.1.7-netconfig.patch
|
||||
Patch2: libtirpc-0.1.7-gssapi.patch
|
||||
Patch3: libtirpc-0.1.7-svcauthnone.patch
|
||||
Patch4: libtirpc-0.1.7-ppc64.patch
|
||||
Patch5: libtirpc-0.1.7-svcauthdestroy.patch
|
||||
Patch6: libtirpc-0.1.7-xdr_bufferoverlow.patch
|
||||
Patch7: libtirpc-0.1.7-bindresvport_ports.patch
|
||||
Patch8: libtirpc-0.1.7-svc-run.patch
|
||||
Patch9: libtirpc-0.1.7-clnt_raw-mutex.patch
|
||||
Patch10: libtirpc-0.1.7-snprintf.patch
|
||||
Patch11: libtirpc-0.1.7-bindresvport-ntohs.patch
|
||||
Patch12: libtirpc-0.1.7-dgcall-iprecverr.patch
|
||||
|
||||
Patch100: libtirpc-0.1.7-compile.patch
|
||||
|
||||
@ -56,6 +60,10 @@ developing programs which use the tirpc library.
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
|
||||
%patch100 -p1
|
||||
|
||||
@ -135,6 +143,14 @@ rm -rf %{buildroot}
|
||||
%{_includedir}/tirpc/un-namespace.h
|
||||
|
||||
%changelog
|
||||
* Mon Jul 30 2007 <steved@redhat.com> 0.1.7-8
|
||||
- Fixed mutex lock problem in clnt_raw_create()
|
||||
- Ignore the return value of snprintf() and use strlen() instead
|
||||
to bump the pointer in clnt_sperror()
|
||||
- A couple ntohs() were needed in bindresvport_sa()
|
||||
- Added IP_RECVERR processing with to clnt_dg_call() so
|
||||
application will see errors instead of timing out
|
||||
|
||||
* Mon Jul 9 2007 <steved@redhat.com> 0.1.7-7
|
||||
- Fixed infinite loop in svc_run() (bz 246677)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user