9 config
= configparser
.RawConfigParser()
10 config
.read(os
.path
.dirname(os
.path
.realpath(__file__
)) + "/../conf/config")
12 aur_db_host
= config
.get('database', 'host')
13 aur_db_name
= config
.get('database', 'name')
14 aur_db_user
= config
.get('database', 'user')
15 aur_db_pass
= config
.get('database', 'password')
16 aur_db_socket
= config
.get('database', 'socket')
18 valid_keytypes
= config
.get('auth', 'valid-keytypes').split()
19 username_regex
= config
.get('auth', 'username-regex')
20 git_serve_cmd
= config
.get('auth', 'git-serve-cmd')
21 ssh_opts
= config
.get('auth', 'ssh-options')
25 if not keytype
in valid_keytypes
:
28 db
= mysql
.connector
.connect(host
=aur_db_host
, user
=aur_db_user
,
29 passwd
=aur_db_pass
, db
=aur_db_name
,
30 unix_socket
=aur_db_socket
, buffered
=True)
33 cur
.execute("SELECT Username FROM Users WHERE SSHPubKey = %s " +
34 "AND Suspended = 0", (keytype
+ " " + keytext
,))
39 user
= cur
.fetchone()[0]
40 if not re
.match(username_regex
, user
):
43 print('command="%s %s",%s %s' % (git_serve_cmd
, user
, ssh_opts
,
44 keytype
+ " " + keytext
))