src/mercurialserver/refreshauth.py
branchdebian
changeset 313 f597eb3b5aaf
parent 311 3cbde66305e4
equal deleted inserted replaced
294:31d5c6236f71 313:f597eb3b5aaf
    37                 #print "Processing file", ffn
    37                 #print "Processing file", ffn
    38                 keyname = ffn[len(kr):]
    38                 keyname = ffn[len(kr):]
    39                 if not goodkey.match(keyname):
    39                 if not goodkey.match(keyname):
    40                     # Encode it for safe quoting
    40                     # Encode it for safe quoting
    41                     keyname = "--base64 " + base64.b64encode(keyname)
    41                     keyname = "--base64 " + base64.b64encode(keyname)
    42                 p = subprocess.Popen(("ssh-keygen", "-i", "-f", ffn), 
    42                 p = subprocess.Popen(("ssh-keygen", "-i", "-f", ffn),
    43                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    43                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    44                 newkey = p.communicate()[0]
    44                 newkey = p.communicate()[0]
    45                 if p.wait() == 0:
    45                 if p.wait() == 0:
    46                     klines = [l.strip() for l in newkey.split("\n")]
    46                     klines = [l.strip() for l in newkey.split("\n")]
    47                 else:
    47                 else:
    55                     if len(l):
    55                     if len(l):
    56                         akeys.write('%s"%s %s" %s\n' % (prefix, wrappercommand, keyname, l))
    56                         akeys.write('%s"%s %s" %s\n' % (prefix, wrappercommand, keyname, l))
    57     akeys.close()
    57     akeys.close()
    58     os.chmod(akeyfile + "_new", stat.S_IRUSR)
    58     os.chmod(akeyfile + "_new", stat.S_IRUSR)
    59     os.rename(akeyfile + "_new", akeyfile)
    59     os.rename(akeyfile + "_new", akeyfile)
    60     
    60 
    61 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
    61 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
    62     refreshAuth()
    62     refreshAuth()
    63