Exemplo n.º 1
0
 def __init__(self, entry, ava, tag=None):
     LDAPProtocolRequest.__init__(self)
     BERSequence.__init__(self, [], tag=tag)
     assert entry is not None
     assert ava is not None
     self.entry = entry
     self.ava = ava
Exemplo n.º 2
0
    def __init__(self,
                 baseObject=None,
                 scope=None,
                 derefAliases=None,
                 sizeLimit=None,
                 timeLimit=None,
                 typesOnly=None,
                 filter=None,
                 attributes=None,
                 tag=None):
        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)

        if baseObject is not None:
            self.baseObject = baseObject
        if scope is not None:
            self.scope = scope
        if derefAliases is not None:
            self.derefAliases = derefAliases
        if sizeLimit is not None:
            self.sizeLimit = sizeLimit
        if timeLimit is not None:
            self.timeLimit = timeLimit
        if typesOnly is not None:
            self.typesOnly = typesOnly
        if filter is not None:
            self.filter = filter
        if attributes is not None:
            self.attributes = attributes
Exemplo n.º 3
0
    def __init__(self,
                 matchingRule=None,
                 type=None,
                 matchValue=None,
                 dnAttributes=None,
                 tag=None):
        BERSequence.__init__(self, value=[], tag=tag)
        assert matchValue is not None
        if isinstance(matchingRule, basestring):
            matchingRule = LDAPMatchingRuleAssertion_matchingRule(matchingRule)

        if isinstance(type, basestring):
            type = LDAPMatchingRuleAssertion_type(type)

        if isinstance(matchValue, basestring):
            matchValue = LDAPMatchingRuleAssertion_matchValue(matchValue)

        if isinstance(dnAttributes, bool):
            dnAttributes = LDAPMatchingRuleAssertion_dnAttributes(dnAttributes)

        self.matchingRule = matchingRule
        self.type = type
        self.matchValue = matchValue
        self.dnAttributes = dnAttributes
        if not self.dnAttributes:
            self.dnAttributes = None
Exemplo n.º 4
0
 def __init__(self, entry, ava, tag=None):
     LDAPProtocolRequest.__init__(self)
     BERSequence.__init__(self, [], tag=tag)
     assert entry is not None
     assert ava is not None
     self.entry = entry
     self.ava = ava
Exemplo n.º 5
0
    def __init__(self,
                 baseObject=None,
                 scope=None,
                 derefAliases=None,
                 sizeLimit=None,
                 timeLimit=None,
                 typesOnly=None,
                 filter=None,
                 attributes=None,
                 tag=None):
        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)

        if baseObject is not None:
            self.baseObject=baseObject
        if scope is not None:
            self.scope=scope
        if derefAliases is not None:
            self.derefAliases=derefAliases
        if sizeLimit is not None:
            self.sizeLimit=sizeLimit
        if timeLimit is not None:
            self.timeLimit=timeLimit
        if typesOnly is not None:
            self.typesOnly=typesOnly
        if filter is not None:
            self.filter=filter
        if attributes is not None:
            self.attributes=attributes
Exemplo n.º 6
0
    def __init__(self,
                 entry,
                 newrdn,
                 deleteoldrdn,
                 newSuperior=None,
                 tag=None):
        """
        Initialize the object

        Example usage::

                l=LDAPModifyDNRequest(entry='cn=foo,dc=example,dc=com',
                                      newrdn='someAttr=value',
                                      deleteoldrdn=0)
        """

        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)
        assert entry is not None
        assert newrdn is not None
        assert deleteoldrdn is not None
        self.entry = entry
        self.newrdn = newrdn
        self.deleteoldrdn = deleteoldrdn
        self.newSuperior = newSuperior
Exemplo n.º 7
0
 def __init__(self, objectName, attributes, tag=None):
     LDAPProtocolResponse.__init__(self)
     BERSequence.__init__(self, [], tag=tag)
     assert objectName is not None
     assert attributes is not None
     self.objectName=objectName
     self.attributes=attributes
Exemplo n.º 8
0
 def __init__(self,
              controlType, criticality=None, controlValue=None,
              id=None, tag=None):
     BERSequence.__init__(self, value=[], tag=tag)
     assert controlType is not None
     self.controlType = controlType
     self.criticality = criticality
     self.controlValue = controlValue
Exemplo n.º 9
0
 def __init__(self, requestName=None, requestValue=None, tag=None):
     LDAPProtocolRequest.__init__(self)
     BERSequence.__init__(self, [], tag=tag)
     assert requestName is not None
     assert isinstance(requestName, basestring)
     assert requestValue is None or isinstance(requestValue, basestring)
     self.requestName = requestName
     self.requestValue = requestValue
Exemplo n.º 10
0
 def __init__(self,
              controlType, criticality=None, controlValue=None,
              id=None, tag=None):
     BERSequence.__init__(self, value=[], tag=tag)
     assert controlType is not None
     self.controlType = controlType
     self.criticality = criticality
     self.controlValue = controlValue
