summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryvesf <yvesf@aurora.xapek.org>2010-02-20 20:35:58 +0100
committeryvesf <yvesf@aurora.xapek.org>2010-02-20 20:35:58 +0100
commit7c54483dffe17585ddaa71c9490c4bfb8609dcb7 (patch)
tree56c44462a4eeb05156f2bf2c316befac90761544
parente163ae33ce7979988beed1098368b656ef4f7fe1 (diff)
downloadfakesmtp-7c54483dffe17585ddaa71c9490c4bfb8609dcb7.tar.gz
fakesmtp-7c54483dffe17585ddaa71c9490c4bfb8609dcb7.zip
fix previous mistake, better logging
-rw-r--r--smtp.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/smtp.py b/smtp.py
index 3be3d63..1f50884 100644
--- a/smtp.py
+++ b/smtp.py
@@ -63,14 +63,17 @@ class SMTPServer(asyncore.dispatcher):
def handle_accept(self):
conn, addr = self.accept()
- self.logger.info("New Client %s" % addr)
- SMTPChannel(self, conn, addr)
+ self.logger.info("New Client %s:%s" % conn.getpeername())
+ try:
+ SMTPChannel(self, conn, addr)
+ except Exception,e:
+ self.logger.error(str(e))
if __name__ == '__main__':
s = SMTPServer()
-
+
#user change
pwinfo = pwd.getpwnam('nobody')
os.setregid(pwinfo[3],pwinfo[3])
@@ -106,5 +109,6 @@ if __name__ == '__main__':
os.dup2(se.fileno(), sys.stderr.fileno())
# Set custom file descriptors so that they get proper buffering.
sys.stdout, sys.stderr = so, se
-
+ #"""
+
asyncore.loop()