src/refresh-auth
changeset 165 3606d60b07e5
parent 86 78777f509303
child 211 0cd59649772c
equal deleted inserted replaced
164:32131253c2f1 165:3606d60b07e5
     6 # file every time it is run
     6 # file every time it is run
     7 # WARNING
     7 # WARNING
     8 
     8 
     9 import sys
     9 import sys
    10 import os
    10 import os
    11 import pwd
       
    12 from mercurialserver import refreshauth, paths
    11 from mercurialserver import refreshauth, paths
    13 
    12 
    14 if len(sys.argv) != 1:
    13 if len(sys.argv) != 1:
    15     sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv)
    14     sys.stderr.write("refresh-auth: must be called with no arguments (%s)\n" % sys.argv)
    16     sys.exit(-1)
    15     sys.exit(-1)
    17 
    16 
    18 pentry = pwd.getpwuid(os.geteuid())
    17 # To protect the authorized_keys file for innocent users, you have to have
    19 if pentry.pw_name != "hg":
    18 # a ~/.mercurial-server file to run this.
    20     # FIXME: re-execute
    19 if not paths.configExists():
    21     print >>sys.stderr, "Must be run as the 'hg' user"
    20     print >>sys.stderr, "Must be run as the 'hg' user"
    22     sys.exit(-1)
    21     sys.exit(-1)
    23 
    22 
    24 paths.setExePath()
    23 paths.setExePath()
    25 
    24 refreshauth.refreshAuth()
    26 refreshauth.refreshAuth(pentry.pw_dir)