[Date Prev][Date Next] [Chronological] [Thread] [Top]

ber_get_next in io.c (ITS#2567)



Full_Name: Ben Lefebvre
Version: openldap-2.1.18
OS: Solaris
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (66.158.138.218)


Hi,

Its seem that there is a bug in io.c in the function ber_tag_t ber_get_next.
When I run the php script, it runs correctly 80%. However, I dont do any
change in the code when its crash (the 20% remaining).
I run the script on a Solaris client and the openldap server is running freebsd
on a different computers.

openldap-2.1.19 -> on the server
openldap-2.1.18 -> on the client


On the Solaris client I get:
bash-2.03# php -q GrixToXml.php
io.c:680: failed assertion `0'
Abort (core dumped)
bash-2.03# 

On the FreeBsd Server I get (loglevel 4):
Jun  2 15:44:30  slapd[10451]: connection_get(13) 
Jun  2 15:44:30  slapd[10451]: ==> bdb_bind: dn: cn=Manager,o=adhersis,c=ca 
Jun  2 15:44:30  slapd[10451]: send_ldap_result: err=0 matched="" text="" 
Jun  2 15:44:30  slapd[10451]: connection_get(13) 
Jun  2 15:44:30  slapd[10451]: SRCH "ou=ESMC,o=adhersis,c=ca" 2 0
Jun  2 15:44:30  slapd[10451]:     0 0 0 
Jun  2 15:44:30  slapd[10451]:     filter: (uid=*) 
Jun  2 15:44:30  slapd[10451]:     attrs:
Jun  2 15:44:30  slapd[10451]:  
Jun  2 15:44:30  slapd[10451]: bdb_idl_fetch_key: @ou=esmc,o=adhersis,c=ca 
Jun  2 15:44:30  slapd[10451]: bdb_idl_fetch_key: [b49d1940] 
Jun  2 15:44:30  slapd[10451]: bdb_idl_fetch_key: [00000001] 
Jun  2 15:44:30  slapd[10451]: connection_get(13) 
Jun  2 15:44:34  last message repeated 43 times
Jun  2 15:44:34  slapd[10451]: SRCH "o=adhersis,c=ca" 2 0
Jun  2 15:44:34  slapd[10451]:     0 0 0 
Jun  2 15:44:34  slapd[10451]:     filter: (uid=*) 
Jun  2 15:44:34  slapd[10451]:     attrs:
Jun  2 15:44:34  slapd[10451]:  
Jun  2 15:44:34  slapd[10451]: bdb_idl_fetch_key: [b49d1940] 
Jun  2 15:44:34  slapd[10451]: bdb_idl_fetch_key: [00000001] 
Jun  2 15:44:34  slapd[10451]: connection_get(13) 
Jun  2 15:44:36  last message repeated 92 times
Jun  2 15:44:36  slapd[10451]: deferring operation 
Jun  2 15:44:36  slapd[10451]: connection_get(13) 
Jun  2 15:44:36  slapd[10451]: deferring operation 
Jun  2 15:44:37  slapd[10451]: connection_get(13) 


The 2 php functions that GrixToXml.php called are:

function getAllUid(&$ret, $ds, $base_dn) {
	$filter = "uid=*";
	$dnsearch = $base_dn;
	if ((@$sr=ldap_search($ds, $dnsearch, $filter)) != FALSE) {
		$info = @ldap_get_entries($ds, $sr);
		if ($info["count"] == 0)  {
			return NULL;
		}
		else {
		   for ($i=0; $i< $info["count"] ; $i++) {
		     for ($ii=0; $ii<$info[$i]["count"]; $ii++) { 
		     	if (strcmp($info[$i][$ii],"uidnumber") == 0) {
			     	$attrib = $info[$i][$ii];
	     			$myinfo = strToLower($info[$i]["$attrib"][0]);
				$ret["$myinfo"] = 1;
		     	}
		     }
		   }
		}
	} else {
		return NULL;
	}
	return TRUE;
}

function getAllMail(&$ret, $domaine, $nomBrancheLdap, $ds, $base_dn) {	
	$filter = "uid=*";
	$dnsearch = "ou=" . $nomBrancheLdap . "," . $base_dn;
	if ((@$sr=ldap_search($ds, $dnsearch, $filter)) != FALSE) {
		$info = @ldap_get_entries($ds, $sr);
		if ($info["count"] == 0)  {
			return NULL;
		}
		else {
		   for ($i=0; $i< $info["count"] ; $i++) {
		     for ($ii=0; $ii<$info[$i]["count"]; $ii++) { 
		     	if (strcmp($info[$i][$ii],"mailalternateaddress") == 0) {
			     	$attrib = $info[$i][$ii];
	     			$myinfo = strToLower($info[$i]["$attrib"][0]);
				$myinfo2 = strToLower($info[$i]["$attrib"][1]);
	     			
	     			$mail = explode("@", $myinfo);
				$mail2 = explode("@", $myinfo2);
				if (strcmp($mail[count($mail)-1],$domaine)==0) {
					$ret["$myinfo"] = 1;
				}
				elseif (strcmp($mail2[count($mail2)-1],$domaine)==0) {
					$ret["$myinfo2"] = 1;
				}
		     	}
		     }
		   }
		}
	} else {
		return NULL;
	}
	return TRUE;
}

If you want the solaris core dump, just ask me.
Thx