How to use the template.protocol.ber.SEQUENCE function in template

To help you get started, we’ve selected a few template examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arizvisa / syringe / template / protocol / ldap.py View on Github external
class LDAPDN(LDAPString): pass
class RelativeLDAPDN(LDAPString): pass
class AttributeDescription(LDAPString): pass
class AttributeValue(ber.OCTETSTRING): pass
class MatchingRuleId(LDAPString): pass

class Op(record): pass

class Control(ber.SEQUENCE):
    _fields_ = [
        (LDAPOID, 'controlType'),
        (ber.BOOLEAN, 'criticality'),
        (OPTIONAL(ber.OCTETSTRING), 'controlValue'),
    ]

class LDAPMessage(ber.SEQUENCE):
    _fields_ = [
        (MessageID, 'MessageID'),
        (Op, 'protocolOp'),
        (Control, 'controls'),
    ]

class ResultCode(ber.ENUMERATED):
    _values_ = [
        ('success', 0),
        ('operationsError', 1),
        ('protocolError', 2),
        ('timeLimitExceeded', 3),
        ('sizeLimitExceeded', 4),
        ('compareFalse', 5),
        ('compareTrue', 6),
        ('authMethodNotSupported', 7),
github arizvisa / syringe / template / protocol / ldap.py View on Github external
@Application.define
class ModifyDNRequest(ber.SEQUENCE):
    tag = 12
    _fields_ = [
        (LDAPDN, 'entry'),
        (RelativeLDAPDN, 'newrdn'),
        (ber.BOOLEAN, 'deleteoldrdn'),
        (OPTIONAL(LDAPDN), 'newSuperior'),
    ]

@Application.define
class ModifyDNResponse(LDAPResult):
    tag = 13

@Application.define
class CompareRequest(ber.SEQUENCE):
    tag = 14
    _fields_ = [
        (LDAPDN, 'entry'),
        (AttributeValueAssertion, 'ava'),
    ]

@Application.define
class CompareResponse(LDAPResult):
    tag = 15

@Application.define
class AbandonRequest(MessageID):
    tag = 16

@Application.define
class ExtendedRequest(ber.SEQUENCE):
github arizvisa / syringe / template / protocol / ldap.py View on Github external
(LDAPDN, 'objectName'),
        (PartialAttributeList, 'attributes'),
    ]

@Application.define
class SearchResultReference(SEQUENCEOF(URI)):
    tag = 19

@Application.define
class SearchResultDone(LDAPResult):
    tag = 5

@Application.define
class ModifyRequest(ber.SEQUENCE):
    tag = 6
    class change(ber.SEQUENCE):
        class operation(ber.ENUMERATED):
            _values_ = [(0,'add'), (1,'delete'), (2,'replace')]
        _fields_ = [
            (operation, 'operation'),
            (PartialAttribute, 'modification'),
        ]
    _fields_ = [
        (LDAPDN, 'object'),
        (SEQUENCEOF(change), 'changes'),
    ]

@Application.define
class ModifyResponse(LDAPResult):
    tag = 7

@Application.define
github arizvisa / syringe / template / protocol / ldap.py View on Github external
('entryAlreadyExists', 68),
        ('objectClassModsProhibited', 69),
        ('CLDAP', 70),
        ('affectsMultipleDSAs', 71),
        ('other', 80),
    ]

class AssertionValue(ber.OCTETSTRING): pass

class AttributeValueAssertion(ber.SEQUENCE):
    _fields_ = [
        (AttributeDescription, 'attributeDesc'),
        (AssertionValue, 'assertionValue'),
    ]

class PartialAttribute(ber.SEQUENCE):
    _fields_ = [
        (AttributeDescription, 'type'),
        (SETOF(AttributeValue), 'vals'),
    ]

class Attribute(PartialAttribute): pass

class LDAPResult(ber.SEQUENCE):
    _fields_ = [
        (ResultCode, 'resultCode'),
        (LDAPDN, 'matchedDN'),
        (LDAPString, 'diagnosticMessage'),
        (OPTIONAL(Referral), 'referral'),
    ]

#### requests
github arizvisa / syringe / template / protocol / ldap.py View on Github external
(AuthenticationChoice, 'authentication'),
    ]

@Application.define
class BindResponse(ber.SEQUENCE):
    tag = 1
    _fields_ = [
        (COMPONENTSOF(LDAPResult), 'result'),
        (OPTIONAL(ber.OCTETSTRING), 'serverSaslCreds'),
    ]

@Application.define
class UnbindRequest(ber.NULL):
    tag = 2

