[omniORB] GateKeeper and OmniORB

Eric Dumas edumas@tumbleweed.com
Mon, 26 Oct 1998 13:39:40 -0800


	Hi. 

	You will find below a short patch which removes from the
tcpwrapper directory (Gatekeepers) some system and libC calls
redefinition. This is a problem when using omniORB with other
applications that need, for example, the syslog(2) feature.

	This patch (omniORB 2.5.0) remove too the use of sys_errlist,
sys_nerr, t_errlist and t_nerr: Solaris 2.7 will no longer use
them. The patch is working on Solaris 2.6 and should work on others
Unix systems (not tested).

	Regards,

Ps: I am not in the list, so if you have any comment, Cc: me.
--
                        Éric Dumas (dumas@tumbleweed.com)
           Tumbleweed Software, 2010 Broadway, Redwood City, CA 94063, USA
               http://www.tumbleweed.com    Tel: +1 650 569-3619

---- cut here

diff --recursive --new-file -u /tmp/omniORB_2.5.0/src/lib/omniORB2/gatekeepers/dummystub/dir.mk gatekeepers/dummystub/dir.mk 
--- /tmp/omniORB2/gatekeepers/tcpwrapper/dir.mk  Wed Sep 23 19:17:47 1998
+++ gatekeepers/tcpwrapper/dir.mk       Thu Oct 22 17:14:18 1998
@@ -22,14 +22,14 @@
 SRCS = hosts_access.c options.c shell_cmd.c rfc931.c eval.c \
        hosts_ctl.c refuse.c percent_x.c clean_exit.c $(AUX_SRCS) \
        fix_options.c socket.c workarounds.c \
-       update.c misc.c diag.c percent_m.c fakelog2.c
+       update.c misc.c diag.c setenv.c percent_m.c 
 
 CXXSRCS = gatekeeper.cc
 
 OBJS = hosts_access.o options.o shell_cmd.o rfc931.o eval.o \
        hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJS) \
-       fix_options.o socket.o tli.o workarounds.o \
-       update.o misc.o diag.o percent_m.o fakelog2.o
+       fix_options.o socket.o setenv.o tli.o workarounds.o \
+       update.o misc.o diag.o percent_m.o 
 
 CXXOBJS = gatekeeper.o

diff --recursive --new-file -u  /tmp/omniORB_2.5.0/src/lib/omniORB2/gatekeepers/dummystub/percent_m.c gatekeepers/dummystub/percent_m.c
--- /tmp/omniORB2/gatekeepers/tcpwrapper/percent_m.c     Wed Sep 23 19:17:55 1998
+++ gatekeepers/tcpwrapper/percent_m.c  Thu Oct 22 17:14:20 1998
@@ -8,18 +8,10 @@
 static char sccsid[] = "@(#) percent_m.c 1.1 94/12/28 17:42:37";
 #endif
 
-#include <stdio.h>
 #include <errno.h>
+#include <stdio.h>
 #include <string.h>
 
-extern int errno;
-#if !(defined(__GLIBC__) && __GLIBC__ >=2)
-#ifndef SYS_ERRLIST_DEFINED
-extern char *sys_errlist[];
-extern int sys_nerr;
-#endif
-#endif
-
 #include "mystdarg.h"
 
 char   *percent_m(obuf, ibuf)
@@ -31,13 +23,16 @@
 
     while (*bp = *cp)
        if (*cp == '%' && cp[1] == 'm') {
-           if (errno < sys_nerr && errno > 0) {
-               strcpy(bp, sys_errlist[errno]);
-           } else {
-               sprintf(bp, "Unknown error %d", errno);
-           }
-           bp += strlen(bp);
-           cp += 2;
+
+         char *ptr = strerror(errno);
+          if (ptr != NULL) {
+            strcpy(bp, ptr);
+         } else {
+            sprintf(bp, "Unknown error %d", errno);
+         }
+         
+         bp += strlen(bp);
+         cp += 2;
        } else {
            bp++, cp++;
        }
diff --recursive --new-file -u /tmp/omniORB2/gatekeepers/tcpwrapper/sharedlib/dir.mk gatekeepers/tcpwrapper/sharedlib/dir.mk
--- /tmp/omniORB2/gatekeepers/tcpwrapper/sharedlib/dir.mk        Wed Sep 23 19:18:03 1998
+++ gatekeepers/tcpwrapper/sharedlib/dir.mk     Thu Oct 22 17:14:21 1998
@@ -52,15 +52,15 @@
 
 SRCS = hosts_access.c options.c shell_cmd.c rfc931.c eval.c \
        hosts_ctl.c refuse.c percent_x.c clean_exit.c $(AUX_SRCS) \
-       fix_options.c socket.c workarounds.c \
-       update.c misc.c diag.c percent_m.c environ.c fakelog2.c
+       fix_options.c socket.c workarounds.c setenv.c \
+       update.c misc.c diag.c percent_m.c  
 
 CXXSRCS = gatekeeper.cc
 
 OBJS = hosts_access.o options.o shell_cmd.o rfc931.o eval.o \
