From b036b436aa64be000481f8d1da30ff53d4bcb889 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 26 Jun 2015 08:52:58 +0200 Subject: Add support for multiple SSH public keys Attaching more than one SSH public key to the same account is useful, e.g. if one uses different machines to access the AUR SSH interface. Multiple keys can now be specified by adding multiple lines to the text area on the account edit form. Implements FS#45469. Signed-off-by: Lukas Fleischer Acked-by: Leonidas Spyropoulos --- git-interface/git-auth.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'git-interface') diff --git a/git-interface/git-auth.py b/git-interface/git-auth.py index b67d9de..c7de777 100755 --- a/git-interface/git-auth.py +++ b/git-interface/git-auth.py @@ -47,8 +47,10 @@ db = mysql.connector.connect(host=aur_db_host, user=aur_db_user, unix_socket=aur_db_socket, buffered=True) cur = db.cursor() -cur.execute("SELECT Username, AccountTypeID FROM Users WHERE SSHPubKey = %s " + - "AND Suspended = 0", (keytype + " " + keytext,)) +cur.execute("SELECT Users.Username, Users.AccountTypeID FROM Users " + + "INNER JOIN SSHPubKeys ON SSHPubKeys.UserID = Users.ID " + "WHERE SSHPubKeys.PubKey = %s AND Users.Suspended = 0", + (keytype + " " + keytext,)) if cur.rowcount != 1: exit(1) -- cgit v1.2.3-54-g00ecf