/usr/lib/python2.7/dist-packages/ldap/controls/libldap.py is in python-ldap 2.4.22-0.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | # -*- coding: utf-8 -*-
"""
controls.libldap - LDAP controls wrapper classes with en-/decoding done
by OpenLDAP functions
See http://www.python-ldap.org/ for details.
$Id: libldap.py,v 1.3 2015/06/06 09:21:38 stroeder Exp $
"""
import _ldap,ldap
from ldap.controls import RequestControl,LDAPControl,KNOWN_RESPONSE_CONTROLS
class AssertionControl(RequestControl):
"""
LDAP Assertion control, as defined in RFC 4528
filterstr
LDAP filter string specifying which assertions have to match
so that the server processes the operation
"""
controlType = ldap.CONTROL_ASSERT
def __init__(self,criticality=True,filterstr='(objectClass=*)'):
self.criticality = criticality
self.filterstr = filterstr
def encodeControlValue(self):
return _ldap.encode_assertion_control(self.filterstr)
KNOWN_RESPONSE_CONTROLS[ldap.CONTROL_ASSERT] = AssertionControl
class MatchedValuesControl(RequestControl):
"""
LDAP Matched Values control, as defined in RFC 3876
filterstr
LDAP filter string specifying which attribute values
should be returned
"""
controlType = ldap.CONTROL_VALUESRETURNFILTER
def __init__(self,criticality=False,filterstr='(objectClass=*)'):
self.criticality = criticality
self.filterstr = filterstr
def encodeControlValue(self):
return _ldap.encode_valuesreturnfilter_control(self.filterstr)
KNOWN_RESPONSE_CONTROLS[ldap.CONTROL_VALUESRETURNFILTER] = MatchedValuesControl
class SimplePagedResultsControl(LDAPControl):
"""
LDAP Control Extension for Simple Paged Results Manipulation
size
Page size requested (number of entries to be returned)
cookie
Cookie string received with last page
"""
controlType = ldap.CONTROL_PAGEDRESULTS
def __init__(self,criticality=False,size=None,cookie=None):
self.criticality = criticality
self.size,self.cookie = size,cookie
def encodeControlValue(self):
return _ldap.encode_page_control(self.size,self.cookie)
def decodeControlValue(self,encodedControlValue):
self.size,self.cookie = _ldap.decode_page_control(encodedControlValue)
KNOWN_RESPONSE_CONTROLS[ldap.CONTROL_PAGEDRESULTS] = SimplePagedResultsControl
|