-       hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJS) \
+       hosts_ctl.o refuse.o percent_x.o clean_exit.o setenv.o $(AUX_OBJS) \
        fix_options.o socket.o workarounds.o \
-       update.o misc.o diag.o percent_m.o environ.o fakelog2.o
+       update.o misc.o diag.o percent_m.o 
 CXXOBJS = gatekeeper.o
 
 DIR_CPPFLAGS += -I.. $(patsubst %,-I%/.,$(VPATH)) \
diff --recursive --new-file -u /tmp/omniORB2/gatekeepers/tcpwrapper/tcpdchk.c gatekeepers/tcpwrapper/tcpdchk.c
--- /tmp/omniORB2/gatekeepers/tcpwrapper/tcpdchk.c       Wed Sep 23 19:18:00 1998
+++ gatekeepers/tcpwrapper/tcpdchk.c    Thu Oct 22 17:14:24 1998
@@ -31,8 +31,6 @@
 #include <netdb.h>
 #include <string.h>
 
-extern int errno;
-extern void exit();
 extern int optind;
 extern char *optarg;
 
diff --recursive --new-file -u /tmp/gatekeepers/tcpwrapper/tli-sequent.c gatekeepers/tcpwrapper/tli-sequent.c
--- /tmp/gatekeepers/tcpwrapper/tli-sequent.c   Wed Sep 23 19:18:01 1998
+++ gatekeepers/tcpwrapper/tli-sequent.c        Thu Oct 22 17:14:24 1998
@@ -29,13 +29,7 @@
 #include <syslog.h>
 #include <errno.h>
 #include <string.h>
-
-extern int errno;
-extern char *sys_errlist[];
-extern int sys_nerr;
-extern int t_errno;
-extern char *t_errlist[];
-extern int t_nerr;
+#include <errno.h>
 
 /* Local stuff. */
 
@@ -150,19 +144,21 @@
     static char buf[40];
 
     if (t_errno != TSYSERR) {
-       if (t_errno < 0 || t_errno >= t_nerr) {
-           sprintf(buf, "Unknown TLI error %d", t_errno);
-           return (buf);
-       } else {
-           return (t_errlist[t_errno]);
-       }
+      char *ptr = t_strerror(t_errno);
+      if (ptr == NULL) {
+       sprintf(buf, "Unknown TLI error %d", t_errno);
+       return buf;
+      } else {
+       return ptr;
+      }
     } else {
-       if (errno < 0 || errno >= sys_nerr) {
-           sprintf(buf, "Unknown UNIX error %d", errno);
-           return (buf);
-       } else {
-           return (sys_errlist[errno]);
-       }
+      char *ptr = strerror(errno);
+      if (ptr == NULL) {
+       sprintf(buf, "Unknown UNIX error %d", errno);
+       return (buf);
+      } else {
+       return ptr;
+      }
     }
 }
 
diff --recursive --new-file -u /tmp/omniORB2/gatekeepers/tcpwrapper/tli.c gatekeepers/tcpwrapper/tli.c
--- /tmp/omniORB_2.5.0/src/lib/omniORB2/gatekeepers/tcpwrapper/tli.c   Wed Sep 23 19:18:02 1998
+++ gatekeepers/tcpwrapper/tli.c        Thu Oct 22 17:14:24 1998
@@ -39,12 +39,6 @@
 #include <string.h>
 
 extern char *nc_sperror();
-extern int errno;
-extern char *sys_errlist[];
-extern int sys_nerr;
-extern int t_errno;
-extern char *t_errlist[];
-extern int t_nerr;
 
 /* Local stuff. */
 
@@ -298,19 +292,21 @@
     static char buf[40];
 
     if (t_errno != TSYSERR) {
-       if (t_errno < 0 || t_errno >= t_nerr) {
-           sprintf(buf, "Unknown TLI error %d", t_errno);
-           return (buf);
-       } else {
-           return (t_errlist[t_errno]);
-       }
+      char *ptr = t_strerror(t_errno);
+      if (ptr == NULL) {
+       sprintf(buf, "Unknown TLI error %d", t_errno);
+       return buf;
+      } else {
+       return ptr;
+      }
     } else {
-       if (errno < 0 || errno >= sys_nerr) {
-           sprintf(buf, "Unknown UNIX error %d", errno);
-           return (buf);
-       } else {
-           return (sys_errlist[errno]);
-       }
+      char *ptr = strerror(errno);
+      if (ptr == NULL) {
+       sprintf(buf, "Unknown UNIX error %d", errno);
+       return buf;
:
+      } else {
+       return ptr;
+      }
     }
 }
 
diff --recursive --new-file -u /tmp/gatekeepers/tcpwrapper/workarounds.c gatekeepers/tcpwrapper/workarounds.c
--- /tmp/gatekeepers/tcpwrapper/workarounds.c   Wed Sep 23 19:18:03 1998
+++ gatekeepers/tcpwrapper/workarounds.c        Thu Oct 22 17:14:24 1998
@@ -22,8 +22,6 @@
 #include <syslog.h>
 #include <string.h>
 
-extern int errno;
-
 #include "tcpd.h"
 
  /*