コード例 #1
0
ファイル: Chainer.py プロジェクト: jqk6/zorp
 def __init__(self, protocol=ZD_PROTO_AUTO, timeout_connect=None, timeout_state=None):
     """<method maturity="stable">
       <summary>
         Constructor to initialize a StateBasedChainer instance.
       </summary>
       <description>
         <para>
           This constructor initializes a StateBasedChainer class by
           filling arguments with appropriate values and calling the
           inherited constructor.
         </para>
       </description>
       <metainfo>
         <arguments>
           <argument maturity="stable">
             <name>protocol</name>
             <type>
               <link id="zorp.proto.id"/>
             </type>
             <default>ZD_PROTO_AUTO</default>
             <description>
               Optional, specifies connection protocol (<parameter>
               ZD_PROTO_TCP</parameter> or <parameter>ZD_PROTO_UDP
               </parameter>), when not specified it
               defaults to the same protocol used on the
               client side.
             </description>
           </argument>
           <argument>
             <name>timeout_connect</name>
             <type>
               <integer/>
             </type>
             <default>30000</default>
             <description>
               Specifies connection timeout to be used when
               connecting to the target server.
             </description>
           </argument>
           <argument>
             <name>timeout_state</name>
             <type>
               <integer/>
             </type>
             <default>60000</default>
             <description>
               The down state of remote hosts is kept for this interval in miliseconds.
             </description>
           </argument>
         </arguments>
       </metainfo>
     </method>
     """
     super(StateBasedChainer, self).__init__(protocol, timeout_connect)
     if not timeout_state:
         timeout_state = 60000
     self.state = TimedCache('chainer-state', int((timeout_state + 999) / 1000), update_stamp=FALSE)
コード例 #2
0
 def __init__(self, server_name, server_port=25, cache_timeout=60, attempt_delivery=FALSE, force_delivery_attempt=FALSE, sender_address='<>', bind_name=''):
     """<method maturity="stable">
       <summary>
       </summary>
       <description>
       </description>
       <metainfo>
       <arguments>
           <argument maturity="stable">
             <name>server_name</name>
             <type>
               <string/>
             </type>
             <description>
               Domain name of the SMTP server that will verify the addresses.
             </description>
           </argument>
           <argument maturity="stable">
             <name>server_port</name>
             <type>
               <integer/>
             </type>
             <default>25</default>
             <description>
               Port of the target server.
             </description>
           </argument>
           <argument maturity="stable">
             <name>cache_timeout</name>
             <type>
               <integer/>
             </type>
             <default>60</default>
             <description>
               How long will the result of an address verification be retained (in seconds).
             </description>
           </argument>
           <argument maturity="obsolete">
             <name>attempt_delivery</name>
             <type>
               <boolean/>
             </type>
             <default>FALSE</default>
             <description>
               Obsolete, ignored.
             </description>
           </argument>
           <argument maturity="stable">
             <name>force_delivery_attempt</name>
             <type>
               <boolean/>
             </type>
             <default>FALSE</default>
             <description>
               Force a delivery attempt even if the autodetection code otherwise
               would use VRFY. Useful if the server always returns success for VRFY.
             </description>
           </argument>
           <argument maturity="stable">
             <name>sender_address</name>
             <type>
               <string/>
             </type>
             <default>"&lt;&gt;"</default>
             <description>
               This value will be used as the mail sender for the
               attempted mail delivery. Mail delivery is attempted if
               the <parameter>force_delivery_attempt</parameter> is TRUE,
               or the recipient server does not support the VRFY command.
             </description>
           </argument>
           <argument maturity="stable">
             <name>bind_name</name>
             <type>
               <string/>
             </type>
             <default>""</default>
             <description>
               Specifies the hostname to bind to before initiating the connection to the SMTP server.
             </description>
           </argument>
         </arguments>
       </metainfo>
     </method>
     """
     super(SmtpInvalidRecipientMatcher, self).__init__()
     self.force_delivery_attempt = force_delivery_attempt
     self.server_name = server_name
     self.server_port = server_port
     self.bind_name = bind_name
     self.sender_address = sender_address
     self.cache = TimedCache('smtp_valid_recipients(%s)' % server_name, cache_timeout)
コード例 #3
0
ファイル: Auth.py プロジェクト: kkovaacs/zorp
 def __init__(self,
              name=None,
              timeout=600,
              update_stamp=TRUE,
              service_equiv=FALSE,
              cleanup_threshold=100):
     """
             <method maturity="stable">
               <summary>
                 Constructor to initialize an instance of the AuthCache class.
               </summary>
               <description>
                 <para>
                   This constructor initializes and registers an AuthCache
                   instance that can be referenced in authentication
                   policies.
                 </para>
               </description>
               <metainfo>
                 <arguments>
                   <argument maturity="obsolete">
                     <name>name</name>
                     <type>
                       <string/>
                     </type>
                     <default>None</default>
                     <description>
                       The name of the authentication cache, this will be
                       used to identify this authentication cache when
                       the obsolete AuthPolicy construct is used. Setting
                       this value is not required if
                       AuthenticationPolicy is used.
                     </description>
                   </argument>
                   <argument>
                     <name>timeout</name>
                     <type>
                       <integer/>
                     </type>
                     <default>600</default>
                     <description>
                       Timeout while an authentication is assumed to be valid.
                     </description>
                   </argument>
                   <argument>
                     <name>update_stamp</name>
                     <type>
                       <boolean/>
                     </type>
                     <default>TRUE</default>
                     <description>
                       If set to <parameter>TRUE</parameter>, then cached authentications increase
                       the validity period of the authentication cache. Otherwise, the authentication
                       cache expires according to the timeout value set in
                       <xref linkend="Auth___init___timeout"/><!-- FIXME ambiguous link, should point to
                       previous attribute-->.
                     </description>
                   </argument>
                   <argument>
                     <name>service_equiv</name>
                     <type>
                       <boolean/>
                     </type>
                     <default>FALSE</default>
                     <description>If enabled, then a single authentication of a user applies to every service from that client.</description>
                   </argument>
                   <argument>
                     <name>cleanup_threshold</name>
                     <type>
                       <integer/>
                     </type>
                     <default>100</default>
                     <description>
                       When the number of entries in the cache reaches the value of
                       <parameter>cleanup_threshold</parameter>, old entries are automatically
                       deleted.
                     </description>
                   </argument>
                 </arguments>
               </metainfo>
             </method>
             """
     if name:
         self.name = name
         cache_name = 'authcache(%s)' % self.name
     else:
         cache_name = 'authcache(noname)'
     self.cache = LockedCache(
         TimedCache(cache_name, timeout, update_stamp, cleanup_threshold))
     self.service_equiv = service_equiv
     if name:
         if Globals.auth_caches.has_key(name):
             raise ValueError, "Duplicate AuthCache name: %s" % name
         Globals.auth_caches[name] = self