This file is indexed.

/usr/share/pyshared/ldap/controls/readentry.py is in python-ldap 2.4.10-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
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python
"""
ldap.controls.readentry - classes for the Read Entry controls
(see RFC 4527)

See http://www.python-ldap.org/ for project details.

$Id: readentry.py,v 1.4 2011/07/28 08:57:12 stroeder Exp $
"""

import ldap

from pyasn1.codec.ber import encoder,decoder
from ldap.controls import LDAPControl,KNOWN_RESPONSE_CONTROLS

from pyasn1_modules.rfc2251 import AttributeDescriptionList,SearchResultEntry


class ReadEntryControl(LDAPControl):
  """
  Base class for read entry control described in RFC 4527

  attrList
      list of attribute type names requested

  Class attributes with values extracted from the response control:

  dn
      string holding the distinguished name of the LDAP entry
  entry
      dictionary holding the LDAP entry
  """

  def __init__(self,criticality=False,attrList=None):
    self.criticality,self.attrList,self.entry = criticality,attrList or [],None

  def encodeControlValue(self):
    attributeSelection = AttributeDescriptionList()
    for i in range(len(self.attrList)):
      attributeSelection.setComponentByPosition(i,self.attrList[i])
    return encoder.encode(attributeSelection)

  def decodeControlValue(self,encodedControlValue):
    decodedEntry,_ = decoder.decode(encodedControlValue,asn1Spec=SearchResultEntry())
    self.dn = str(decodedEntry[0])
    self.entry = {}
    for attr in decodedEntry[1]:
      self.entry[str(attr[0])] = [ str(attr_value) for attr_value in attr[1] ]


class PreReadControl(ReadEntryControl):
  """
  Class for pre-read control described in RFC 4527

  attrList
      list of attribute type names requested

  Class attributes with values extracted from the response control:

  dn
      string holding the distinguished name of the LDAP entry
      before the operation was done by the server
  entry
      dictionary holding the LDAP entry
      before the operation was done by the server
  """
  controlType = ldap.CONTROL_PRE_READ

KNOWN_RESPONSE_CONTROLS[PreReadControl.controlType] = PreReadControl


class PostReadControl(ReadEntryControl):
  """
  Class for post-read control described in RFC 4527

  attrList
      list of attribute type names requested

  Class attributes with values extracted from the response control:

  dn
      string holding the distinguished name of the LDAP entry
      after the operation was done by the server
  entry
      dictionary holding the LDAP entry
      after the operation was done by the server
  """
  controlType = ldap.CONTROL_POST_READ

KNOWN_RESPONSE_CONTROLS[PostReadControl.controlType] = PostReadControl