Changes of Revision 6

php-kolab-net-ldap3.spec Changed
x
 
1
@@ -24,7 +24,7 @@
2
 %else
3
 Name:               php-kolab-net-ldap3
4
 %endif
5
-Version:            1.0.7
6
+Version:            1.1.0
7
 Release:            1%{?dist}
8
 Summary:            Object oriented interface for searching and manipulating LDAP-entries
9
 Group:              Development/Libraries
10
@@ -71,6 +71,9 @@
11
 %{_datadir}/%{php}/Net/LDAP3/Result.php
12
 
13
 %changelog
14
+* Wed Jun  5 2019 Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> - 1.1.0-1
15
+- Release of version 1.1.0
16
+
17
 * Wed Jun 20 2018 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 1.0.7-1
18
 - Release of version 1.0.7
19
 
20
debian.changelog Changed
11
 
1
@@ -1,3 +1,9 @@
2
+php-net-ldap3 (1.1.0-1~kolab1) unstable; urgency=low
3
+
4
+  * Release version 1.1.0
5
+
6
+ -- Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>  Wed,  5 Jun 2019 15:27:46 +0100
7
+
8
 php-net-ldap3 (1.0.7-1~kolab1) unstable; urgency=low
9
 
10
   * Release version 1.0.7
11
pear-Net-LDAP3-1.0.7.tar.gz/composer.json -> pear-Net-LDAP3-1.1.0.tar.gz/composer.json Changed
10
 
1
@@ -2,7 +2,7 @@
2
    "name": "kolab/net_ldap3",
3
    "description": "A successor of the PEAR:Net_LDAP2 module providing advanced functionality for accessing LDAP directories",
4
    "type": "library",
5
-   "version": "1.0.6",
6
+   "version": "1.0.7",
7
    "keywords": ["pear", "ldap", "vlv"],
8
    "homepage": "http://git.kolab.org/pear/Net_LDAP3/",
9
    "license": "GPL-3.0+",
10
pear-Net-LDAP3-1.0.7.tar.gz/lib/Net/LDAP3.php -> pear-Net-LDAP3-1.1.0.tar.gz/lib/Net/LDAP3.php Changed
201
 
1
@@ -41,6 +41,11 @@
2
  */
3
 class Net_LDAP3
