Commit da636a4e authored by Friedrich Weber's avatar Friedrich Weber

Cosmetic Changes

parent 53df44a6
...@@ -127,10 +127,12 @@ class Authenticator(object): ...@@ -127,10 +127,12 @@ class Authenticator(object):
if result.get("value"): if result.get("value"):
save_auth_item(self.sqlfile, self.user, serial, tokentype, save_auth_item(self.sqlfile, self.user, serial, tokentype,
auth_item) auth_item)
return True
else: else:
syslog.syslog(syslog.LOG_ERR, syslog.syslog(syslog.LOG_ERR,
"%s: %s" % (__name__, "%s: %s" % (__name__,
result.get("error").get("message"))) result.get("error").get("message")))
return False
def authenticate(self, password): def authenticate(self, password):
rval = self.pamh.PAM_SYSTEM_ERR rval = self.pamh.PAM_SYSTEM_ERR
...@@ -454,7 +456,7 @@ def save_auth_item(sqlfile, user, serial, tokentype, authitem): ...@@ -454,7 +456,7 @@ def save_auth_item(sqlfile, user, serial, tokentype, authitem):
# delete old refilltoken # delete old refilltoken
try: try:
c.execute('DELETE FROM refilltokens WHERE serial=?', (serial,)) c.execute('DELETE FROM refilltokens WHERE serial=?', (serial,))
except: except sqlite3.OperationalError:
pass pass
c.execute("INSERT INTO refilltokens (serial, refilltoken) VALUES (?,?)", c.execute("INSERT INTO refilltokens (serial, refilltoken) VALUES (?,?)",
(serial, refilltoken)) (serial, refilltoken))
...@@ -476,12 +478,12 @@ def _create_table(c): ...@@ -476,12 +478,12 @@ def _create_table(c):
c.execute("CREATE TABLE authitems " c.execute("CREATE TABLE authitems "
"(counter int, user text, serial text, tokenowner text," "(counter int, user text, serial text, tokenowner text,"
"otp text, tokentype text)") "otp text, tokentype text)")
except: except sqlite3.OperationalError:
pass pass
try: try:
# create refilltokens table # create refilltokens table
c.execute("CREATE TABLE refilltokens (serial text, refilltoken text)") c.execute("CREATE TABLE refilltokens (serial text, refilltoken text)")
except: except sqlite3.OperationalError:
pass pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment