--- a/src/mercurialserver/refreshauth.py Tue Oct 13 18:32:26 2009 +0100
+++ b/src/mercurialserver/refreshauth.py Mon Nov 09 16:23:04 2009 +0000
@@ -9,16 +9,14 @@
import base64
import os
import os.path
-import pwd
import subprocess
from mercurialserver import paths
goodkey = re.compile("[/A-Za-z0-9._-]+$")
-def refreshAuth(pw_dir):
- akeyfile = pw_dir + "/.ssh/authorized_keys"
+def refreshAuth():
+ akeyfile = os.path.expanduser("~/.ssh/authorized_keys")
wrappercommand = paths.getExePath() + "/hg-ssh"
- keydirs = [paths.getEtcPath() + "/keys", pw_dir + "/repos/hgadmin/keys"]
prefix='no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command='
if os.path.exists(akeyfile):
@@ -31,7 +29,7 @@
f.close()
akeys = open(akeyfile + "_new", "w")
- for keyroot in keydirs:
+ for keyroot in paths.getKeysPaths():
kr = keyroot + "/"
#print "Processing keyroot", keyroot
for root, dirs, files in os.walk(keyroot):
@@ -63,6 +61,5 @@
os.rename(akeyfile + "_new", akeyfile)
def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
- pentry = pwd.getpwuid(os.geteuid())
- refreshAuth(pentry.pw_dir)
+ refreshAuth()