summaryrefslogtreecommitdiffstats
path: root/saslauthd
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-11-21 14:42:34 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-11-21 14:42:34 +0100
commit998804c66908f84e5e7b2da4685dd3043b8e8c1c (patch)
treea41f028e20121c2973e599b8e9d3eaf5f71e270f /saslauthd
parenta866247cb929f8c883ffb7805302f4e2f8114fa6 (diff)
downloadpykolab-998804c66908f84e5e7b2da4685dd3043b8e8c1c.tar.gz
Attempt to circumvent interrupted system calls on UCS / Debian Squeeze
Diffstat (limited to 'saslauthd')
-rw-r--r--saslauthd/__init__.py36
1 files changed, 30 insertions, 6 deletions
diff --git a/saslauthd/__init__.py b/saslauthd/__init__.py
index 4eaba67..90a7413 100644
--- a/saslauthd/__init__.py
+++ b/saslauthd/__init__.py
@@ -30,6 +30,7 @@ from ConfigParser import SafeConfigParser
import os
import shutil
+import sys
import time
import traceback
@@ -86,11 +87,15 @@ class SASLAuthDaemon(object):
conf.finalize_conf()
- utils.ensure_directory(
- os.path.dirname(conf.pidfile),
- conf.process_username,
- conf.process_groupname
- )
+ try:
+ utils.ensure_directory(
+ os.path.dirname(conf.pidfile),
+ conf.process_username,
+ conf.process_groupname
+ )
+ except Exception, errmsg:
+ log.error(_("Could not create %r: %r") % (os.path.dirname(conf.pidfile), errmsg))
+ sys.exit(1)
self.thread_count = 0
@@ -167,7 +172,26 @@ class SASLAuthDaemon(object):
s.listen(5)
while 1:
- (clientsocket, address) = s.accept()
+ max_tries = 20
+ cur_tries = 0
+ bound = False
+ while not bound:
+ cur_tries += 1
+ try:
+ (clientsocket, address) = s.accept()
+ bound = True
+ except Exception, errmsg:
+ log.error(
+ _("kolab-saslauthd could not accept " + \
+ "connections on socket: %r") % (errmsg)
+ )
+
+ if cur_tries >= max_tries:
+ log.fatal(_("Maximum tries exceeded, exiting"))
+ sys.exit(1)
+
+ time.sleep(1)
+
received = clientsocket.recv(4096)
login = []