src/mercurialserver/refreshauth.py
changeset 106 0519745e7a57
parent 86 78777f509303
child 107 84e9e33d866b
--- a/src/mercurialserver/refreshauth.py	Mon Oct 12 12:08:49 2009 +0100
+++ b/src/mercurialserver/refreshauth.py	Mon Oct 12 16:04:07 2009 +0100
@@ -5,12 +5,14 @@
 # file every time it is run
 # WARNING
 
-import sys
+import re
 import os
 import os.path
 import pwd
 import subprocess
-from mercurialserver import ruleset, paths
+from mercurialserver import paths
+
+goodkey = re.compile("[A-Za-z0-9._-]+$")
 
 def refreshAuth(pw_dir):
     akeyfile = pw_dir + "/.ssh/authorized_keys"
@@ -38,9 +40,10 @@
                     raise Exception("Inconsistent behaviour in os.walk, bailing")
                 #print "Processing file", ffn
                 keyname = ffn[len(kr):]
-                if not ruleset.goodpath(keyname):
+                # FIXME: still too strict
+                if not goodkey.match(keyname)
                     # ignore any path that contains dodgy characters
-                    #print "Ignoring file", ffn
+                    print "Ignoring key that contains banned character:", ffn
                     continue
                 p = subprocess.Popen(("ssh-keygen", "-i", "-f", ffn), 
                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)