Skip to content

Commit

Permalink
* The methods SSSResponseControl.decodeControlValue() and
Browse files Browse the repository at this point in the history
  VLVResponseControl.decodeControlValue() now follow the coding
  convention to use camel-cased ASN.1 name as class attribute name.
  The old class names are still set for back-ward compability
  but should not be used in new code because they might be removed
  in a later release.
* removed SSSRequestControl from ldap.controls.KNOWN_RESPONSE_CONTROLS
  • Loading branch information
stroeder committed Nov 12, 2017
1 parent 072f5cf commit 65e9271
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ Lib/
without cleaning any data
* Compability changes for pyasn1 0.3.x or newer
(thanks to Ilya Etingof and Christian Heimes)
* The methods SSSResponseControl.decodeControlValue() and
VLVResponseControl.decodeControlValue() now follow the coding
convention to use camel-cased ASN.1 name as class attribute name.
The old class names are still set for back-ward compability
but should not be used in new code because they might be removed
in a later release.
* removed SSSRequestControl from ldap.controls.KNOWN_RESPONSE_CONTROLS

Tests/
* added explicit reconnect tests for ReconnectLDAPObject
Expand Down
19 changes: 11 additions & 8 deletions Lib/ldap/controls/sss.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,17 @@ def __init__(self,criticality=False):
def decodeControlValue(self, encoded):
p, rest = decoder.decode(encoded, asn1Spec=SortResultType())
assert not rest, 'all data could not be decoded'
self.result = int(p.getComponentByName('sortResult'))
self.result_code = p.getComponentByName('sortResult').prettyOut(self.result)
attribute_type_error = p.getComponentByName('attributeType')
if attribute_type_error.hasValue():
self.attribute_type_error = attribute_type_error
sort_result = p.getComponentByName('sortResult')
self.sortResult = int(sort_result)
attribute_type = p.getComponentByName('attributeType')
if attribute_type.hasValue():
self.attributeType = attribute_type
else:
self.attribute_type_error = None
self.attributeType = None
# backward compability class attributes
self.result = self.sortResult
self.attribute_type_error = self.attributeType
# not sure whether to keep this
self.result_code = sort_result.prettyPrint()


KNOWN_RESPONSE_CONTROLS[SSSRequestControl.controlType] = SSSRequestControl
KNOWN_RESPONSE_CONTROLS[SSSResponseControl.controlType] = SSSResponseControl
20 changes: 13 additions & 7 deletions Lib/ldap/controls/vlv.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,21 @@ def __init__(self,criticality=False):
def decodeControlValue(self,encoded):
p, rest = decoder.decode(encoded, asn1Spec=VirtualListViewResponseType())
assert not rest, 'all data could not be decoded'
self.target_position = int(p.getComponentByName('targetPosition'))
self.content_count = int(p.getComponentByName('contentCount'))
self.result = int(p.getComponentByName('virtualListViewResult'))
self.result_code = p.getComponentByName('virtualListViewResult').prettyOut(self.result)
self.targetPosition = int(p.getComponentByName('targetPosition'))
self.contentCount = int(p.getComponentByName('contentCount'))
virtual_list_view_result = p.getComponentByName('virtualListViewResult')
self.virtualListViewResult = int(virtual_list_view_result)
context_id = p.getComponentByName('contextID')
if context_id.hasValue():
self.context_id = str(context_id)
self.contextID = str(context_id)
else:
self.context_id = None

self.contextID = None
# backward compability class attributes
self.target_position = self.targetPosition
self.content_count = self.contentCount
self.result = self.virtualListViewResult
self.context_id = self.contextID
# not sure whether to keep this
self.result_code = virtual_list_view_result.prettyPrint()

KNOWN_RESPONSE_CONTROLS[VLVResponseControl.controlType] = VLVResponseControl

0 comments on commit 65e9271

Please sign in to comment.