backwards compatibility: fix order of fields in TI-RPC's svc_req

This commit is contained in:
Steve Dickson 2009-01-28 14:28:24 +00:00
parent b625f0b495
commit e42e0b9fa6
2 changed files with 91 additions and 1 deletions

View File

@ -0,0 +1,85 @@
commit 2bb4c8d7ec8a98e1be9133d5901149a81ea9b5d9
Author: Chuck Lever <chuck.lever@oracle.com>
Date: Wed Jan 28 09:19:07 2009 -0500
backwards compatibility: fix order of fields in TI-RPC's svc_req
Preserve ABI compatibility between glibc's RPC implementation and
the legacy RPC implementation in libtirpc by moving the rq_xprt
field in the TI-RPC version of the svc_req struct so it is
backwards compatible with the legacy version of this structure.
Linux's legacy svc_req struct, from /usr/include/rpc/svc.h, looks
like this:
struct svc_req {
rpcprog_t rq_prog; /* service program number */
rpcvers_t rq_vers; /* service protocol version */
rpcproc_t rq_proc; /* the desired procedure */
struct opaque_auth rq_cred; /* raw creds from the wire */
caddr_t rq_clntcred; /* read only cooked cred */
SVCXPRT *rq_xprt; /* associated transport */
};
The new TI-RPC svc_req struct, from /usr/include/tirpc/rpc/svc.h,
looks like this:
struct svc_req {
u_int32_t rq_prog; /* service program number */
u_int32_t rq_vers; /* service protocol version */
u_int32_t rq_proc; /* the desired procedure */
struct opaque_auth rq_cred; /* raw creds from the wire */
void *rq_clntcred; /* read only cooked cred */
caddr_t rq_clntname; /* read only client name */
caddr_t rq_svcname; /* read only cooked service cred */
SVCXPRT *rq_xprt; /* associated transport */
};
Note the extra fields rq_clntname and rq_svcname. These are used for
TI-RPC's RPCSEC GSS flavor support.
This issue came to light because rpc.statd still uses only legacy RPC
calls, and thus includes /usr/include/rpc/svc.h. However, other parts
of nfs-utils now link with TI-RPC, so the legacy RPC functions in
libtirpc are used in favor of glibc's RPC functions. The libtirpc svc
functions use the new svc_req struct, but rpc.statd uses the old
svc_req struct.
Since the svc_req fields were different, rpc.statd broke after recent
IPv6-related changes, even though I hadn't made any changes to it.
Note that rpc.mountd also references the rq_xprt field, so it has the
same issue.
In most operating systems, there is only one rpc/svc.h and one version
of svc_req so this is not a problem. We should audit all of the
structures and functions under /usr/include/rpc and
/usr/include/tirpc/rpc to ensure we have a reasonable level of
backwards compatibility until such a time it is decided to merge these
implementations or get rid of RPC support in glibc.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/tirpc/rpc/svc.h b/tirpc/rpc/svc.h
index ec5914f..ea2985d 100644
--- a/tirpc/rpc/svc.h
+++ b/tirpc/rpc/svc.h
@@ -131,14 +131,17 @@ typedef struct __rpc_svcxprt {
* Service request
*/
struct svc_req {
+ /* ORDER: compatibility with legacy RPC */
u_int32_t rq_prog; /* service program number */
u_int32_t rq_vers; /* service protocol version */
u_int32_t rq_proc; /* the desired procedure */
struct opaque_auth rq_cred; /* raw creds from the wire */
void *rq_clntcred; /* read only cooked cred */
+ SVCXPRT *rq_xprt; /* associated transport */
+
+ /* New with TI-RPC */
caddr_t rq_clntname; /* read only client name */
caddr_t rq_svcname; /* read only cooked service cred */
- SVCXPRT *rq_xprt; /* associated transport */
};
/*

View File

@ -1,6 +1,6 @@
Name: libtirpc
Version: 0.1.10
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Transport Independent RPC Library
Group: System Environment/Libraries
License: SISSL
@ -33,6 +33,7 @@ Requires(devel): pkgconfig man
Patch01: libtirpc-0.1.10-dg-unlock.patch
Patch02: libtirpc-0.1.10-errmess-unlock.patch
Patch03: libtirpc-0.1.10-C++declares.patch
Patch04: libtirpc-0.1.10-svcreq-compat.patch
Patch100: libtirpc-0.1.7-compile.patch
@ -46,6 +47,7 @@ developing programs which use the tirpc library.
%patch01 -p1
%patch02 -p1
%patch03 -p1
%patch04 -p1
%patch100 -p1
@ -144,6 +146,9 @@ rm -rf %{buildroot}
%{_mandir}/*/*
%changelog
* Wed Jan 28 2009 Steve Dickson <steved@redhat.com> 0.1.10-3
- backwards compatibility: fix order of fields in TI-RPC's svc_req
* Thu Jan 22 2009 Steve Dickson <steved@redhat.com> 0.1.10-2
- Header file fixes for C++