Stripped trailing white-spaces
This commit is contained in:
@@ -3,7 +3,7 @@ ldap.async - handle async LDAP operations
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: async.py,v 1.33 2013/09/21 03:55:38 stroeder Exp $
|
||||
\$Id: async.py,v 1.34 2015/06/06 09:21:37 stroeder Exp $
|
||||
|
||||
Python compability note:
|
||||
Tested on Python 2.0+ but should run on Python 1.5.x.
|
||||
@@ -103,7 +103,7 @@ class AsyncSearchHandler:
|
||||
|
||||
def afterFirstResult(self):
|
||||
"""
|
||||
Do anything you want right after successfully receiving but before
|
||||
Do anything you want right after successfully receiving but before
|
||||
processing first result
|
||||
"""
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ controls.py - support classes for LDAP controls
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
$Id: __init__.py,v 1.9 2013/05/29 20:27:32 stroeder Exp $
|
||||
$Id: __init__.py,v 1.10 2015/06/06 09:21:38 stroeder Exp $
|
||||
|
||||
Description:
|
||||
The ldap.controls module provides LDAPControl classes.
|
||||
@@ -45,7 +45,7 @@ except ImportError:
|
||||
class RequestControl:
|
||||
"""
|
||||
Base class for all request controls
|
||||
|
||||
|
||||
controlType
|
||||
OID as string of the LDAPv3 extended request control
|
||||
criticality
|
||||
|
||||
@@ -5,7 +5,7 @@ by OpenLDAP functions
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
$Id: libldap.py,v 1.2 2011/07/23 07:42:04 stroeder Exp $
|
||||
$Id: libldap.py,v 1.3 2015/06/06 09:21:38 stroeder Exp $
|
||||
"""
|
||||
|
||||
import _ldap,ldap
|
||||
@@ -20,8 +20,8 @@ class AssertionControl(RequestControl):
|
||||
LDAP filter string specifying which assertions have to match
|
||||
so that the server processes the operation
|
||||
"""
|
||||
|
||||
controlType = ldap.CONTROL_ASSERT
|
||||
|
||||
controlType = ldap.CONTROL_ASSERT
|
||||
def __init__(self,criticality=True,filterstr='(objectClass=*)'):
|
||||
self.criticality = criticality
|
||||
self.filterstr = filterstr
|
||||
@@ -40,9 +40,9 @@ class MatchedValuesControl(RequestControl):
|
||||
LDAP filter string specifying which attribute values
|
||||
should be returned
|
||||
"""
|
||||
|
||||
|
||||
controlType = ldap.CONTROL_VALUESRETURNFILTER
|
||||
|
||||
|
||||
def __init__(self,criticality=False,filterstr='(objectClass=*)'):
|
||||
self.criticality = criticality
|
||||
self.filterstr = filterstr
|
||||
|
||||
@@ -5,7 +5,7 @@ ldap.controls.ppolicy - classes for Password Policy controls
|
||||
|
||||
See http://www.python-ldap.org/ for project details.
|
||||
|
||||
$Id: ppolicy.py,v 1.3 2011/11/27 15:26:06 stroeder Exp $
|
||||
$Id: ppolicy.py,v 1.4 2015/06/06 09:21:38 stroeder Exp $
|
||||
"""
|
||||
|
||||
__all__ = [
|
||||
@@ -91,6 +91,6 @@ class PasswordPolicyControl(ValueLessRequestControl,ResponseControl):
|
||||
self.error = None
|
||||
else:
|
||||
self.error = int(error)
|
||||
|
||||
|
||||
|
||||
KNOWN_RESPONSE_CONTROLS[PasswordPolicyControl.controlType] = PasswordPolicyControl
|
||||
|
||||
@@ -4,7 +4,7 @@ ldap.controls.simple - classes for some very simple LDAP controls
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
$Id: simple.py,v 1.9 2012/08/09 07:01:20 stroeder Exp $
|
||||
$Id: simple.py,v 1.10 2015/06/06 09:21:38 stroeder Exp $
|
||||
"""
|
||||
|
||||
import struct,ldap
|
||||
@@ -34,7 +34,7 @@ class ValueLessRequestControl(RequestControl):
|
||||
class OctetStringInteger(LDAPControl):
|
||||
"""
|
||||
Base class with controlValue being unsigend integer values
|
||||
|
||||
|
||||
integerValue
|
||||
Integer to be sent as OctetString
|
||||
"""
|
||||
@@ -49,7 +49,7 @@ class OctetStringInteger(LDAPControl):
|
||||
|
||||
def decodeControlValue(self,encodedControlValue):
|
||||
self.integerValue = struct.unpack('!Q',encodedControlValue)[0]
|
||||
|
||||
|
||||
|
||||
class BooleanControl(LDAPControl):
|
||||
"""
|
||||
@@ -100,7 +100,7 @@ KNOWN_RESPONSE_CONTROLS[ldap.CONTROL_RELAX] = RelaxRulesControl
|
||||
class ProxyAuthzControl(RequestControl):
|
||||
"""
|
||||
Proxy Authorization Control
|
||||
|
||||
|
||||
authzId
|
||||
string containing the authorization ID indicating the identity
|
||||
on behalf which the server should process the request
|
||||
@@ -123,9 +123,9 @@ class AuthorizationIdentityRequestControl(ValueLessRequestControl):
|
||||
class AuthorizationIdentityResponseControl(ResponseControl):
|
||||
"""
|
||||
Authorization Identity Request and Response Controls
|
||||
|
||||
|
||||
Class attributes:
|
||||
|
||||
|
||||
authzId
|
||||
decoded authorization identity
|
||||
"""
|
||||
|
||||
@@ -3,7 +3,7 @@ dn.py - misc stuff for handling distinguished names (see RFC 4514)
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: dn.py,v 1.12 2014/05/20 20:15:15 stroeder Exp $
|
||||
\$Id: dn.py,v 1.13 2015/06/06 09:21:37 stroeder Exp $
|
||||
|
||||
Compability:
|
||||
- Tested with Python 2.0+
|
||||
@@ -31,7 +31,7 @@ def escape_dn_chars(s):
|
||||
s = s.replace('>' ,'\\>')
|
||||
s = s.replace(';' ,'\\;')
|
||||
s = s.replace('=' ,'\\=')
|
||||
s = s.replace('\000' ,'\\\000')
|
||||
s = s.replace('\000' ,'\\\000')
|
||||
if s[0]=='#' or s[0]==' ':
|
||||
s = ''.join(('\\',s))
|
||||
if s[-1]==' ':
|
||||
@@ -43,7 +43,7 @@ def str2dn(dn,flags=0):
|
||||
"""
|
||||
This function takes a DN as string as parameter and returns
|
||||
a decomposed DN. It's the inverse to dn2str().
|
||||
|
||||
|
||||
flags describes the format of the dn
|
||||
|
||||
See also the OpenLDAP man-page ldap_str2dn(3)
|
||||
@@ -69,7 +69,7 @@ def dn2str(dn):
|
||||
def explode_dn(dn,notypes=0,flags=0):
|
||||
"""
|
||||
explode_dn(dn [, notypes=0]) -> list
|
||||
|
||||
|
||||
This function takes a DN and breaks it up into its component parts.
|
||||
The notypes parameter is used to specify that only the component's
|
||||
attribute values be returned and not the attribute types.
|
||||
@@ -95,7 +95,7 @@ def explode_dn(dn,notypes=0,flags=0):
|
||||
def explode_rdn(rdn,notypes=0,flags=0):
|
||||
"""
|
||||
explode_rdn(rdn [, notypes=0]) -> list
|
||||
|
||||
|
||||
This function takes a RDN and breaks it up into its component parts
|
||||
if it is a multi-valued RDN.
|
||||
The notypes parameter is used to specify that only the component's
|
||||
|
||||
@@ -3,7 +3,7 @@ filters.py - misc stuff for handling LDAP filter strings (see RFC2254)
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: filter.py,v 1.9 2011/07/22 07:20:53 stroeder Exp $
|
||||
\$Id: filter.py,v 1.10 2015/06/06 09:21:37 stroeder Exp $
|
||||
|
||||
Compability:
|
||||
- Tested with Python 2.0+
|
||||
@@ -16,7 +16,7 @@ def escape_filter_chars(assertion_value,escape_mode=0):
|
||||
"""
|
||||
Replace all special characters found in assertion_value
|
||||
by quoted notation.
|
||||
|
||||
|
||||
escape_mode
|
||||
If 0 only special chars mentioned in RFC 4515 are escaped.
|
||||
If 1 all NON-ASCII chars are escaped.
|
||||
@@ -41,7 +41,7 @@ def escape_filter_chars(assertion_value,escape_mode=0):
|
||||
s = s.replace(r'(', r'\28')
|
||||
s = s.replace(r')', r'\29')
|
||||
s = s.replace('\x00', r'\00')
|
||||
return s
|
||||
return s
|
||||
|
||||
|
||||
def filter_format(filter_template,assertion_values):
|
||||
|
||||
@@ -3,7 +3,7 @@ functions.py - wraps functions of module _ldap
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: functions.py,v 1.30 2014/05/20 20:44:28 stroeder Exp $
|
||||
\$Id: functions.py,v 1.31 2015/06/06 09:21:37 stroeder Exp $
|
||||
|
||||
Compability:
|
||||
- Tested with Python 2.0+ but should work with Python 1.5.x
|
||||
@@ -135,7 +135,7 @@ def set_option(option,invalue):
|
||||
|
||||
def escape_str(escape_func,s,*args):
|
||||
"""
|
||||
Applies escape_func() to all items of `args' and returns a string based
|
||||
Applies escape_func() to all items of `args' and returns a string based
|
||||
on format string `s'.
|
||||
"""
|
||||
escape_args = map(escape_func,args)
|
||||
|
||||
@@ -3,7 +3,7 @@ ldapobject.py - wraps class _ldap.LDAPObject
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: ldapobject.py,v 1.144 2015/05/02 16:19:23 stroeder Exp $
|
||||
\$Id: ldapobject.py,v 1.145 2015/06/06 09:21:38 stroeder Exp $
|
||||
|
||||
Compability:
|
||||
- Tested with Python 2.0+ but should work with Python 1.5.x
|
||||
@@ -139,7 +139,7 @@ class SimpleLDAPObject:
|
||||
def fileno():
|
||||
"""
|
||||
Returns file description of LDAP connection.
|
||||
|
||||
|
||||
Just a convenience wrapper for LDAPObject.get_option(ldap.OPT_DESC)
|
||||
"""
|
||||
return self.get_option(ldap.OPT_DESC)
|
||||
@@ -662,7 +662,7 @@ class SimpleLDAPObject:
|
||||
def read_s(self,dn,filterstr=None,attrlist=None,serverctrls=None,clientctrls=None,timeout=-1):
|
||||
"""
|
||||
Reads and returns a single entry specified by `dn'.
|
||||
|
||||
|
||||
Other attributes just like those passed to `search_ext_s()'
|
||||
"""
|
||||
r = self.search_ext_s(
|
||||
|
||||
@@ -9,7 +9,7 @@ class logging_file_class:
|
||||
|
||||
def __init__(self,logging_level):
|
||||
self._logging_level = logging_level
|
||||
|
||||
|
||||
def write(self,msg):
|
||||
logging.log(self._logging_level,msg[:-1])
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ sasl.py - support for SASL mechanism
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: sasl.py,v 1.16 2014/03/23 19:06:47 stroeder Exp $
|
||||
\$Id: sasl.py,v 1.17 2015/06/06 09:21:38 stroeder Exp $
|
||||
|
||||
Description:
|
||||
The ldap.sasl module provides SASL authentication classes.
|
||||
@@ -63,7 +63,7 @@ class sasl:
|
||||
useful for writing generic sasl GUIs, which would need to know all
|
||||
the questions to ask, before the answers are returned to the sasl
|
||||
lib (in contrast to one question at a time)."""
|
||||
|
||||
|
||||
# The following print command might be useful for debugging
|
||||
# new sasl mechanisms. So it is left here
|
||||
cb_result = self.cb_value_dict.get(cb_id,defresult) or ''
|
||||
@@ -73,7 +73,7 @@ class sasl:
|
||||
cb_id, challenge, prompt, repr(defresult), repr(self.cb_value_dict.get(cb_result))
|
||||
))
|
||||
return cb_result
|
||||
|
||||
|
||||
|
||||
class cram_md5(sasl):
|
||||
"""This class handles SASL CRAM-MD5 authentication."""
|
||||
|
||||
@@ -3,7 +3,7 @@ schema.py - support for subSchemaSubEntry information
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: models.py,v 1.47 2014/03/12 21:44:10 stroeder Exp $
|
||||
\$Id: models.py,v 1.48 2015/06/06 09:21:38 stroeder Exp $
|
||||
"""
|
||||
|
||||
import UserDict,ldap.cidict
|
||||
@@ -36,7 +36,7 @@ class SchemaElement:
|
||||
Base class for all schema element classes. Not used directly!
|
||||
|
||||
Arguments:
|
||||
|
||||
|
||||
schema_element_str
|
||||
String which contains the schema element description to be parsed.
|
||||
|
||||
@@ -51,7 +51,7 @@ class SchemaElement:
|
||||
token_defaults = {
|
||||
'DESC':(None,),
|
||||
}
|
||||
|
||||
|
||||
def __init__(self,schema_element_str=None):
|
||||
if schema_element_str:
|
||||
l = split_tokens(schema_element_str,self.token_defaults)
|
||||
@@ -72,7 +72,7 @@ class SchemaElement:
|
||||
def key_attr(self,key,value,quoted=0):
|
||||
assert value is None or type(value)==StringType,TypeError("value has to be of StringType, was %s" % repr(value))
|
||||
if value:
|
||||
if quoted:
|
||||
if quoted:
|
||||
return " %s '%s'" % (key,value.replace("'","\\'"))
|
||||
else:
|
||||
return " %s %s" % (key,value)
|
||||
@@ -101,7 +101,7 @@ class SchemaElement:
|
||||
class ObjectClass(SchemaElement):
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
|
||||
schema_element_str
|
||||
String containing an ObjectClassDescription
|
||||
|
||||
@@ -194,7 +194,7 @@ AttributeUsage = ldap.cidict.cidict({
|
||||
class AttributeType(SchemaElement):
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
|
||||
schema_element_str
|
||||
String containing an AttributeTypeDescription
|
||||
|
||||
@@ -336,7 +336,7 @@ class LDAPSyntax(SchemaElement):
|
||||
This string contains description text (DESC) of the LDAP syntax
|
||||
not_human_readable
|
||||
Integer flag (0 or 1) indicating whether the attribute type is marked
|
||||
as not human-readable (X-NOT-HUMAN-READABLE)
|
||||
as not human-readable (X-NOT-HUMAN-READABLE)
|
||||
"""
|
||||
schema_attribute = 'ldapSyntaxes'
|
||||
token_defaults = {
|
||||
@@ -355,7 +355,7 @@ class LDAPSyntax(SchemaElement):
|
||||
self.x_binary_transfer_required = d['X-BINARY-TRANSFER-REQUIRED'][0]=='TRUE'
|
||||
assert self.desc is None or type(self.desc)==StringType
|
||||
return
|
||||
|
||||
|
||||
def __str__(self):
|
||||
result = [str(self.oid)]
|
||||
result.append(self.key_attr('DESC',self.desc,quoted=1))
|
||||
@@ -369,7 +369,7 @@ class LDAPSyntax(SchemaElement):
|
||||
class MatchingRule(SchemaElement):
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
|
||||
schema_element_str
|
||||
String containing an MatchingRuleDescription
|
||||
|
||||
@@ -418,7 +418,7 @@ class MatchingRule(SchemaElement):
|
||||
class MatchingRuleUse(SchemaElement):
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
|
||||
schema_element_str
|
||||
String containing an MatchingRuleUseDescription
|
||||
|
||||
@@ -468,7 +468,7 @@ class MatchingRuleUse(SchemaElement):
|
||||
class DITContentRule(SchemaElement):
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
|
||||
schema_element_str
|
||||
String containing an DITContentRuleDescription
|
||||
|
||||
@@ -541,7 +541,7 @@ class DITContentRule(SchemaElement):
|
||||
class DITStructureRule(SchemaElement):
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
|
||||
schema_element_str
|
||||
String containing an DITStructureRuleDescription
|
||||
|
||||
@@ -604,7 +604,7 @@ class DITStructureRule(SchemaElement):
|
||||
class NameForm(SchemaElement):
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
|
||||
schema_element_str
|
||||
String containing an NameFormDescription
|
||||
|
||||
@@ -670,7 +670,7 @@ class NameForm(SchemaElement):
|
||||
class Entry(UserDict.UserDict):
|
||||
"""
|
||||
Schema-aware implementation of an LDAP entry class.
|
||||
|
||||
|
||||
Mainly it holds the attributes in a string-keyed dictionary with
|
||||
the OID as key.
|
||||
"""
|
||||
|
||||
@@ -3,7 +3,7 @@ ldap.schema.subentry - subschema subentry handling
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: subentry.py,v 1.34 2013/09/13 18:02:47 stroeder Exp $
|
||||
\$Id: subentry.py,v 1.35 2015/06/06 09:21:38 stroeder Exp $
|
||||
"""
|
||||
|
||||
import ldap.cidict,ldap.schema
|
||||
@@ -75,7 +75,7 @@ class SubSchema:
|
||||
non_unique_oids
|
||||
List of OIDs used at least twice in the subschema
|
||||
non_unique_names
|
||||
List of NAMEs used at least twice in the subschema for the same schema element
|
||||
List of NAMEs used at least twice in the subschema for the same schema element
|
||||
"""
|
||||
|
||||
def __init__(self,sub_schema_sub_entry,check_uniqueness=1):
|
||||
|
||||
@@ -4,7 +4,7 @@ ldap.syncrepl - for implementing syncrepl consumer (see RFC 4533)
|
||||
|
||||
See http://www.python-ldap.org/ for project details.
|
||||
|
||||
$Id: syncrepl.py,v 1.6 2014/09/26 16:11:43 stroeder Exp $
|
||||
$Id: syncrepl.py,v 1.7 2015/06/06 09:21:38 stroeder Exp $
|
||||
"""
|
||||
|
||||
#__all__ = [
|
||||
@@ -316,9 +316,9 @@ class SyncreplConsumer:
|
||||
methods to store the cookie appropriately, rather than
|
||||
passing it.
|
||||
|
||||
Only a single syncrepl search may be active on a SyncreplConsumer
|
||||
object. Multiple concurrent syncrepl searches require multiple
|
||||
separate SyncreplConsumer objects and thus multiple connections
|
||||
Only a single syncrepl search may be active on a SyncreplConsumer
|
||||
object. Multiple concurrent syncrepl searches require multiple
|
||||
separate SyncreplConsumer objects and thus multiple connections
|
||||
(LDAPObject instances).
|
||||
"""
|
||||
if cookie is None:
|
||||
|
||||
@@ -3,7 +3,7 @@ ldapurl - handling of LDAP URLs as described in RFC 4516
|
||||
|
||||
See http://www.python-ldap.org/ for details.
|
||||
|
||||
\$Id: ldapurl.py,v 1.71 2015/06/05 21:04:58 stroeder Exp $
|
||||
\$Id: ldapurl.py,v 1.72 2015/06/06 09:21:37 stroeder Exp $
|
||||
|
||||
Python compability note:
|
||||
This module only works with Python 2.0+ since
|
||||
@@ -73,7 +73,7 @@ class LDAPUrlExtension:
|
||||
Usable class attributes:
|
||||
critical
|
||||
Boolean integer marking the extension as critical
|
||||
extype
|
||||
extype
|
||||
Type of extension
|
||||
exvalue
|
||||
Value of extension
|
||||
@@ -112,7 +112,7 @@ class LDAPUrlExtension:
|
||||
'!'*(self.critical>0),
|
||||
self.extype,quote(self.exvalue or '')
|
||||
)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return self.unparse()
|
||||
|
||||
@@ -177,7 +177,7 @@ class LDAPUrlExtensions(UserDict.UserDict):
|
||||
"other has to be instance of %s" % (self.__class__)
|
||||
)
|
||||
return self.data==other.data
|
||||
|
||||
|
||||
def parse(self,extListStr):
|
||||
for extension_str in extListStr.strip().split(','):
|
||||
if extension_str:
|
||||
@@ -358,11 +358,11 @@ class LDAPUrl:
|
||||
if self.extensions:
|
||||
ldap_url = ldap_url+'?'+self.extensions.unparse()
|
||||
return ldap_url
|
||||
|
||||
|
||||
def htmlHREF(self,urlPrefix='',hrefText=None,hrefTarget=None):
|
||||
"""
|
||||
Returns a string with HTML link for this LDAP URL.
|
||||
|
||||
|
||||
urlPrefix
|
||||
Prefix before LDAP URL (e.g. for addressing another web-based client)
|
||||
hrefText
|
||||
|
||||
Reference in New Issue
Block a user