class SubstringFilter(ber.SEQUENCE):
    class substrings(ber.SEQUENCE):
        class _object_(CHOICE):
            _values_ = [
                (0, 'initial', AssertionValue),
                (1, 'any', AssertionValue),
                (2, 'final', AssertionValue),
            ]
    _fields_ = [
        (AttributeDescription, 'type'),
        (substrings, 'substrings'),
    ]

class MatchingRuleAssertion(ber.SEQUENCE):
    class MatchingRuleId(LDAPString): pass
    _fields_ = [
        (OPTIONAL(MatchingRuleId), 'MatchingRule'),
github arizvisa / syringe / template / protocol / ldap.py View on Github external
_values_ = [
        (0, 'simple', ber.OCTETSTRING),
        (3, 'sasl', SaslCredentials),
    ]

@Application.define
class BindRequest(ber.SEQUENCE):
    tag = 0
    _fields_ = [
        (ber.INTEGER, 'version'),
        (LDAPDN, 'name'),
        (AuthenticationChoice, 'authentication'),
    ]

@Application.define
class BindResponse(ber.SEQUENCE):
    tag = 1
    _fields_ = [
        (COMPONENTSOF(LDAPResult), 'result'),
        (OPTIONAL(ber.OCTETSTRING), 'serverSaslCreds'),
    ]

@Application.define
class UnbindRequest(ber.NULL):
    tag = 2

class SubstringFilter(ber.SEQUENCE):
    class substrings(ber.SEQUENCE):
        class _object_(CHOICE):
            _values_ = [
                (0, 'initial', AssertionValue),
                (1, 'any', AssertionValue),
github arizvisa / syringe / template / protocol / ldap.py View on Github external
]
    class AttributeSelection(SEQUENCEOF(LDAPString)): pass

    _fields_ = [
        (LDAPDN, 'baseObject'),
        (scope, 'scope'),
        (derefAliases, 'derefAliases'),
        (ber.INTEGER, 'sizeLimit'),
        (ber.INTEGER, 'timeLimit'),
        (ber.BOOLEAN, 'typesOnly'),
        (Filter, 'filter'),
        (AttributeSelection, 'attributes'),
    ]

@Application.define
class SearchResult(ber.SEQUENCE):
    tag = 4
    class PartialAttributeList(SEQUENCEOF(PartialAttribute)): pass
    _fields_ = [
        (LDAPDN, 'objectName'),
        (PartialAttributeList, 'attributes'),
    ]

@Application.define
class SearchResultReference(SEQUENCEOF(URI)):
    tag = 19

@Application.define
class SearchResultDone(LDAPResult):
    tag = 5

@Application.define
github arizvisa / syringe / template / protocol / ldap.py View on Github external
def SEQUENCEOF(t):
    return dyn.clone(ber.SEQUENCE, _object_=t)
github arizvisa / syringe / template / protocol / ldap.py View on Github external
tag = 14
    _fields_ = [
        (LDAPDN, 'entry'),
        (AttributeValueAssertion, 'ava'),
    ]

@Application.define
class CompareResponse(LDAPResult):
    tag = 15

@Application.define
class AbandonRequest(MessageID):
    tag = 16

@Application.define
class ExtendedRequest(ber.SEQUENCE):
    tag = 23
    _fields_ = [
        (LDAPOID, 'requestName'),
        (OPTIONAL(ber.OCTETSTRING), 'requestValue'),
    ]

@Application.define
class ExtendedResponse(ber.SEQUENCE):
    tag = 24
    _fields_ = [
        (COMPONENTSOF(LDAPResult), 'result'),
        (OPTIONAL(LDAPOID), 'responseName'),
        (OPTIONAL(ber.OCTETSTRING), 'responseValue'),
    ]

@Application.define
github arizvisa / syringe / template / protocol / ldap.py View on Github external
]

@Application.define
class BindResponse(ber.SEQUENCE):
    tag = 1
    _fields_ = [
        (COMPONENTSOF(LDAPResult), 'result'),
        (OPTIONAL(ber.OCTETSTRING), 'serverSaslCreds'),
    ]

@Application.define
class UnbindRequest(ber.NULL):
    tag = 2

class SubstringFilter(ber.SEQUENCE):
    class substrings(ber.SEQUENCE):
        class _object_(CHOICE):
            _values_ = [
                (0, 'initial', AssertionValue),
                (1, 'any', AssertionValue),
                (2, 'final', AssertionValue),
            ]
    _fields_ = [
        (AttributeDescription, 'type'),
        (substrings, 'substrings'),
    ]

class MatchingRuleAssertion(ber.SEQUENCE):
    class MatchingRuleId(LDAPString): pass
    _fields_ = [
        (OPTIONAL(MatchingRuleId), 'MatchingRule'),
        (OPTIONAL(AttributeDescription), 'type'),