Commits

Zhang Huangbin committed 4adf1a5

* Change default action to 'DUNNO', so that we won't miss any email while
incorrect config.
* Add handle of LDAP quering of non exist recipient. Thanks Bill Holt for
his report.
* Prepend 'action=' only one time.

  • Participants
  • Parent commits 43dbb61

Comments (0)

Files changed (2)

+iRedAPD-1.2.3:
+    * Change default action to 'DUNNO', so that we won't miss any email while
+      incorrect config.
+    * Add handle of LDAP quering of non exist recipient. Thanks Bill Holt for
+      his report.
+    * Prepend 'action=' only one time.
+
 iRedAPD-1.2.2:
     * Fix incorrect member list, return all instead of one the first one.
     * Don't ignore external mail list members.

File src/iredapd.py

 
 sys.path.append(os.path.abspath(os.path.dirname(__file__)) + '/plugins')
 
-ACTION_ACCEPT = "action=DUNNO"
-ACTION_DEFER = "action=DEFER_IF_PERMIT Service temporarily unavailable"
-ACTION_REJECT = 'action=REJECT Not Authorized'
-ACTION_DEFAULT = ACTION_REJECT
+ACTION_ACCEPT = 'DUNNO'
+ACTION_DEFER = 'DEFER_IF_PERMIT Service temporarily unavailable'
+ACTION_REJECT = 'REJECT Not Authorized'
+ACTION_DEFAULT = 'DUNNO'
 
 # Get config file.
 if len(sys.argv) != 2:
                 logging.debug('Error: %s. Use default action instead: %s' % (str(e), str(action)) )
 
             logging.info('%s -> %s, %s' % (self.map['sender'], self.map['recipient'], str(action).split('=')[1] ))
-            self.push(action)
+            self.push('action=' + action)
             self.push('')
             asynchat.async_chat.handle_close(self)
             logging.debug("Connection closed")
                 # Get account dn and LDIF data.
                 recipientDn, recipientLdif = self.__get_recipient_dn_ldif(map['recipient'])
 
+                # Return if recipient account doesn't exist.
+                if recipientDn is None or recipientLdif is None:
+                    logging.debug(str(e))
+                    return ACTION_DEFAULT
+
                 #
                 # Import plugin modules.
                 #
                         logging.debug('Response from plugin (%s): %s' % (module.__name__, pluginAction))
                         if not pluginAction.startswith('DUNNO'):
                             logging.info('Response from plugin (%s): %s' % (module.__name__, pluginAction))
-                            return 'action=' + pluginAction
+                            return pluginAction
                     except Exception, e:
                         logging.debug('Error while apply plugin (%s): %s' % (module, str(e)))
 
             else:
                 # No plugins available.
-                return 'action=DUNNO'
+                return 'DUNNO'
         else:
             return ACTION_DEFER