Subversion Repositories ALCASAR

Rev

Rev 1279 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1279 Rev 1709
Line 3... Line 3...
3
# Things should work even if register_globals is set to off
3
# Things should work even if register_globals is set to off
4
#
4
#
5
$testVer=intval(str_replace(".", "",'4.1.0'));
5
$testVer=intval(str_replace(".", "",'4.1.0'));
6
$curVer=intval(str_replace(".", "",phpversion()));
6
$curVer=intval(str_replace(".", "",phpversion()));
7
if( $curVer >= $testVer )
7
if( $curVer >= $testVer )
-
 
8
{
8
	import_request_variables('GPC');
9
//	import_request_variables('GPC');
-
 
10
	extract($_GET);
-
 
11
	extract($_POST);
-
 
12
	extract($_COOKIE);
-
 
13
}
9
# If using sessions set use_session to 1 to also cache the config file
14
# If using sessions set use_session to 1 to also cache the config file
10
#
15
#
11
$use_session = 0;
16
$use_session = 0;
12
unset($config);
17
unset($config);
13
unset($nas_list);
18
unset($nas_list);
Line 22... Line 27...
22
if (!isset($config)){
27
if (!isset($config)){
23
	$ARR=file("/etc/freeradius-web/admin.conf");
28
	$ARR=file("/etc/freeradius-web/admin.conf");
24
	$EXTRA_ARR = array();
29
	$EXTRA_ARR = array();
25
	foreach($ARR as $val) {
30
	foreach($ARR as $val) {
26
		$val=chop($val);
31
		$val=chop($val);
27
		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
32
		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
28
			continue;
33
			continue;
29
		list($key,$v)=split(":[[:space:]]*",$val,2);
34
		list($key,$v)=preg_split("/:[[:space:]]*/",$val,2);
30
		if (preg_match("/%\{(.+)\}/",$v,$matches)){
35
		if (preg_match("/%\{(.+)\}/",$v,$matches)){
31
			$val=$config[$matches[1]];
36
			$val=$config[$matches[1]];
32
			$v=preg_replace("/%\{$matches[1]\}/",$val,$v);
37
			$v=preg_replace("/%\{$matches[1]\}/",$val,$v);
33
		}
38
		}
34
		if (preg_match("/^nas(\d+)_(\w+)$/",$key,$matches))
39
		if (preg_match("/^nas(\d+)_(\w+)$/",$key,$matches))
Line 43... Line 48...
43
			$config["$key"]="$v";
48
			$config["$key"]="$v";
44
	}
49
	}
45
	foreach($EXTRA_ARR as $val1) {
50
	foreach($EXTRA_ARR as $val1) {
46
		foreach($val1 as $val){
51
		foreach($val1 as $val){
47
			$val=chop($val);
52
			$val=chop($val);
48
			if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
53
			if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
49
				continue;
54
				continue;
50
			list($key,$v)=split(":[[:space:]]*",$val,2);
55
			list($key,$v)=preg_split("/:[[:space:]]*/",$val,2);
51
			if (preg_match("/%\{(.+)\}/",$v,$matches)){
56
			if (preg_match("/%\{(.+)\}/",$v,$matches)){
52
				$val=$config[$matches[1]];
57
				$val=$config[$matches[1]];
53
				$v=preg_replace("/%\{$matches[1]\}/",$val,$v);
58
				$v=preg_replace("/%\{$matches[1]\}/",$val,$v);
54
			}
59
			}
55
			if (preg_match("/^nas(\d+)_(\w+)$/",$key,$matches))
60
			if (preg_match("/^nas(\d+)_(\w+)$/",$key,$matches))
Line 86... Line 91...
86
	$mappings = $_SESSION['mappings'];
91
	$mappings = $_SESSION['mappings'];
87
if (!isset($mappings) && $config['general_username_mappings_file'] != ''){
92
if (!isset($mappings) && $config['general_username_mappings_file'] != ''){
88
	$ARR = file($config['general_username_mappings_file']);
93
	$ARR = file($config['general_username_mappings_file']);
89
	foreach($ARR as $val){
94
	foreach($ARR as $val){
90
		$val=chop($val);
95
		$val=chop($val);
91
		if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
96
		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
92
			continue;
97
			continue;
93
		list($key,$realm,$v)=split(":[[:space:]]*",$val,3);
98
		list($key,$realm,$v)=preg_split("/:[[:space:]]*/",$val,3);
94
		if ($realm == 'accounting' || $realm == 'userdb' || $realm == 'nasdb' || $realm == 'nasadmin')
99
		if ($realm == 'accounting' || $realm == 'userdb' || $realm == 'nasdb' || $realm == 'nasadmin')
95
			$mappings["$key"][$realm] = $v;
100
			$mappings["$key"][$realm] = $v;
96
		if ($realm == 'nasdb'){
101
		if ($realm == 'nasdb'){
97
			$NAS_ARR = array();
102
			$NAS_ARR = array();
98
			$NAS_ARR = split(',',$v);
103
			$NAS_ARR = explode(',',$v);
99
			foreach ($nas_list as $key => $nas){
104
			foreach ($nas_list as $key => $nas){
100
				foreach ($NAS_ARR as $nas_check){
105
				foreach ($NAS_ARR as $nas_check){
101
					if ($nas_check == $nas['name'])
106
					if ($nas_check == $nas['name'])
102
						unset($nas_list[$key]);
107
						unset($nas_list[$key]);
103
				}
108
				}