]> andersk Git - zcommit.git/commitdiff
Added quentin's patched zsend binary to spoof arbitrary sender
authorGreg Brockman <gdb@mit.edu>
Tue, 23 Mar 2010 20:53:34 +0000 (16:53 -0400)
committerGreg Brockman <gdb@mit.edu>
Tue, 23 Mar 2010 20:53:34 +0000 (16:53 -0400)
bin/zsend [new file with mode: 0755]
tkt [deleted file]
zcommit.py

diff --git a/bin/zsend b/bin/zsend
new file mode 100755 (executable)
index 0000000..7dde6b3
Binary files /dev/null and b/bin/zsend differ
diff --git a/tkt b/tkt
deleted file mode 100755 (executable)
index f26d988..0000000
Binary files a/tkt and /dev/null differ
index 71984c7ef298bcf5f5e9f4167867787d78e4c8fa..14fa1b87a2e7ff22653127907db6aa4ec53a0b90 100755 (executable)
@@ -10,7 +10,7 @@ import sys
 import traceback
 
 HERE = os.path.dirname(__file__)
-os.environ['KRBTKFILE'] = os.path.join(HERE, 'tkt')
+ZWRITE = os.path.join(HERE, 'bin', 'zsend')
 LOG_FILENAME = 'logs/zcommit.log'
 
 # Set up a specific logger with our desired output level
@@ -21,15 +21,19 @@ logger.setLevel(logging.DEBUG)
 handler = logging.FileHandler(LOG_FILENAME)
 logger.addHandler(handler)
 
-def zephyr(klass, instance, zsig, msg):
+def zephyr(sender, klass, instance, zsig, msg):
     # TODO: spoof the sender
     logger.info("""About to send zephyr:
+sender: %(sender)s
 class: %(klass)s
 instance: %(instance)s
 zsig: %(zsig)s
-msg: %(msg)s""" % {'klass' : klass, 'instance' : instance,
-                 'zsig' : zsig, 'msg' : msg})
-    cmd = ['zwrite', '-c', klass, '-i', instance,
+msg: %(msg)s""" % {'sender' : sender,
+                   'klass' : klass,
+                   'instance' : instance,
+                   'zsig' : zsig,
+                   'msg' : msg})
+    cmd = [ZWRITE, '-S', sender, '-c', klass, '-i', instance,
            '-s', zsig, '-d', '-m', msg]
     subprocess.check_call(cmd)
 
@@ -68,6 +72,7 @@ class Application(object):
                 zsig = payload['ref']
                 if 'zsig' in opts:
                     zsig = '%s: %s' % (opts['zsig'], zsig)
+                sender = opts.get('sender', 'daemon.zcommit')
                 logger.debug('Set zsig')
                 for c in reversed(payload['commits']):
                     inst = opts.get('instance', c['id'][:8])
@@ -84,14 +89,14 @@ class Application(object):
                             'email' : c['author']['email'],
                             'message' : c['message'],
                             'timestamp' : c['timestamp'],
-                            'actions' : '\n--\n'.join(actions)}
+                            'actions' : '--\n'.join(actions)}
                     
                     msg = """%(name)s <%(email)s>
 %(message)s
 %(timestamp)s
 --
 %(actions)s""" % info
-                    zephyr(opts['class'], inst, zsig, msg)
+                    zephyr(sender, opts['class'], inst, zsig, msg)
                 msg = 'Thanks for posting!'
             else:
                 msg = ('If you had sent a POST request to this URL, would have sent'
This page took 0.266332 seconds and 5 git commands to generate.