Re-port RPC library to Solaris
authorwarlord <warlord@cb58f699-b61c-0410-a6fe-9272a202ed29>
Fri, 1 Nov 2002 01:29:56 +0000 (01:29 +0000)
committerwarlord <warlord@cb58f699-b61c-0410-a6fe-9272a202ed29>
Fri, 1 Nov 2002 01:29:56 +0000 (01:29 +0000)
Hook RPC library into build tree
Use RPC library when RPC-check fails (need a better way)

git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@185 cb58f699-b61c-0410-a6fe-9272a202ed29

27 files changed:
configure.ac
mod_shibrm/Makefile.am
mod_shire/Makefile.am
oncrpc/.cvsignore [new file with mode: 0644]
oncrpc/Makefile.am [new file with mode: 0644]
oncrpc/auth_uni.c
oncrpc/authunix.c
oncrpc/clnt_per.c
oncrpc/clnt_tcp.c
oncrpc/clnt_udp.c
oncrpc/get_myad.c
oncrpc/pmap_cln.c
oncrpc/pmap_get.c
oncrpc/pmap_gma.c
oncrpc/pmap_rmt.c
oncrpc/rpc/.cvsignore [new file with mode: 0644]
oncrpc/rpc/Makefile.am [new file with mode: 0644]
oncrpc/rpc/svc_auth.h
oncrpc/rpc/types.h
oncrpc/svc.c
oncrpc/svc_run.c
oncrpc/svc_tcp.c
oncrpc/svc_udp.c
oncrpc/xdr_arra.c
oncrpc/xdr_rec.c
shar/Makefile.am
shib-target/Makefile.am

index 12e57c1..0ebfcd2 100644 (file)
@@ -36,14 +36,6 @@ AC_SEARCH_LIBS(xdr_uint64_t,nsl,,
         CXXFLAGS="$CXXFLAGS -DNEED_XDR_LONGLONG"])
 LIBS="$old_LIBS"
 
-ACX_RPCTEST([rpctest="yes"],[rpctest="no"])
-if test $rpctest = "no"; then
-    AC_CHECK_HEADERS([stropts.h])
-    CFLAGS="-DNEED_RPC_TLI $CFLAGS"
-    CXXFLAGS="-DNEED_RPC_TLI $CXXFLAGS"
-    ACX_RPCTEST(,AC_MSG_ERROR([neither style of ONC RPC worked]))
-fi
-
 # checks for pthreads
 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
 if test $enable_threads != "pthread"; then
@@ -159,7 +151,15 @@ AC_TRY_LINK(
 # output the underlying makefiles
 WANT_SUBDIRS="shib schemas configs eduPerson shib-target shar test"
 AC_CONFIG_FILES([Makefile shib/Makefile schemas/Makefile eduPerson/Makefile \
-                configs/Makefile shib-target/Makefile shar/Makefile test/Makefile])
+                configs/Makefile oncrpc/Makefile oncrpc/rpc/Makefile \
+                shib-target/Makefile shar/Makefile test/Makefile])
+
+# now test the rpc library, to see if we need to build our own
+ACX_RPCTEST([rpctest="yes"],[rpctest="no"])
+if test $rpctest = "no"; then
+    WANT_SUBDIRS="oncrpc $WANT_SUBDIRS"
+    AM_CONDITIONAL(USE_OUR_ONCRPC,test "$rpctest" = "no")
+fi
 
 # Much of this is taken from mod_dav.
 # The basic idea is to use configure options to control whether/which types
index 6fc5767..09e94e4 100644 (file)
@@ -2,12 +2,16 @@
 
 AUTOMAKE_OPTIONS = foreign
 
+if USE_OUR_ONCRPC
+RPC_CFLAGS = -I${top_srcdir}/oncrpc
+endif
+
 shibrmdir = $(libexecdir)
 shibrm_LTLIBRARIES = mod_shibrm.la
 
 mod_shibrm_la_SOURCES = mod_shibrm.cpp
 
-AM_CXXFLAGS = $(APXS_CFLAGS) -I$(APXS_INCLUDE)
+AM_CXXFLAGS = $(APXS_CFLAGS) -I$(APXS_INCLUDE) $(RPC_CFLAGS)
 
 mod_shibrm_la_LIBADD = $(top_builddir)/shib/libshib.la $(top_builddir)/shib-target/libshib-target.la
 
index 79fe57b..1302884 100644 (file)
@@ -2,12 +2,16 @@
 
 AUTOMAKE_OPTIONS = foreign
 
