ldaptor API Reference¶
Subpackages¶
- ldaptor.protocols package
- Subpackages
- ldaptor.protocols.ldap package
- Subpackages
- Submodules
- ldaptor.protocols.ldap.distinguishedname module
- ldaptor.protocols.ldap.fetchschema module
- ldaptor.protocols.ldap.ldapclient module
- ldaptor.protocols.ldap.ldapconnector module
- ldaptor.protocols.ldap.ldaperrors module
- ldaptor.protocols.ldap.ldapserver module
- ldaptor.protocols.ldap.ldapsyntax module
- ldaptor.protocols.ldap.ldif module
- ldaptor.protocols.ldap.ldifdelta module
- ldaptor.protocols.ldap.ldifprotocol module
- ldaptor.protocols.ldap.proxy module
- ldaptor.protocols.ldap.svcbindproxy module
- Module contents
- ldaptor.protocols.ldap package
- Submodules
- ldaptor.protocols.pureber module
- ldaptor.protocols.pureldap module
- Module contents
- Subpackages
- ldaptor.samba package
Submodules¶
ldaptor.attributeset module¶
ldaptor.checkers module¶
ldaptor.config module¶
-
class
ldaptor.config.
LDAPConfig
(baseDN=None, serviceLocationOverrides=None, identityBaseDN=None, identitySearch=None)[source]¶ Bases:
object
-
baseDN
= None¶
-
identityBaseDN
= None¶
-
identitySearch
= None¶
-
ldaptor.delta module¶
Changes to the content of one single LDAP entry.
(This means these do not belong here: adding or deleting of entries, changing of location in tree)
-
class
ldaptor.delta.
Add
(key, *a, **kw)[source]¶ Bases:
ldaptor.delta.Modification
-
class
ldaptor.delta.
AddOp
(entry)[source]¶ Bases:
ldaptor.delta.Operation
-
class
ldaptor.delta.
Delete
(key, *a, **kw)[source]¶ Bases:
ldaptor.delta.Modification
-
class
ldaptor.delta.
DeleteOp
(dn)[source]¶ Bases:
ldaptor.delta.Operation
-
class
ldaptor.delta.
ModifyOp
(dn, modifications=[])[source]¶ Bases:
ldaptor.delta.Operation
ldaptor.dns module¶
DNS-related utilities.
ldaptor.entry module¶
-
class
ldaptor.entry.
BaseLDAPEntry
(dn, attributes={})[source]¶ Bases:
ldaptor._encoder.WireStrAlias
-
diff
(other)[source]¶ Compute differences between this and another LDAP entry.
@param other: An LDAPEntry to compare to.
@return: None if equal, otherwise a ModifyOp that would make this entry look like other.
-
dn
= None¶
-
-
class
ldaptor.entry.
EditableLDAPEntry
(dn, attributes={})[source]¶ Bases:
ldaptor.entry.BaseLDAPEntry
ldaptor.entryhelpers module¶
ldaptor.generate_password module¶
ldaptor.inmemory module¶
-
class
ldaptor.inmemory.
InMemoryLDIFProtocol
[source]¶ Bases:
ldaptor.protocols.ldap.ldifprotocol.LDIF
Receive LDIF data and gather results into an ReadOnlyInMemoryLDAPEntry.
You can override lookupFailed and addFailed to provide smarter error handling. They are called as Deferred errbacks; returning the reason causes error to pass onward and abort the whole operation. Returning None from lookupFailed skips that entry, but continues loading.
When the full LDIF data has been read, the completed Deferred will trigger.
-
exception
ldaptor.inmemory.
LDAPCannotRemoveRootError
(message=None)[source]¶ Bases:
ldaptor.protocols.ldap.ldaperrors.LDAPNamingViolation
Cannot remove root of LDAP tree
-
class
ldaptor.inmemory.
ReadOnlyInMemoryLDAPEntry
(*a, **kw)[source]¶ Bases:
ldaptor.entry.EditableLDAPEntry
,ldaptor.entryhelpers.DiffTreeMixin
,ldaptor.entryhelpers.SubtreeFromChildrenMixin
,ldaptor.entryhelpers.MatchMixin
,ldaptor.entryhelpers.SearchByTreeWalkingMixin
ldaptor.interfaces module¶
ldaptor.ldapfilter module¶
ldaptor.ldiftree module¶
Manage LDAP data as a tree of LDIF files.
-
exception
ldaptor.ldiftree.
LDAPCannotRemoveRootError
(message=None)[source]¶ Bases:
ldaptor.protocols.ldap.ldaperrors.LDAPNamingViolation
Cannot remove root of LDAP tree
-
class
ldaptor.ldiftree.
LDIFTreeEntry
(path, dn=None, *a, **kw)[source]¶ Bases:
ldaptor.entry.EditableLDAPEntry
,ldaptor.entryhelpers.DiffTreeMixin
,ldaptor.entryhelpers.SubtreeFromChildrenMixin
,ldaptor.entryhelpers.MatchMixin
,ldaptor.entryhelpers.SearchByTreeWalkingMixin
-
exception
ldaptor.ldiftree.
LDIFTreeEntryContainsMultipleEntries
[source]¶ Bases:
Exception
LDIFTree entry contains multiple LDIF entries.
-
exception
ldaptor.ldiftree.
LDIFTreeEntryContainsNoEntries
[source]¶ Bases:
Exception
LDIFTree entry does not contain a valid LDIF entry.
-
exception
ldaptor.ldiftree.
LDIFTreeNoSuchObject
[source]¶ Bases:
Exception
LDIFTree does not contain such entry.
-
class
ldaptor.ldiftree.
StoreParsedLDIF
[source]¶
ldaptor.numberalloc module¶
Find an available uidNumber/gidNumber/other similar number.
ldaptor.schema module¶
-
class
ldaptor.schema.
AttributeTypeDescription
(text)[source]¶ Bases:
ldaptor.schema.ASN1ParserThingie
,ldaptor._encoder.WireStrAlias
ASN Syntax:
AttributeTypeDescription = "(" whsp numericoid whsp ; AttributeType identifier [ "NAME" qdescrs ] ; name used in AttributeType [ "DESC" qdstring ] ; description [ "OBSOLETE" whsp ] [ "SUP" woid ] ; derived from this other AttributeType [ "EQUALITY" woid ; Matching Rule name [ "ORDERING" woid ; Matching Rule name [ "SUBSTR" woid ] ; Matching Rule name [ "SYNTAX" whsp noidlen whsp ] ; see section 4.3 [ "SINGLE-VALUE" whsp ] ; default multi-valued [ "COLLECTIVE" whsp ] ; default not collective [ "NO-USER-MODIFICATION" whsp ]; default user modifiable [ "USAGE" whsp AttributeUsage ]; default userApplications whsp ")" AttributeUsage = "userApplications" / "directoryOperation" / "distributedOperation" / ; DSA-shared "dSAOperation" ; DSA-specific, value depends on server noidlen = numericoid [ "{" len "}" ] len = numericstring
-
class
ldaptor.schema.
MatchingRuleDescription
(text)[source]¶ Bases:
ldaptor.schema.ASN1ParserThingie
,ldaptor._encoder.WireStrAlias
ASN Syntax:
MatchingRuleDescription = "(" whsp numericoid whsp ; MatchingRule identifier [ "NAME" qdescrs ] [ "DESC" qdstring ] [ "OBSOLETE" whsp ] "SYNTAX" numericoid whsp ")"
-
class
ldaptor.schema.
ObjectClassDescription
(text)[source]¶ Bases:
ldaptor.schema.ASN1ParserThingie
,ldaptor._encoder.WireStrAlias
ASN Syntax:
d = "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" numericstring = 1*d numericoid = numericstring *( "." numericstring ) space = 1*" " whsp = [ space ] descr = keystring qdescr = whsp "'" descr "'" whsp qdescrlist = [ qdescr *( qdescr ) ] ; object descriptors used as schema element names qdescrs = qdescr / ( whsp "(" qdescrlist ")" whsp ) dstring = 1*utf8 qdstring = whsp "'" dstring "'" whsp descr = keystring oid = descr / numericoid woid = whsp oid whsp ; set of oids of either form oids = woid / ( "(" oidlist ")" ) ObjectClassDescription = "(" whsp numericoid whsp ; ObjectClass identifier [ "NAME" qdescrs ] [ "DESC" qdstring ] [ "OBSOLETE" whsp ] [ "SUP" oids ] ; Superior ObjectClasses [ ( "ABSTRACT" / "STRUCTURAL" / "AUXILIARY" ) whsp ] ; default structural [ "MUST" oids ] ; AttributeTypes [ "MAY" oids ] ; AttributeTypes whsp ")"
-
class
ldaptor.schema.
SyntaxDescription
(text)[source]¶ Bases:
ldaptor.schema.ASN1ParserThingie
,ldaptor._encoder.WireStrAlias
ASN Syntax:
SyntaxDescription = "(" whsp numericoid whsp [ "DESC" qdstring ] whsp ")"
ldaptor.testutil module¶
Utilities for writing Twistedy unit tests and debugging.
-
class
ldaptor.testutil.
LDAPClientTestDriver
(*responses)[source]¶ Bases:
object
A test driver that looks somewhat like a real LDAPClient.
Pass in a list of lists of LDAPProtocolResponses. For each sent LDAP message, the first item of said list is iterated through, and all the items are sent as responses to the callback. The sent LDAP messages are stored in self.sent, so you can assert that the sent messages are what they are supposed to be.
It is also possible to include a Failure instance instead of a list of LDAPProtocolResponses which will cause the errback to be called with the failure.
-
fakeUnbindResponse
= 'fake-unbind-by-LDAPClientTestDriver'¶
-
-
ldaptor.testutil.
createServer
(proto, *responses, **kw)[source]¶ Create an LDAP server for testing. :param proto: The server protocol factory (e.g. ProxyBase). :param responses: The responses to initialize the LDAPClientTestDrive. :param proto_args: Optional mapping passed as keyword args to protocol factory.
ldaptor.usage module¶
Command line argument/options available to various ldaptor tools.
-
class
ldaptor.usage.
Options_base_optional
[source]¶ Bases:
object
-
optParameters
= (('base', None, None, 'LDAP base dn'),)¶
-
-
class
ldaptor.usage.
Options_bind
[source]¶ Bases:
object
-
optParameters
= (('binddn', None, None, 'use Distinguished Name to bind to the directory'), ('bind-auth-fd', None, None, 'read bind password from filedescriptor'))¶
-
-
class
ldaptor.usage.
Options_bind_mandatory
[source]¶ Bases:
ldaptor.usage.Options_bind
-
class
ldaptor.usage.
Options_scope
[source]¶ Bases:
object
-
optParameters
= (('scope', None, 'sub', 'LDAP search scope (one of base, one, sub)'),)¶
-
Module contents¶
A Pure-Python Twisted library for LDAP