From 17101b6f4c2b1fd5f56258018bd0ab91da5f6c92 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Wed, 11 Apr 2018 18:48:53 -0600 Subject: [PATCH] Enable TIRPC support for Linux This is enabled by default. To disable, add: in the config/cf/site.def or host.def file. You will need to have the libtirpc-dev package installed. The benefit is that you will no longer need to run rpcbind in insecure mode (the -i option). There are other benefits we may be able to take advantage of in the future, like supporting IPV6 for ToolTalk. --- cde/config/cf/linux.cf | 20 ++++++++++++-------- cde/lib/tt/Imakefile | 2 ++ cde/lib/tt/bin/Imakefile | 2 ++ cde/lib/tt/bin/dbck/Imakefile | 2 +- cde/lib/tt/bin/scripts/Imakefile | 1 + cde/lib/tt/bin/shell/Imakefile | 2 +- cde/lib/tt/bin/tt_type_comp/Imakefile | 2 +- cde/lib/tt/bin/ttauth/Imakefile | 2 +- cde/lib/tt/bin/ttdbserverd/Imakefile | 4 ++-- cde/lib/tt/bin/ttdbserverd/dm_server.C | 5 +++-- cde/lib/tt/bin/ttsession/Imakefile | 2 +- cde/lib/tt/bin/tttar/Imakefile | 2 +- cde/lib/tt/bin/tttrace/Imakefile | 2 +- cde/lib/tt/lib/Imakefile | 2 +- cde/lib/tt/lib/api/Imakefile | 2 ++ cde/lib/tt/lib/api/c/Imakefile | 2 +- cde/lib/tt/lib/api/dnd/Imakefile | 2 +- cde/lib/tt/lib/db/Imakefile | 2 +- cde/lib/tt/lib/mp/Imakefile | 2 +- cde/lib/tt/lib/tttk/Imakefile | 2 +- cde/lib/tt/lib/util/Imakefile | 2 +- cde/lib/tt/mini_isam/Imakefile | 2 +- cde/lib/tt/slib/Imakefile | 2 +- cde/lib/tt/tooltalk.tmpl | 11 +++++++++++ cde/programs/dtsession/Imakefile | 3 ++- 25 files changed, 53 insertions(+), 29 deletions(-) diff --git a/cde/config/cf/linux.cf b/cde/config/cf/linux.cf index 21ed5a08..5b5624f1 100644 --- a/cde/config/cf/linux.cf +++ b/cde/config/cf/linux.cf @@ -143,20 +143,23 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) XCOMM Lets try XdmAuth instead of the ancient MIT/DES auth #define HasXdmAuth YES -XCOMM If you have the tirpc library on your system, and you have the -XCOMM libtirpc-dev installed, then define HasTIRPCLib to YES in either -XCOMM your host.def or site.def file. Using the tirpc lib should -XCOMM allow running rpcbind in secure mode (ie: without the -i option). -XCOMM The default is NO. +XCOMM TIRPC is enabled by default now on Linux. The libtirpc-dev package is +XCOMM required for this support. If you cannot use tirpc for some reason, +XCOMM can disable it by defining HasTIRPCLib to NO in either +XCOMM your host.def or site.def file. Not using the TIRPC lib will require +XCOMM that you run rpcbind in insecure mode (ie: with the -i option). +XCOMM The default is YES. #ifndef HasTIRPCLib -# define HasTIRPCLib NO +# define HasTIRPCLib YES #endif #if HasTIRPCLib TIRPCLIB = -ltirpc +TIRPCINC = -I/usr/include/tirpc #else -TIRPCLIB = +TIRPCLIB = +TIRPCINC = #endif #if !defined(DefaultGcc2i386Opt) @@ -288,7 +291,8 @@ XCOMM This is needed for CDE currently #define ArchitectureDefines -DLINUX_ARCHITECTURE #define TtClientLibs $(TTLIB) $(TIRPCLIB) $(XTOOLLIB) $(XLIB) -#define TtClientDepLibs $(DEPTTLIB) $(DEPXTOOLLIB) $(DEPXLIB) + +#define SharedTtReqs $(TIRPCLIB) $(LDPRELIBS) SharedXReqs $(CXXLIB) #include #include diff --git a/cde/lib/tt/Imakefile b/cde/lib/tt/Imakefile index 8f8513f0..826041a2 100644 --- a/cde/lib/tt/Imakefile +++ b/cde/lib/tt/Imakefile @@ -5,5 +5,7 @@ XCOMM $TOG: Imakefile /main/7 1998/08/10 18:01:46 mgreess $ SUBDIRS = mini_isam lib slib bin LINTSUBDIRS = mini_isam lib slib bin +INCLUDES = $(TIRPCINC) + MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/cde/lib/tt/bin/Imakefile b/cde/lib/tt/bin/Imakefile index dc754fa9..f46412b4 100644 --- a/cde/lib/tt/bin/Imakefile +++ b/cde/lib/tt/bin/Imakefile @@ -5,6 +5,8 @@ XCOMM $TOG: Imakefile /main/8 1999/08/30 14:33:22 mgreess $ SUBDIRS = dbck shell scripts tt_type_comp \ ttauth ttdbserverd ttsession tttar tttrace +INCLUDES = $(TIRPCINC) + MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) LintSubdirs($(SUBDIRS)) diff --git a/cde/lib/tt/bin/dbck/Imakefile b/cde/lib/tt/bin/dbck/Imakefile index f10301e9..4d82974d 100644 --- a/cde/lib/tt/bin/dbck/Imakefile +++ b/cde/lib/tt/bin/dbck/Imakefile @@ -9,7 +9,7 @@ EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I. -I../../slib -I../../lib -I../../mini_isam +INCLUDES = $(TIRPCINC) -I. -I../../slib -I../../lib -I../../mini_isam DEPLIBS = ../../slib/libstt.a TtClientDepLibs ../../mini_isam/libisam.a LOCAL_LIBRARIES = ../../slib/libstt.a TtClientLibs ../../mini_isam/libisam.a diff --git a/cde/lib/tt/bin/scripts/Imakefile b/cde/lib/tt/bin/scripts/Imakefile index e960c44b..8acf6eb7 100644 --- a/cde/lib/tt/bin/scripts/Imakefile +++ b/cde/lib/tt/bin/scripts/Imakefile @@ -5,6 +5,7 @@ XCOMM $XConsortium: Imakefile /main/4 1996/04/21 19:11:31 drk $ /* Any shell scripts shipped as part of ToolTalk are collected here. */ PROGRAMS = ttce2xdr +INCLUDES = $(TIRPCINC) all:: $(PROGRAMS) diff --git a/cde/lib/tt/bin/shell/Imakefile b/cde/lib/tt/bin/shell/Imakefile index 68a1b797..bc77714b 100644 --- a/cde/lib/tt/bin/shell/Imakefile +++ b/cde/lib/tt/bin/shell/Imakefile @@ -9,7 +9,7 @@ EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I. -I../../lib +INCLUDES = $(TIRPCINC) -I. -I../../lib DEPLIBS = TtClientDepLibs LOCAL_LIBRARIES = TtClientLibs diff --git a/cde/lib/tt/bin/tt_type_comp/Imakefile b/cde/lib/tt/bin/tt_type_comp/Imakefile index 0e00641c..92179208 100644 --- a/cde/lib/tt/bin/tt_type_comp/Imakefile +++ b/cde/lib/tt/bin/tt_type_comp/Imakefile @@ -9,7 +9,7 @@ EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I../../lib -I../../slib +INCLUDES = $(TIRPCINC) -I../../lib -I../../slib DEPLIBS = ../../slib/libstt.a TtClientDepLibs LOCAL_LIBRARIES = ../../slib/libstt.a TtClientLibs diff --git a/cde/lib/tt/bin/ttauth/Imakefile b/cde/lib/tt/bin/ttauth/Imakefile index 2cd2ebf8..8189f292 100644 --- a/cde/lib/tt/bin/ttauth/Imakefile +++ b/cde/lib/tt/bin/ttauth/Imakefile @@ -5,7 +5,7 @@ XCOMM $TOG: Imakefile /main/1 1999/08/30 10:44:56 mgreess $ DEFINES = CONN_DEFINES = ConnectionFlags -INCLUDES = -I. -I../../slib -I../../lib +INCLUDES = $(TIRPCINC) -I. -I../../slib -I../../lib DEPLIBS = TtClientDepLibs LOCAL_LIBRARIES = TtClientLibs diff --git a/cde/lib/tt/bin/ttdbserverd/Imakefile b/cde/lib/tt/bin/ttdbserverd/Imakefile index d8271617..8564008e 100644 --- a/cde/lib/tt/bin/ttdbserverd/Imakefile +++ b/cde/lib/tt/bin/ttdbserverd/Imakefile @@ -8,8 +8,8 @@ EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB) #include "../../tooltalk.tmpl" -DEFINES = -INCLUDES = -I. -I../../slib -I../../lib -I../../mini_isam +DEFINES = $(TIRPC_DEFINES) +INCLUDES = $(TIRPCINC) -I. -I../../slib -I../../lib -I../../mini_isam DEPLIBS = ../../slib/libstt.a TtClientDepLibs ../../mini_isam/libisam.a LOCAL_LIBRARIES = ../../slib/libstt.a TtClientLibs ../../mini_isam/libisam.a diff --git a/cde/lib/tt/bin/ttdbserverd/dm_server.C b/cde/lib/tt/bin/ttdbserverd/dm_server.C index 43ccae01..120d0c0a 100644 --- a/cde/lib/tt/bin/ttdbserverd/dm_server.C +++ b/cde/lib/tt/bin/ttdbserverd/dm_server.C @@ -2105,12 +2105,13 @@ bool_t msg_q_lock(int isfd, const char *record, int length, SVCXPRT *transp) // (with a 16 byte key, the rec length must be at least 31) if ((length > 30) && !memcmp(record+16, "_TT_QUEUED_MSGS", 15)) { // Get the address of the client -#if defined(OPT_TLI) +#if defined(OPT_TLI) || defined(OPT_TIRPC) netbuf *client_address = svc_getrpccaller(transp); _Tt_string client_id(client_address->len); memcpy((char *)client_id, client_address->buf, client_address->len); #else struct sockaddr_in *client_address = svc_getcaller(transp); + _Tt_string client_id(sizeof(struct in_addr)); memcpy( (char *)client_id, &client_address->sin_addr, sizeof(struct in_addr) ); @@ -2129,7 +2130,7 @@ bool_t msg_q_lock(int isfd, const char *record, int length, SVCXPRT *transp) // (with a 16 byte key, the rec length must be at least 27) else if ((length > 26) && !memcmp(record+16, "_TT_MSG_", 8)) { // Get the address of the client -#if defined(OPT_TLI) +#if defined(OPT_TLI) || defined(OPT_TIRPC) netbuf *client_address = svc_getrpccaller(transp); _Tt_string client_id(client_address->len); (void)memcpy((char *)client_id, client_address->buf, client_address->len); diff --git a/cde/lib/tt/bin/ttsession/Imakefile b/cde/lib/tt/bin/ttsession/Imakefile index 89088893..3ff7a14c 100644 --- a/cde/lib/tt/bin/ttsession/Imakefile +++ b/cde/lib/tt/bin/ttsession/Imakefile @@ -9,7 +9,7 @@ EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I. -I../../slib -I../../lib +INCLUDES = $(TIRPCINC) -I. -I../../slib -I../../lib DEPLIBS = ../../slib/libstt.a TtClientDepLibs LOCAL_LIBRARIES = ../../slib/libstt.a TtClientLibs diff --git a/cde/lib/tt/bin/tttar/Imakefile b/cde/lib/tt/bin/tttar/Imakefile index 3f4c87f5..2ee31189 100644 --- a/cde/lib/tt/bin/tttar/Imakefile +++ b/cde/lib/tt/bin/tttar/Imakefile @@ -9,7 +9,7 @@ EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I. -I../../lib +INCLUDES = $(TIRPCINC) -I. -I../../lib DEPLIBS = ../../slib/libstt.a TtClientDepLibs ../../mini_isam/libisam.a LOCAL_LIBRARIES = ../../slib/libstt.a TtClientLibs ../../mini_isam/libisam.a diff --git a/cde/lib/tt/bin/tttrace/Imakefile b/cde/lib/tt/bin/tttrace/Imakefile index d5ffce27..f1aa15d0 100644 --- a/cde/lib/tt/bin/tttrace/Imakefile +++ b/cde/lib/tt/bin/tttrace/Imakefile @@ -9,7 +9,7 @@ EXTRA_LOAD_FLAGS = ExtraLoadFlags $(UNSHARED_CXXLIB) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I. -I../../lib +INCLUDES = $(TIRPCINC) -I. -I../../lib DEPLIBS = TtClientDepLibs LOCAL_LIBRARIES = TtClientLibs diff --git a/cde/lib/tt/lib/Imakefile b/cde/lib/tt/lib/Imakefile index f0a1de87..f1446579 100644 --- a/cde/lib/tt/lib/Imakefile +++ b/cde/lib/tt/lib/Imakefile @@ -31,7 +31,7 @@ DependSubdirs($(SUBDIRS)) #include "../tooltalk.tmpl" DEFINES = -INCLUDES = -I. +INCLUDES = $(TIRPCINC) -I. #ifdef RsArchitecture REALPATHC = realpath.c diff --git a/cde/lib/tt/lib/api/Imakefile b/cde/lib/tt/lib/api/Imakefile index f265380f..2718f9a8 100644 --- a/cde/lib/tt/lib/api/Imakefile +++ b/cde/lib/tt/lib/api/Imakefile @@ -5,6 +5,8 @@ XCOMM $TOG: Imakefile /main/6 1998/08/10 18:00:37 mgreess $ SUBDIRS = c dnd DONES = c/DONE dnd/DONE +INCLUDES = $(TIRPCINC) + MakeSubdirs($(SUBDIRS)) ForceSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/cde/lib/tt/lib/api/c/Imakefile b/cde/lib/tt/lib/api/c/Imakefile index 74369d0a..bc561f49 100644 --- a/cde/lib/tt/lib/api/c/Imakefile +++ b/cde/lib/tt/lib/api/c/Imakefile @@ -19,7 +19,7 @@ DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) #include "../../../tooltalk.tmpl" DEFINES = -INCLUDES = -I../../../lib +INCLUDES = $(TIRPCINC) -I../../../lib /*** NOTE! *** Every time a .o is added below it needs to be added to diff --git a/cde/lib/tt/lib/api/dnd/Imakefile b/cde/lib/tt/lib/api/dnd/Imakefile index 841542ba..a750ac10 100644 --- a/cde/lib/tt/lib/api/dnd/Imakefile +++ b/cde/lib/tt/lib/api/dnd/Imakefile @@ -13,7 +13,7 @@ XCOMM $XConsortium: Imakefile /main/6 1996/04/21 19:12:16 drk $ #include "../../../tooltalk.tmpl" DEFINES = -INCLUDES = -I../.. +INCLUDES = $(TIRPCINC) -I../.. /*** NOTE! *** Every time a .o is added below it needs to be added to diff --git a/cde/lib/tt/lib/db/Imakefile b/cde/lib/tt/lib/db/Imakefile index 2c96e81f..68827d69 100644 --- a/cde/lib/tt/lib/db/Imakefile +++ b/cde/lib/tt/lib/db/Imakefile @@ -16,7 +16,7 @@ DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(ISAM_INCLUDES) $(DEPENDDEFINES) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I../../lib +INCLUDES = $(TIRPCINC) -I../../lib ISAM_INCLUDES = -I../../mini_isam /*** NOTE! diff --git a/cde/lib/tt/lib/mp/Imakefile b/cde/lib/tt/lib/mp/Imakefile index f30be125..4a575136 100644 --- a/cde/lib/tt/lib/mp/Imakefile +++ b/cde/lib/tt/lib/mp/Imakefile @@ -16,7 +16,7 @@ DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(ISAM_INCLUDES) $(DEPENDDEFINES) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I../../lib +INCLUDES = $(TIRPCINC) -I../../lib ISAM_INCLUDES = -I../../mini_isam /* Use BSD-compatible accept() call */ diff --git a/cde/lib/tt/lib/tttk/Imakefile b/cde/lib/tt/lib/tttk/Imakefile index a6dc05a3..ec74d7f2 100644 --- a/cde/lib/tt/lib/tttk/Imakefile +++ b/cde/lib/tt/lib/tttk/Imakefile @@ -19,7 +19,7 @@ DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I../../lib +INCLUDES = $(TIRPCINC) -I../../lib /*** NOTE! *** Every time a .o is added below it needs to be added to diff --git a/cde/lib/tt/lib/util/Imakefile b/cde/lib/tt/lib/util/Imakefile index b1ae307c..bd82fbd7 100644 --- a/cde/lib/tt/lib/util/Imakefile +++ b/cde/lib/tt/lib/util/Imakefile @@ -16,7 +16,7 @@ DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) #include "../../tooltalk.tmpl" DEFINES = -INCLUDES = -I../../lib +INCLUDES = $(TIRPCINC) -I../../lib #ifdef RsArchitecture /* To get definitions of iswprint and iswspace */ diff --git a/cde/lib/tt/mini_isam/Imakefile b/cde/lib/tt/mini_isam/Imakefile index ac159799..a98ab93b 100644 --- a/cde/lib/tt/mini_isam/Imakefile +++ b/cde/lib/tt/mini_isam/Imakefile @@ -12,7 +12,7 @@ XCOMM $XConsortium: Imakefile /main/4 1996/04/21 19:12:37 drk $ #include "../tooltalk.tmpl" DEPEND_DEFINES = $(DEPENDDEFINES) -INCLUDES = -I. +INCLUDES = $(TIRPCINC) -I. SRCS = isaddindex.c isamaddindex.c isopen.c isamopen.c \ isdelcurr.c isdelrec.c isamdelrec.c isbuild.c \ diff --git a/cde/lib/tt/slib/Imakefile b/cde/lib/tt/slib/Imakefile index 887929bb..cd713a2b 100644 --- a/cde/lib/tt/slib/Imakefile +++ b/cde/lib/tt/slib/Imakefile @@ -15,7 +15,7 @@ DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) #include "../tooltalk.tmpl" DEFINES = -INCLUDES = -I. -I../lib +INCLUDES = $(TIRPCINC) -I. -I../lib SRCS = \ mp_ce_attrs.C mp_observer.C mp_observer_utils.C \ diff --git a/cde/lib/tt/tooltalk.tmpl b/cde/lib/tt/tooltalk.tmpl index 9ef0a8aa..830ee6d1 100644 --- a/cde/lib/tt/tooltalk.tmpl +++ b/cde/lib/tt/tooltalk.tmpl @@ -19,6 +19,17 @@ DEPTTLIB_AND_MAYBE_XLIB = $(DEPTTLIB) /* put EXTRA_DEFINES and EXTRA_INCLUDES below */ + +/* For linux with TIRPC, set this so the right bits can/will be used. */ +XCOMM Enable TIRPC for linux hosts with the option enabled +#ifdef LinuxArchitecture +# if HasTIRPCLib +TIRPC_DEFINES = -DOPT_TIRPC +# else +TIRPC_DEFINES = +# endif +#endif + #ifdef SunArchitecture LAST_LOAD_FLAGS = -Bstatic -lC -Bdynamic -lm -lc -Bstatic #endif diff --git a/cde/programs/dtsession/Imakefile b/cde/programs/dtsession/Imakefile index 4718e9da..33278f6e 100644 --- a/cde/programs/dtsession/Imakefile +++ b/cde/programs/dtsession/Imakefile @@ -74,7 +74,8 @@ SYS_LIBRARIES = -lelf -lm -ldl -lgen #if defined(LinuxArchitecture) EXTRA_DEFINES = -D${PROGRAMS} $(XINOPT) -DUSE_X11SSEXT -SYS_LIBRARIES = $(XINLIB) -lXss -ldl -lcrypt -lm +SYS_LIBRARIES = $(XINLIB) $(TIRPCLIB) -lXss -ldl -lcrypt -lm +INCLUDES = $(TIRPCINC) #endif #if defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) -- 2.25.1