]> andersk Git - test.git/commitdiff
Added SSL support for OpenBSD
authorMarkus Gutschke <markus@shellinabox.com>
Mon, 25 May 2009 06:03:26 +0000 (06:03 +0000)
committerMarkus Gutschke <markus@shellinabox.com>
Mon, 25 May 2009 06:03:26 +0000 (06:03 +0000)
ChangeLog
config.h
configure
configure.ac
demo/vt100.js
libhttp/ssl.c
shellinabox/shell_in_a_box.js
shellinabox/vt100.js

index 6512433c079bbe3c6951ffe115b62736f4f5bfab..e28f3434777ab3eb312ac53f185a90b9aab14b9e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-24  Markus Gutschke  <markus@shellinabox.com>
+
+       * Added SSL support for OpenBSD
+
 2009-05-23  Markus Gutschke  <markus@shellinabox.com>
 
        * Released version 2.8
index 9e9e93654730ab4efb7dbdbe9682e7c33d618fc9..a140e671c37947189e0e41683abab72b4efce187 100644 (file)
--- a/config.h
+++ b/config.h
 #define STDC_HEADERS 1
 
 /* Most recent revision number in the version control system */
-#define VCS_REVISION "121"
+#define VCS_REVISION "122"
 
 /* Version number of package */
 #define VERSION "2.8"
index 2cab1a546731ace124974bae35bb7b5282cb03bd..215ae73cdfac129fa0af66da7b4eba16fb5f0aff 100755 (executable)
--- a/configure
+++ b/configure
@@ -2037,7 +2037,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-VCS_REVISION=121
+VCS_REVISION=122
 
 
 cat >>confdefs.h <<_ACEOF
@@ -12867,7 +12867,7 @@ $as_echo "$ac_cv_header_openssl_ssl_h" >&6; }
 
 fi
 if test "x$ac_cv_header_openssl_ssl_h" = x""yes; then
-  LIBS="-lssl $LIBS"
+  LIBS="-lssl -lcrypto $LIBS"
 fi
 
 
index a5c8f145f149ad01f9b5046e013c67dbc765397d..fab433ecac5fb01432ae51a88a1c95b2cc7b81a0 100644 (file)
@@ -2,7 +2,7 @@ AC_PREREQ(2.57)
 
 dnl This is the one location where the authoritative version number is stored
 AC_INIT(shellinabox, 2.8, markus@shellinabox.com)
-VCS_REVISION=121
+VCS_REVISION=122
 AC_SUBST(VCS_REVISION)
 AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
                    [Most recent revision number in the version control system])
@@ -111,7 +111,7 @@ if test "x$enable_runtime_loading" == xno; then
   if test "x$enable_ssl" != xno; then
     AC_CHECK_HEADER(openssl/bio.h,
       [AC_CHECK_HEADER(openssl/err.h,
-        [AC_CHECK_HEADER(openssl/ssl.h, [LIBS="-lssl $LIBS"])])])
+        [AC_CHECK_HEADER(openssl/ssl.h, [LIBS="-lssl -lcrypto $LIBS"])])])
   fi
 
   dnl Link against PAM libraries, unless PAM support has been disabled
