sql command succeeds we delete the corresponding input file. That way if an sql server is down we store the
accounting info in the input file and then send it all when it comes back up.
* Add a directive sql_debug. Add debuging statements in the sql library
+* Add a directive ldap_debug. Add debuging statements in the ldap library
+* Add debug statements in the pg driver
Ver 1.61:
* Add a string encoder for greek
* If general_decode_normal_attributes is set then encode attributes in lib/ldap/change_info. In the near future
}
}
if (isset($mod)){
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): ldap_mod_del(): DN='$dn'</b><br>\n";
+ print "<b>DEBUG(LDAP): ldap_mod_del(): Data:";
+ print_r($mod);
+ print "</b><br>\n";
+ }
@ldap_mod_del($ds,$dn,$mod);
}
if (isset($add_r)){
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): ldap_mod_add(): DN='$dn'</b><br>\n";
+ print "<b>DEBUG(LDAP): ldap_mod_add(): Data:";
+ print_r($add_r);
+ print "</b><br>\n";
+ }
@ldap_mod_add($ds,$dn,$add_r);
}
if (isset($del)){
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): ldap_mod_replace(): DN='$dn'</b><br>\n";
+ print "<b>DEBUG(LDAP): ldap_mod_replace(): Data:";
+ print_r($del);
+ print "</b><br>\n";
+ }
@ldap_mod_del($ds,$dn,$del);
}
}
if ($Fhomephone != '' && $Fhomephone != '-' && $Fhomephone != $homephone)
$mod['homephone'] = $Fhomephone;
if ($dn != ''){
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): ldap_mod_replace(): DN='$dn'</b><br>\n";
+ print "<b>DEBUG(LDAP): ldap_mod_replace(): Data:";
+ print_r($mod);
+ print "</b><br>\n";
+ }
@ldap_mod_replace($ds,$dn,$mod);
if (@ldap_error($ds) != 'Success')
echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";
$passwd = da_encrypt($passwd);
$passwd = '{' . $config[general_encryption_method] . '}' . $passwd;
$mod[$attrmap['User-Password']] = $passwd;
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): ldap_mod_replace(): DN='$dn'</b><br>\n";
+ print "<b>DEBUG(LDAP): ldap_mod_replace(): Data:";
+ print_r($mod);
+ print "</b><br>\n";
+ }
@ldap_mod_replace($ds,$dn,$mod);
if (@ldap_error($ds) != 'Success')
echo "<b>LDAP ERROR: " . ldap_error($ds) . "</b><br>\n";
$new_user_entry[$attrmap['User-Password']]="{clear}" . $passwd;
}
- print_r($new_user_entry);
-
+ if ($config[ldap_debug] == 'true'){
+ print "<b>DEBUG(LDAP): ldap_add(): DN='$dn'</b><br>\n";
+ print "<b>DEBUG(LDAP): ldap_add(): Entry Data:";
+ print_r($new_user_entry);
+ print "</b><br>\n";
+ }
@ldap_add($ds,$dn,$new_user_entry);
foreach($show_attrs as $key => $attr){
continue;
$mod[$attrmap["$key"]] = $$attrmap["$key"];
+ if ($config[ldap_debug] == 'true'){
+ print "<b>DEBUG(LDAP): ldap_mod_add(): DN='$dn'</b><br>\n";
+ print "<b>DEBUG(LDAP): ldap_mod_add(): Data:";
+ print_r($mod);
+ print "</b><br>\n";
+ }
@ldap_mod_add($ds,$dn,$mod);
}
}
$ds=@ldap_connect("$config[ldap_server]"); // must be a valid ldap server!
if ($ds) {
$r=@da_ldap_bind($ds,$config);
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Search Query: BASE='$config[ldap_default_dn]',FILTER='objectclass=*'</b><br>\n";
$sr=@ldap_search($ds,"$config[ldap_default_dn]", 'objectclass=*');
if ($info = @ldap_get_entries($ds, $sr)){
$dn = $info[0]['dn'];
}
if ($regular_profile_attr != ''){
$get_attrs = array("$regular_profile_attr");
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Search Query: BASE='$config[ldap_base]',FILTER='uid=$login'</b><br>\n";
$sr=@ldap_search($ds,"$config[ldap_base]","uid=" . $login,$get_attrs);
if ($info = @ldap_get_entries($ds,$sr)){
for($i=0;$i<$info[0][$regular_profile_attr]["count"];$i++){
$dn2 = $info[0][$regular_profile_attr][$i];
if ($dn2 != ''){
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Search Query: BASE='$dn2',FILTER='objectclass=*'</b><br>\n";
$sr2=@ldap_search($ds,"$dn2",'objectclass=*');
if ($info2 = @ldap_get_entries($ds,$sr2)){
$dn3 = $info2[0]['dn'];
if ($ds){
$r = @da_ldap_bind($ds,$config);
if ($r){
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Delete Request: DN='$dn'</b><br>\n";
@ldap_delete($ds,$dn);
if (@ldap_error($ds) == 'Success')
echo "<b>User Deleted successfully</b><br>\n";
require('../lib/ldap/attrmap.php3');
$attr = $attrmap[$radius_attr];
}
- $sr=@ldap_search($ds,"$config[ldap_base]", "(&($attr=*$search*)(uid=*))",array('uid'),0,$max_results);
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Search Query: BASE='$config[ldap_base]',FILTER='$attr=*$search*'</b><br>\n";
+ $sr=@ldap_search($ds,"$config[ldap_base]", "$attr=*$search*",array('uid'),0,$max_results);
if (($info = @ldap_get_entries($ds, $sr))){
for ($i = 0; $i < $info["count"]; $i++)
$found_users[] = $info[$i]['uid'][0];
($din == '' && $pass == '')){
$din = $config[ldap_binddn];
$pass = $config[ldap_bindpw];
- }
- if (preg_match('/[\s,]/',$din)) // It looks like a dn
- return @ldap_bind($ds,$din,$pass);
+ }
+ if (preg_match('/[\s,]/',$din)){ // It looks like a dn
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Bind Request: DN='$din',PASSWD='$pass'</b><br>\n";
+ return @ldap_bind($ds,"$din","$pass");
+ }
else{ // It's not a DN. Find a corresponding DN
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Bind Request: DN='$config[ldap_binddn]',PASSWD='$config[ldap_bindpw]'</b><br>\n";
$r=@ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
if ($r){
$sr=@ldap_search($ds,"$config[ldap_base]", 'uid=' . $din);
$info = @ldap_get_entries($ds, $sr);
$din = $info[0]['dn'];
- if ($din != '')
- return @ldap_bind($ds,$din,$pass);
+ if ($din != ''){
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Bind Request: DN='$din',PASSWD='$pass'</b><br>\n";
+ return @ldap_bind($ds,"$din","$pass");
+ }
}
}
}
$ds=@ldap_connect("$config[ldap_server]"); // must be a valid ldap server!
if ($ds) {
$r=@da_ldap_bind($ds,$config);
+ if ($config[ldap_debug] == 'true')
+ print "<b>DEBUG(LDAP): Search Query: BASE='$config[ldap_base]',FILTER='uid=$login'</b><br>\n";
$sr=@ldap_search($ds,"$config[ldap_base]", 'uid=' . $login);
$info = @ldap_get_entries($ds, $sr);
$dn = $info[0]['dn'];
function da_sql_query($link,$config,$query)
{
+ if ($config[sql_debug] == 'true')
+ print "<b>DEBUG(SQL,PG DRIVER): Query: $query</b><br>\n";
return @pg_exec($link,$query);
}
function da_sql_num_rows($result,$config)
{
+ if ($config[sql_debug] == 'true')
+ print "<b>DEBUG(SQL,PG DRIVER): Query Result: Num rows:: " . @pg_numrows($result) . "</b><br>\n";
return @pg_numrows($result);
}
function da_sql_fetch_array($result,$config)
{
+ if ($config[sql_debug] == 'true'){
+ print "<b>DEBUG(SQL,PG DRIVER): Query Result: ";
+ print_r(@pg_fetch_array($result,$config[tmp_pg_array_num][$result]++,PGSQL_ASSOC));
+ print "</b><br>\n";
+ }
$row = @pg_fetch_array($result,$config[tmp_pg_array_num][$result]++,PGSQL_ASSOC);
if (!$row)
$config[tmp_pg_array_num][$result] = 0;
function da_sql_affected_rows($link,$result,$config)
{
+ if ($config[sql_debug] == 'true')
+ print "<b>DEBUG(SQL,PG DRIVER): Query Result: Affected rows:: " . @pg_cmdtuples($result) . "</b><br>\n";
return @pg_cmdtuples($result);
}