diff --git a/contrib/fix_munged.php b/contrib/fix_munged.php
index 1195fb305717853f41d3cff028b91a484304c697..405d345afb295f9ee20eda8b90d27075ba0921c8 100755 (executable)
--- a/contrib/fix_munged.php
+++ b/contrib/fix_munged.php
/* Internal Settings */
$ldap_protocol= "3";
/* Internal Settings */
$ldap_protocol= "3";
-$filter= "(objectClass=sambaSamAccount)";
+$filter= "(&(objectClass=sambaSamAccount)(sambaMungedDial=*))";
$attributes= array("dn","sambaMungedDial");
print("This script will try to convert all ldap entries that have the sambaMungedDial-Attribute set, into the new \n".
$attributes= array("dn","sambaMungedDial");
print("This script will try to convert all ldap entries that have the sambaMungedDial-Attribute set, into the new \n".
@@ -52,18 +52,18 @@ print("This script will try to convert all ldap entries that have the sambaMunge
"before running.\n".
"Do you want to continue (y/n)?\n");
"before running.\n".
"Do you want to continue (y/n)?\n");
-$handle= fopen("/dev/stdin","r");
+$handle= fopen("php://stdin","r");
$input=(fgets($handle,16));
fclose($handle);
if(substr(strtolower($input),0,1)!="y") {
exit(1);
}
/* Connect to server */
$input=(fgets($handle,16));
fclose($handle);
if(substr(strtolower($input),0,1)!="y") {
exit(1);
}
/* Connect to server */
-ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $ldap_protocol);
$connection= ldap_connect($ldap_host,$ldap_port)
$connection= ldap_connect($ldap_host,$ldap_port)
- or die ('Could not connect to server '.$ldap_host.'!');
+ or die ('Could not connect to server '.$ldap_host."\n!");
+ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, $ldap_protocol);
ldap_bind($connection,$ldap_admin,$ldap_password)
ldap_bind($connection,$ldap_admin,$ldap_password)
- or die ('Could not bind to server '.$ldap_host.'!');
+ or die ('Could not bind to server '.$ldap_host."!\n");
$results= ldap_get_entries($connection, ldap_search($connection, $ldap_base, $filter, $attributes));
$results= ldap_get_entries($connection, ldap_search($connection, $ldap_base, $filter, $attributes));
$mungedDial->load($entry['sambamungeddial'][0]);
$modify['sambaMungedDial'][0]= $mungedDial->getMunged();
if(ldap_modify($connection,$entry['dn'],$modify)) {
$mungedDial->load($entry['sambamungeddial'][0]);
$modify['sambaMungedDial'][0]= $mungedDial->getMunged();
if(ldap_modify($connection,$entry['dn'],$modify)) {
- print('done.');
+ print("done.\n");
} else {
} else {
- print('failed.');
+ print("failed.\n");
}
}
}
}