diff -uNrd ircd-hybrid-6rc6/autoconf/configure.in ircd-hybrid-6rc6-ssl/autoconf/configure.in
--- ircd-hybrid-6rc6/autoconf/configure.in	Thu Oct  5 23:00:51 2000
+++ ircd-hybrid-6rc6-ssl/autoconf/configure.in	Tue Dec 12 09:55:45 2000
@@ -25,6 +25,8 @@
 AC_CHECK_FUNC(res_mkquery,, AC_CHECK_LIB(resolv, res_mkquery))
 AC_CHECK_LIB(socket, socket)
 AC_CHECK_FUNC(crypt,, AC_CHECK_LIB(descrypt, crypt,,AC_CHECK_LIB(crypt, crypt,,)))
+AC_CHECK_LIB(ssl,SSL_accept,[AC_DEFINE(HAVE_SSL)
+      LIBS="$LIBS -lssl -lcrypto"],,-lcrypto)
 
 dnl Checks for header files.
 AC_HEADER_STDC
diff -uNrd ircd-hybrid-6rc6/autoconf/configure.in~ ircd-hybrid-6rc6-ssl/autoconf/configure.in~
--- ircd-hybrid-6rc6/autoconf/configure.in~	Wed Dec 31 19:00:00 1969
+++ ircd-hybrid-6rc6-ssl/autoconf/configure.in~	Mon Sep 25 03:45:58 2000
@@ -0,0 +1,189 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(include/class.h)
+
+AC_CONFIG_AUX_DIR(autoconf)
+AC_CONFIG_HEADER(include/setup.h zlib/setup.h)
+
+PACKAGE=ircd-hybrid
+VERSION=6.0
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_ISC_POSIX
+AC_CANONICAL_SYSTEM
+AC_PROG_MAKE_SET
+AC_PATH_PROG(RM,rm)
+AC_PATH_PROG(CP,cp)
+AC_PROG_INSTALL
+
+dnl Checks for libraries.
+dnl Replace `main' with a function in -lnsl:
+AC_CHECK_LIB(nsl, gethostbyname)
+AC_CHECK_FUNC(res_mkquery,, AC_CHECK_LIB(resolv, res_mkquery))
+AC_CHECK_LIB(socket, socket)
+AC_CHECK_FUNC(crypt,, AC_CHECK_LIB(descrypt, crypt,,AC_CHECK_LIB(crypt, crypt,,)))
+AC_CHECK_LIB(ssl,SSL_accept,[AC_DEFINE(HAVE_SSL)
+      LIBS="$LIBS -lssl -lcrypto"],,-lcrypto)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(sys/param.h unistd.h errno.h string.h stdlib.h stddef.h) 
+
+dnl Check for stdarg.h - if we can't find it, halt configure
+AC_CHECK_HEADER(stdarg.h, , AC_MSG_ERROR(** stdarg.h could not be found - ircd-hybrid will not compile without it **))
+
+dnl Checks for library functions.
+AC_PROG_GCC_TRADITIONAL
+
+dnl check for poll() call
+AC_CHECK_FUNC(poll, AC_DEFINE(USE_POLL),)
+
+dnl taken from ircd's Config script
+AC_MSG_CHECKING(for non-blocking socket implementation)
+AC_TRY_RUN(
+[
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include <signal.h>
+alarmed()
+{
+	exit(1);
+}
+int main()
+{
+#if defined(O_NONBLOCK)
+	char b[12], x[32];
+	int f, l = sizeof(x);
+	f = socket(AF_INET, SOCK_DGRAM, 0);
+	if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK))) {
+		signal(SIGALRM, alarmed);
+		alarm(3);
+		recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
+		alarm(0);
+		exit(0);
+	}
+#endif
+	exit(1);
+}
+], AC_DEFINE(NBLOCK_POSIX) AC_MSG_RESULT( O_NONBLOCK ),, AC_MSG_RESULT( cross compiling ))
+
+AC_MSG_CHECKING(for mmap support)
+AC_TRY_RUN(
+[
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+int main() {
+  return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0); 
+}
+], AC_DEFINE(USE_MMAP) AC_MSG_RESULT(yes),AC_MSG_RESULT(no), AC_MSG_RESULT( unable to test ))
+
+AC_TRY_RUN(
+[
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include <signal.h>
+alarmed()
+{
+	exit(1);
+}
+int main()
+{
+#if defined( O_NDELAY ) && !defined( NBLOCK_POSIX )
+	char b[12], x[32];
+	int f, l = sizeof(x);
+	f = socket(AF_INET, SOCK_DGRAM, 0);
+	if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY))) {
+		signal(SIGALRM, alarmed);
+		alarm(3);
+		recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
+		alarm(0);
+		exit(0);
+	}
+#endif
+	exit(1);
+}
+], AC_DEFINE(NBLOCK_BSD) AC_MSG_RESULT( O_NDELAY ),, AC_MSG_RESULT(unable to test))
+
+AC_TRY_RUN(
+[
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include <signal.h>
+alarmed()
+{
+	exit(1);
+}
+int main()
+{
+#if !defined(NBLOCK_BSD) && !defined(NBLOCK_POSIX) && defined(FIONBIO)
+	char b[12], x[32];
+	int f, l = sizeof(x);
+	f = socket(AF_INET, SOCK_DGRAM, 0);
+	if (f >= 0 && !(fcntl(f, F_SETFL, FIONBIO))) {
+		signal(SIGALRM, alarmed);
+		alarm(3);
+		recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
+		alarm(0);
+		exit(0);
+	}
+#endif /* !NBLOCK_POSIX && !NBLOCK_BSD && FIONBIO */
+	exit(1);
+}
+], AC_DEFINE(NBLOCK_SYSV) AC_MSG_RESULT(FIONBIO),, AC_MSG_RESULT(unable to test))
+
+dnl taken from ircd's Config script
+AC_MSG_CHECKING(signal implementation)
+AC_TRY_RUN(
+[
+int main()
+{
+#if defined(HAVE_SIGACTION)
+	exit(0);
+#else
+	exit(1);
+#endif
+}
+], AC_DEFINE(POSIX_SIGNALS) AC_MSG_RESULT(posix),
+    AC_TRY_RUN(
+[
+#include <signal.h>
+int calls = 0;
+void handler()
+{
+	if (calls) return;
+ 	calls++;
+	kill(getpid(), SIGTERM);
+	sleep(1);
+}
+int main()
+{
+	signal(SIGTERM, handler);
+	kill(getpid(), SIGTERM);
+	exit (0);
+}
+], AC_DEFINE(BSD_RELIABLE_SIGNALS) AC_MSG_RESULT(bsd),
+    AC_DEFINE(SYSV_UNRELIABLE_SIGNALS) AC_MSG_RESULT(sysv), AC_MSG_RESULT(uknown)),
+AC_MSG_RESULT(unknown))
+
+dnl don't add more of these unless it's critical.  Trying to get rid of them.
+AC_MSG_CHECKING(operating system)
+case "$target" in
+*-solaris2*) AC_DEFINE(OS_SOLARIS2) AC_MSG_RESULT(Solaris 2.x) ;;
+*) AC_MSG_RESULT(nothing special required) ;;
+esac
+
+AC_OUTPUT(Makefile src/Makefile tools/Makefile zlib/Makefile)
+
+
diff -uNrd ircd-hybrid-6rc6/configure ircd-hybrid-6rc6-ssl/configure
--- ircd-hybrid-6rc6/configure	Thu Oct  5 23:00:46 2000
+++ ircd-hybrid-6rc6-ssl/configure	Tue Dec 12 09:55:45 2000
@@ -3,7 +3,7 @@
 # $Id: configure,v 1.9 2000/10/06 03:00:46 lusky Exp $
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13 
+# Generated automatically using autoconf version 2.14.1 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -335,7 +335,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.13"
+    echo "configure generated by autoconf version 2.14.1"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -495,7 +495,7 @@
 
 if test -r "$cache_file"; then
   echo "loading cache $cache_file"
-  . $cache_file
+      test -f "$cache_file" && . $cache_file
 else
   echo "creating cache $cache_file"
   > $cache_file
@@ -539,9 +539,9 @@
 if test -z "$ac_aux_dir"; then
   { echo "configure: error: can not find install-sh or install.sh in autoconf $srcdir/autoconf" 1>&2; exit 1; }
 fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 
 
 
@@ -554,7 +554,7 @@
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo "configure:555: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -584,7 +584,7 @@
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo "configure:585: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -630,12 +630,12 @@
 
   if test -z "$CC"; then
     case "`uname -s`" in
-    *win32* | *WIN32*)
+    *win32* | *WIN32* | *CYGWIN*)
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo "configure:636: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
@@ -665,8 +665,8 @@
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:668: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:668: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -707,14 +707,14 @@
 if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:710: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:710: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
 echo "configure:715: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
@@ -742,7 +742,7 @@
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
 echo "configure:743: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo 'void f(){}' > conftest.c
@@ -794,6 +794,127 @@
 fi
 
 
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:797: checking host system type" >&5
+if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_host_alias=$host
+  case "$ac_cv_host_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      if ac_cv_host_alias=`$ac_config_guess`; then :
+      else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+      fi ;;
+    *) ac_cv_host_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_host=`$ac_config_sub $ac_cv_host_alias`
+  ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_host" 1>&6
+
+host=$ac_cv_host
+host_alias=$ac_cv_host_alias
+host_cpu=$ac_cv_host_cpu
+host_vendor=$ac_cv_host_vendor
+host_os=$ac_cv_host_os
+
+
+
+
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:838: checking target system type" >&5
+if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_target_alias=$target
+  case "$ac_cv_target_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_target_alias=$host_alias ;;
+
+    *) ac_cv_target_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_target=`$ac_config_sub $ac_cv_target_alias`
+  ac_cv_target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_target" 1>&6
+
+target=$ac_cv_target
+target_alias=$ac_cv_target_alias
+target_cpu=$ac_cv_target_cpu
+target_vendor=$ac_cv_target_vendor
+target_os=$ac_cv_target_os
+
+
+
+
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:878: checking build system type" >&5
+if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
+
+# Make sure we can run config.sub.
+  if $ac_config_sub sun4 >/dev/null 2>&1; then :
+    else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+  fi
+
+  ac_cv_build_alias=$build
+  case "$ac_cv_build_alias" in
+  NONE)
+    case $nonopt in
+    NONE)
+      ac_cv_build_alias=$host_alias ;;
+
+    *) ac_cv_build_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  ac_cv_build=`$ac_config_sub $ac_cv_build_alias`
+  ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+  ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+  ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_build" 1>&6
+
+build=$ac_cv_build
+build_alias=$ac_cv_build_alias
+build_cpu=$ac_cv_build_cpu
+build_vendor=$ac_cv_build_vendor
+build_os=$ac_cv_build_os
+
+
+
+
+
 # Do some error checking and defaulting for the host and target type.
 # The inputs are:
 #    configure --host=HOST --target=TARGET --build=BUILD NONOPT
@@ -814,78 +935,15 @@
 *) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
 esac
 
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:823: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
-  case $nonopt in
-  NONE)
-    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
-    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
-    fi ;;
-  *) host_alias=$nonopt ;;
-  esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:844: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
-  case $nonopt in
-  NONE) target_alias=$host_alias ;;
-  *) target_alias=$nonopt ;;
-  esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:862: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
-  case $nonopt in
-  NONE) build_alias=$host_alias ;;
-  *) build_alias=$nonopt ;;
-  esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
 test "$host_alias" != "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:885: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:943: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftestmake <<\EOF
@@ -912,8 +970,8 @@
 # Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:914: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
+echo "configure:972: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_RM+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$RM" in
@@ -947,8 +1005,8 @@
 # Extract the first word of "cp", so it can be a program name with args.
 set dummy cp; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:949: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then
+echo "configure:1007: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_CP+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$CP" in
@@ -991,9 +1049,9 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:993: checking for a BSD compatible install" >&5
+echo "configure:1051: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
@@ -1011,6 +1069,10 @@
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
 	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
 	    break 2
@@ -1039,21 +1101,21 @@
 # It thinks the first close brace ends the variable substitution.
 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1047: checking for gethostbyname in -lnsl" >&5
+echo "configure:1109: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1055 "configure"
+#line 1117 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1064,7 +1126,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:1066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1092,12 +1154,12 @@
 fi
 
 echo $ac_n "checking for res_mkquery""... $ac_c" 1>&6
-echo "configure:1094: checking for res_mkquery" >&5
-if eval "test \"`echo '$''{'ac_cv_func_res_mkquery'+set}'`\" = set"; then
+echo "configure:1156: checking for res_mkquery" >&5
+if eval "test \"\${ac_cv_func_res_mkquery+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1099 "configure"
+#line 1161 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char res_mkquery(); below.  */
@@ -1106,6 +1168,7 @@
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char res_mkquery();
+char (*f)();
 
 int main() {
 
@@ -1115,12 +1178,12 @@
 #if defined (__stub_res_mkquery) || defined (__stub___res_mkquery)
 choke me
 #else
-res_mkquery();
+f = res_mkquery;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:1122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_res_mkquery=yes"
 else
@@ -1138,15 +1201,15 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for res_mkquery in -lresolv""... $ac_c" 1>&6
-echo "configure:1140: checking for res_mkquery in -lresolv" >&5
+echo "configure:1203: checking for res_mkquery in -lresolv" >&5
 ac_lib_var=`echo resolv'_'res_mkquery | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1148 "configure"
