php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16406 ldap_delete and ldap_add return http header
Submitted: 2002-04-03 03:01 UTC Modified: 2002-04-03 07:16 UTC
From: aede dot vander dot weij at cgey dot nl Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 4.1.2 OS: win, iis
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: aede dot vander dot weij at cgey dot nl
New email:
PHP Version: OS:

 

 [2002-04-03 03:01 UTC] aede dot vander dot weij at cgey dot nl
I'm using IIS, Win2000, PHP 4.1.2, IPlanet 5.1. When I try to delete or add an entry I receive the http header. This is a sample of the code:

if (!$ds=@ldap_connect($LDAP_SERVER[$SERVER_ID])) die("Unable to connect");

if (!@ldap_bind($ds,$gebruiker,$passw)) {
    $errno = ldap_errno($ds);
    // error 49 wrong password, error 32 unknown user
    if ($errno == 49 || $errno == 32) {
        //call login function
        showLogin();
    } else {
        die("Unable to bind");
}

if (!@ldap_delete($ds, $dn)) {
     $errno = ldap_errno($ds);
     //error 50 No Access
     if ($errno == 50) {
	showLogin($);
     } else {
        die ("Could not delete");
     }
}

What this should do is delete an entry by first connecting to the server, then bind to it and finally delete the specified entry.

When a bind is unsuccessful due to wrong access info a redirect to a login screen is forced. This also goes for when an object has insufficient right to delete the specified entry.

The function ldap_delete does return true or false, but when I don't have sufficient access rights to delete an entry (errno 50) the below http header is not processed by the webserver but returned to the browser instead.

X-Powered-By: PHP/4.1.2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://www.somedomain.com/loginscreen.php
Content-type: text/html

This problem also occurs when I don't have proper rights to add an entry with ldap_add.

These problems do not occur when I run the code on a Unix system and a Apache webserver. So it might be the dll or IIS that's causing the problems.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-03 05:25 UTC] mfischer@php.net
See, the LDAP module does in no way return any headers if it encounters an error (that would render it useless for on-web application for which I use it for example).

It's more likely a configuration error with your webserver or your code, you should double/tripple check that first.
 [2002-04-03 07:16 UTC] aede dot vander dot weij at cgey dot nl
I installed Apache on my win2000 machine and tested the code. This processed the code without any problems. I guess it is save to say that IIS, or at least the configuration is to blame.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 16:01:30 2025 UTC