index 3787cd88a4989512115d3506bd81eb811e039060..2080500e602cbe35bfe318d71de507f0fd312b80 100644 (file)
@@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() {
 };
 
 VT100.prototype.about = function() {
-  alert("VT100 Terminal Emulator " + "2.8 (revision 121)" +
+  alert("VT100 Terminal Emulator " + "2.8 (revision 122)" +
         "\nCopyright 2008-2009 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com");
 };
index 24c8690847c1afea69e37e4a970d8f21ad057251..bb815f7be3bd00c8dcd400bb2c4edb13771e1806 100644 (file)
@@ -178,22 +178,60 @@ void deleteSSL(struct SSLSupport *ssl) {
 }
 
 #if defined(HAVE_OPENSSL) && defined(HAVE_DLOPEN)
+static int maybeLoadCrypto(void) {
+  // Some operating systems cannot automatically load dependent dynamic
+  // libraries. As libssl.so can depend on libcrypto.so, we try to load
+  // it, iff we haven't tried loading it before and iff libssl.so does not
+  // work by itself.
+  static int crypto;
+  if (!crypto++) {
+#ifdef RTLD_NOLOAD
+    if (dlopen("libcrypto.so", RTLD_LAZY|RTLD_GLOBAL|RTLD_NOLOAD))
+      return 1;
+    else
+#endif
+      if (dlopen("libcrypto.so", RTLD_LAZY|RTLD_GLOBAL))
+        return 1;
+  }
+  return 0;
+}
+
 static void *loadSymbol(const char *lib, const char *fn) {
+  int err  = NOINTR(dup(2));
+  if (err > 2) {
+    int null = NOINTR(open("/dev/null", O_WRONLY));
+    if (null >= 0) {
+      NOINTR(dup2(null, 2));
+      NOINTR(close(null));
+    }
+  }
   void *dl = RTLD_DEFAULT;
   void *rc = dlsym(dl, fn);
   if (!rc) {
+    for (int i = 0; i < 2; i++) {
 #ifdef RTLD_NOLOAD
-    dl     = dlopen(lib, RTLD_LAZY|RTLD_GLOBAL|RTLD_NOLOAD);
+      dl   = dlopen(lib, RTLD_LAZY|RTLD_GLOBAL|RTLD_NOLOAD);
 #else
-    dl     = NULL;
+      dl   = NULL;
 #endif
-    if (dl == NULL) {
-      dl   = dlopen(lib, RTLD_LAZY|RTLD_GLOBAL);
+      if (dl == NULL) {
+        dl = dlopen(lib, RTLD_LAZY|RTLD_GLOBAL);
+      }
+      if (dl != NULL || !maybeLoadCrypto()) {
+        break;
+      }
     }
     if (dl != NULL) {
-      rc   = dlsym(dl, fn);
+      rc   = dlsym(RTLD_DEFAULT, fn);
+      if (rc == NULL && maybeLoadCrypto()) {
+        rc = dlsym(RTLD_DEFAULT, fn);
+      }
     }
   }
+  if (err > 2) {
+    NOINTR(dup2(err, 2));
+  }
+  NOINTR(close(err));
   return rc;
 }
 
@@ -305,7 +343,7 @@ static void sslGenerateCertificate(const char *certificate,
     "set -e; "
     "exec 2>/dev/null </dev/null; "
     "umask 0377; "
-    "PATH=/usr/bin "
+    "PATH=/usr/bin:/usr/sbin "
     "openssl req -x509 -nodes -days 7300 -newkey rsa:1024 -keyout /dev/stdout "
                                  "-out /dev/stdout -subj '/CN=%s/' | cat>'%s'",
     serverName, certificate);
index 4460671d68beee0b24ab1336e5144c2f21b27b63..0d75efff71973b5867e01f6a019b99d60b1f5146 100644 (file)
@@ -355,7 +355,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
 };
 
 ShellInABox.prototype.about = function() {
-  alert("Shell In A Box version " + "2.8 (revision 121)" +
+  alert("Shell In A Box version " + "2.8 (revision 122)" +
         "\nCopyright 2008-2009 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com" +
         (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
index 3787cd88a4989512115d3506bd81eb811e039060..2080500e602cbe35bfe318d71de507f0fd312b80 100644 (file)
@@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() {
 };
 
 VT100.prototype.about = function() {
-  alert("VT100 Terminal Emulator " + "2.8 (revision 121)" +
+  alert("VT100 Terminal Emulator " + "2.8 (revision 122)" +
         "\nCopyright 2008-2009 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com");
 };
This page took 0.057895 seconds and 5 git commands to generate.