Bug #79637 [NEW]: ldap_connect ignoring port
From: bf at kosmoskosmos dot de
Operating system: Linux/ANY
PHP version: 7.4.6
Package: *Network Functions
Bug Type: Bug
Bug description:ldap_connect ignoring port
Description:
------------
It turned out that the ldap port argument from
ldap_connect($URI,intval(1234)
) was ignored , and the port set in URI made it possible
( more info here : https://github.com/glpi-project/glpi/issues/7316
)
Test script:
---------------
<?php
//there is a server with ssl on port 6366
// SETTING PORT IN LDAP URL
$ldaphost = "ldaps://brother.hood.local:6636";
$ldapUsername = "uid=realuser,cn=Users,dc=hood,dc=local";
$ldapPassword = "ARealUsersPassword";
$ldapUsername =
"cn=inventory_hq_hood_systems,cn=computers,dc=hood,dc=local";
$ldapPassword =
"IB3t0nlyGøD_Y0urMøm_AndBillGatesNowMyPassWordIs_TotallyInsecure";
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
//FAILS:
//$ds = ldap_connect($ldaphost,intval(6366));
//WORKS
$ds = ldap_connect($ldaphost);
if (!$ds) { echo "No Connection";}
if(!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)){
print "Could not set LDAPv3\r\n";
}
else {
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
// if (!@ldap_start_tls($ds)) {echo "No Starttls";}
// now we need to bind to the ldap server
$bth = ldap_bind($ds, $ldapUsername, $ldapPassword) or die("\r\nCould
not connect to LDAP server\r\n");
}
?>
Expected result:
----------------
connect to the port given on second argument
Actual result:
--------------
connects to default port 389
--
Edit bug report at https://bugs.php.net/bug.php?id=79637&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79637&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79637&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79637&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79637&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79637&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79637&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79637&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79637&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79637&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79637&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79637&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79637&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79637&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79637&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79637&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79637&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79637&r=mysqlcfg
Thread (3 messages)
- bf at kosmoskosmos dot de