php / php/php-src

ldap timeouts not enforced for ldaps protocol

Open
#9,320 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Extension: ldap Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

According to site: https://bugs.php.net/bug.php?id=69574
I added LDAP_OPT_TIMEOUT to enforce bind operation time out. This worked for ldap protocol. But not for ldaps protocol.
steps to reproduce:

In one ssh session, I am running the following command to simulate a socket listener:
nc -l 636

And run following code:

<?php
$ldap = ldap_connect('ldaps://127.0.0.1:636');

ldap_set_option($ldap, LDAP_OPT_NETWORK_TIMEOUT, 3);
ldap_set_option($ldap, LDAP_OPT_TIMELIMIT, 3);
ldap_set_option($ldap, LDAP_OPT_TIMEOUT, 3);

ldap_bind($ldap);
?>

Resulted in this output:

This never times out

But I expected this output instead:

times out in 3 seconds. 
PHP Version

PHP 7.4.30

Operating System

Windows 10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied PHP script with the nc listener and focus on the ldap_connect, ldap_set_option, and ldap_bind entry points for the ldaps protocol. Trace how LDAP_OPT_NETWORK_TIMEOUT, LDAP_OPT_TIMELIMIT, and LDAP_OPT_TIMEOUT are applied, then verify that the bind exits with a timeout after about 3 seconds.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
authentication, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.