* Merged in IO ERROR's diffs to make Citadel work with HP/UX
authorArt Cancro <ajc@citadel.org>
Thu, 24 Aug 2000 02:48:18 +0000 (02:48 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 24 Aug 2000 02:48:18 +0000 (02:48 +0000)
citadel/ChangeLog
citadel/citserver.c
citadel/configure.in
citadel/domain.h
citadel/dynloader.c
citadel/hpsux.h [new file with mode: 0644]

index de4f01b7953a393566eeb8a29588632953342dc8..6c96407603dc5a281226cd7b34987b01b9ba36b0 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 572.28  2000/08/24 02:48:18  ajc
+ * Merged in IO ERROR's diffs to make Citadel work with HP/UX
+
  Revision 572.27  2000/08/22 02:31:47  ajc
  * nonce (for APOP-style auth) is now generated when a context is created
    instead of during protocol greeting functions.
@@ -1999,3 +2002,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index b0b046332eaf118e612b4bc14493f26ae22a5280..d249e345c7ae227e764e9ab9ce14de83cdb9b156 100644 (file)
@@ -17,7 +17,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <syslog.h>
-#include <dlfcn.h>
+/* #include <dlfcn.h> */
 #include <netdb.h>
 #include <sys/types.h>
 #include <sys/socket.h>
index 8c641749e241a4f30bace5d02099d7e2ca020e5c..dcdf5db66beacdcccca91089c4e167517b40bf4c 100644 (file)
@@ -25,7 +25,7 @@ TARGETS=client
 AC_CANONICAL_HOST
 SO=.so
 PTHREAD_DEFS=-D_REENTRANT
-LINK_SHARED='$(CC) -shared'
+LINK_SHARED='$(CC) -shared -fPIC'
 case "$host" in
        dnl BSDI 3.0 wants relocatable object modules instead of shared libs
        dnl for dlopen(), and has a wrapper script to link with shared libs.
@@ -125,6 +125,9 @@ if test "$ac_cv_func_dlopen" = no; then
                test "$with_pam" = yes && chkpwd_LIBS="-ldl $chkpwd_LIBS"])
 fi
 
+dnl Check for HP/UX dyanmic loader. This should only be in -ldld.
+AC_CHECK_LIB(dld, shl_load, LIBS="-ldld $LIBS")
+
 dnl Determine the system's authentication capabilities, if autologin is
 dnl requested. We currently support PAM, standard getpwnam(), and getspnam()
 dnl (Linux shadow passwords)
@@ -188,7 +191,7 @@ AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 test -f /usr/local/include/gdbm.h && CPPFLAGS="$CPPFLAGS -I/usr/local/include"
-AC_CHECK_HEADERS(curses.h fcntl.h limits.h termios.h strings.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h gdbm.h utmp.h utmpx.h paths.h)
+AC_CHECK_HEADERS(curses.h dl.h dlfcn.h fcntl.h limits.h termios.h strings.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h gdbm.h utmp.h utmpx.h paths.h)
 
 dnl some systems require -pthread, -D_REENTRANT, etc to be passed to cc if we
 dnl include pthread.h:
index 0d9ac9f66074cbe8593708421795eb0057881390..e7091b5db9e251dea09bd96c4ccce3147b95c4e9 100644 (file)
@@ -10,3 +10,16 @@ struct mx {
 
 int get_smarthosts(char *mxbuf);
 int getmx(char *mxbuf, char *dest);
+
+
+/* HP/UX has old include files...these are from arpa/nameser.h */
+
+#ifndef HFIXEDSZ
+#define HFIXEDSZ       12              /* I hope! */
+#endif
+#ifndef INT16SZ
+#define        INT16SZ         sizeof(int16)
+#endif
+#ifndef INT32SZ
+#define INT32SZ                sizeof(int32)
+#endif
index b8be4eb34cbef73f39bd634908fe949fb986b83a..de01715ebfba83ea3f03155c1adff9dc0b6f0ed6 100644 (file)
@@ -9,7 +9,13 @@
 #include "sysdep.h"
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_DLFCN_H
 #include <dlfcn.h>
+#endif
+#ifdef HAVE_DL_H
+#include <dl.h>
+#include "hpsux.h"
+#endif
 #include <sys/types.h>
 #include <dirent.h>
 #include <strings.h>
diff --git a/citadel/hpsux.h b/citadel/hpsux.h
new file mode 100644 (file)
index 0000000..e4ebb5b
--- /dev/null
@@ -0,0 +1,79 @@
+/* $Id$ */
+
+/* This nice file makes Citadel/UX work with HP/UX's dynamic loader. */
+/* It's unusual to put C code in a .h file, but I think it's easier for the
+   moment.  */
+
+#ifndef _CITADEL_UX_HPSUX_H
+#define _CITADEL_UX_HPSUX_H
+
+/* includes */
+#include <errno.h>
+#include <dl.h>
+#include <string.h>
+
+
+/* functions */
+void *dlopen(const char *, int);
+int dlclose(void *);
+const char *dlerror(void);
+void *dlsym(void *, char *);
+
+
+/* #defines mapped */
+
+#define RTLD_LAZY      BIND_DEFERRED
+#define RTLD_NOW       BIND_IMMEDIATE
+#define RTLD_GLOBAL    0       /* This SEEMS to be the default for HP/UX */
+
+
+/* extern variables */
+extern int errno;
+
+
+/* local variables */
+static char *dlerrmsg; /* pointer to last error message */
+
+
+/* functions mapped */
+
+/* dlopen() */
+void *dlopen(const char *filename, int flag)
+{
+       shl_t handle;
+
+       handle = shl_load(filename, flag, 0L);
+       if (handle == NULL)
+               dlerrmsg = strerror(errno);
+       return (void *)handle;
+}
+
+/* dlclose() */
+int dlclose(void *handle)
+{
+       return shl_unload(handle);
+}
+
+/* dlerror() */
+/* I think this is as thread safe as it's going to get */
+const char *dlerror(void)
+{
+       const char *msg;
+
+       msg = dlerrmsg;
+       dlerrmsg = NULL;
+       return msg;
+}
+
+/* dlsym() */
+void *dlsym(void *handle, char *symbol)
+{
+       void *value = NULL;     /* Linux man page says 0 is a valid symbol */
+       /* address.  I don't understand this, of course, but what do I know? */
+
+       if (shl_findsym(handle, symbol, TYPE_UNDEFINED, value) == -1)
+               dlerrmsg = strerror(errno);
+       return value;
+}
+
+#endif /* _CITADEL_UX_HPSUX_H */