Commits

Zhang Huangbin committed bd05693

Code cleanup.

Comments (0)

Files changed (5)

+* plugin/ldap_expired_passwd.py: set password last update date to today if
+  shadowLastChange is not present or 0?
+* plugins/{ldap, sql}
 * Query required SQL columns instead of all
 * Plugins:
     + Greylisting (server-wide and per-user, per-domain)
 
 
 class DaemonSocket(asyncore.dispatcher):
-    def __init__(self, localaddr, plugins=[]):
+    def __init__(self, localaddr):
         asyncore.dispatcher.__init__(self)
         self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
         self.set_reuse_addr()
                 'default': 'DUNNO',
                }
 
-ACCESS_POLICIES_OF_MAIL_LIST = {
+LDAP_ACCESS_POLICIES_OF_MAIL_LIST = {
     'public': 'Unrestricted',
     'domain': 'Only users under same domain are allowed',
     'subdomain': 'Only users under same domain and sub domains are allowed',

plugins/ldap_expired_password.py

 import datetime
 from libs import SMTP_ACTIONS
 
-REQUIRE_LOCAL_SENDER_= True
+REQUIRE_LOCAL_SENDER = True
 REQUIRE_LOCAL_RECIPIENT = False
 SENDER_SEARCH_ATTRLIST = ['shadowLastChange']
 RECIPIENT_SEARCH_ATTRLIST = []
 # Force mail user to change password in how many days. Default is 90.
 EXPIRED_DAYS = 90
 
-def restriction(smtpSessionData, ldapSenderLdif, **kargs):
+def restriction(**kwargs):
+    ldapSenderLdif = kwargs['senderLdif']
+
     # Check password last change days
     last_changed_day = int(ldapSenderLdif.get('shadowLastChange', [0])[0])
 

plugins/ldap_maillist_access_policy.py

 # Note: Access policy is defined in libs/__init__.py.
 
 import logging
-from libs import SMTP_ACTIONS, ACCESS_POLICIES_OF_MAIL_LIST, ldap_conn_utils
+from libs import SMTP_ACTIONS, LDAP_ACCESS_POLICIES_OF_MAIL_LIST, ldap_conn_utils
 
 REQUIRE_LOCAL_SENDER = False
 REQUIRE_LOCAL_RECIPIENT = True
 
     logging.debug('%s -> %s, access policy: %s (%s)' % (
         sender, recipient, policy,
-        ACCESS_POLICIES_OF_MAIL_LIST.get(policy, 'no description'))
+        LDAP_ACCESS_POLICIES_OF_MAIL_LIST.get(policy, 'no description'))
     )
 
     if policy == 'public':