Exemplo n.º 11
0
 def __init__(self, requestName, requestValue=None,
              tag=None):
     LDAPProtocolRequest.__init__(self)
     BERSequence.__init__(self, [], tag=tag)
     assert requestName is not None
     assert isinstance(requestName, basestring)
     self.requestName=requestName
     self.requestValue=requestValue
Exemplo n.º 12
0
 def __init__(self, value=None, controls=None, id=None, tag=None):
     BERSequence.__init__(self, value=[], tag=tag)
     assert value is not None
     self.id=id
     if self.id is None:
         self.id=alloc_ldap_message_id()
     self.value=value
     self.controls = controls
Exemplo n.º 13
0
 def __init__(self, matchingRule=None, type=None, matchValue=None, dnAttributes=None, tag=None):
     BERSequence.__init__(self, value=[], tag=tag)
     assert matchValue is not None
     self.matchingRule=matchingRule
     self.type=type
     self.matchValue=matchValue
     self.dnAttributes=dnAttributes
     if not self.dnAttributes:
         self.dnAttributes=None
Exemplo n.º 14
0
 def __init__(self,
              attributeDesc=None,
              assertionValue=None,
              tag=None,
              escaper=escape):
     BERSequence.__init__(self, value=[], tag=tag)
     assert attributeDesc is not None
     self.attributeDesc = attributeDesc
     self.assertionValue = assertionValue
     self.escaper = escaper
Exemplo n.º 15
0
 def __init__(self, version=None, dn=None, auth=None, tag=None):
     LDAPProtocolRequest.__init__(self)
     BERSequence.__init__(self, [], tag=tag)
     self.version=version
     if self.version is None:
         self.version=3
     self.dn=dn
     if self.dn is None:
         self.dn=''
     self.auth=auth
     if self.auth is None:
         self.auth=''
Exemplo n.º 16
0
 def __init__(self, version=None, dn=None, auth=None, tag=None):
     LDAPProtocolRequest.__init__(self)
     BERSequence.__init__(self, [], tag=tag)
     self.version = version
     if self.version is None:
         self.version = 3
     self.dn = dn
     if self.dn is None:
         self.dn = ''
     self.auth = auth
     if self.auth is None:
         self.auth = ''
Exemplo n.º 17
0
 def __init__(self, resultCode=None, matchedDN=None, errorMessage=None, referral=None, serverSaslCreds=None, tag=None):
     LDAPProtocolResponse.__init__(self)
     BERSequence.__init__(self, value=[], tag=tag)
     assert resultCode is not None
     self.resultCode=resultCode
     if matchedDN is None:
         matchedDN=''
     self.matchedDN=matchedDN
     if errorMessage is None:
         errorMessage=''
     self.errorMessage=errorMessage
     self.referral=referral
     self.serverSaslCreds=serverSaslCreds
Exemplo n.º 18
0
 def __init__(self, resultCode=None, matchedDN=None, errorMessage=None, referral=None, serverSaslCreds=None, tag=None):
     LDAPProtocolResponse.__init__(self)
     BERSequence.__init__(self, value=[], tag=tag)
     assert resultCode is not None
     self.resultCode=resultCode
     if matchedDN is None:
         matchedDN=''
     self.matchedDN=matchedDN
     if errorMessage is None:
         errorMessage=''
     self.errorMessage=errorMessage
     self.referral=referral
     self.serverSaslCreds=serverSaslCreds
Exemplo n.º 19
0
 def __init__(self,
              matchingRule=None,
              type=None,
              matchValue=None,
              dnAttributes=None,
              tag=None):
     BERSequence.__init__(self, value=[], tag=tag)
     assert matchValue is not None
     self.matchingRule = matchingRule
     self.type = type
     self.matchValue = matchValue
     self.dnAttributes = dnAttributes
     if not self.dnAttributes:
         self.dnAttributes = None
Exemplo n.º 20
0
    def __init__(self, version=None, dn=None, auth=None, tag=None, sasl=False):
        """Constructor for LDAP Bind Request

        For sasl=False, pass a string password for 'auth'
        For sasl=True, pass a tuple of (mechanism, credentials) for 'auth'"""

        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)
        self.version=version
        if self.version is None:
            self.version=3
        self.dn=dn
        if self.dn is None:
            self.dn=''
        self.auth=auth
        if self.auth is None:
            self.auth=''
            assert(not sasl)
        self.sasl=sasl
Exemplo n.º 21
0
    def __init__(self, version=None, dn=None, auth=None, tag=None, sasl=False):
        """Constructor for LDAP Bind Request

        For sasl=False, pass a string password for 'auth'
        For sasl=True, pass a tuple of (mechanism, credentials) for 'auth'"""

        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)
        self.version = version
        if self.version is None:
            self.version = 3
        self.dn = dn
        if self.dn is None:
            self.dn = ''
        self.auth = auth
        if self.auth is None:
            self.auth = ''
            assert (not sasl)
        self.sasl = sasl
