Index: Makefile.am
===================================================================
--- Makefile.am	(revision 3d9f4d349acb9c9ec0a1357b321622ded78d166c)
+++ Makefile.am	(revision 191d5e78d2a465e2a7f6ddae43e1448ea7476d09)
@@ -5,23 +5,16 @@
      owl.h owl_perl.h config.h \
      owl.c \
-     libzcrypt.a \
      $(GEN_C) $(GEN_H)
 
-barnowl_bin_LDADD = libfaim/libfaim.a libzcrypt.a
+barnowl_bin_LDADD = libfaim/libfaim.a
 
 tester_SOURCES = $(BASE_SRCS) \
      owl.h owl_perl.h config.h \
-     libzcrypt.a \
      $(GEN_C) $(GEN_H) \
      tester.c
 
-tester_LDADD = libfaim/libfaim.a libzcrypt.a
+tester_LDADD = libfaim/libfaim.a
 
 TESTS=runtests.sh
-
-noinst_LIBRARIES = libzcrypt.a
-
-libzcrypt_a_SOURCES = zcrypt.c
-libzcrypt_a_CFLAGS  = -w
 
 CPPFLAGS = -I$(top_srcdir)/ \
@@ -32,5 +25,5 @@
      perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \
      regex.c history.c view.c dict.c variable.c filterelement.c pair.c \
-     keypress.c keymap.c keybinding.c cmd.c context.c \
+     keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \
      aim.c buddy.c buddylist.c style.c errqueue.c \
      zbuddylist.c popexec.c obarray.c select.c wcwidth.c \
@@ -57,5 +50,5 @@
 	$(AM_V_GEN)perl $< $(filter-out $<,$+) > $@
 
-owl_prototypes.h.new: codelist.pl varstubs.c $(BASE_SRCS) zcrypt.c
+owl_prototypes.h.new: codelist.pl varstubs.c $(BASE_SRCS)
 	$(AM_V_GEN)perl $< $(filter-out $<,$+) > $@
 
Index: commands.c
===================================================================
--- commands.c	(revision 3e96ff08c5b445d58c5bc3fe0abafc871a0df1fd)
+++ commands.c	(revision fea5ddf28e9314ff2fd0484f89ca9d632b811650)
@@ -1987,4 +1987,5 @@
 #else
   owl_function_makemsg("This Owl does not support zcrypt");
+  return NULL;
 #endif
 }
Index: configure.ac
===================================================================
--- configure.ac	(revision d7cc50b9bac64c7e71cb55c8686076c33f1f07dd)
+++ configure.ac	(revision 1c89df8f438c2dfca73a85d27b20fd19383f5039)
@@ -8,39 +8,4 @@
 AC_PROG_CC
 