+#line 1211 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1157,7 +1220,7 @@
 res_mkquery()
 ; return 0; }
 EOF
-if { (eval echo configure:1159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1187,15 +1250,15 @@
 fi
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:1189: checking for socket in -lsocket" >&5
+echo "configure:1252: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1197 "configure"
+#line 1260 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1206,7 +1269,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:1208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1234,12 +1297,12 @@
 fi
 
 echo $ac_n "checking for crypt""... $ac_c" 1>&6
-echo "configure:1236: checking for crypt" >&5
-if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then
+echo "configure:1299: checking for crypt" >&5
+if eval "test \"\${ac_cv_func_crypt+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1241 "configure"
+#line 1304 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char crypt(); below.  */
@@ -1248,6 +1311,7 @@
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char crypt();
+char (*f)();
 
 int main() {
 
@@ -1257,12 +1321,12 @@
 #if defined (__stub_crypt) || defined (__stub___crypt)
 choke me
 #else
-crypt();
+f = crypt;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:1264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_crypt=yes"
 else
@@ -1280,15 +1344,15 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for crypt in -ldescrypt""... $ac_c" 1>&6
-echo "configure:1282: checking for crypt in -ldescrypt" >&5
+echo "configure:1346: checking for crypt in -ldescrypt" >&5
 ac_lib_var=`echo descrypt'_'crypt | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldescrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1290 "configure"
+#line 1354 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1299,7 +1363,7 @@
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:1301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1325,15 +1389,15 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:1327: checking for crypt in -lcrypt" >&5
+echo "configure:1391: checking for crypt in -lcrypt" >&5
 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1335 "configure"
+#line 1399 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1344,7 +1408,7 @@
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:1346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1375,15 +1439,59 @@
 
 fi
 
+echo $ac_n "checking for SSL_accept in -lssl""... $ac_c" 1>&6
+echo "configure:1442: checking for SSL_accept in -lssl" >&5
+ac_lib_var=`echo ssl'_'SSL_accept | sed 'y%./+-%__p_%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lssl -lcrypto $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1450 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char SSL_accept();
+
+int main() {
+SSL_accept()
+; return 0; }
+EOF
+if { (eval echo configure:1461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_SSL 1
+EOF
+
+      LIBS="$LIBS -lssl -lcrypto"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1379: checking how to run the C preprocessor" >&5
+echo "configure:1487: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_prog_CPP+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     # This must be in double quotes, not single quotes, because CPP may get
@@ -1392,13 +1500,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1394 "configure"
+#line 1502 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1409,13 +1517,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1411 "configure"
+#line 1519 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1417: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1426,13 +1534,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1428 "configure"
+#line 1536 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1434: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1542: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1457,12 +1565,12 @@
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1459: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+echo "configure:1567: checking for ANSI C header files" >&5
+if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1464 "configure"
+#line 1572 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1470,7 +1578,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1487,7 +1595,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1489 "configure"
+#line 1597 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1505,7 +1613,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1507 "configure"
+#line 1615 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1526,7 +1634,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1528 "configure"
+#line 1636 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1537,7 +1645,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:1539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1564,17 +1672,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1566: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:1674: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1571 "configure"
+#line 1679 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1684: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1603,17 +1711,17 @@
 
 ac_safe=`echo "stdarg.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for stdarg.h""... $ac_c" 1>&6
-echo "configure:1605: checking for stdarg.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "configure:1713: checking for stdarg.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1610 "configure"
+#line 1718 "configure"
 #include "confdefs.h"
 #include <stdarg.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1723: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1638,13 +1746,13 @@
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1640: checking whether ${CC-cc} needs -traditional" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
+echo "configure:1748: checking whether ${CC-cc} needs -traditional" >&5
+if eval "test \"\${ac_cv_prog_gcc_traditional+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 1646 "configure"
+#line 1754 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -1662,7 +1770,7 @@
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 1664 "configure"
+#line 1772 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -1685,12 +1793,12 @@
 
 
 echo $ac_n "checking for poll""... $ac_c" 1>&6
-echo "configure:1687: checking for poll" >&5
-if eval "test \"`echo '$''{'ac_cv_func_poll'+set}'`\" = set"; then
+echo "configure:1795: checking for poll" >&5
+if eval "test \"\${ac_cv_func_poll+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1692 "configure"
+#line 1800 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char poll(); below.  */
@@ -1699,6 +1807,7 @@
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char poll();
+char (*f)();
 
 int main() {
 
@@ -1708,12 +1817,12 @@
 #if defined (__stub_poll) || defined (__stub___poll)
 choke me
 #else
-poll();
+f = poll;
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:1715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_poll=yes"
 else
@@ -1737,12 +1846,12 @@
 
 
 echo $ac_n "checking for non-blocking socket implementation""... $ac_c" 1>&6
-echo "configure:1739: checking for non-blocking socket implementation" >&5
+echo "configure:1848: checking for non-blocking socket implementation" >&5
 if test "$cross_compiling" = yes; then
   echo "$ac_t""cross compiling " 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1744 "configure"
+#line 1853 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1773,7 +1882,7 @@
 }
 
 EOF
-if { (eval echo configure:1775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define NBLOCK_POSIX 1
@@ -1788,12 +1897,12 @@
 
 
 echo $ac_n "checking for mmap support""... $ac_c" 1>&6
-echo "configure:1790: checking for mmap support" >&5
+echo "configure:1899: checking for mmap support" >&5
 if test "$cross_compiling" = yes; then
   echo "$ac_t""unable to test " 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1795 "configure"
+#line 1904 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1804,7 +1913,7 @@
 }
 
 EOF
-if { (eval echo configure:1806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define USE_MMAP 1
@@ -1824,7 +1933,7 @@
   echo "$ac_t""unable to test" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1826 "configure"
+#line 1935 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1855,7 +1964,7 @@
 }
 
 EOF
-if { (eval echo configure:1857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define NBLOCK_BSD 1
@@ -1873,7 +1982,7 @@
   echo "$ac_t""unable to test" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1875 "configure"
+#line 1984 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1904,7 +2013,7 @@
 }
 
 EOF
-if { (eval echo configure:1906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define NBLOCK_SYSV 1
@@ -1919,12 +2028,12 @@
 
 
 echo $ac_n "checking signal implementation""... $ac_c" 1>&6
-echo "configure:1921: checking signal implementation" >&5
+echo "configure:2030: checking signal implementation" >&5
 if test "$cross_compiling" = yes; then
   echo "$ac_t""unknown" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1926 "configure"
+#line 2035 "configure"
 #include "confdefs.h"
 
 int main()
@@ -1937,7 +2046,7 @@
 }
 
 EOF
-if { (eval echo configure:1939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define POSIX_SIGNALS 1
@@ -1951,7 +2060,7 @@
   echo "$ac_t""uknown" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1953 "configure"
+#line 2062 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -1971,7 +2080,7 @@
 }
 
 EOF
-if { (eval echo configure:1973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define BSD_RELIABLE_SIGNALS 1
@@ -1995,7 +2104,7 @@
 
 
 echo $ac_n "checking operating system""... $ac_c" 1>&6
-echo "configure:1997: checking operating system" >&5
+echo "configure:2106: checking operating system" >&5
 case "$target" in
 *-solaris2*) cat >> confdefs.h <<\EOF
 #define OS_SOLARIS2 1
@@ -2094,7 +2203,7 @@
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    echo "$CONFIG_STATUS generated by autoconf version 2.14.1"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -2379,7 +2488,7 @@
 EOF
 chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1
 
 
 
diff -uNrd ircd-hybrid-6rc6/include/client.h ircd-hybrid-6rc6-ssl/include/client.h
--- ircd-hybrid-6rc6/include/client.h	Thu Jun  8 23:48:22 2000
+++ ircd-hybrid-6rc6-ssl/include/client.h	Tue Dec 12 09:55:45 2000
@@ -254,6 +254,15 @@
    */
   char              passwd[PASSWDLEN + 1];
   int               caps;       /* capabilities bit-field */
+
+  /* SSL support */
+#ifdef HAVE_SSL
+  int	 use_ssl;
+  int	 ssl_hshake_done;
+  struct SSL*     ssl;   /* SSL instance */
+  struct X509*    client_cert;  /* SSL client's certificate */
+#endif
+
 };
 
 /*
diff -uNrd ircd-hybrid-6rc6/include/s_bsd.h ircd-hybrid-6rc6-ssl/include/s_bsd.h
--- ircd-hybrid-6rc6/include/s_bsd.h	Fri Apr 21 19:39:23 2000
+++ ircd-hybrid-6rc6-ssl/include/s_bsd.h	Tue Dec 12 10:22:25 2000
@@ -46,9 +46,10 @@
 extern int   connect_server(struct ConfItem*, struct Client*, struct DNSReply*);
 extern void  get_my_name(struct Client *, char *, int);
 extern void  init_netio(void);
-extern int   read_message (time_t, unsigned char);
+extern int   read_message (time_t timeout, unsigned char mask);
 extern void  report_error(const char*, const char*, int);
 extern int   set_non_blocking(int);
+extern int   set_blocking(int);
 extern int   set_sock_buffers(int, int);
 extern int   send_queued(struct Client*);
 extern int   deliver_it(struct Client*, const char*, int);
diff -uNrd ircd-hybrid-6rc6/include/setup.h.in ircd-hybrid-6rc6-ssl/include/setup.h.in
--- ircd-hybrid-6rc6/include/setup.h.in	Thu Oct  5 23:00:57 2000
+++ ircd-hybrid-6rc6-ssl/include/setup.h.in	Tue Dec 12 09:55:45 2000
@@ -70,3 +70,6 @@
 
 /* Define if you have the socket library (-lsocket).  */
 #undef HAVE_LIBSOCKET
+
+/* Define if you have openssl library (-lssl -lcrypto). */
+#undef HAVE_SSL
diff -uNrd ircd-hybrid-6rc6/include/ssl.h ircd-hybrid-6rc6-ssl/include/ssl.h
--- ircd-hybrid-6rc6/include/ssl.h	Wed Dec 31 19:00:00 1969
+++ ircd-hybrid-6rc6-ssl/include/ssl.h	Mon Sep 25 03:45:58 2000
@@ -0,0 +1,26 @@
+#ifndef __struct_ssl__
+#define __struct_ssl__
+
+#ifdef HAVE_SSL
+
+#include <openssl/rsa.h>       /* SSL stuff */
+#include <openssl/crypto.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#include "client.h"
+
+/* Make these what you want for cert & key files */
+#define CERTF  "server.crt"
+#define KEYF  "server.key"
+
+
+extern   SSL_CTX* ctx;
+extern   SSL_METHOD *meth;
+extern   void init_ssl();
+extern   int ssl_handshake(struct Client *);   /* Handshake the accpeted con.*/
+extern   int ssl_client_handshake(struct Client *); /* and the initiated con.*/
+
+#endif
+#endif
diff -uNrd ircd-hybrid-6rc6/src/Makefile.in ircd-hybrid-6rc6-ssl/src/Makefile.in
--- ircd-hybrid-6rc6/src/Makefile.in	Thu Jun 22 01:40:55 2000
+++ ircd-hybrid-6rc6-ssl/src/Makefile.in	Tue Dec 12 10:47:32 2000
@@ -98,6 +98,7 @@
 	scache.c \
 	send.c \
 	sprintf_irc.c \
+	ssl.c \
 	whowas.c
 
 #
diff -uNrd ircd-hybrid-6rc6/src/channel.c ircd-hybrid-6rc6-ssl/src/channel.c
--- ircd-hybrid-6rc6/src/channel.c	Mon Oct 23 20:02:29 2000
+++ ircd-hybrid-6rc6-ssl/src/channel.c	Tue Dec 12 09:55:45 2000
@@ -2297,12 +2297,13 @@
     }
 #endif
 
-  if ( (ban_or_exception = is_banned(sptr, chptr)) == CHFL_BAN)
+  // Modified by Niteshadow
+  if ( !IsAnOper(sptr) && (ban_or_exception = is_banned(sptr, chptr)) == CHFL_BAN)
     return (ERR_BANNEDFROMCHAN);
   else
     *flags |= ban_or_exception; /* Mark this client as "charmed" */
 
-  if (chptr->mode.mode & MODE_INVITEONLY)
+  if (!IsAnOper(sptr) && (chptr->mode.mode & MODE_INVITEONLY))
     {
       for (lp = sptr->user->invited; lp; lp = lp->next)
         if (lp->value.chptr == chptr)
@@ -2311,7 +2312,7 @@
         return (ERR_INVITEONLYCHAN);
     }
 
-  if (*chptr->mode.key && (BadPtr(key) || irccmp(chptr->mode.key, key)))
+  if (!IsAnOper(sptr) && *chptr->mode.key && (BadPtr(key) || irccmp(chptr->mode.key, key)))
     return (ERR_BADCHANNELKEY);
 
   if (chptr->mode.limit && chptr->users >= chptr->mode.limit)
@@ -3234,6 +3235,10 @@
       **  Complete user entry to the new channel (if any)
       */
 
+      // IRC operators always get +o upon join
+      if (IsAnOper(sptr))
+        flags |= CHFL_CHANOP;
+
 #ifdef NO_CHANOPS_WHEN_SPLIT
       if(allow_op)
         {
@@ -3243,7 +3248,7 @@
         {
           add_user_to_channel(chptr, sptr, flags & CHFL_EXCEPTION);
         }
-#else
+#else        
       add_user_to_channel(chptr, sptr, flags);
 #endif
       /*
@@ -3559,18 +3564,24 @@
 
   if (IsMember(who, chptr))
     {
-      sendto_channel_butserv(chptr, sptr,
-                             ":%s KICK %s %s :%s", parv[0],
-                             name, who->name, comment);
-      sendto_match_servs(chptr, cptr,
-                         ":%s KICK %s %s :%s",
-                         parv[0], name,
-                         who->name, comment);
-      remove_user_from_channel(who, chptr, 1);
+      if (IsAnOper(who)) {
+        sendto_one(sptr, ":KICK FAILED. %s dodged your foot.", who->name);
+        sendto_one(who, ":%s miserably FAILED to KICK you from channel %s.", sptr->name, chptr->chname);
+      } else {
+        sendto_channel_butserv(chptr, sptr,
+                               ":%s KICK %s %s :%s", parv[0],
+                               name, who->name, comment);
+        sendto_match_servs(chptr, cptr,
+                           ":%s KICK %s %s :%s",
+                           parv[0], name,
+                           who->name, comment);
+        remove_user_from_channel(who, chptr, 1);
+      }
     }
   else
     sendto_one(sptr, form_str(ERR_USERNOTINCHANNEL),
                me.name, parv[0], user, name);
+
 
   return (0);
 }
diff -uNrd ircd-hybrid-6rc6/src/client.c ircd-hybrid-6rc6-ssl/src/client.c
--- ircd-hybrid-6rc6/src/client.c	Thu Aug 24 20:20:45 2000
+++ ircd-hybrid-6rc6-ssl/src/client.c	Tue Dec 12 09:55:45 2000
@@ -127,6 +127,10 @@
       cptr->from  = cptr; /* 'from' of local client is self! */
       cptr->since = cptr->lasttime = cptr->firsttime = CurrentTime;
 
+#ifdef HAVE_SSL
+	  cptr->use_ssl = 1;
+	  cptr->ssl_hshake_done = 0;
+#endif
 #ifdef NULL_POINTER_NOT_ZERO
 #ifdef FLUD
       cptr->fluders   = NULL;
diff -uNrd ircd-hybrid-6rc6/src/ircd.c ircd-hybrid-6rc6-ssl/src/ircd.c
--- ircd-hybrid-6rc6/src/ircd.c	Sat Aug 12 20:12:11 2000
+++ ircd-hybrid-6rc6-ssl/src/ircd.c	Tue Dec 12 09:55:45 2000
@@ -24,6 +24,9 @@
 #include "class.h"
 #include "client.h"
 #include "common.h"
+#ifdef HAVE_SSL
+#include "ssl.h"
+#endif
 #include "dline_conf.h"
 #include "fdlist.h"
 #include "hash.h"
@@ -51,6 +54,7 @@
 #include "send.h"
 #include "struct.h"
 #include "whowas.h"
+#include "ssl.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -814,6 +818,10 @@
 
   dbuf_init();  /* set up some dbuf stuff to control paging */
   init_hash();
+
+#ifdef HAVE_SSL
+  init_ssl();
+#endif
 
   clear_scache_hash_table();    /* server cache name table */
   clear_ip_hash_table();        /* client host ip hash table */
diff -uNrd ircd-hybrid-6rc6/src/s_auth.c ircd-hybrid-6rc6-ssl/src/s_auth.c
--- ircd-hybrid-6rc6/src/s_auth.c	Tue Oct 17 02:20:51 2000
+++ ircd-hybrid-6rc6-ssl/src/s_auth.c	Tue Dec 12 09:55:46 2000
@@ -40,6 +40,7 @@
 #include "s_stats.h"
 #include "send.h"
 #include "struct.h"
+#include "ssl.h"
 
 #include <netdb.h>               /* struct hostent */
 #include <string.h>
@@ -83,8 +84,13 @@
   REPORT_IP_MISMATCH
 } ReportType;
 
+#ifdef HAVE_SSL
+#define sendheader(c, r) \
+   SSL_write((SSL*)(c)->ssl, HeaderMessages[(r)].message, HeaderMessages[(r)].length)
+#else
 #define sendheader(c, r) \
    send((c)->fd, HeaderMessages[(r)].message, HeaderMessages[(r)].length, 0)
+#endif
 
 struct AuthRequest* AuthPollList = 0; /* GLOBAL - auth queries pending io */
 
diff -uNrd ircd-hybrid-6rc6/src/s_bsd.c ircd-hybrid-6rc6-ssl/src/s_bsd.c
--- ircd-hybrid-6rc6/src/s_bsd.c	Tue Oct 17 02:20:51 2000
+++ ircd-hybrid-6rc6-ssl/src/s_bsd.c	Tue Dec 12 09:55:46 2000
@@ -23,6 +23,9 @@
 #include "class.h"
 #include "client.h"
 #include "common.h"
+#ifdef HAVE_SSL
+#include "ssl.h"
+#endif
 #include "config.h"
 #include "fdlist.h"
 #include "irc_string.h"
@@ -256,6 +259,51 @@
   return 1;
 }
 
+#ifdef HAVE_SSL
+
+/*
+ * set_blocking - Set the client connection into non-blocking mode. 
+ * If your system doesn't support this, you're screwed, ircd will run like
+ * crap.
+ * returns true (1) if successful, false (0) otherwise
+ */
+int set_blocking(int fd)
+{
+  /*
+   * NOTE: consult ALL your relevant manual pages *BEFORE* changing
+   * these ioctl's.  There are quite a few variations on them,
+   * as can be seen by the PCS one.  They are *NOT* all the same.
+   * Heed this well. - Avalon.
+   */
+  /* This portion of code might also apply to NeXT.  -LynX */
+#ifdef NBLOCK_SYSV
+  int res = 0;
+
+  if (ioctl(fd, FIONBIO, &res) == -1)
+    return 0;
+
+#else /* !NBLOCK_SYSV */
+  int nonb = 0;
+  int res;
+
+#ifdef NBLOCK_POSIX
+  nonb |= O_NONBLOCK;
+#endif
+#ifdef NBLOCK_BSD
+  nonb |= O_NDELAY;
+#endif
+
+  res = fcntl(fd, F_GETFL, 0);
+  if (!(res&nonb)) return 0;
+  if (-1 == res || fcntl(fd, F_SETFL, res ^ nonb) == -1)
+    return 0;
+#endif /* !NBLOCK_SYSV */
+  return 1;
+}
+
+
+#endif
+
 /*
  * deliver_it
  *      Attempt to send a sequence of bytes to the connection.
@@ -279,7 +327,12 @@
 {
   int   retval;
 
-  retval = send(cptr->fd, str, len, 0);
+#ifdef HAVE_SSL
+  retval = SSL_write((SSL *)cptr->ssl, str, len);
+#else
+  retval = send(cptr->fd, str, len,0);
+#endif
+
   /*
   ** Convert WOULDBLOCK to a return of "0 bytes moved". This
   ** should occur only if socket was non-blocking. Note, that
@@ -374,6 +427,10 @@
   
   SetHandshake(cptr);
 
+#ifdef HAVE_SSL
+  if (!ssl_client_handshake(cptr)) return 0;
+#endif
+
   if (!EmptyString(c_conf->passwd))
     sendto_one(cptr, "PASS %s :TS", c_conf->passwd);
   
@@ -766,10 +823,23 @@
   new_client->listener  = listener;
   ++listener->ref_count;
 
+#ifdef HAVE_SSL
+  ssl_handshake(new_client);
+/*
+  if (!ssl_handshake(new_client)) {
+    ServerStats->is_ref++;
+    close(fd);
+    free(new_client);
+    return;
+  }
+*/
+#endif
+
   if (!set_non_blocking(new_client->fd))
     report_error(NONB_ERROR_MSG, get_client_name(new_client, TRUE), errno);
   if (!disable_sock_options(new_client->fd))
     report_error(OPT_ERROR_MSG, get_client_name(new_client, TRUE), errno);
+
   start_auth(new_client);
 }
 
@@ -834,7 +904,11 @@
 
   if (!(IsPerson(cptr) && DBufLength(&cptr->recvQ) > SBSD_MAX_CLIENT)) {
     errno = 0;
+#ifdef HAVE_SSL
+    length = SSL_read((SSL *)cptr->ssl, readBuf, READBUF_SIZE);
+#else
     length = recv(cptr->fd, readBuf, READBUF_SIZE, 0);
+#endif
     /*
      * If not ready, fake it so it isnt closed
      */
diff -uNrd ircd-hybrid-6rc6/src/send.c ircd-hybrid-6rc6-ssl/src/send.c
--- ircd-hybrid-6rc6/src/send.c	Wed Nov  1 22:37:17 2000
+++ ircd-hybrid-6rc6-ssl/src/send.c	Tue Dec 12 09:55:47 2000
@@ -557,6 +557,7 @@
   register aClient *acptr;
   register int i;
   char char_type;
+  va_list args;
 
   ++current_serial;
 
diff -uNrd ircd-hybrid-6rc6/src/send.c.rej ircd-hybrid-6rc6-ssl/src/send.c.rej
--- ircd-hybrid-6rc6/src/send.c.rej	Wed Dec 31 19:00:00 1969
+++ ircd-hybrid-6rc6-ssl/src/send.c.rej	Tue Dec 12 09:55:47 2000
@@ -0,0 +1,17 @@
+***************
+*** 1274,1280 ****
+  
+    vsendto_realops(pattern, args);
+  
+-   va_end(vl);
+  } /* sendto_realops() */
+  
+  /*
+--- 1290,1296 ----
+  
+    vsendto_realops(pattern, args);
+  
++   va_end(args);
+  } /* sendto_realops() */
+  
+  /*
diff -uNrd ircd-hybrid-6rc6/src/ssl.c ircd-hybrid-6rc6-ssl/src/ssl.c
--- ircd-hybrid-6rc6/src/ssl.c	Wed Dec 31 19:00:00 1969
+++ ircd-hybrid-6rc6-ssl/src/ssl.c	Tue Dec 12 10:56:02 2000
@@ -0,0 +1,154 @@
+#include "config.h"
+#ifdef HAVE_SSL
+
+#include "ssl.h"
+#include "common.h"
+#include "client.h"
+#include "s_log.h"
+#include "s_bsd.h"
+
+/* The SSL structures */
+SSL_CTX* ctx;
+SSL_METHOD* meth;
+
+void init_ssl() {
+    /* SSL preliminaries. We keep the certificate and key with the context. */
+
+  SSL_load_error_strings();
+  SSLeay_add_ssl_algorithms();
+  meth = SSLv23_server_method();
+  ctx = SSL_CTX_new (meth);
+       if (!ctx)
+         {
+               ERR_print_errors_fp (stderr);
+               exit (2);
+         }
+
+       if (SSL_CTX_use_certificate_file (ctx, CERTF, SSL_FILETYPE_PEM) <= 0)
+         {
+               ERR_print_errors_fp (stderr);
+               exit (3);
+         }
+       if (SSL_CTX_use_PrivateKey_file (ctx, KEYF, SSL_FILETYPE_PEM) <= 0)
+         {
+               ERR_print_errors_fp (stderr);
+               exit (4);
+         }
+
+       if (!SSL_CTX_check_private_key (ctx))
+         {
+               fprintf (stderr, "Private key does not match the certificate public key\n");
+               exit (5);
+         }
+
+}
+
+#define CHK_NULL(x) if ((x)==NULL) {\
+        log(L_NOTICE, "Lost connection to %s:Error in SSL", \
+                     get_client_name(cptr, TRUE)); \
+	return 0;\
+	}
+
+int ssl_handshake(struct Client *cptr) {
+
+  char *str;
+  int err;
+
+      cptr->ssl = (struct SSL*) SSL_new (ctx);
+      CHK_NULL (cptr->ssl);
+      SSL_set_fd ((SSL *)cptr->ssl, cptr->fd);
+      err = SSL_accept ((SSL *)cptr->ssl);
+      if ((err)==-1) {
+        log(L_NOTICE,"Lost connection to %s:Error in SSL_accept()", 
+                     get_client_name(cptr, TRUE));
+        return 0;
+      }
+
+      /* Get the cipher - opt */
+
+      log (L_DEBUG, "SSL connection using %s\n", SSL_get_cipher ((SSL *)cptr->ssl));
+
+      /* Get client's certificate (note: beware of dynamic
+       * allocation) - opt */
+
+      cptr->client_cert = (struct X509*)SSL_get_peer_certificate ((SSL *)cptr->ssl);
+
+      if (cptr->client_cert != NULL)
+      {
+        log (L_DEBUG,"Client certificate:\n");
+
+        str = X509_NAME_oneline (X509_get_subject_name ((X509*)cptr->client_cert), 0, 0);
+        CHK_NULL (str);
+        log (L_DEBUG, "\t subject: %s\n", str);
+        // Bejvavalo
+ 	//       Free (str);
+	free(str);
+	
+        str = X509_NAME_oneline (X509_get_issuer_name ((X509*)cptr->client_cert), 0, 0);
+        CHK_NULL (str);
+        log (L_DEBUG, "\t issuer: %s\n", str);
+        // Bejvavalo
+        // Free (str);
+	free(str);
+	
+        /* We could do all sorts of certificate
+         * verification stuff here before
+         *        deallocating the certificate. */
+
+        X509_free ((X509*)cptr->client_cert);
+      }
+      else
+        log (L_DEBUG, "Client does not have certificate.\n");
+
+      return 0;
+
+}
+
+int ssl_client_handshake(struct Client *cptr) {
+
+  char *str;
+  int err;
+
+  cptr->ssl = (struct SSL*)SSL_new (ctx);                         CHK_NULL(cptr->ssl);    
+  SSL_set_fd ((SSL*)cptr->ssl, cptr->fd);
+  set_blocking(cptr->fd);
+  err = SSL_connect ((SSL*)cptr->ssl);                     
+  set_non_blocking(cptr->fd);
+  if ((err)==-1) {
+     log(L_NOTICE,"Could connect to %s:Error in SSL_connect()", 
+                  get_client_name(cptr, TRUE));
+     return 0;
+     }
+    
+  /* Following two steps are optional and not required for
+     data exchange to be successful. */
+  
+  /* Get the cipher - opt */
+  set_blocking(cptr->fd);
+  log (L_NOTICE,"SSL connection using %s\n", SSL_get_cipher ((SSL*)cptr->ssl));
+  
+  /* Get server's certificate (note: beware of dynamic allocation) - opt */
+
+  cptr->client_cert = (struct X509*)SSL_get_peer_certificate ((SSL *)cptr->ssl);
+  set_non_blocking(cptr->fd);
+  CHK_NULL(cptr->client_cert);
+  log (L_NOTICE,"Server certificate:\n");
+  
+  str = X509_NAME_oneline (X509_get_subject_name ((X509*)cptr->client_cert),0,0);
+  CHK_NULL(str);
+  log (L_NOTICE, "\t subject: %s\n", str);
+  // Free (str);
+  free (str);
+  
+  str = X509_NAME_oneline (X509_get_issuer_name  ((X509*)cptr->client_cert),0,0);
+  CHK_NULL(str);
+  log (L_NOTICE, "\t issuer: %s\n", str);
+  // Free (str);
+  free (str);
+  /* We could do all sorts of certificate verification stuff here before
+     deallocating the certificate. */
+
+  X509_free ((X509*)cptr->client_cert);
+  return 1;
+}
+#endif
