diff options
author | alice <alice@immerda.ch> | 2012-10-19 15:02:37 +0200 |
---|---|---|
committer | alice <alice@immerda.ch> | 2012-10-19 15:20:07 +0200 |
commit | ae0eafa812de8b6160aa3afd2e83942d5dc51a01 (patch) | |
tree | afb08d8404ecfc96c93c29258efc595dfca4ed32 /py-bin | |
parent | 377aaf72d7b9f47509fa66e7e300eda69b7f0ef2 (diff) |
replace sha.sha by hashlib.sha1; fixed a tiny bug if user is not logged in; (cc) 2007-2012
Diffstat (limited to 'py-bin')
-rw-r--r-- | py-bin/jabberman.py | 3 | ||||
-rw-r--r-- | py-bin/lib/jon/session.py | 6 | ||||
-rw-r--r-- | py-bin/mail_auth.py | 2 | ||||
-rw-r--r-- | py-bin/templates/jman_base.em | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/py-bin/jabberman.py b/py-bin/jabberman.py index 04b463e..848c6b9 100644 --- a/py-bin/jabberman.py +++ b/py-bin/jabberman.py @@ -1,6 +1,6 @@ #jabber manager -import sqlite3, atexit, bcrypt, sha, hmac, random, os, struct, time, re, logging, datetime, string +import sqlite3, atexit, bcrypt, random, os, struct, time, re, logging, datetime, string import config import utils @@ -262,6 +262,7 @@ class JabberManager: return self.current_user def authenticate(self): + user= None if not self.current_user and "uid" in self.session: user = self.jadb.get_web_user(self.session["uid"]) diff --git a/py-bin/lib/jon/session.py b/py-bin/lib/jon/session.py index 7a253ab..d4803b9 100644 --- a/py-bin/lib/jon/session.py +++ b/py-bin/lib/jon/session.py @@ -1,6 +1,6 @@ # $Id: session.py,v 1.9 2003/01/02 23:24:44 jribbens Exp $ -import time, hmac, sha, Cookie, re, random, os, errno, fcntl +import time, hmac, hashlib, Cookie, re, random, os, errno, fcntl try: import cPickle as pickle except ImportError: @@ -16,7 +16,7 @@ class Session(dict): """Create a hash for 'sid' This function may be overridden by subclasses.""" - return hmac.new(secret, sid, sha).hexdigest()[:8] + return hmac.new(secret, sid, hashlib.sha1).hexdigest()[:8] def _create(self, secret): """Create a new session ID and, optionally hash @@ -31,7 +31,7 @@ class Session(dict): """ rnd = str(time.time()) + str(random.random()) + \ str(self._req.environ.get("UNIQUE_ID")) - self["id"] = sha.new(rnd).hexdigest()[:8] + self["id"] = hashlib.sha1(rnd).hexdigest()[:8] def _load(self): """Load the session dictionary from somewhere diff --git a/py-bin/mail_auth.py b/py-bin/mail_auth.py index c57ee79..99c1081 100644 --- a/py-bin/mail_auth.py +++ b/py-bin/mail_auth.py @@ -1,6 +1,6 @@ #mail authentication -import smtplib, hmac, sha, re, time, logging +import smtplib, re, time, logging from utils import empy_render import subprocess import config diff --git a/py-bin/templates/jman_base.em b/py-bin/templates/jman_base.em index 1d067cb..f41aca4 100644 --- a/py-bin/templates/jman_base.em +++ b/py-bin/templates/jman_base.em @@ -84,7 +84,7 @@ a:active, a:hover { @em_child_content <div id="bottombar" class="carbonbar"> - Copyleft (<a href="http://creativecommons.org" target="_blank">cc</a>) 2007 + Copyleft (<a href="http://creativecommons.org" target="_blank">cc</a>) 2007-2012 <a href="https://www.immerda.ch" target="_blank">Immerda Projekt</a> </div> </div> |