Browse files

gateone.py: Fixed a bug where you'd get a KeyError exception if the '…

…enable_unix_socket' setting was missing. It is no longer mandatory.

sso.py:  Improved error handling/logging when there's a Kerberos-specific problem.
Bookmarks plugin:  Fixed a bug where 't' was undefined.
setup.py (and others):  Moved terminal.py into its own separate module.  Apps and plugins had to have their imports corrected to reflect this.
  • Loading branch information...
1 parent c494ca8 commit 288b414d2c5ef1acf75fdaa84d957e5071aa2697 @liftoff committed Mar 7, 2013
View
2 gateone/applications/terminal/app_terminal.py
@@ -599,7 +599,7 @@ def add_terminal_callbacks(self, term, multiplex, callback_id):
Sets up all the callbacks associated with the given *term*, *multiplex*
instance and *callback_id*.
"""
- from termio import terminal
+ import terminal
refresh = partial(self.refresh_screen, term)
multiplex.add_callback(multiplex.CALLBACK_UPDATE, refresh, callback_id)
ended = partial(self.term_ended, term)
View
1 gateone/applications/terminal/plugins/bookmarks/static/bookmarks.js
@@ -7,6 +7,7 @@ var document = window.document; // Have to do this because we're sandboxed
// Useful sandbox-wide stuff
var go = GateOne,
u = go.Utils,
+ t = go.Terminal,
prefix = go.prefs.prefix,
noop = u.noop,
months = {
View
2 gateone/applications/terminal/plugins/html/html.py
@@ -46,7 +46,7 @@
import os
import re
import logging
-from termio import terminal
+import terminal
class HTMLOutput(terminal.FileType):
"""
View
4 gateone/applications/terminal/plugins/logging/logging_plugin.py
@@ -78,7 +78,7 @@ def retrieve_log_frames(golog_path, rows, cols, limit=None):
If *limit* is given, only return that number of frames (e.g. for preview)
"""
out_frames = []
- from termio.terminal import Terminal
+ from terminal import Terminal
terminal_emulator = Terminal
term = terminal_emulator(
# 14/7 for the em_height should be OK for most browsers to ensure that
@@ -320,7 +320,7 @@ def _retrieve_log_flat(queue, settings):
out_dict['result'] = "Success"
from io import BytesIO
# Use the terminal emulator to create nice HTML-formatted output
- from termio.terminal import Terminal
+ from terminal import Terminal
term = Terminal(rows=100, cols=300, em_dimensions=0)
io_obj = BytesIO()
flatten_log(log_path, io_obj)
View
2 gateone/gateone.py
@@ -3462,7 +3462,7 @@ def main():
"authenticate the user that owns the gateone.py process." %
go_settings['pam_service']))
try: # Start your engines!
- if go_settings['enable_unix_socket']:
+ if go_settings.get('enable_unix_socket', False):
https_server.add_socket(
tornado.netutil.bind_unix_socket(
go_settings['unix_socket_path']))
View
26 gateone/sso.py
@@ -64,7 +64,7 @@
"""
# Standard library modules
-import base64
+import logging, base64
# Import our own stuff
from utils import get_translation
@@ -150,17 +150,21 @@ def auth_negotiate(self, auth_header, callback):
"""
auth_str = auth_header.split()[1]
# Initialize Kerberos Context
- result, context = kerberos.authGSSServerInit(
- self.settings['sso_service'])
- if result != 1:
+ try:
+ result, context = kerberos.authGSSServerInit(
+ self.settings['sso_service'])
+ if result != 1:
+ raise tornado.web.HTTPError(500, _("Kerberos Init failed"))
+ result = kerberos.authGSSServerStep(context, auth_str)
+ if result == 1:
+ gssstring = kerberos.authGSSServerResponse(context)
+ else: # Fall back to Basic auth
+ self.auth_basic(auth_header, callback)
+ # NOTE: The user we get from Negotiate is a full UPN (user@REALM)
+ user = kerberos.authGSSServerUserName(context)
+ except kerberos.GSSError as e:
+ logging.error(_("Kerberos Error: %s" % e))
raise tornado.web.HTTPError(500, _("Kerberos Init failed"))
- result = kerberos.authGSSServerStep(context, auth_str)
- if result == 1:
- gssstring = kerberos.authGSSServerResponse(context)
- else: # Fall back to Basic auth
- self.auth_basic(auth_header, callback)
- # NOTE: The user we get from Negotiate is a full UPN (e.g. user@REALM)
- user = kerberos.authGSSServerUserName(context)
self.set_header('WWW-Authenticate', "Negotiate %s" % gssstring)
kerberos.authGSSServerClean(context)
callback(user)
View
2 setup.py
@@ -214,7 +214,7 @@ def walk_data_files(path, install_path=prefix):
author_email = 'daniel.mcdougall@liftoffsoftware.com',
requires = ["tornado (>=2.4)"],
provides = ['gateone'],
- packages = ['gateone', 'termio', 'onoff'],
+ packages = ['gateone', 'termio', 'terminal', 'onoff'],
data_files = data_files
)
View
10 terminal/__init__.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright 2011 Liftoff Software Corporation
+#
+# For license information see LICENSE.txt
+
+# Meta
+__author__ = 'Dan McDougall <daniel.mcdougall@liftoffsoftware.com>'
+
+from .terminal import *
View
0 termio/terminal.py → terminal/terminal.py
File renamed without changes.
View
1 termio/__init__.py
@@ -7,5 +7,4 @@
# Meta
__author__ = 'Dan McDougall <daniel.mcdougall@liftoffsoftware.com>'
-import terminal
from .termio import *

0 comments on commit 288b414

Please sign in to comment.