/usr/share/freeradius-dialupadmin/lib/sql/defaults.php is in freeradius-dialupadmin 2.1.12+dfsg-1.2ubuntu8.
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 132 133 134 135 136 137 138 139 | <?php
require('../lib/sql/attrmap.php');
if ($login != '' && $user_type != 'group'){
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
else{
echo "<b>Could not include SQL library</b><br>\n";
exit();
}
if ($config[sql_use_operators] == 'true'){
$op = ',op';
$use_op = 1;
}else{
$op = "";
$use_op = 0;
}
$overwrite_defaults = 1;
$stop = 0;
$times = 0;
do{
unset($item_vals);
unset($member_groups);
unset($tmp);
$times++;
$link = @da_sql_pconnect($config);
if ($link){
$res = @da_sql_query($link,$config,
"SELECT groupname FROM $config[sql_usergroup_table] WHERE username = '$login';");
if ($res){
while(($row = @da_sql_fetch_array($res,$config))){
$group = $row[groupname];
$member_groups[$group] = $group;
}
if (isset($member_groups))
ksort($member_groups);
}
if (isset($member_groups)){
$in = '(';
foreach ($member_groups as $group)
$in .= "'$group',";
$in = substr($in,0,-1);
$in .= ')';
$res = @da_sql_query($link,$config,
"SELECT attribute,value $op FROM $config[sql_groupcheck_table]
WHERE groupname IN $in;");
if ($res){
while(($row = @da_sql_fetch_array($res,$config))){
$attr = $row[attribute];
$val = $row[value];
if ($use_op){
$oper = $row[op];
$tmp["$attr"][operator][]="$oper";
}
$tmp["$attr"][]="$val";
$tmp["$attr"][count]++;
}
$res = @da_sql_query($link,$config,
"SELECT attribute,value $op FROM $config[sql_groupreply_table]
WHERE groupname IN $in;");
if ($res){
while(($row = @da_sql_fetch_array($res,$config))){
$attr = $row[attribute];
$val = $row[value];
if ($use_op){
$oper = $row[op];
$tmp["$attr"][operator][]="$oper";
}
$tmp["$attr"][] = "$val";
$tmp["$attr"][count]++;
}
}
else
echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n";
}
else
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
if (isset($tmp)){
foreach(array_keys($tmp) as $val){
if ($val == '')
continue;
$key = $rev_attrmap["$val"];
if ($key == ''){
$key = $val;
$attrmap["$key"] = $val;
$attr_type["$key"] = 'replyItem';
$rev_attrmap["$val"] = $key;
}
if (!isset($default_vals["$key"]) || $overwrite_defaults){
if ($use_op)
$default_vals["$key"][operator] = $tmp["$val"][operator];
if ($tmp[$val][0] != '')
$default_vals["$key"] = $tmp["$val"];
}
}
}
}
if ($times == 1){
if ($config[sql_default_user_profile] == '')
$stop = 1;
else{
$saved_login = $login;
$saved_member_groups = $member_groups;
$login = $config[sql_default_user_profile];
$overwrite_defaults = 0;
}
}
if ($times == 2){
$login = $saved_login;
$member_groups = $saved_member_groups;
$stop = 1;
}
}
else
echo "<b>Could not connect to SQL database</b><br>\n";
}while($stop == 0);
}
else{
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
else{
echo "<b>Could not include SQL library</b><br>\n";
exit();
}
unset($member_groups);
$link = @da_sql_pconnect($config);
if ($link){
$res = @da_sql_query($link,$config,
"SELECT DISTINCT groupname FROM $config[sql_usergroup_table];");
if ($res){
while(($row = @da_sql_fetch_array($res,$config)))
$member_groups[] = $row[groupname];
}
else
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
}
else
echo "<b>Could not connect to SQL database</b><br>\n";
}
?>
|