-dnl Check for Athena
-AC_MSG_CHECKING(for /usr/athena/include)
-if test -d /usr/athena/include; then
-	CFLAGS=${CFLAGS}\ -I/usr/athena/include
-	CPPFLAGS=${CPPFLAGS}\ -I/usr/athena/include
-	AC_MSG_RESULT(yes)
-else
-	AC_MSG_RESULT(no)
-fi
-AC_MSG_CHECKING(for /usr/athena/lib)
-if test -d /usr/athena/lib; then
-	LDFLAGS=${LDFLAGS}\ -L/usr/athena/lib
-	AC_MSG_RESULT(yes)
-else
-	AC_MSG_RESULT(no)
-fi
-
-dnl Check for kerberosIV include
-AC_MSG_CHECKING(for kerberosIV)
-if test -d /usr/include/kerberosIV; then
-        CFLAGS=${CFLAGS}\ -I/usr/include/kerberosIV
-        CPPFLAGS=${CPPFLAGS}\ -I/usr/include/kerberosIV
-        AC_MSG_RESULT(yes)
-elif test -d /usr/local/include/kerberosIV; then
-        CFLAGS=${CFLAGS}\ -I/usr/local/include/kerberosIV
-        CPPFLAGS=${CPPFLAGS}\ -I/usr/local/include/kerberosIV
-        AC_MSG_RESULT(yes)
-elif test -d /usr/include/openssl; then
-        CFLAGS=${CFLAGS}\ -I/usr/include/openssl
-        CPPFLAGS=${CPPFLAGS}\ -I/usr/include/openssl
-        AC_MSG_RESULT(OpenSSL DES found instead)
-else
-        AC_MSG_RESULT(no)
-fi
-
 AC_ARG_WITH([stack-protector],
   [AS_HELP_STRING([--with-stack-protector],
@@ -50,25 +15,15 @@
 
 AS_IF([test "x$with_stack_protector" != xno],
-  [
-    SAVE_CFLAGS=$CFLAGS
-    CFLAGS="$CFLAGS -fstack-protector"
-    AC_MSG_CHECKING(whether protection cflags work)
-    AC_COMPILE_IFELSE(int i;,
-        [AC_MSG_RESULT(yes)],
-        [AC_MSG_RESULT(no)
-        CFLAGS=$SAVE_CFLAGS
-        if test "x$with_stack_protector" != xcheck; then
-          AC_MSG_FAILURE([--with-stack-protector selected, but gcc does support it.])
-        fi])
-    AC_CHECK_LIB(ssp, __stack_chk_guard)
-  ])
+  [AX_C_CHECK_FLAG([-fstack-protector],[],[],
+    [CFLAGS="$CFLAGS -fstack-protector"],
+    [if test "x$with_stack_protector" != xcheck; then
+       AC_MSG_FAILURE([--with-stack-protector selected, but gcc does support it.])
+     fi
+    ])])
 
 AC_CHECK_LIB(ncursesw, initscr,, AC_MSG_ERROR(No libncursesw found.))
-AC_CHECK_LIB(com_err, com_err)
-AC_CHECK_LIB(nsl, gethostbyname)
-AC_CHECK_LIB(socket, socket)
-dnl AC_CHECK_LIB(des425, req_act_vno)
-AC_CHECK_LIB(des425, des_cbc_encrypt,,AC_CHECK_LIB(crypto,DES_cbc_encrypt))
-AC_CHECK_LIB(resolv, res_search)
+AC_SEARCH_LIBS([gethostbyname], [nsl])
+AC_SEARCH_LIBS([socket], [socket])
+AC_SEARCH_LIBS([res_search], [resolv])
 
 AC_ARG_WITH([zephyr],
@@ -79,5 +34,17 @@
 
 AS_IF([test "x$with_zephyr" != xno],
-  [AC_CHECK_LIB([zephyr], [ZGetSender],
+  [AC_MSG_CHECKING([for Kerberos IV])
+   AS_IF([krb5-config krb4 --libs >/dev/null 2>&1],
+     [AC_MSG_RESULT([yes])
+      AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV])
+      CFLAGS="${CFLAGS} `krb5-config krb4 --cflags`"
+      LIBS="${LIBS} `krb5-config krb4 --libs`"
+     ],
+     [AC_MSG_RESULT([no])
+      PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
+      CFLAGS="${CFLAGS} ${LIBCRYPTO_CFLAGS}"
+      LIBS="${LIBS} ${LIBCRYPTO_LIBS}"
+     ])
+   AC_CHECK_LIB([zephyr], [ZGetSender],
    [LIBS="$LIBS -lzephyr"
     AC_DEFINE([HAVE_LIBZEPHYR], [1],
@@ -86,4 +53,6 @@
       AC_DEFINE([HAVE_LIBZEPHYR_ZINITLOCATIONINFO], [1],
                 [Have ZInitLocationInfo]),)
+    AC_CHECK_LIB([com_err], [com_err])
+    AC_CHECK_HEADERS([com_err.h])
    ],
    [if test "x$with_zephyr" != xcheck; then
@@ -93,27 +62,17 @@
    ])])
 
-AC_CHECK_FUNCS(use_default_colors resizeterm des_string_to_key des_key_sched des_ecb_encrypt)
-AC_CHECK_FUNCS(				   DES_string_to_key  DES_ecb_encrypt DES_key_sched)
-
-AC_MSG_CHECKING(for des_ecb_encrypt prototype)
-AC_TRY_COMPILE([#include <des.h>
-int des_ecb_encrypt(char foo[], char bar[], des_key_schedule baz, int qux);],
-[int foo = des_ecb_encrypt(0,0,0,0);],
-ac_cv_des_ecb_encrypt_proto=no,
-ac_cv_des_ecb_encrypt_proto=yes)
-AC_MSG_RESULT($ac_cv_des_ecb_encrypt_proto)
-if test "$ac_cv_des_ecb_encrypt_proto" = yes; then
-	AC_DEFINE([HAVE_DES_ECB_ENCRYPT_PROTO], [], [have proto for des_ecb_encrypt])
-fi
+AC_CHECK_FUNCS([use_default_colors resizeterm])
+AC_CHECK_FUNCS([des_string_to_key des_key_sched des_ecb_encrypt])
+AC_CHECK_FUNCS([DES_string_to_key DES_ecb_encrypt DES_key_sched])
 
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(strings.h sys/ioctl.h sys/filio.h unistd.h com_err.h)
+AC_CHECK_HEADERS(strings.h sys/ioctl.h sys/filio.h unistd.h)
 
 dnl Add CFLAGS for embeded perl
-FOO=`perl -MExtUtils::Embed -e ccopts`
-AC_MSG_NOTICE([Adding perl CFLAGS ${FOO}])
-CFLAGS=${CFLAGS}\ ${FOO}
+PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
+AC_MSG_NOTICE([Adding perl CFLAGS ${PERL_CFLAGS}])
+CFLAGS="${CFLAGS} ${PERL_CFLAGS}"
 
 dnl Find the location of perl XSUBPP
@@ -154,4 +113,11 @@
 dnl Checks for typedefs, structures, and compiler characteristics.
 
+AX_CFLAGS_WARN_ALL
+
+AX_C_CHECK_FLAG([-Wno-pointer-sign],[],[],
+  [LIBFAIM_CFLAGS="$LIBFAIM_CFLAGS -Wno-pointer-sign"])
+
+AC_SUBST([LIBFAIM_CFLAGS])
+
 AC_SUBST(XSUBPPDIR)
 AC_SUBST(XSUBPPFLAGS)
Index: libfaim/Makefile.am
===================================================================
--- libfaim/Makefile.am	(revision ed6248222e25dffa6b616cbeb08cf3b6aaa19f9b)
+++ libfaim/Makefile.am	(revision 215c119ee835ac36d645babc2e3c04da7e9b44a3)
@@ -10,4 +10,5 @@
      aim_cbtypes.h  aim.h  aim_internal.h  faimconfig.h md5.h
 
+libfaim_a_CFLAGS = $(LIBFAIM_CFLAGS)
 libfaim_a_CPPFLAGS = -DAIM_BUILDDATE=\"x\" -DAIM_BUILDTIME=\"x\" \
                      -I${top_srcdir}/libfaim
Index: perlconfig.c
===================================================================
--- perlconfig.c	(revision eea72a13603338942d86c969f95425ae2fc1f9bd)
+++ perlconfig.c	(revision 2693b1267c8595113719e7614fb716b9398d7eb8)
@@ -26,5 +26,5 @@
 {
   SV *ret = newSVpv(str, 0);
-  if(is_utf8_string(str, strlen(str))) {
+  if(is_utf8_string((U8*)str, strlen(str))) {
     SvUTF8_on(ret);
   } else {
Index: zcrypt.c
===================================================================
--- zcrypt.c	(revision 36486be17f6eb6298a9c9b05929fe1b6f31e065b)
+++ zcrypt.c	(revision 3daca1324ca0398ead628003a4011fbdd685226f)
@@ -23,5 +23,10 @@
 #include <unistd.h>
 #include <sys/types.h>
-#include <des.h>
+
+#ifdef HAVE_KERBEROS_IV
+#include <kerberosIV/des.h>
+#else
+#include <openssl/des.h>
+#endif
 
 #define MAX_KEY 128
@@ -51,8 +56,4 @@
 char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);
 
-#ifndef HAVE_DES_ECB_ENCRYPT_PROTO
-int des_ecb_encrypt(char [], char [], des_key_schedule, int);
-#endif
-
 #define M_NONE            0
 #define M_ZEPHYR_ENCRYPT  1
@@ -61,4 +62,15 @@
 #define M_RANDOMIZE       4
 #define M_SETKEY          5
+
+static void owl_zcrypt_string_to_schedule(char *keystring, des_key_schedule schedule) {
+#ifdef HAVE_KERBEROS_IV
+  des_cblock key;
+#else
+  des_cblock _key, *key = &_key;
+#endif
+
+  des_string_to_key(keystring, key);
+  des_key_sched(key, schedule);
+}
 
 /* The 'owl_zcrypt_decrypt' function was written by kretch for Owl.
@@ -73,7 +85,6 @@
   char *fname, keystring[MAX_KEY];
   FILE *fkey;
-  des_cblock key;
   des_key_schedule schedule;
-  char input[8], output[9];
+  unsigned char input[8], output[8];
   int i, c1, c2;
   
@@ -82,5 +93,8 @@
   fkey=fopen(fname, "r");
   if (!fkey) return(-1);
-  fgets(keystring, MAX_KEY-1, fkey);
+  if (!fgets(keystring, MAX_KEY-1, fkey)) {
+    fclose(fkey);
+    return -1;
+  }
   fclose(fkey);
 
@@ -88,8 +102,6 @@
 
   output[0] = '\0';    /* In case no message at all                 */
-  output[8] = '\0';    /* NULL at end will limit string length to 8 */
-
-  des_string_to_key(keystring, key);
-  des_key_sched(key, schedule);
+
+  owl_zcrypt_string_to_schedule(keystring, schedule);
 
   inptr=in;
@@ -102,15 +114,10 @@
       inptr+=2;
     }
-    des_ecb_encrypt(input, output, schedule, FALSE);
-    strcat(out, output);
-  }
-
-  if (output[0]) {
-    if (output[strlen(output)-1] != '\n') {
-      strcat(out, "\n");
-    }
-  } else {
+    des_ecb_encrypt(&input, &output, schedule, FALSE);
+    strncat(out, (const char *)output, 8);
+  }
+
+  if (out[0] && out[strlen(out) - 1] != '\n')
     strcat(out, "\n");
-  }
   return(0);
 }
@@ -119,7 +126,6 @@
   char *fname, keystring[MAX_KEY];
   FILE *fkey;
-  des_cblock key;
   des_key_schedule schedule;
-  char input[8], output[8];
+  unsigned char input[8], output[8];
   int size, length, i;
   const char *inbuff = NULL, *inptr;
@@ -131,9 +137,11 @@
   fkey=fopen(fname, "r");
   if (!fkey) return(-1);
-  fgets(keystring, MAX_KEY-1, fkey);
+  if (!fgets(keystring, MAX_KEY-1, fkey)) {
+    fclose(fkey);
+    return -1;
+  }
   fclose(fkey);
 
-  des_string_to_key(keystring, key);
-  des_key_sched(key, schedule);
+  owl_zcrypt_string_to_schedule(keystring, schedule);
 
   inbuff=in;
@@ -167,5 +175,5 @@
 
     /* Encrypt and output the block */
-    des_ecb_encrypt(input, output, schedule, TRUE);
+    des_ecb_encrypt(&input, &output, schedule, TRUE);
 
     for (i = 0; i < 8; i++) {
@@ -216,5 +224,5 @@
     /* Scan file for a match */
     while (!feof(fsearch)) {
-      fgets(buffer, MAX_BUFF - 3, fsearch);
+      if (!fgets(buffer, MAX_BUFF - 3, fsearch)) break;
       for (i = 0; i < numsearch; i++) {
 	if (strncasecmp(varname[i], buffer, length[i]) == 0) {
@@ -262,5 +270,3 @@
 }
 
-static pid_t zephyrpipe_pid = 0;
-
-#endif
+#endif
