From 04c2ae62574defcaa067d481978992e0627e9e55 Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Mon, 30 Jul 2007 11:56:40 +0000 Subject: [PATCH] - Make sure remote address (xp_rtaddr) is populated with the correct type of address. --- libtirpc-0.1.7-svc-rtaddr.patch | 52 +++++++++++++++++++++++++++++++++ libtirpc.spec | 4 +++ 2 files changed, 56 insertions(+) create mode 100644 libtirpc-0.1.7-svc-rtaddr.patch diff --git a/libtirpc-0.1.7-svc-rtaddr.patch b/libtirpc-0.1.7-svc-rtaddr.patch new file mode 100644 index 0000000..459b52d --- /dev/null +++ b/libtirpc-0.1.7-svc-rtaddr.patch @@ -0,0 +1,52 @@ +commit f8ff8f0de33606ff544dc87c0a9993fd3a0f5475 +Author: Steve Dickson +Date: Mon Jul 30 07:26:45 2007 -0400 + + - Make sure remote address (xp_rtaddr) is populated + with the correct type of address. + + Signed-off-by: Steve Dickson + +diff --git a/src/svc_vc.c b/src/svc_vc.c +index 48494e1..3d77aef 100644 +--- a/src/svc_vc.c ++++ b/src/svc_vc.c +@@ -239,7 +239,10 @@ svc_fd_create(fd, sendsize, recvsize) + warnx("svc_fd_create: no mem for local addr"); + goto freedata; + } +- memcpy(ret->xp_rtaddr.buf, &sin6, (size_t)sizeof(ss)); ++ if (ss.ss_family == AF_INET) ++ memcpy(ret->xp_rtaddr.buf, &ss, (size_t)sizeof(ss)); ++ else ++ memcpy(ret->xp_rtaddr.buf, &sin6, (size_t)sizeof(ss)); + #ifdef PORTMAP + if (sin6.sin6_family == AF_INET6 || sin6.sin6_family == AF_LOCAL) { + memcpy(&ret->xp_raddr, ret->xp_rtaddr.buf, +@@ -343,20 +346,23 @@ again: + newxprt = makefd_xprt(sock, r->sendsize, r->recvsize); + if (addr.ss_family == AF_INET) { + map_ipv4_to_ipv6((struct sockaddr_in *)&addr, &sin6); +- len = sizeof(struct sockaddr_in6); + } else { + memcpy(&sin6, &addr, len); + } + newxprt->xp_rtaddr.buf = mem_alloc(len); + if (newxprt->xp_rtaddr.buf == NULL) + return (FALSE); +- memcpy(newxprt->xp_rtaddr.buf, &sin6, len); ++ ++ if (addr.ss_family == AF_INET) ++ memcpy(newxprt->xp_rtaddr.buf, &addr, len); ++ else ++ memcpy(newxprt->xp_rtaddr.buf, &sin6, len); + newxprt->xp_rtaddr.maxlen = newxprt->xp_rtaddr.len = len; + #ifdef PORTMAP + if (sin6.sin6_family == AF_INET6 || sin6.sin6_family == AF_LOCAL) { + memcpy(&newxprt->xp_raddr, newxprt->xp_rtaddr.buf, + sizeof(struct sockaddr_in6)); +- newxprt->xp_addrlen = len; ++ newxprt->xp_addrlen = sizeof(struct sockaddr_in6); + } + #endif /* PORTMAP */ + if (__rpc_fd2sockinfo(sock, &si) && si.si_proto == IPPROTO_TCP) { diff --git a/libtirpc.spec b/libtirpc.spec index c226073..796de07 100644 --- a/libtirpc.spec +++ b/libtirpc.spec @@ -42,6 +42,7 @@ 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 +Patch13: libtirpc-0.1.7-svc-rtaddr.patch Patch100: libtirpc-0.1.7-compile.patch @@ -64,6 +65,7 @@ developing programs which use the tirpc library. %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 %patch100 -p1 @@ -150,6 +152,8 @@ rm -rf %{buildroot} - 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 +- Make sure remote address (xp_rtaddr) is populated + with the correct type of address. * Mon Jul 9 2007 0.1.7-7 - Fixed infinite loop in svc_run() (bz 246677)