This file is indexed.

/usr/share/arc/ldap-monitor/includes/ldap_nice_dump.inc is in nordugrid-arc-ldap-monitor 1.1.1-1.

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
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
 
// Author: oxana.smirnova@hep.lu.se

/**
 * Quite a universal function, dumping any LDAP
 * search result in a nice fashion
 */

require_once('mylo.inc');

/**
 * @return string
 * @param ds string
 * @param dn string
 * @param exclude array
 * @desc Dumps all the LDAP attributes (except those in exclude) returned by a search in an HTML table
 */
function ldap_nice_dump() {

  $tlim = 10;
  $tout = 11;

  $strings = func_get_arg(0);
  $ds      = func_get_arg(1);
  $dn      = func_get_arg(2);
  if ( func_num_args() == 4 ) $exclude = func_get_arg(3);

  // Descriptive array of known MDS attributes (optional)
  $mdsattr = &$strings["mdsattr"];
  $isattr  = &$strings["isattr"];
  $errors  = &$strings["errors"];

  // Strings for a list box
  $itself = $_SERVER['PHP_SELF'];
  $fhead = "<form action=\"$itself\" method=\"post\"><textarea readonly name=\"l\" rows=\"4\" cols=\"60\" style=\"font-size:small\">";
  $ftail = "</textarea></form>";

  // Plain LDAP dump for the DN
  $filstr = "(objectclass=*)";
  $sr     = @ldap_search($ds,$dn,$filstr,array("*"),0,0,$tlim,LDAP_DEREF_NEVER);

  if ($sr) {
    
    // If search returned, check that there are valid entries
    
    $nmatch = ldap_count_entries($ds,$sr);
    if ($nmatch > 0) {
      
      // If there are valid entries, tabulate results
      
      $first   = ldap_first_entry($ds,$sr);
      $entries = ldap_get_attributes($ds,$first);
      $nfields = $entries["count"];
      
      // get the Distinguished Name
      
      $thisdn = ldap_get_dn($ds,$first);
      
      // HTML table initialisation
      
      $dtable = new LmTableSp("ldapdump",$strings["ldapdump"]);
      
      // add the DN entry
      
      $drowcont = array("<b>".$errors["420"]."</b>",$thisdn);
      $dtable->addrow($drowcont, "#cccccc");
      $drowcont = array();
      
      // loop on the rest of attributes
      
      for ($i=0; $i<$nfields; $i++) {
        $curatt = $entries[$i];
	if ( $exclude && in_array($curatt,$exclude) ) continue;
        $engatt = ($isattr[$curatt]) ? $isattr[$curatt] : $curatt;
        $nval   = $entries[$curatt]["count"];
        
	$encatt = rawurlencode($curatt);
	$attwin = popup("attlist.php?attribute=$encatt",650,300,7);

	$attstring   = @( $mdsattr[$curatt] ) ? "<b>$engatt</b>" : "<a href=\"$attwin\"><b>$engatt</b></a>";
        $drowcont[0] = $attstring;
        $drowcont[1] = "&nbsp;";
        
        if ($nval==0) $dtable->addrow($drowcont);
        
	$drowcont[1] = "";
	if ( $nval > 4 ) $drowcont[1] = $fhead;
	for ($k=0; $k<$nval; $k++) {
	  $curval = $entries[$curatt][$k];

	  // Strip HTML tags some smart folks are adding
	  $curval = strip_tags($curval);
	  
	  // Some time-stamp readability adjustment
	  if ( strlen($curval) == 15 && $curval{14} == "Z" ) $curval=cnvtime($curval);
	  
	  $encval = htmlspecialchars($curval,ENT_QUOTES,"UTF-8");

	  // E-mail masquerading for short lists (dunno what to do with long lists)
	  if (strpos($curval,"@",1) && $nval<5) {
	    $m = mylo ($curval);
	    if ( $m[0] ) $encval = "<script type='text/javascript'>mylo('".$m[0]."','".$m[1]."','".$m[2]."','".$m[3]."')</script><noscript>JS disabled</noscript>";
	  }

	  if ( $nval > 4 ) {
	    $drowcont[1] .= "$encval";
	    if ( $k < $nval-1 ) $drowcont[1] .= "\n";
	  } else {
	    $drowcont[1] .= $encval;
	    if ( $k < $nval-1 ) $drowcont[1] .= "<br>&nbsp;";
	  }
	}
	if ( $nval > 4 ) $drowcont[1] .= $ftail;
	$dtable->addrow($drowcont);
      }
      $dtable->close();
      ldap_free_result($sr);
      return $thisdn;
    } else {
      $errno = 9;
      echo "<br><font color=\"red\"><b>".$errors[$errno]."</b></font>\n";
      return $errno;
    }
  } else {
    $errno = 5;
    echo "<br><font color=\"red\"><b>".$errors[$errno]."</b></font>\n";
    return $errno;
  }
}
?>