+if USE_OUR_ONCRPC
+RPC_CFLAGS = -I${top_srcdir}/oncrpc
+endif
+
 shiredir = $(libexecdir)
 shire_LTLIBRARIES = mod_shire.la
 
 mod_shire_la_SOURCES = mod_shire.cpp
 
-AM_CXXFLAGS = $(APXS_CFLAGS) -I$(APXS_INCLUDE)
+AM_CXXFLAGS = $(APXS_CFLAGS) -I$(APXS_INCLUDE) $(RPC_CFLAGS)
 
 mod_shire_la_LIBADD = $(top_builddir)/shib/libshib.la $(top_builddir)/shib-target/libshib-target.la
 
diff --git a/oncrpc/.cvsignore b/oncrpc/.cvsignore
new file mode 100644 (file)
index 0000000..3bfbb72
--- /dev/null
@@ -0,0 +1,6 @@
+Makefile.in
+Makefile
+.libs
+.deps
+*.lo
+*.la
diff --git a/oncrpc/Makefile.am b/oncrpc/Makefile.am
new file mode 100644 (file)
index 0000000..3b8e46d
--- /dev/null
@@ -0,0 +1,64 @@
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = . rpc
+
+AM_CFLAGS = -D_rpc_dtablesize=getdtablesize
+
+lib_LTLIBRARIES = liboncrpc.la
+
+liboncrpc_la_SOURCES = \
+  auth_non.c \
+  auth_uni.c \
+  authunix.c \
+  clnt_gen.c \
+  clnt_per.c \
+  clnt_raw.c \
+  clnt_sim.c \
+  clnt_tcp.c \
+  clnt_udp.c \
+  get_myad.c \
+  pmap_cln.c \
+  pmap_get.c \
+  pmap_gma.c \
+  pmap_pr.c \
+  pmap_pro.c \
+  pmap_rmt.c \
+  rpc_call.c \
+  rpc_comm.c \
+  rpc_prot.c \
+  svc.c \
+  svc_auth.c \
+  svc_autu.c \
+  svc_raw.c \
+  svc_run.c \
+  svc_simp.c \
+  svc_tcp.c \
+  svc_udp.c \
+  xdr.c \
+  xdr_arra.c \
+  xdr_floa.c \
+  xdr_mem.c \
+  xdr_rec.c \
+  xdr_refe.c \
+  xdr_stdi.c
+
+# this is different from the project version
+# http://sources.redhat.com/autobook/autobook/autobook_91.html
+liboncrpc_la_LDFLAGS = -version-info 1:0:0
+
+EXTRA_DIST = \
+  .cvsignore \
+  makefile.bc \
+  makefile.nt \
+  oncbcimp.def \
+  oncrpc.def \
+  oncrpc.rc \
+  oncrpcbc.def \
+  bcopy.c \
+  bindresv.c \
+  getrpcen.c \
+  getrpcpo.c \
+  nt.c \
+  portmap.c
+
index ee482fe..e8da42b 100644 (file)
@@ -60,7 +60,7 @@ static char sccsid[] = "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
 #include <rpc/rpc.h>
 #include <rpc/xdr.h>
 #include <rpc/auth.h>
-#include <rpc/auth_uni.h>
+#include <rpc/auth_unix.h>
 #else
 #include <rpc/types.h>
 #include <rpc/xdr.h>
index e170ff0..7f1ac7d 100644 (file)
@@ -54,7 +54,7 @@ static char sccsid[] = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
 #include <rpc/types.h>
 #include <rpc/xdr.h>
 #include <rpc/auth.h>
-#include <rpc/auth_uni.h>
+#include <rpc/auth_unix.h>
 #else
 #include <rpc/types.h>
 #include <rpc/xdr.h>
index d3c10b7..35cd883 100644 (file)
@@ -59,8 +59,10 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
 
 #ifndef WIN32
 extern char *sys_errlist[];
+#ifdef NEED_SPRINTF
 extern char *sprintf();
 #endif
+#endif
 static char *auth_errmsg();
 
 extern char *strcpy();
index e298608..125851c 100644 (file)
@@ -65,7 +65,7 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
 #include <rpc/rpc.h>
 #ifdef WIN32
 #include <errno.h>
-#include <rpc/pmap_cln.h>
+#include <rpc/pmap_clnt.h>
 #else
 #include <sys/socket.h>
 #include <netdb.h>
