/usr/share/arc/ldap-monitor/includes/ldap_purge.inc is in nordugrid-arc-ldap-monitor 5.0.5-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | <?php
// Author: oxana.smirnova@hep.lu.se
/**
* A function purging any LDAP
* search result with identical DNs
*/
/**
* @return array
* @param allentries array
* @param attr string
* @desc Purges identical $attr entries from LDAP search result
*/
function ldap_purge($allentries,$attr="dn",$debug=0)
{
$dnstore = array(); /* array to store unique attributes */
$entries = array(); /* purged array to be returned */
$ninp = $allentries["count"];
$storesize = 0;
for ($i = 0; $i < $ninp; $i++) {
$curdn = $allentries[$i][$attr][0];
if ( $attr == "dn" ) $curdn = $allentries[$i][$attr];
// $trimdn = str_replace(" ","",$curdn); // get rid of blanks in DN
$trimdn = $curdn;
if ( !in_array($trimdn,$dnstore) ) {
array_push($dnstore,$trimdn);
$storesize++;
array_push($entries,$allentries[$i]);
} else {
// if ( $debug==2 ) echo "<b>### purged DN:".$curdn."</b><br>\n";
}
}
$entries["count"] = $storesize;
return $entries;
}
?>
|