4
 {
5
+    const CONTROL_EFFECTIVE_RIGHTS = '1.3.6.1.4.1.42.2.27.9.5.2';
6
+    const CONTROL_SORT_REQUEST     = '1.2.840.113556.1.4.473';
7
+    const CONTROL_VLV_REQUEST      = '2.16.840.1.113730.3.4.9';
8
+    const CONTROL_VLV_RESPONSE     = '2.16.840.1.113730.3.4.10';
9
+
10
     public $conn;
11
     public $vlv_active = false;
12
 
13
@@ -83,8 +88,9 @@
14
      *       'root_dn'         => 'dc=example,dc=org',
15
      */
16
     protected $config = array(
17
-        'sizelimit' => 0,
18
-        'timelimit' => 0,
19
+        'sizelimit'      => 0,
20
+        'timelimit'      => 0,
21
+        'config_root_dn' => 'cn=config',
22
     );
23
 
24
     protected $debug_level = false;
25
@@ -113,32 +119,29 @@
26
     protected $_current_bind_dn;
27
     protected $_current_bind_pw;
28
     protected $_current_host;
29
-    protected $_supported_control = array();
30
+    protected $_metadata;
31
     protected $_vlv_indexes_and_searches;
32
 
33
+
34
     /**
35
      * Constructor
36
      *
37
-     * @param array $config Configuration parameters that have not already
38
-     *                      been initialized. For configuration parameters
39
-     *                      that have in fact been set, use the config_set()
40
-     *                      method after initialization.
41
+     * @param array $config Configuration parameters. After initialization use
42
+     *                      the config_set() method.
43
      */
44
     public function __construct($config = array())
45
     {
46
         if (!empty($config) && is_array($config)) {
47
             foreach ($config as $key => $value) {
48
-                if (empty($this->config[$key])) {
49
-                    $setter = 'config_set_' . $key;
50
-                    if (method_exists($this, $setter)) {
51
-                        $this->$setter($value);
52
-                    }
53
-                    else if (isset($this->$key)) {
54
-                        $this->$key = $value;
55
-                    }
56
-                    else {
57
-                        $this->config[$key] = $value;
58
-                    }
59
+                $setter = 'config_set_' . $key;
60
+                if (method_exists($this, $setter)) {
61
+                    $this->$setter($value);
62
+                }
63
+                else if (isset($this->$key)) {
64
+                    $this->$key = $value;
65
+                }
66
+                else {
67
+                    $this->config[$key] = $value;
68
                 }
69
             }
70
         }
71
@@ -688,22 +691,16 @@
72
         return true;
73
     }
74
 
75
+    /**
76
+     * Gets effective rights of an ldap entry
77
+     */
78
     public function effective_rights($subject)
79
     {
80
-        $effective_rights_control_oid = "1.3.6.1.4.1.42.2.27.9.5.2";
81
-
82
-        $supported_controls = $this->supported_controls();
83
-
84
-        if (!in_array($effective_rights_control_oid, $supported_controls)) {
85
+        if (!in_array(self::CONTROL_EFFECTIVE_RIGHTS, $this->supported_controls())) {
86
             $this->_debug("LDAP: No getEffectiveRights control in supportedControls");
87
             return false;
88
         }
89
 
90
-        $attributes = array(
91
-            'attributeLevelRights' => array(),
92
-            'entryLevelRights' => array(),
93
-        );
94
-
95
         $entry_dn = $this->entry_dn($subject);
96
 
97
         if (!$entry_dn) {
98
@@ -720,6 +717,53 @@
99
 
100
         $this->_debug("effective_rights for subject $subject resolves to entry dn $entry_dn");
101
 
102
+        if (PHP_VERSION_ID >= 70300) {
103
+            // Note: This get_entry() have to request all attributes to be working
104
+            $result = $this->get_entry($entry_dn, array('*'), array(
105
+                    array(
106
+                        'oid'        => self::CONTROL_EFFECTIVE_RIGHTS,
107
+                        'value'      => 'dn:' . $this->_current_bind_dn,
108
+                        'iscritical' => true,
109
+                    ),
110
+                ));
111
+
112
+            if (!empty($result)) {
113
+                $attributes = array(
114
+                    'dn'                   => $entry_dn,
115
+                    'attributeLevelRights' => array(),
116
+                    'entryLevelRights'     => array(),
117
+                );
118
+
119
+                foreach (array('aclRights', 'attributeLevelRights', 'entryLevelRights') as $attr_name) {
120
+                    if ($attr_value = $result[$attr_name]) {
121
+                        switch ($attr_name) {
122
+                        case 'aclRights':
123
+                            $this->parse_aclrights($attributes, $attr_value);
124
+                            break;
125
+                        case 'attributeLevelRights':
126
+                            $attributes[$attr_name] = $this->parse_attribute_level_rights($attr_value);
127
+                            break;
128
+                        case 'entryLevelRights':
129
+                            $attributes[$attr_name] = $this->parse_entry_level_rights($attr_value);
130
+                            break;
131
+                        }
132
+                    }
133
+                }
134
+
135
+                $this->_debug("LDAP: Effective rights:" . var_export($attributes, true));
136
+
137
+                return $attributes;
138
+            }
139
+
140
+            return false;
141
+        }
142
+
143
+        // Use ldapsearch command
144
+        return $this->effective_rights_mozldap($entry_dn);
145
+    }
146
+
147
+    protected function effective_rights_mozldap($entry_dn)
148
+    {
149
         $moz_ldapsearch = "/usr/lib64/mozldap/ldapsearch";
150
         if (!is_file($moz_ldapsearch)) {
151
             $moz_ldapsearch = "/usr/lib/mozldap/ldapsearch";
152
@@ -729,7 +773,7 @@
153
         }
154
 
155
         if (empty($moz_ldapsearch)) {
156
-            $this->_error("Mozilla LDAP C SDK binary ldapsearch not found, cannot get effective rights on subject $subject");
157
+            $this->_error("Mozilla LDAP C SDK binary ldapsearch not found, cannot get effective rights");
158
             return null;
159
         }
160
 
161
@@ -754,33 +798,13 @@
162
         if ($this->vendor_name() == "Oracle Corporation") {
163
             // For Oracle DSEE
164
             $command[] = "-J";
165
-            $command[] = escapeshellarg(
166
-                    implode(
167
-                            ':',
168
-                            Array(
169
-                                    $effective_rights_control_oid,          // OID
170
-                                    'true'                                  // Criticality
171
-                                )
172
-                        )
173
-                );
174
+            $command[] = escapeshellarg(self::CONTROL_EFFECTIVE_RIGHTS . ':true');
175
             $command[] = "-c";
176
-            $command[] = escapeshellarg(
177
-                    'dn:' . $this->_current_bind_dn
178
-                );
179
-
180
+            $command[] = escapeshellarg('dn:' . $this->_current_bind_dn);
181
         } else {
182
             // For 389 DS:
183
             $command[] = "-J";
184
-            $command[] = escapeshellarg(
185
-                    implode(
186
-                            ':',
187
-                            Array(
188
-                                    $effective_rights_control_oid,          // OID
189
-                                    'true',                                 // Criticality
190
-                                    'dn:' . $this->_current_bind_dn         // User DN
191
-                                )
192
-                        )
193
-                );
194
+            $command[] = escapeshellarg(self::CONTROL_EFFECTIVE_RIGHTS . ':true:dn:' . $this->_current_bind_dn);
195
         }
196
 
197
         // For both
198
@@ -821,6 +845,12 @@
199
             }
200
         }
201
pear-Net-LDAP3-1.0.7.tar.gz/lib/Net/LDAP3/Result.php -> pear-Net-LDAP3-1.1.0.tar.gz/lib/Net/LDAP3/Result.php Changed
9
 
1
@@ -42,6 +42,7 @@
2
     protected $base_dn;
3
     protected $filter;
4
     protected $scope;
5
+    protected $result;
6
 
7
     private $count;
8
     private $current;
9
php-net-ldap3.dsc Changed
17
 
1
@@ -2,7 +2,7 @@
2
 Source: php-net-ldap3
3
 Binary: php-net-ldap3
4
 Architecture: all
5
-Version: 1.0.7-1~kolab1
6
+Version: 1.1.0-1~kolab1
7
 Maintainer: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>
8
 Uploaders: Christoph Wickert <wickert@kolabsys.com>
9
 Homepage: http://kolab.org
10
@@ -12,5 +12,5 @@
11
 Package-List:
12
  php-net-ldap3 deb php optional
13
 Files:
14
- 00000000000000000000000000000000 0 pear-Net-LDAP3-1.0.7.tar.gz
15
+ 00000000000000000000000000000000 0 pear-Net-LDAP3-1.1.0.tar.gz
16
  00000000000000000000000000000000 0 debian.tar.gz
17