Index: univention-management-console-frontend/univention-management-console-web-server =================================================================== --- univention-management-console-frontend/univention-management-console-web-server (Revision 44155) +++ univention-management-console-frontend/univention-management-console-web-server (Arbeitskopie) @@ -34,7 +34,6 @@ import cherrypy import httplib import os -import threading import Queue from optparse import OptionParser import simplejson @@ -75,6 +74,9 @@ except (cherrypy.HTTPError, cherrypy.HTTPRedirect): # ignore common cherrypy exceptions raise + except (KeyboardInterrupt, SystemExit): + # ignore + raise except Exception, ex: CORE.error('Traceback in %s(%r, %r):\n%s' % (f.__name__, args, kwargs, traceback.format_exc())) raise @@ -420,6 +422,18 @@ self._log(99, 'sessionid="%s"' % (sessionid)) return sessionid + def set_session_id(self, sessionid): + # set the cookie once during successful authentication + # force expiration of cookie in 5 years from now on... + # IE does not support max-age + expiration = datetime.datetime.now() + expiration = expiration.replace(year=expiration.year + 5) + expirationStr = expiration.strftime("%a, %d-%b-%Y %H:%M:%S GMT") + cherrypy.response.cookie['UMCSessionId'] = sessionid + cherrypy.response.cookie['UMCSessionId']['expires'] = expirationStr + cherrypy.response.cookie['UMCSessionId']['version'] = 1 + cherrypy.response.cookie['UMCSessionId']['path'] = '/' + @logExceptions def load_json(self, body): try: @@ -511,16 +525,7 @@ # update IP address of sesssion ==> address changes during single sign on UMCP_Dispatcher.sessions[login_token.sessionid].ip = self.get_ip_address() - # set the cookie once during successful authentication - # force expiration of cookie in 5 years from now on... - # IE does not support max-age - expiration = datetime.datetime.now() - expiration = expiration.replace(year=expiration.year + 5) - expirationStr = expiration.strftime("%a, %d-%b-%Y %H:%M:%S GMT") - cherrypy.response.cookie['UMCSessionId'] = login_token.sessionid - cherrypy.response.cookie['UMCSessionId']['expires'] = expirationStr - cherrypy.response.cookie['UMCSessionId']['version'] = 1 - cherrypy.response.cookie['UMCSessionId']['path'] = '/' + self.set_session_id(login_token.sessionid) cherrypy.response.cookie['UMCUsername'] = login_token.username cherrypy.response.cookie['UMCUsername']['expires'] = expirationStr cherrypy.response.cookie['UMCUsername']['version'] = 1 @@ -683,16 +688,7 @@ # add new one time session UMCP_Dispatcher.logintokens.add_session(response.body.get('sessionid'), json[ 'options' ].get('username','')) - # set the cookie once during successful authentication - # force expiration of cookie in 5 years from now on... - # IE does not support max-age - expiration = datetime.datetime.now() - expiration = expiration.replace(year=expiration.year + 5) - expirationStr = expiration.strftime("%a, %d-%b-%Y %H:%M:%S GMT") - cherrypy.response.cookie['UMCSessionId'] = response.body.get('sessionid') - cherrypy.response.cookie['UMCSessionId']['expires'] = expirationStr - cherrypy.response.cookie['UMCSessionId']['version'] = 1 - cherrypy.response.cookie['UMCSessionId']['path'] = '/' + self.set_session_id(response.body.get('sessionid')) return "" Index: univention-management-console-module-lib/umc/python/lib/server.py =================================================================== --- univention-management-console-module-lib/umc/python/lib/server.py (Revision 44155) +++ univention-management-console-module-lib/umc/python/lib/server.py (Arbeitskopie) @@ -170,7 +170,7 @@ opener.add_handler(urllib2.HTTPCookieProcessor(cookie_jar)) MODULE.process('Sending request...') try: - response = opener.open(urllib2.Request(url, body, {'Content-Type': 'application/json'})) + response = opener.open(urllib2.Request(url, body, {'Content-Type': 'application/json', 'User-Agent': 'UMC 2'})) MODULE.process('Got response ...') except (urllib2.HTTPError, urllib2.URLError), ex: MODULE.error('sso_getsession: unable to connect to %r: %s' % (host, ex))