[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Made the porxies comapatible with native Windows python...
Update of /home/minion/cvsroot/src/minion/etc
In directory moria.mit.edu:/tmp/cvs-serv24892
Modified Files:
IMAPproxy.py minionProxy.py minionSMTP.py mmUtils.py pop3d.py
Log Message:
Made the porxies comapatible with native Windows python. Corrected a bug
in the arguments parsing (missing colon). The windows popen* does not like
the list of commands so the shell insecurity is back in!
Index: IMAPproxy.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/etc/IMAPproxy.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- IMAPproxy.py 5 Mar 2004 17:42:31 -0000 1.1
+++ IMAPproxy.py 11 Mar 2004 23:51:33 -0000 1.2
@@ -5,7 +5,7 @@
import sys
import os
-import pwd
+# import pwd
import errno
import getopt
import time
@@ -47,6 +47,12 @@
# Get the IMAP messages
try:
M = imaplib.IMAP4(self.__server)
+ except:
+ print "Wrond server name %s" % self.__server
+ return []
+
+ try:
+
M.login(user, passd)
M.select()
# Filter for anonymous messages
Index: minionProxy.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/etc/minionProxy.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- minionProxy.py 8 Mar 2004 16:53:32 -0000 1.3
+++ minionProxy.py 11 Mar 2004 23:51:33 -0000 1.4
@@ -58,7 +58,7 @@
# -h, --help - gives some help
try:
opts, args = getopt.getopt(
- sys.argv[1:], 'VhHPSL',
+ sys.argv[1:], 'VhH:P:S:L:',
['version', 'help','host','pop3port','smtpport','localhost'])
except getopt.error, e:
print e
@@ -67,6 +67,7 @@
for opt, arg in opts:
if opt in ('-H', '--host'):
imap_address = arg
+ print opt,arg,imap_address
elif opt in ('-I', '--imapport'):
try:
imap_port = int(arg)
Index: minionSMTP.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/etc/minionSMTP.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- minionSMTP.py 5 Mar 2004 17:42:31 -0000 1.3
+++ minionSMTP.py 11 Mar 2004 23:51:33 -0000 1.4
@@ -109,6 +109,7 @@
if retaddrs != None:
surb = mmUtils.getSURB(retaddrs,nickname,self.__passwd)
+ print surb,retaddrs,nickname,self.__passwd
body = body +'\n'+surb[0]
# Base mixminion command
@@ -116,10 +117,10 @@
# Augment the command with a nickname
if nickname != '':
- cmd.append('--from=%s' % nickname)
+ cmd.append('--from=\"%s\"' % nickname)
if subject != '':
- cmd.append('--subject=%s' % subject)
+ cmd.append('--subject=\"%s\"' % subject)
for address in rcpttos:
taz = re.findall('([^@]*)@nym.taz',address)
Index: mmUtils.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/etc/mmUtils.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mmUtils.py 5 Mar 2004 17:42:31 -0000 1.1
+++ mmUtils.py 11 Mar 2004 23:51:33 -0000 1.2
@@ -6,7 +6,10 @@
# it returns what appeared in the std output.
# PRIVATE: DO NOT CALL FROM OUTSIDE THIS MODULE!!!
def mm_command(cmd, in_str = None, show_stderr = 1):
- c = cmd
+ # c = cmd
+
+ c = reduce(lambda x,y: x+" "+y, cmd)
+ print c
if show_stderr == 1:
(sout,sin) = os.popen4(c)
@@ -23,7 +26,7 @@
# provides a single use reply block
# If an error occus it return an empty list '[]'
def getSURB(addrs,login,passwd):
- rs = mm_command(['mixminion','generate-surb','--identity=%s'%login,'-t',addrs], passwd)
+ rs = mm_command(['mixminion','generate-surb','--identity=\"%s\"'%login,'-t',addrs], passwd)
surbPat = re.compile('-----BEGIN TYPE III REPLY BLOCK-----[^\-]*-----END TYPE III REPLY BLOCK-----',re.S)
rs = surbPat.findall(rs)
return rs
@@ -73,6 +76,6 @@
if __name__ == '__main__':
import getpass
sb = getSURB('gd216@cl.cam.ac.uk',getpass.getpass())
- reply('Hello world\nThis is my message\n',sb[0])
+ # reply('Hello world\nThis is my message\n',sb[0])
# print rs
Index: pop3d.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/etc/pop3d.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pop3d.py 5 Mar 2004 17:42:31 -0000 1.2
+++ pop3d.py 11 Mar 2004 23:51:33 -0000 1.3
@@ -27,7 +27,7 @@
import sys
import os
-import pwd
+# import pwd
import errno
import getopt
import time