--- a/refresh-auth Tue Apr 15 18:30:43 2008 +0100
+++ b/refresh-auth Wed Apr 16 12:43:21 2008 +0100
@@ -1,14 +1,20 @@
#!/usr/bin/python
# WARNING
-# This script completely destroys your .ssh/authorized_keys
+# This script completely destroys your ~/.ssh/authorized_keys
# file every time it is run
# WARNING
+import sys
import os
import os.path
import re
+if len(sys.argv) != 2:
+ sys.stderr.write("refresh-auth: wrong number of arguments (%s)" % sys.argv)
+ sys.exit(-1)
+
+wrappercommand = sys.argv[1]
akeyfile = os.path.expanduser("~/.ssh/authorized_keys")
allowedchars = "A-Za-z0-9_.-"
@@ -22,11 +28,10 @@
continue
keyname = ffn[5:]
prefix=('command="%s",no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding'
- % ('./.hg-ssh-wrapper %s' % keyname))
+ % ('%s %s' % (wrappercommand, keyname))
kf = open(ffn)
try:
for l in kf:
- #prefix='no-port-forwarding,no-X11-forwarding,no-agent-forwarding'
akeys.write("%s %s\n" % (prefix, l.strip()))
finally:
kf.close()