Exemplo n.º 22
0
    def __init__(self, object=None, modification=None, tag=None):
        """
        Initialize the object

        Example usage::

                l = LDAPModifyRequest(
                    object='cn=foo,dc=example,dc=com',
                    modification=[

                      BERSequence([
                        BEREnumerated(0),
                        BERSequence([
                          LDAPAttributeDescription('attr1'),
                          BERSet([
                            LDAPString('value1'),
                            LDAPString('value2'),
                            ]),
                          ]),
                        ]),

                      BERSequence([
                        BEREnumerated(1),
                        BERSequence([
                          LDAPAttributeDescription('attr2'),
                          ]),
                        ]),

                    ])

        But more likely you just want to say::

        	mod = delta.ModifyOp('cn=foo,dc=example,dc=com',
                    [delta.Add('attr1', ['value1', 'value2']),
                     delta.Delete('attr1', ['value1', 'value2'])])
        	l = mod.asLDAP()
        """

        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)
        self.object=object
        self.modification=modification
Exemplo n.º 23
0
    def __init__(self, object=None, modification=None, tag=None):
        """
        Initialize the object

        Example usage::

                l = LDAPModifyRequest(
                    object='cn=foo,dc=example,dc=com',
                    modification=[

                      BERSequence([
                        BEREnumerated(0),
                        BERSequence([
                          LDAPAttributeDescription('attr1'),
                          BERSet([
                            LDAPString('value1'),
                            LDAPString('value2'),
                            ]),
                          ]),
                        ]),

                      BERSequence([
                        BEREnumerated(1),
                        BERSequence([
                          LDAPAttributeDescription('attr2'),
                          ]),
                        ]),

                    ])

        But more likely you just want to say::

        	mod = delta.ModifyOp('cn=foo,dc=example,dc=com',
                    [delta.Add('attr1', ['value1', 'value2']),
                     delta.Delete('attr1', ['value1', 'value2'])])
        	l = mod.asLDAP()
        """

        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)
        self.object = object
        self.modification = modification
Exemplo n.º 24
0
    def __init__(self, entry, newrdn, deleteoldrdn, newSuperior=None,
                 tag=None):
        """
        Initialize the object

        Example usage::

                l=LDAPModifyDNRequest(entry='cn=foo,dc=example,dc=com',
                                      newrdn='someAttr=value',
                                      deleteoldrdn=0)
        """

        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)
        assert entry is not None
        assert newrdn is not None
        assert deleteoldrdn is not None
        self.entry=entry
        self.newrdn=newrdn
        self.deleteoldrdn=deleteoldrdn
        self.newSuperior=newSuperior
Exemplo n.º 25
0
    def __init__(self, entry=None, attributes=None, tag=None):
        """
        Initialize the object

        Example usage::

                l=LDAPAddRequest(entry='cn=foo,dc=example,dc=com',
                        attributes=[(LDAPAttributeDescription("attrFoo"),
                             BERSet(value=(
                                 LDAPAttributeValue("value1"),
                                 LDAPAttributeValue("value2"),
                             ))),
                             (LDAPAttributeDescription("attrBar"),
                             BERSet(value=(
                                 LDAPAttributeValue("value1"),
                                 LDAPAttributeValue("value2"),
                             ))),
                             ])
"""

        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)
        self.entry = entry
        self.attributes = attributes
Exemplo n.º 26
0
    def __init__(self, entry=None, attributes=None, tag=None):
        """
        Initialize the object

        Example usage::

                l=LDAPAddRequest(entry='cn=foo,dc=example,dc=com',
                        attributes=[(LDAPAttributeDescription("attrFoo"),
                             BERSet(value=(
                                 LDAPAttributeValue("value1"),
                                 LDAPAttributeValue("value2"),
                             ))),
                             (LDAPAttributeDescription("attrBar"),
                             BERSet(value=(
                                 LDAPAttributeValue("value1"),
                                 LDAPAttributeValue("value2"),
                             ))),
                             ])
"""

        LDAPProtocolRequest.__init__(self)
        BERSequence.__init__(self, [], tag=tag)
        self.entry=entry
        self.attributes=attributes
Exemplo n.º 27
0
 def __init__(self, attributeDesc=None, assertionValue=None, tag=None):
     BERSequence.__init__(self, value=[], tag=tag)
     assert attributeDesc is not None
     self.attributeDesc=attributeDesc
     self.assertionValue=assertionValue
Exemplo n.º 28
0
 def __init__(self, type=None, substrings=None, tag=None):
     BERSequence.__init__(self, value=[], tag=tag)
     assert type is not None
     assert substrings is not None
     self.type = type
     self.substrings = substrings
Exemplo n.º 29
0
 def __init__(self, type=None, substrings=None, tag=None):
     BERSequence.__init__(self, value=[], tag=tag)
     assert type is not None
     assert substrings is not None
     self.type=type
     self.substrings=substrings