示例#1
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
示例#2
0
文件: pureldap.py 项目: im-0/ldaptor
 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
示例#3
0
文件: pureldap.py 项目: im-0/ldaptor
 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
示例#4
0
文件: pureldap.py 项目: im-0/ldaptor
    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
示例#5
0
文件: pureldap.py 项目: im-0/ldaptor
    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
示例#6
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
示例#7
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
示例#8
0
文件: pureldap.py 项目: im-0/ldaptor
 def __str__(self):
     return str(
         BERSequence([
             LDAPString(self.entry),
             BERSequence(map(BERSequence, self.attributes)),
         ],
                     tag=self.tag))
示例#9
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
示例#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
示例#11
0
文件: pureldap.py 项目: im-0/ldaptor
 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
示例#12
0
文件: pureldap.py 项目: im-0/ldaptor
 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
示例#13
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
示例#14
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
示例#15
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
示例#16
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
示例#17
0
 def __str__(self):
     if not self.sasl:
         auth_ber = BEROctetString(self.auth, tag=CLASS_CONTEXT|0)
     else:
         auth_ber = BERSequence([BEROctetString(self.auth[0]), BEROctetString(self.auth[1])], tag=CLASS_CONTEXT|3)
     return str(BERSequence([
         BERInteger(self.version),
         BEROctetString(self.dn),
         auth_ber,
         ], tag=self.tag))
示例#18
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
示例#19
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 = ''
示例#20
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=''
示例#21
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
示例#22
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
示例#23
0
文件: pureldap.py 项目: im-0/ldaptor
 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
示例#24
0
 def __str__(self):
     self.data=[LDAPOID(self.controlType)]
     if self.criticality is not None:
         self.data.append(BERBoolean(self.criticality))
     if self.controlValue is not None:
         self.data.append(BEROctetString(self.controlValue))
     return BERSequence.__str__(self)
示例#25
0
文件: pureldap.py 项目: im-0/ldaptor
 def __str__(self):
     return str(
         BERSequence(filter(lambda x: x is not None, [
             self.matchingRule, self.type, self.matchValue,
             self.dnAttributes
         ]),
                     tag=self.tag))
示例#26
0
文件: pureldap.py 项目: im-0/ldaptor
 def __str__(self):
     self.data = [LDAPOID(self.controlType)]
     if self.criticality is not None:
         self.data.append(BERBoolean(self.criticality))
     if self.controlValue is not None:
         self.data.append(BEROctetString(self.controlValue))
     return BERSequence.__str__(self)
示例#27
0
 def __str__(self):
     assert self.referral is None #TODO
     return str(BERSequence([
         BEREnumerated(self.resultCode),
         BEROctetString(self.matchedDN),
         BEROctetString(self.errorMessage),
         #TODO referral [3] Referral OPTIONAL
         ], tag=self.tag))
示例#28
0
 def __str__(self):
     return str(
         BERSequence([
             BERInteger(self.version),
             BEROctetString(self.dn),
             BEROctetString(self.auth, tag=CLASS_CONTEXT | 0),
         ],
                     tag=self.tag))
示例#29
0
 def __str__(self):
     return str(BERSequence([
         BEROctetString(self.objectName),
         BERSequence(map(lambda (attr,li):
                         BERSequence([BEROctetString(attr),
                                      BERSet(map(BEROctetString,
                                                 li))]),
                         self.attributes)),
         ], tag=self.tag))
示例#30
0
文件: pureldap.py 项目: im-0/ldaptor
 def __str__(self):
     l = [
         LDAPString(self.entry),
         LDAPString(self.newrdn),
         BERBoolean(self.deleteoldrdn),
     ]
     if self.newSuperior is not None:
         l.append(LDAPString(self.newSuperior, tag=CLASS_CONTEXT | 0))
     return str(BERSequence(l, tag=self.tag))
示例#31
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
示例#32
0
文件: pureldap.py 项目: im-0/ldaptor
    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
示例#33
0
文件: pureldap.py 项目: im-0/ldaptor
    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
示例#34
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
示例#35
0
 def __str__(self):
     return str(BERSequence([
         BEROctetString(self.baseObject),
         BEREnumerated(self.scope),
         BEREnumerated(self.derefAliases),
         BERInteger(self.sizeLimit),
         BERInteger(self.timeLimit),
         BERBoolean(self.typesOnly),
         self.filter,
         BERSequenceOf(map(BEROctetString, self.attributes)),
         ], tag=self.tag))
示例#36
0
 def __str__(self):
     assert self.referral is None #TODO
     l=[BEREnumerated(self.resultCode),
        BEROctetString(self.matchedDN),
        BEROctetString(self.errorMessage),
        #TODO referral [3] Referral OPTIONAL
        ]
     if self.responseName is not None:
         l.append(LDAPOID(self.responseName, tag=CLASS_CONTEXT|0x0a))
     if self.response is not None:
         l.append(BEROctetString(self.response, tag=CLASS_CONTEXT|0x0b))
     return str(BERSequence(l, tag=self.tag))
示例#37
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
示例#38
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
示例#39
0
文件: pureldap.py 项目: im-0/ldaptor
    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
示例#40
0
    def __init__(self, requestName=None,
                 userIdentity=None, oldPasswd=None, newPasswd=None,
                 tag=None):
        assert (requestName is None
                or requestName == self.oid), \
                '%s requestName was %s instead of %s' \
                % (self.__class__.__name__, requestName, self.oid)
        #TODO genPasswd

        l=[]
        if userIdentity is not None:
            l.append(LDAPPasswordModifyRequest_userIdentity(userIdentity))
        if oldPasswd is not None:
            l.append(LDAPPasswordModifyRequest_oldPasswd(oldPasswd))
        if newPasswd is not None:
            l.append(LDAPPasswordModifyRequest_newPasswd(newPasswd))
        LDAPExtendedRequest.__init__(
            self,
            requestName=self.oid,
            requestValue=str(BERSequence(l)),
            tag=tag)
示例#41
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
示例#42
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
示例#43
0
文件: pureldap.py 项目: im-0/ldaptor
 def __str__(self):
     l = [LDAPOID(self.requestName, tag=CLASS_CONTEXT | 0)]
     if self.requestValue is not None:
         l.append(
             BEROctetString(str(self.requestValue), tag=CLASS_CONTEXT | 1))
     return str(BERSequence(l, tag=self.tag))
示例#44
0
文件: pureldap.py 项目: im-0/ldaptor
 def __str__(self):
     return str(
         BERSequence([self.attributeDesc, self.assertionValue],
                     tag=self.tag))
示例#45
0
文件: pureldap.py 项目: im-0/ldaptor
 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
示例#46
0
文件: pureldap.py 项目: im-0/ldaptor
 def __str__(self):
     return str(
         BERSequence([LDAPString(self.type),
                      BERSequence(self.substrings)],
                     tag=self.tag))