summaryrefslogtreecommitdiffstats
path: root/git-interface/git-auth.py
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-08-04 21:00:50 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-08-05 12:05:22 +0200
commit27631f1157226bd9ca4d0dbfb6a59c7656e7e361 (patch)
tree3c393a62029829a61c1ed92ca4b6814b08da9a86 /git-interface/git-auth.py
parentecbf32f0cc4673c56380a97a0097187924d47624 (diff)
downloadaurweb-27631f1157226bd9ca4d0dbfb6a59c7656e7e361.tar.xz
git-interface: Do not use rowcount
Avoid using Cursor.rowcount to obtain the number of rows returned by a SELECT statement as this is not guaranteed to be supported by every database engine. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface/git-auth.py')
-rwxr-xr-xgit-interface/git-auth.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-interface/git-auth.py b/git-interface/git-auth.py
index ebdc75c..45fd577 100755
--- a/git-interface/git-auth.py
+++ b/git-interface/git-auth.py
@@ -40,10 +40,11 @@ cur = conn.execute("SELECT Users.Username, Users.AccountTypeID FROM Users " +
"WHERE SSHPubKeys.PubKey = ? AND Users.Suspended = 0",
(keytype + " " + keytext,))
-if cur.rowcount != 1:
+row = cur.fetchone()
+if not row or cur.fetchone():
exit(1)
-user, account_type = cur.fetchone()
+user, account_type = row
if not re.match(username_regex, user):
exit(1)