src/mercurialserver/refreshauth.py
changeset 211 0cd59649772c
parent 165 3606d60b07e5
child 213 72e7ba8b41a6
equal deleted inserted replaced
208:31e862df1884 211:0cd59649772c
     8 import re
     8 import re
     9 import base64
     9 import base64
    10 import os
    10 import os
    11 import os.path
    11 import os.path
    12 import subprocess
    12 import subprocess
    13 from mercurialserver import paths
    13 from mercurialserver import config
    14 
    14 
    15 goodkey = re.compile("[/A-Za-z0-9._-]+$")
    15 goodkey = re.compile("[/A-Za-z0-9._-]+$")
    16 
    16 
    17 def refreshAuth():
    17 def refreshAuth():
    18     akeyfile = os.path.expanduser("~/.ssh/authorized_keys")
    18     akeyfile = os.path.expanduser("~/.ssh/authorized_keys")
    19     wrappercommand = paths.getExePath() + "/hg-ssh"
    19     wrappercommand = config.getExePath() + "/hg-ssh"
    20     prefix='no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command='
    20     prefix='no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command='
    21 
    21 
    22     if os.path.exists(akeyfile):
    22     if os.path.exists(akeyfile):
    23         f = open(akeyfile)
    23         f = open(akeyfile)
    24         try:
    24         try:
    27                     raise Exception("Safety check failed, delete %s to continue" % akeyfile)
    27                     raise Exception("Safety check failed, delete %s to continue" % akeyfile)
    28         finally:
    28         finally:
    29             f.close()
    29             f.close()
    30 
    30 
    31     akeys = open(akeyfile + "_new", "w")
    31     akeys = open(akeyfile + "_new", "w")
    32     for keyroot in paths.getKeysPaths():
    32     for keyroot in config.getKeysPaths():
    33         kr = keyroot + "/"
    33         kr = keyroot + "/"
    34         #print "Processing keyroot", keyroot
    34         #print "Processing keyroot", keyroot
    35         for root, dirs, files in os.walk(keyroot):
    35         for root, dirs, files in os.walk(keyroot):
    36             for fn in files:
    36             for fn in files:
    37                 ffn = os.path.join(root, fn)
    37                 ffn = os.path.join(root, fn)