@@ -504,7 +504,7 @@ readtcp(ct, buf, len)
        }
        return (len);
 #else
-               switch (select(_rpc_dtablesize(), &readfds, (int*)NULL, (int*)NULL,
+               switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
                               &(ct->ct_wait))) {
                case 0:
                        ct->ct_error.re_status = RPC_TIMEDOUT;
index be0f28d..dab060a 100644 (file)
@@ -52,7 +52,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
 #include <rpc/rpc.h>
 #ifdef WIN32
 #include <errno.h>
-#include <rpc/pmap_cln.h>
+#include <rpc/pmap_clnt.h>
 #else
 #include <sys/socket.h>
 #include <sys/ioctl.h>
@@ -60,6 +60,10 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
 #include <errno.h>
 #include <rpc/pmap_clnt.h>
 
+#ifndef FIONBIO
+#include <sys/filio.h>
+#endif
+
 extern int errno;
 #endif
 
@@ -331,11 +335,11 @@ send_again:
        for (;;) {
                readfds = mask;
 #ifdef WIN32
-               switch (select(0 /* unused in winsock */, &readfds, (int *)NULL,
+               switch (select(0 /* unused in winsock */, &readfds, (int *)NULL, (int *)NULL,
 #else
-               switch (select(_rpc_dtablesize(), &readfds, (int *)NULL, 
+                switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
 #endif
-                              (int *)NULL, &(cu->cu_wait))) {
+                              &(cu->cu_wait))) {
 
                case 0:
                        time_waited.tv_sec += cu->cu_wait.tv_sec;
index 8528786..a907656 100644 (file)
@@ -50,7 +50,7 @@ static char sccsid[] = "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro";
 
 #ifdef WIN32
 #include <rpc/rpc.h>
-#include <rpc/pmap_pro.h>
+#include <rpc/pmap_prot.h>
 #include <stdio.h>
 
 #define MAX_NAME_LEN   255
@@ -64,6 +64,10 @@ static char sccsid[] = "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro";
 #include <arpa/inet.h>
 #include <netinet/in.h>
 
+#ifndef SIOCGIFCONF
+#include <sys/sockio.h>
+#endif
+
 /* 
  * don't use gethostbyname, which would invoke yellow pages
  */
index 24aead2..1514d2e 100644 (file)
@@ -51,8 +51,8 @@ static char sccsid[] = "@(#)pmap_clnt.c 1.37 87/08/11 Copyr 1984 Sun Micro";
 
 #include <rpc/rpc.h>
 #ifdef WIN32
-#include <rpc/pmap_pro.h>
-#include <rpc/pmap_cln.h>
+#include <rpc/pmap_prot.h>
+#include <rpc/pmap_clnt.h>
 #else
 #include <rpc/pmap_prot.h>
 #include <rpc/pmap_clnt.h>
index fa4a6da..302bb4f 100644 (file)
@@ -50,8 +50,8 @@ static char sccsid[] = "@(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro";
  */
 
 #include <rpc/rpc.h>
-#include <rpc/pmap_pro.h>
-#include <rpc/pmap_cln.h>
+#include <rpc/pmap_prot.h>
+#include <rpc/pmap_clnt.h>
 
 static struct timeval timeout = { 5, 0 };
 static struct timeval tottimeout = { 60, 0 };
@@ -90,7 +90,11 @@ pmap_getport(address, program, version, protocol)
                }
                CLNT_DESTROY(client);
        }
+#ifdef WIN32
        (void)closesocket(socket);
+#else
+       (void)close(socket);
+#endif
        address->sin_port = 0;
        return (port);
 }
index f84953b..3c50bc5 100644 (file)
@@ -53,8 +53,8 @@ static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
 #include <rpc/rpc.h>
 #ifdef WIN32
 #include <stdlib.h>
-#include <rpc/pmap_pro.h>
-#include <rpc/pmap_cln.h>
+#include <rpc/pmap_prot.h>
+#include <rpc/pmap_clnt.h>
 #else
 #include <rpc/pmap_prot.h>
 #include <rpc/pmap_clnt.h>
index ccd3f8e..d2e0133 100644 (file)
@@ -51,8 +51,8 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
 
 #include <rpc/rpc.h>
 #ifdef WIN32
-#include <rpc/pmap_pro.h>
-#include <rpc/pmap_cln.h>
+#include <rpc/pmap_prot.h>
+#include <rpc/pmap_clnt.h>
 #include <rpc/pmap_rmt.h>
 #include <stdio.h>
 #include <errno.h>
@@ -69,6 +69,10 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
 #include <arpa/inet.h>
 #define MAX_BROADCAST_SIZE 1400
 
+#ifndef SIOCGIFCONF
+#include <sys/sockio.h>
+#endif
+
 extern int errno;
 #endif
 static struct timeval timeout = { 3, 0 };
@@ -220,7 +224,7 @@ getbroadcastnets(addrs, sock, buf)
 #ifdef SIOCGIFBRDADDR   /* 4.3BSD */
                        if (ioctl(sock, SIOCGIFBRDADDR, (char *)&ifreq) < 0) {
                                addrs[i++] = inet_makeaddr(inet_netof
-                           (sin->sin_addr.s_addr), INADDR_ANY);
+                           (sin->sin_addr), INADDR_ANY);
                        } else {
                                addrs[i++] = ((struct sockaddr_in*)
                                  &ifreq.ifr_addr)->sin_addr;
@@ -356,11 +360,11 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
                 msg.acpted_rply.ar_results.proc = xdr_rmtcallres;
                readfds = mask;
 #ifdef WIN32
-               switch (select(0 /* unused in winsock */, &readfds, (int *)NULL,
+               switch (select(0 /* unused in winsock */, &readfds, (int *)NULL, (int*)NULL,
 #else
-               switch (select(_rpc_dtablesize(), &readfds, (int *)NULL, 
+               switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
 #endif
-                              (int *)NULL, &t)) {
+                              &t)) {
                case 0:  /* timed out */
                        stat = RPC_TIMEDOUT;
                        continue;
diff --git a/oncrpc/rpc/.cvsignore b/oncrpc/rpc/.cvsignore
new file mode 100644 (file)
index 0000000..3bfbb72
--- /dev/null
@@ -0,0 +1,6 @@
+Makefile.in
+Makefile
+.libs
+.deps
+*.lo
+*.la
diff --git a/oncrpc/rpc/Makefile.am b/oncrpc/rpc/Makefile.am
new file mode 100644 (file)
index 0000000..edf6284
--- /dev/null
@@ -0,0 +1,22 @@
+
+AUTOMAKE_OPTIONS = foreign
+
+oncrpcdir = $(includedir)/rpc
+oncrpc_DATA = \
+  auth.h \
+  clnt.h \
+  pmap_prot.h \
+  rpc_msg.h \
+  types.h \
+  auth_unix.h \
+  netdb.h \
+  pmap_rmt.h \
+  svc.h \
+  xdr.h \
+  bcopy.h \
+  pmap_clnt.h \
+  rpc.h \
+  svc_auth.h
+
+EXTRA_DIST = \
+  ${oncrpc_DATA}
index 75e2f23..4d7cd9d 100644 (file)
@@ -53,6 +53,6 @@
 #ifdef __cplusplus
 extern "C" auth_stat _authenticate(...);
 #else
-extern struct auth_stat _authenticate();
+extern enum auth_stat _authenticate();
 #endif
 
index 699be58..1008af0 100644 (file)
@@ -70,6 +70,8 @@ extern char *malloc();
 #endif
 #ifndef WIN32
 #include <sys/time.h>
+#include <netinet/in.h>
+#include <netdb.h>
 #endif
 
 #ifndef INADDR_LOOPBACK
@@ -79,9 +81,11 @@ extern char *malloc();
 #define        MAXHOSTNAMELEN  64
 #endif
 
+#ifdef WIN32
 typedef char *caddr_t;
 typedef unsigned int u_int;
 typedef unsigned long u_long;
 typedef unsigned short u_short;
+#endif
 
 #endif /* ndef __TYPES_RPC_HEADER__ */
index 8723a77..8b4a3fe 100644 (file)
@@ -54,7 +54,7 @@ static char sccsid[] = "@(#)svc.c 1.41 87/10/13 Copyr 1984 Sun Micro";
 
 #ifdef WIN32
 #include <rpc/rpc.h>
-#include <rpc/pmap_cln.h>
+#include <rpc/pmap_clnt.h>
 #include <stdio.h>
 #else
 #include <sys/errno.h>
@@ -546,5 +546,6 @@ svc_getreqset(readfds)
                                break;
                        }
                } while (stat == XPRT_MOREREQS);
+           }
        }
 }
index fb5ab6a..930adbc 100644 (file)
@@ -75,7 +75,7 @@ svc_run()
 #ifdef WIN32
                switch (select(0 /* unused in winsock */, &readfds, (int *)0, (int *)0,
 #else
-               switch (select(_rpc_dtablesize(), &readfds, (int *)0, (int *)0,
+               switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
 #endif
                               (struct timeval *)0)) {
                case -1:
index 9b0feff..5f77b67 100644 (file)
@@ -363,7 +363,7 @@ readtcp(xprt, buf, len)
 #ifdef WIN32
                if (select(0 /* unused in winsock */, &readfds, (int*)NULL, (int*)NULL,
 #else
-               if (select(_rpc_dtablesize(), &readfds, (int*)NULL, (int*)NULL, 
+               if (select(_rpc_dtablesize(), &readfds, NULL, NULL, 
 #endif
                           &wait_per_try) <= 0) {
 #ifdef WIN32
index 0921797..167b045 100644 (file)
@@ -68,6 +68,10 @@ static bool_t                svcudp_getargs();
 static bool_t          svcudp_freeargs();
 static void            svcudp_destroy();
 
+static                 cache_get();
+static                 cache_set();
+
+
 static struct xp_ops svcudp_op = {
        svcudp_recv,
        svcudp_stat,
@@ -323,15 +327,12 @@ svcudp_destroy(xprt)
 #define CACHE_PERROR(msg)      \
        nt_rpc_report(msg)
 #else
-#define CACHE_PERROR(msg)      \
-       (void) fprintf(stderr,"%s\n", msg)
+#define CACHE_PERROR(msg)      (void) fprintf(stderr,"%s\n", msg)
 #endif
 
-#define ALLOC(type, size)      \
-       (type *) mem_alloc((unsigned) (sizeof(type) * (size)))
+#define ALLOC(type, size)      (type *) mem_alloc((unsigned)(sizeof(type)*(size)))
 
-#define BZERO(addr, type, size)         \
-       bzero((char *) addr, sizeof(type) * (int) (size))
+#define BZERO(addr, type, size)        bzero((char *) addr, sizeof(type) * (int) (size))
 
 /*
  * An entry in the cache
@@ -358,7 +359,6 @@ struct cache_node {
 };
 
 
-
 /*
  * The entire cache
  */
@@ -377,9 +377,7 @@ struct udp_cache {
 /*
  * the hashing function
  */
-#define CACHE_LOC(transp, xid) \
- (xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size))
-
+#define CACHE_LOC(transp, xid) (xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size))
 
 /*
  * Enable use of the cache.
@@ -524,4 +522,3 @@ cache_get(xprt, msg, replyp, replylenp)
        uc->uc_addr = xprt->xp_raddr;
        return(0);
 }
-
index fd51554..06a4f6c 100644 (file)
@@ -86,7 +86,8 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
                return (FALSE);
        }
        c = *sizep;
-       if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
+       if ((c > maxsize || c > LASTUNSIGNED / elsize) &&
+           (xdrs->x_op != XDR_FREE)) {
                return (FALSE);
        }
        nodesize = c * elsize;
index 7711eb5..937a44a 100644 (file)
@@ -83,6 +83,11 @@ static bool_t        xdrrec_setpos();
 static long *  xdrrec_inline();
 static void    xdrrec_destroy();
 
+static bool_t  flush_out();
+static bool_t  get_input_bytes();
+static bool_t  set_input_fragment();
+static bool_t  skip_input_bytes();
+
 static struct  xdr_ops xdrrec_ops = {
        xdrrec_getlong,
        xdrrec_putlong,
index 4c30e87..a3d0972 100644 (file)
@@ -2,6 +2,10 @@
 
 AUTOMAKE_OPTIONS = foreign
 
+if USE_OUR_ONCRPC
+AM_CFLAGS = -I${top_srcdir}/oncrpc
+endif
+
 bin_PROGRAMS = shar test-client
 
 test_client_SOURCES = test-client.c
index af219e3..2b553c0 100644 (file)
@@ -4,6 +4,12 @@ AUTOMAKE_OPTIONS = foreign
 
 lib_LTLIBRARIES = libshib-target.la
 
+if USE_OUR_ONCRPC
+libshib_target_la_LIBADD = ${top_builddir}/oncrpc/liboncrpc.la
+AM_CFLAGS = -I${top_srcdir}/oncrpc
+AM_CXXFLAGS = -I${top_srcdir}/oncrpc
+endif
+
 libshib_targetdir = $(includedir)/shib-target
 libshib_target_HEADERS = shib-target.h shibrpc.h