Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-ldapserver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uffd
python-ldapserver
Commits
73f3f72d
Commit
73f3f72d
authored
3 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Completed class attribute type annotations in ldap.py
parent
ad699a92
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#7062
failed
3 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ldapserver/ldap.py
+82
-0
82 additions, 0 deletions
ldapserver/ldap.py
with
82 additions
and
0 deletions
ldapserver/ldap.py
+
82
−
0
View file @
73f3f72d
...
...
@@ -261,6 +261,10 @@ class LDAPResult(asn1.Sequence):
(
LDAPString
,
'
diagnosticMessage
'
,
''
,
False
),
]
resultCode
:
LDAPResultCode
matchedDN
:
str
diagnosticMessage
:
str
class
AttributeSelection
(
asn1
.
SequenceOf
):
SET_TYPE
=
LDAPString
...
...
@@ -287,6 +291,9 @@ class SaslCredentials(asn1.Sequence, AuthenticationChoice):
(
asn1
.
OctetString
,
'
credentials
'
,
None
,
True
),
]
mechanism
:
str
credentials
:
bytes
class
AttributeValueSet
(
asn1
.
Set
):
SET_TYPE
=
asn1
.
OctetString
...
...
@@ -296,6 +303,9 @@ class PartialAttribute(asn1.Sequence):
(
AttributeValueSet
,
'
vals
'
,
lambda
:
[],
False
),
]
type
:
str
vals
:
typing
.
List
[
bytes
]
class
PartialAttributeList
(
asn1
.
SequenceOf
):
SET_TYPE
=
PartialAttribute
...
...
@@ -306,6 +316,9 @@ class Attribute(asn1.Sequence):
(
AttributeValueSet
,
'
vals
'
,
lambda
:
[],
False
),
]
type
:
str
vals
:
typing
.
List
[
bytes
]
class
AttributeList
(
asn1
.
SequenceOf
):
SET_TYPE
=
Attribute
...
...
@@ -320,6 +333,10 @@ class BindRequest(asn1.Sequence, ProtocolOp):
(
AuthenticationChoice
,
'
authentication
'
,
lambda
:
SimpleAuthentication
(),
False
)
# pylint: disable=unnecessary-lambda
]
version
:
int
name
:
str
authentication
:
AuthenticationChoice
class
BindResponse
(
asn1
.
Sequence
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
1
)
SEQUENCE_FIELDS
=
[
...
...
@@ -329,6 +346,11 @@ class BindResponse(asn1.Sequence, ProtocolOp):
(
asn1
.
retag
(
asn1
.
OctetString
,
(
2
,
False
,
7
)),
'
serverSaslCreds
'
,
None
,
True
)
]
resultCode
:
LDAPResultCode
matchedDN
:
str
diagnosticMessage
:
str
serverSaslCreds
:
bytes
class
UnbindRequest
(
asn1
.
Sequence
,
ProtocolOp
):
BER_TAG
=
(
1
,
False
,
2
)
...
...
@@ -345,6 +367,15 @@ class SearchRequest(asn1.Sequence, ProtocolOp):
(
AttributeSelection
,
'
attributes
'
,
lambda
:
[],
False
)
]
baseObject
:
str
scope
:
SearchScope
derefAliases
:
DerefAliases
sizeLimit
:
int
timeLimit
:
int
typesOnly
:
bool
filter
:
Filter
attributes
:
typing
.
List
[
str
]
@classmethod
def
from_ber
(
cls
,
data
):
return
super
().
from_ber
(
data
)
...
...
@@ -356,6 +387,9 @@ class SearchResultEntry(asn1.Sequence, ProtocolOp):
(
PartialAttributeList
,
'
attributes
'
,
lambda
:
[],
False
),
]
objectName
:
str
attributes
:
typing
.
List
[
PartialAttribute
]
class
SearchResultDone
(
LDAPResult
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
5
)
...
...
@@ -370,6 +404,8 @@ class ModifyChange(asn1.Sequence):
(
asn1
.
wrapenum
(
ModifyOperation
),
'
operation
'
,
None
,
False
),
(
PartialAttribute
,
'
modification
'
,
None
,
False
),
]
operation
:
ModifyOperation
modification
:
PartialAttribute
class
ModifyChanges
(
asn1
.
SequenceOf
):
SET_TYPE
=
ModifyChange
...
...
@@ -380,6 +416,8 @@ class ModifyRequest(asn1.Sequence, ProtocolOp):
(
LDAPString
,
'
object
'
,
None
,
False
),
(
ModifyChanges
,
'
changes
'
,
None
,
False
),
]
object
:
str
changes
:
typing
.
List
[
ModifyChange
]
class
ModifyResponse
(
LDAPResult
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
7
)
...
...
@@ -390,6 +428,8 @@ class AddRequest(asn1.Sequence, ProtocolOp):
(
LDAPString
,
'
entry
'
,
None
,
False
),
(
AttributeList
,
'
attributes
'
,
None
,
False
),
]
entry
:
str
attributes
:
Attribute
class
AddResponse
(
LDAPResult
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
9
)
...
...
@@ -400,6 +440,8 @@ class DelRequest(asn1.Wrapper, ProtocolOp):
WRAPPED_TYPE
=
LDAPString
WRAPPED_DEFAULT
=
None
dn
:
str
class
DelResponse
(
LDAPResult
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
11
)
...
...
@@ -412,6 +454,11 @@ class ModifyDNRequest(asn1.Sequence, ProtocolOp):
(
asn1
.
retag
(
LDAPString
,
(
2
,
False
,
0
)),
'
newSuperior
'
,
None
,
True
),
]
entry
:
str
newrdn
:
str
deleteoldrdn
:
bool
newSuperior
:
str
class
ModifyDNResponse
(
LDAPResult
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
13
)
...
...
@@ -422,6 +469,9 @@ class CompareRequest(asn1.Sequence, ProtocolOp):
(
AttributeValueAssertion
,
'
ava
'
,
None
,
False
),
]
entry
:
str
ava
:
AttributeValueAssertion
class
CompareResponse
(
LDAPResult
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
15
)
...
...
@@ -431,6 +481,8 @@ class AbandonRequest(asn1.Wrapper, ProtocolOp):
WRAPPED_TYPE
=
asn1
.
Integer
WRAPPED_DEFAULT
=
None
messageID
:
int
class
ExtendedRequest
(
asn1
.
Sequence
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
23
)
SEQUENCE_FIELDS
=
[
...
...
@@ -438,6 +490,9 @@ class ExtendedRequest(asn1.Sequence, ProtocolOp):
(
asn1
.
retag
(
asn1
.
OctetString
,
(
2
,
False
,
1
)),
'
requestValue
'
,
None
,
True
),
]
requestName
:
str
requestValue
:
bytes
class
ExtendedResponse
(
asn1
.
Sequence
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
24
)
SEQUENCE_FIELDS
=
[
...
...
@@ -448,6 +503,12 @@ class ExtendedResponse(asn1.Sequence, ProtocolOp):
(
asn1
.
retag
(
asn1
.
OctetString
,
(
2
,
False
,
11
)),
'
responseValue
'
,
None
,
True
),
]
resultCode
:
LDAPResultCode
matchedDN
:
str
diagnosticMessage
:
str
responseName
:
str
responseValue
:
bytes
class
IntermediateResponse
(
asn1
.
Sequence
,
ProtocolOp
):
BER_TAG
=
(
1
,
True
,
25
)
SEQUENCE_FIELDS
=
[
...
...
@@ -455,6 +516,9 @@ class IntermediateResponse(asn1.Sequence, ProtocolOp):
(
asn1
.
retag
(
asn1
.
OctetString
,
(
2
,
False
,
1
)),
'
responseValue
'
,
None
,
True
),
]
responseName
:
str
responseValue
:
bytes
class
Control
(
asn1
.
Sequence
):
SEQUENCE_FIELDS
=
[
(
LDAPOID
,
'
controlType
'
,
None
,
False
),
...
...
@@ -462,6 +526,10 @@ class Control(asn1.Sequence):
(
asn1
.
OctetString
,
'
controlValue
'
,
None
,
True
),
]
controlType
:
str
criticality
:
bool
controlValue
:
bytes
class
Controls
(
asn1
.
SequenceOf
):
BER_TAG
=
(
2
,
True
,
0
)
SET_TYPE
=
Control
...
...
@@ -473,10 +541,18 @@ class LDAPMessage(asn1.Sequence):
(
Controls
,
'
controls
'
,
None
,
True
)
]
messageID
:
int
protocolOp
:
ProtocolOp
controls
:
typing
.
List
[
Control
]
class
ShallowLDAPMessage
(
asn1
.
BERType
):
BER_TAG
=
(
0
,
True
,
16
)
# pylint: disable=invalid-name
messageID
:
int
protocolOpType
:
typing
.
Type
[
ProtocolOp
]
data
:
bytes
def
__init__
(
self
,
messageID
=
None
,
protocolOpType
=
None
,
data
=
None
):
self
.
messageID
=
messageID
self
.
protocolOpType
=
protocolOpType
...
...
@@ -518,7 +594,13 @@ class PasswdModifyRequestValue(asn1.Sequence):
(
asn1
.
retag
(
asn1
.
OctetString
,
(
2
,
False
,
2
)),
'
newPasswd
'
,
None
,
True
),
]
userIdentity
:
str
oldPasswd
:
bytes
newPasswd
:
bytes
class
PasswdModifyResponseValue
(
asn1
.
Sequence
):
SEQUENCE_FIELDS
=
[
(
asn1
.
retag
(
asn1
.
OctetString
,
(
2
,
False
,
0
)),
'
genPasswd
'
,
None
,
True
),
]
genPasswd
:
bytes
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment