]> andersk Git - test.git/commitdiff
Fixed a potential assertion failure in the daemon, if a user manages to type keys...
authorMarkus Gutschke <markus@shellinabox.com>
Thu, 13 Aug 2009 01:55:44 +0000 (01:55 +0000)
committerMarkus Gutschke <markus@shellinabox.com>
Thu, 13 Aug 2009 01:55:44 +0000 (01:55 +0000)
config.h
configure
configure.ac
demo/vt100.js
shellinabox/shell_in_a_box.js
shellinabox/shellinaboxd.c
shellinabox/vt100.js
stresstest.sh [new file with mode: 0755]

index 5f836df236a7e508d22d653faebb8d9350a6eda1..951299d30eb95dd4a001b8ef73a839ac9e68709c 100644 (file)
--- a/config.h
+++ b/config.h
 #define STDC_HEADERS 1
 
 /* Most recent revision number in the version control system */
-#define VCS_REVISION "168"
+#define VCS_REVISION "169"
 
 /* Version number of package */
 #define VERSION "2.9"
index 86ab553668c5c6d751576c4707e3f4b67f81b174..1f353a41822bb33561c2aed99b5888c3372c858b 100755 (executable)
--- a/configure
+++ b/configure
@@ -2317,7 +2317,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-VCS_REVISION=168
+VCS_REVISION=169
 
 
 cat >>confdefs.h <<_ACEOF
index b94a5e7720b81b8ae2c457aa4e38bc7cb7f775f1..9e54461e2d5494b5f8596858b4e59efd9d4cb8f0 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.9, markus@shellinabox.com)
-VCS_REVISION=168
+VCS_REVISION=169
 AC_SUBST(VCS_REVISION)
 AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
                    [Most recent revision number in the version control system])
index 64dd2c17c479ea0b67c0209b2616d5a4413206bf..9dccb5ee7270105a7016967e1c2262a13a079200 100644 (file)
@@ -1829,7 +1829,7 @@ VT100.prototype.toggleBell = function() {
 };
 
 VT100.prototype.about = function() {
-  alert("VT100 Terminal Emulator " + "2.9 (revision 168)" +
+  alert("VT100 Terminal Emulator " + "2.9 (revision 169)" +
         "\nCopyright 2008-2009 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com");
 };
index 34686951bb6fe60c415003f2c51374dbf2a3111b..6807414e28b6077a421ebc44184402294870b973 100644 (file)
@@ -355,7 +355,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
 };
 
 ShellInABox.prototype.about = function() {
-  alert("Shell In A Box version " + "2.9 (revision 168)" +
+  alert("Shell In A Box version " + "2.9 (revision 169)" +
         "\nCopyright 2008-2009 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com" +
         (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
index b89669a5215cba020fe4f45edcd63599c4d74ed3..e2d6034ac3be6feacd8950f99961798988b00dd5 100644 (file)
@@ -350,12 +350,17 @@ static int dataHandler(HttpConnection *http, struct Service *service,
 
   // Create a new session, if the client did not provide an existing one
   if (isNew) {
-    if (cgiServer && cgiSessions++) {
-      serverExitLoop(cgiServer, 1);
+    if (keys) {
+    bad_new_session:
       abandonSession(session);
       httpSendReply(http, 400, "Bad Request", NO_MSG);
       return HTTP_DONE;
     }
+
+    if (cgiServer && cgiSessions++) {
+      serverExitLoop(cgiServer, 1);
+      goto bad_new_session;
+    }
     session->http         = http;
     if (launchChild(service->id, session) < 0) {
       abandonSession(session);
index 64dd2c17c479ea0b67c0209b2616d5a4413206bf..9dccb5ee7270105a7016967e1c2262a13a079200 100644 (file)
@@ -1829,7 +1829,7 @@ VT100.prototype.toggleBell = function() {
 };
 
 VT100.prototype.about = function() {
-  alert("VT100 Terminal Emulator " + "2.9 (revision 168)" +
+  alert("VT100 Terminal Emulator " + "2.9 (revision 169)" +
         "\nCopyright 2008-2009 by Markus Gutschke\n" +
         "For more information check http://shellinabox.com");
 };
diff --git a/stresstest.sh b/stresstest.sh
new file mode 100755 (executable)
index 0000000..88f5cf6
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/bash -e
+
+PORT=4201
+PIDFILE=stresstest.pid
+
+rm -f "${PIDFILE}"
+trap '[ -r "${PIDFILE}" ] && kill "$(cat "${PIDFILE}")"; rm -f "${PIDFILE}"'  \
+     EXIT INT TERM QUIT HUP
+
+./shellinaboxd -p "${PORT}" -s "/:$(id -u):$(id -g):${PWD}:/bin/bash -c       \
+               'while read i; do [ -z "${i}" ] && break; echo \" $i\"; done'" \
+               --background="${PIDFILE}"
+
+session() {
+  local data="$(wget -O- --post-data='' --quiet "http://localhost:${PORT}/")"
+  local session="${data##*\"session\":\"}"
+  session="${session%%\"*}"
+  while read -r i; do
+    local keys="$(echo -n "${i}" | od -tx1 -An -w1000)"
+    wget -O/dev/null --post-data="session=${session}&keys=${keys// /}"        \
+                     --quiet "http://localhost:${PORT}/"
+    kill -0 "$(cat "${PIDFILE}")" || break
+    [ -z "$i" ] && break
+    data="$(wget -O- --post-data="session=${session}"                         \
+                 --quiet "http://localhost:${PORT}/")"
+    data=${data##*\"data\":\"}
+    data=${data%%\"*}
+    echo "${data}"
+  done <<'EOF'
+Hello world
+This is a test
+OK, that's it for now
+
+EOF
+}
+
+pids=""
+for i in `seq 100`; do
+  session &
+  pids="${pids} $!"
+  sleep 0.02
+  kill -0 "$(cat "${PIDFILE}")" || break
+done
+wait $pids >&/dev/null
This page took 0.081792 seconds and 5 git commands to generate.