Commit graph

858 commits

Author SHA1 Message Date
Niels Dossche
f90323c8d4
Fix GH-17280: ldap_search() fails when $attributes array has holes (#17284)
We relax the constraint that the array must be a list. What really
matters is that it only has numeric keys. As shown in the example code,
it's really easy to accidentally create a non-list array, so it makes
sense to relax the constraint.
There are 3 cases left where the array is checked to be a list,
in php_ldap_do_search, but I believe this makes sense to keep because
the indices of those arrays have a meaning because they should match
between different arrays. In that case it will prevent programmer
errors.
2024-12-27 17:58:50 +01:00
Jakub Zelenka
4b211a7769
Merge branch 'PHP-8.4' 2024-11-20 11:14:32 +01:00
Jakub Zelenka
7c96af42b7
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-20 11:14:04 +01:00
Jakub Zelenka
ffff27f734
Merge branch 'PHP-8.2' into PHP-8.3 2024-11-20 11:12:19 +01:00
Niels Dossche
fba659abb9
Fix GHSA-g665-fm4p-vhff: OOB access in ldap_escape 2024-11-20 11:06:12 +01:00
Ilija Tovilo
93c9c7c5c1
[skip ci] Update to ubuntu 24.04 for asan in nightly 2024-11-07 22:05:54 +01:00
Christoph M. Becker
59fe79fb45
Merge branch 'PHP-8.4'
* PHP-8.4:
  Skip tests if ldap_set_rebind_proc() is not available
2024-11-07 13:24:33 +01:00
Christoph M. Becker
6b754d9e81
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip tests if ldap_set_rebind_proc() is not available
2024-11-07 13:24:00 +01:00
Christoph M. Becker
fb6d500457
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Skip tests if ldap_set_rebind_proc() is not available
2024-11-07 13:22:54 +01:00
Christoph M. Becker
d276ea54f4
Skip tests if ldap_set_rebind_proc() is not available
This is already done by ldap_set_rebind_proc_error.phpt, but not by the
other two affected tests.

Closes GH-16708.
2024-11-07 13:22:17 +01:00
Niels Dossche
497dbaa2df
Fix GH-16389: Assertion failure in ext/ldap/ldap.c:2718 (#16392) 2024-10-12 13:19:23 +02:00
Gina Peter Banyard
e01cde7b1b ext/ldap: Pass a HashTable directly to parse individual control
Rename function to not have a leading "_" at the same time
2024-10-05 12:48:59 +01:00
Gina Peter Banyard
d7f946d28b ext/ldap: Use bool instead of int 2024-10-05 12:48:59 +01:00
Gina Peter Banyard
f60487821d ext/ldap: Remove an unnecessary duplication 2024-10-05 12:48:59 +01:00
Gina Peter Banyard
636b6a1a59 ext/ldap: Parse attribute value via new API in do_modify
Add a new API to free a zend_string via its char*
2024-10-05 12:48:59 +01:00
Gina Peter Banyard
495837bfa9 ext/ldap: Add API parsing zval to LDAP value 2024-10-05 12:48:59 +01:00
Gina Peter Banyard
524f6dfb19 ext/ldap: Use zend_string_equals() API 2024-10-02 23:22:34 +01:00
Gina Peter Banyard
355f320a27 ext/ldap: Use HashTable* for controls 2024-10-02 23:22:34 +01:00
Gina Peter Banyard
e8e4d36bc9 ext/ldap: Rename variable and move closer to usage site 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
0733e90c7f ext/ldap: Check that array key is not empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
72ee812e2a ext/ldap: Check array key does not have any nul bytes 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
d34d015078 ext/ldap: Promote warning to ValueError if array is not a dict 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
127968b1e4 ext/ldap: Refactor loop to a HASH_FOREACH loop 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
34e9d9ee41 ext/ldap: Zero out arrays and traverse them as NULL terminated list 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
304a514863 ext/ldap: Use HASH_FOREACH macro 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
8a9aa08de7 ext/ldap: Reduce scope of variables 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
db57561479 ext/ldap: Check that attribute values is a list before traversal 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
9e91810807 ext/ldap: Ensure list of attribute values is not empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
09ffa28224 ext/ldap: Handle attribute => value case directly 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
08bf506953 ext/ldap: php_ldap_do_modify() throw ValueError when entries array is empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
3a2a86b525 ext/ldap: Add tests for php_ldap_do_modify()
And also amend some existing tests which would duplicate coverage
2024-10-01 19:57:47 +01:00
Gina Peter Banyard
a6d111ff2a
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS entries for LDAP bug fixes
  ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify())
  ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
2024-09-30 22:24:45 +01:00
Gina Peter Banyard
747860ccf0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS entries for LDAP bug fixes
  ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify())
  ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
2024-09-30 22:24:39 +01:00
Gina Peter Banyard
10b5d4beb5
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  NEWS entries for LDAP bug fixes
  ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify())
  ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
2024-09-30 22:24:08 +01:00
Gina Peter Banyard
21260318c6
ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify()) 2024-09-30 22:23:01 +01:00
Gina Peter Banyard
c910e78c39
ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
Closes GH-16134
2024-09-30 22:23:01 +01:00
Gina Peter Banyard
52b514bf62
ext/ldap: Fix references for ldap_modify_batch() (#16121)
Because I don't know how references work in PHP
2024-09-30 11:27:56 +01:00
Gina Peter Banyard
d87711b9f4 ext/ldap: Print correct type 2024-09-30 11:27:40 +01:00
Gina Peter Banyard
415d93eda2 ext/ldap: Remove unnecessary copy
I am faily certain this was just leaking memory
2024-09-30 11:27:40 +01:00
Gina Peter Banyard
5e2c179d8d ext/ldap: Use HASH_FOREACH macro to traverse array 2024-09-30 11:27:40 +01:00
Gina Peter Banyard
491fab0a28 ext/ldap: Improve validation of inputs for parallel search 2024-09-30 11:27:40 +01:00
Gina Peter Banyard
29a77e56f6 ext/ldap: Refactor validation of attributes array for php_ldap_do_search() 2024-09-30 11:27:40 +01:00
Gina Peter Banyard
8d1a791ed5
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/ldap: Fix GH-16101 (Segfaults in php_ldap_do_search() when LDAPs is not a list)
2024-09-28 19:55:01 +01:00
Gina Peter Banyard
16b272da14
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/ldap: Fix GH-16101 (Segfaults in php_ldap_do_search() when LDAPs is not a list)
2024-09-28 19:54:40 +01:00
Gina Peter Banyard
0f2fe67b2a
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/ldap: Fix GH-16101 (Segfaults in php_ldap_do_search() when LDAPs is not a list)
2024-09-28 19:54:06 +01:00
Gina Peter Banyard
19bba83715
ext/ldap: Fix GH-16101 (Segfaults in php_ldap_do_search() when LDAPs is not a list)
Closes GH-16102
2024-09-28 19:52:47 +01:00
Gina Peter Banyard
30bc98ce0a ext/ldap: Merge loops together 2024-09-28 14:26:21 +01:00
Gina Peter Banyard
d3e65d548e ext/ldap: Throw a ValueError when passing an unknown option 2024-09-28 14:26:21 +01:00
Gina Peter Banyard
18fca34ef3 ext/ldap: Improve type check for option value 2024-09-28 14:26:21 +01:00
Gina Peter Banyard
b79866d01a ext/ldap: Refactor ldap_parse_result() to not rely on argnum 2024-09-28 14:26:21 +01:00