Fixed IE6 support, and fixed possible memory corruption, when sessions

time out.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@77 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
zodiac 2009-03-17 17:51:42 +00:00
parent 5cea9a25d8
commit 97fff401a3
6 changed files with 44 additions and 15 deletions

View file

@ -1,3 +1,9 @@
2009-03-17 Markus Gutschke <markus@shellinabox.com>
* Fixed IE6 support.
* Fixed possible memory corruption, when sessions time out.
2009-03-16 Markus Gutschke <markus@shellinabox.com> 2009-03-16 Markus Gutschke <markus@shellinabox.com>
* Fixed some compiler warnings, that newer versions of GCC issue. * Fixed some compiler warnings, that newer versions of GCC issue.

View file

@ -35,13 +35,13 @@
#define HAVE_PTSNAME_R 1 #define HAVE_PTSNAME_R 1
/* Define to 1 if you have the <security/pam_appl.h> header file. */ /* Define to 1 if you have the <security/pam_appl.h> header file. */
/* #undef HAVE_SECURITY_PAM_APPL_H */ #define HAVE_SECURITY_PAM_APPL_H 1
/* Define to 1 if you have the <security/pam_client.h> header file. */ /* Define to 1 if you have the <security/pam_client.h> header file. */
/* #undef HAVE_SECURITY_PAM_CLIENT_H */ #define HAVE_SECURITY_PAM_CLIENT_H 1
/* Define to 1 if you have the <security/pam_misc.h> header file. */ /* Define to 1 if you have the <security/pam_misc.h> header file. */
/* #undef HAVE_SECURITY_PAM_MISC_H */ #define HAVE_SECURITY_PAM_MISC_H 1
/* Define to 1 if you have the <stdint.h> header file. */ /* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1 #define HAVE_STDINT_H 1
@ -95,7 +95,7 @@
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Most recent revision number in the version control system */ /* Most recent revision number in the version control system */
#define VCS_REVISION "76" #define VCS_REVISION "77"
/* Version number of package */ /* Version number of package */
#define VERSION "2.4" #define VERSION "2.4"

View file

@ -1077,7 +1077,7 @@ static void childProcess(struct Service *service, int width, int height,
environment[numEnvVars] = NULL; environment[numEnvVars] = NULL;
// Set initial terminal settings // Set initial terminal settings
struct termios tt; struct termios tt = { 0 };
tcgetattr(0, &tt); tcgetattr(0, &tt);
cfsetispeed(&tt, 38400); cfsetispeed(&tt, 38400);
cfsetospeed(&tt, 38400); cfsetospeed(&tt, 38400);

View file

@ -158,9 +158,18 @@ ShellInABox.prototype.sendRequest = function(request) {
if (request == undefined) { if (request == undefined) {
request = new XMLHttpRequest(); request = new XMLHttpRequest();
} }
request.open('POST', this.url, true); request.open(this.session ? 'POST' : 'GET', this.url, true);
request.setRequestHeader('Content-Type', request.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded; charset=utf-8'); 'application/x-www-form-urlencoded; charset=utf-8');
var content = this.session ?
('width=' + this.terminalWidth +
'&height=' + this.terminalHeight +
'&session=' +
encodeURIComponent(this.session)) : '';
if (this.session) {
request.setRequestHeader('Content-Length', content.length);
}
request.onreadystatechange = function(shellInABox) { request.onreadystatechange = function(shellInABox) {
return function() { return function() {
try { try {
@ -170,10 +179,15 @@ ShellInABox.prototype.sendRequest = function(request) {
} }
} }
}(this); }(this);
request.send( try {
'width=' + this.terminalWidth + if (this.session) {
'&height=' + this.terminalHeight + request.send(content);
(this.session ? "&session=" + encodeURIComponent(this.session) : "")); } else {
request.send();
}
} catch (e) {
alert('' + e + '\n' + this.url + '\n' + content);
}
}; };
ShellInABox.prototype.onReadyStateChange = function(request) { ShellInABox.prototype.onReadyStateChange = function(request) {

View file

@ -273,6 +273,10 @@ static int handleSession(struct ServerConnection *connection, void *arg,
} }
check(!session->done); check(!session->done);
check(completePendingRequest(session, buf, bytes, MAX_RESPONSE)); check(completePendingRequest(session, buf, bytes, MAX_RESPONSE));
connection = serverGetConnection(session->server,
connection,
session->pty);
session->connection = connection;
if (session->len >= MAX_RESPONSE) { if (session->len >= MAX_RESPONSE) {
serverConnectionSetEvents(session->server, connection, 0); serverConnectionSetEvents(session->server, connection, 0);
} }

View file

@ -226,6 +226,7 @@ VT100.prototype.initializeElements = function(container) {
} }
} catch (e) { } catch (e) {
} }
this.container.innerHTML = this.container.innerHTML =
'<div id="reconnect" style="visibility: hidden">' + '<div id="reconnect" style="visibility: hidden">' +
'<input type="button" value="Connect" ' + '<input type="button" value="Connect" ' +
@ -308,7 +309,8 @@ VT100.prototype.initializeElements = function(container) {
this.isEmbedded = marginTop != y || this.isEmbedded = marginTop != y ||
marginLeft != x || marginLeft != x ||
(window.innerWidth || (window.innerWidth ||
document.documentElement.clientWidth) - document.documentElement.clientWidth ||
document.body.clientWidth) -
marginRight != x + this.container.offsetWidth; marginRight != x + this.container.offsetWidth;
if (!this.isEmbedded) { if (!this.isEmbedded) {
this.addListener(window, 'resize', this.addListener(window, 'resize',
@ -485,13 +487,15 @@ VT100.prototype.resizer = function() {
var console = this.console[this.currentScreen]; var console = this.console[this.currentScreen];
var height = (this.isEmbedded ? this.container.clientHeight var height = (this.isEmbedded ? this.container.clientHeight
: (window.innerHeight || : (window.innerHeight ||
document.documentElement.clientHeight))-1; document.documentElement.clientHeight ||
document.body.clientHeight))-1;
var partial = height % this.cursorHeight; var partial = height % this.cursorHeight;
this.scrollable.style.height = height + 'px'; this.scrollable.style.height = (height > 0 ? height : 0) + 'px';
this.padding.style.height = partial + 'px'; this.padding.style.height = (partial > 0 ? partial : 0) + 'px';
var oldTerminalHeight = this.terminalHeight; var oldTerminalHeight = this.terminalHeight;
this.updateWidth(); this.updateWidth();
this.updateHeight(); this.updateHeight();
// Clip the cursor to the visible screen. // Clip the cursor to the visible screen.
var cx = this.cursorX; var cx = this.cursorX;
var cy = this.cursorY + this.numScrollbackLines; var cy = this.cursorY + this.numScrollbackLines;
@ -746,7 +750,8 @@ VT100.prototype.updateHeight = function() {
} else { } else {
// Use the full browser window. // Use the full browser window.
this.terminalHeight = Math.floor(((window.innerHeight || this.terminalHeight = Math.floor(((window.innerHeight ||
document.documentElement.clientHeight)-1)/ document.documentElement.clientHeight ||
document.body.clientHeight)-1)/
this.cursorHeight); this.cursorHeight);
} }
return this.terminalHeight; return this.terminalHeight;