[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[minion-cvs] Mixminion sends and delivers MBOX and SMTP-Via-Mixmaste...
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.seul.org:/tmp/cvs-serv18625/lib/mixminion
Modified Files:
ClientMain.py Modules.py ServerMain.py test.py
Log Message:
Mixminion sends and delivers MBOX and SMTP-Via-Mixmaster messages. I'm going to bed now.
ClientMain:
- Fix a bug in the functionality-checking code
- Change MBOX to support implicit last hop
Modules:
- Only advertise functionality we have.
- Correctly report plaintext fwd messages as fwd.
- Fix typos in accessing cfg options
ServerMain:
- Fix lingering queue/queueDelivery issues
test:
- Bring tests back into line with correct behavior
Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ClientMain.py 2 Dec 2002 03:19:44 -0000 1.8
+++ ClientMain.py 2 Dec 2002 10:13:48 -0000 1.9
@@ -188,14 +188,16 @@
routingType, routingInfo, lastHop = address.getRouting()
if lastHop is None:
+ lastServer = servers2[-1]
+ print path2[-1], routingType
# FFFF This is only a temporary solution. It needs to get
# FFFF rethought, or refactored into ServerInfo, or something.
if routingType == SMTP_TYPE:
- ok = path2[-1]['Delivery/SMTP'].get('Version',None)
+ ok = lastServer['Delivery/SMTP'].get('Version',None)
if not ok:
raise MixError("Last hop doesn't support SMTP")
elif routingType == MBOX_TYPE:
- ok = path2[-1]['Delivery/MBOX'].get('Version',None)
+ ok = lastServer['Delivery/MBOX'].get('Version',None)
if not ok:
raise MixError("Last hop doesn't support MBOX")
else:
@@ -242,10 +244,11 @@
raise ParseError("Invalid type: 0x%04x"%tp)
return Address(tp, val, None)
elif tp == 'mbox':
- if "@" not in val:
- raise ParseError("No server for mailbox %s" % s)
- mbox, server = val.split("@",1)
- return Address(MBOX_TYPE, parseMBOXInfo(mbox).pack(), server)
+ if "@" in val:
+ mbox, server = val.split("@",1)
+ return Address(MBOX_TYPE, parseMBOXInfo(mbox).pack(), server)
+ else:
+ return Address(MBOX_TYPE, parseMBOXInfo(val).pack(), None)
elif tp == 'smtp':
# May raise ParseError
return Address(SMTP_TYPE, parseSMTPInfo(val).pack(), None)
Index: Modules.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Modules.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- Modules.py 2 Dec 2002 04:25:52 -0000 1.20
+++ Modules.py 2 Dec 2002 10:13:49 -0000 1.21
@@ -170,6 +170,7 @@
# Fields
# syntax: extensions to the syntax configuration in Config.py
# modules: a list of DeliveryModule objects
+ # enabled: a set of enabled DeliveryModule objects
# nameToModule: Map from module name to module
# typeToModule: a map from delivery type to enabled deliverymodule.
# path: search path for python modules.
@@ -177,9 +178,12 @@
# queues: a map from module name to queue (Queue objects must support
# queueMessage and sendReadyMessages as in DeliveryQueue.)
+
def __init__(self):
self.syntax = {}
self.modules = []
+ self.enabled = {}
+
self.nameToModule = {}
self.typeToModule = {}
self.path = []
@@ -270,6 +274,7 @@
queueDir = os.path.join(self.queueRoot, module.getName())
queue = module.createDeliveryQueue(queueDir)
self.queues[module.getName()] = queue
+ self.enabled[module.getName()] = 1
def cleanQueues(self):
for queue in self.queues.values():
@@ -284,6 +289,8 @@
del self.typeToModule[t]
if self.queues.has_key(module.getName()):
del self.queues[module.getName()]
+ if self.enabled.has_key(module.getName()):
+ del self.enabled[module.getName()]
def queueMessage(self, message, tag, exitType, address):
mod = self.typeToModule.get(exitType, None)
@@ -302,14 +309,15 @@
queue.queueDeliveryMessage((exitType, address, tag), message)
else:
# forward message
- queue.queueDeliveryMessage((exitType, address, tag), payload)
+ queue.queueDeliveryMessage((exitType, address, None), payload)
def sendReadyMessages(self):
for name, queue in self.queues.items():
queue.sendReadyMessages()
def getServerInfoBlocks(self):
- return [ m.getServerInfoBlock() for m in self.modules ]
+ return [ m.getServerInfoBlock() for m in self.modules
+ if self.enabled.get(m.getName(),0) ]
#----------------------------------------------------------------------
class DropModule(DeliveryModule):
@@ -374,7 +382,7 @@
self.nickname = config['Server']['Nickname']
if not self.nickname:
self.nickname = socket.gethostname()
- self.addr = config['Server'].get('IP', "<Unknown host>")
+ self.addr = config['Incoming/MMTP'].get('IP', "<Unknown host>")
self.addresses = {}
f = open(self.addressFile)
@@ -492,9 +500,9 @@
if not self.enabled:
manager.disableModule(self)
return
- cmd = sec['MixmasterCommand']
+ cmd = sec['MixCommand']
self.server = sec['Server']
- self.subject = sec['Subject']
+ self.subject = sec['SubjectLine']
self.command = cmd[0]
self.options = tuple(cmd[1]) + ("-l", self.server,
"-s", self.subject)
Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ServerMain.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ServerMain.py 2 Dec 2002 03:30:07 -0000 1.15
+++ ServerMain.py 2 Dec 2002 10:13:49 -0000 1.16
@@ -311,7 +311,7 @@
def queueMessage(self, msg):
"""Add a message for delivery"""
- self.queueDeliveryMessage(self, None, msg)
+ self.queueDeliveryMessage(None, msg)
def _deliverMessages(self, msgList):
"Implementation of abstract method from DeliveryQueue."
@@ -367,7 +367,7 @@
else:
assert tp == 'QUEUE'
ipv4, msg = info
- self.outgoingQueue.queueMessage(ipv4, msg)
+ self.outgoingQueue.queueDeliveryMessage(ipv4, msg)
self.queue.removeMessage(h)
class OutgoingQueue(mixminion.Queue.DeliveryQueue):
@@ -550,6 +550,7 @@
except:
getLog().fatal_exc(sys.exc_info(),"Exception while configuring server")
print >>sys.stderr, "Shutting down because of exception"
+ #XXXX print stack trace
sys.exit(1)
getLog().info("Starting server")
@@ -559,6 +560,7 @@
pass
except:
getLog().fatal_exc(sys.exc_info(),"Exception while running server")
+ #XXXX print stack trace
getLog().info("Server shutting down")
server.close()
getLog().info("Server is shut down")
Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- test.py 2 Dec 2002 03:25:46 -0000 1.39
+++ test.py 2 Dec 2002 10:13:49 -0000 1.40
@@ -2628,7 +2628,7 @@
eq(info['Incoming/MMTP']['Deny'], [("192.168.0.16", "255.255.255.255",
0,65535),
])
- eq(info['Delivery/MBOX']['Version'], "0.1")
+ eq(info['Delivery/MBOX'].get('Version'), None)
# Now make sure everything was saved properly
keydir = os.path.join(d, "key_key1")
@@ -2923,8 +2923,8 @@
module = mixminion.Modules.MixmasterSMTPModule()
module.configure({"Delivery/SMTP-Via-Mixmaster" :
{"Enabled":1, "Server": "nonesuch",
- "Subject":'foobar',
- 'MixmasterCommand' : ('ls', ['-z'])}},
+ "SubjectLine":'foobar',
+ 'MixCommand' : ('ls', ['-z'])}},
manager)
queue = manager.queues['SMTP_MIX2']
replaceFunction(os, "spawnl")
@@ -2960,8 +2960,9 @@
addrfile = mix_mktemp()
writeFile(addrfile, MBOX_ADDRESS_SAMPLE)
module.configure({'Server':{'Nickname': "nickname"},
+ 'Incoming/MMTP':{},
"Delivery/MBOX" :
- {"Enabled": 1,
+ {"Enabled": 1,
"AddressFile": addrfile,
"ReturnAddress": "returnaddress@x",
"RemoveContact": "removeaddress@x",
@@ -3334,6 +3335,7 @@
eq(s, server)
eq(a, addr)
+ parseEq("mbox:foo", MBOX_TYPE, "foo", None)
parseEq("mbox:foo@bar", MBOX_TYPE, "foo", "bar")
parseEq("mbox:foo@bar@baz", MBOX_TYPE, "foo", "bar@baz")
parseEq("smtp:foo@bar", SMTP_TYPE, "foo@bar", None)
@@ -3350,7 +3352,6 @@
parseFails("sxtp:foo@bar.com")
parseFails("mbox")
- parseFails("mbox:x")
parseFails("mbox:")
parseFails("smtp:Foo")
parseFails("smtp:foo@bar@baz")