Freeradius_settings_resync() reverting users file to original
-
when i try edit users file [/usr/pbi/freeradius-amd64/local/etc/raddb/users] by custom web page
function freeradius_settings_resync reverting users file to original becuase original data store in this$config['installedpackages']['freeradius']['config']
script read array
require_once("config.inc"); $array = $config['installedpackages']['freeradius']['config']; print_r(array_values($array)); ?>
Array store my original password
users file before function start
 start [/b]<br />[img]http://i.imgur.com/6XUM1Uh.png[/img]<br /><br />how to edit data in this array before function sync start.<br />i think if edit this data success my users file must change follow this array.<br /><br />Thanks <br /><br />Steve. :)[/u][/u][/img]) -
The image is totally unreadable, and your unknown "custom web page" apparently broken. Beyond that, with the amount of information available here, try a crystal ball.
-
change_password.php
<form action="captiveportal-cmd.php" method="post" name="frm_data" class="login"> Captivportal Change Password. **cmd.php**
if(!isset($_POST['auth_user']) ||
($_POST['auth_user'])==null ||
($_POST['auth_pass'])==null||
($_POST['new_pass'])==null||
($_POST['conf_pass'])==null){
exit();
}$user = $_POST['auth_user'];
$old_pwd = $_POST['auth_pass'];
$new_pwd = $_POST['new_pass'];
$conf_pwd = $_POST['conf_pass'];echo '
if($_POST['from']=="first_login"){
echo shell_exec("sh captiveportal-first_login.sh '$user' '$old_pwd' '$new_pwd'");
}
else{
echo shell_exec("sh captiveportal-password.sh '$user' '$old_pwd' '$new_pwd'");
}
echo '
';
?>**password.sh**
#!/bin/bash
base_users="/usr/pbi/freeradius-amd64/local/etc/raddb/users"
username=$1
next_changepassword=date -v +90d +%Y-%m-%d
input=$1" "$2
oldpassmd5=md5 -s $2 | awk -F ' ' '{print $4}'
newpassmd5=md5 -s $3 | awk -F ' ' '{print $4}'
#newpassword=$3
result=$(grep -i '"'$1'" Cleartext-Password := "'$2'"' $base_users | awk -F '"' '{print $2" "$4}')
size=${#result}#echo "Input : $input"
if [ "$size" == "0" ]
then
echo ''
else
if [ "$result" == "$input" ]
then## Check Old Password check_allpwd=`cat /home/log/pwd.log | grep -w $1| wc -l | awk -F ' ' '{print $1}'` first_oldpwd=`grep -w $1 /home/log/pwd.log | tail -1` check_oldpwd=`cat /home/log/pwd.log | grep -w $1:$newpassmd5 | wc -l | awk -F ' ' '{print $1}'` if [ "$check_oldpwd" != "0" ] then echo '' else sed -i '' s'/"'$1'" Cleartext-Password := "'$2'"/"'$1'" Cleartext-Password := "'$3'"/g' $base_users echo $1:$newpassmd5 >> /home/log/pwd.log grep -wiv $username /home/log/log_changepassword > /home/log/tmp ; mv /home/log/tmp /home/log/log_changepassword echo $1:$next_changepassword >> /home/log/log_changepassword #delete first_oldpwd if [ "$check_allpwd" -lt 5 ] then sh captiveportal-av.sh > /dev/null else sed -i"$1" '1d' /home/log/pwd.log rm /home/log/pwd.log$1 sh av.sh > /dev/null fi #echo `date` User [ $1 ] Change password from [ $2 ] ==\> [ $3 ] with no error. >> /home/log/success.log
echo '
';
fielse
echo `date` User [ $1 ] Change password from [ $2 ] ==\> [ $3 ] with error. >> /home/log/error.log echo ''
fi
fi
**av.sh **``` #!/bin/sh readStatus(){ x=$(cat /home/log/Status) } readStatus while [ $x != "Ready" ] do sleep 2 readStatus done echo Busy > /home/log/Status sh /usr/local/etc/rc.d/radiusd.sh restart > /dev/null sleep 1.5 echo Ready > /home/log/Status ```****</form>