Revision 4e322e2c
Added by Phil Davis over 9 years ago
src/etc/inc/auth.inc | ||
---|---|---|
165 | 165 |
$referrer_host = str_replace(array("[", "]"), "", $referrer_host); |
166 | 166 |
if ($referrer_host) { |
167 | 167 |
if (strcasecmp($referrer_host, $config['system']['hostname'] . "." . $config['system']['domain']) == 0 || |
168 |
strcasecmp($referrer_host, $config['system']['hostname']) == 0) {
|
|
168 |
strcasecmp($referrer_host, $config['system']['hostname']) == 0) {
|
|
169 | 169 |
$found_host = true; |
170 | 170 |
} |
171 | 171 |
|
... | ... | |
1126 | 1126 |
|
1127 | 1127 |
$gresults = isset($authcfg['ldap_rfc2307']) ? $info : $info[0][$ldapgroupattribute]; |
1128 | 1128 |
|
1129 |
if(is_array($gresults)) { |
|
1129 |
if (is_array($gresults)) {
|
|
1130 | 1130 |
/* Iterate through the groups and throw them into an array */ |
1131 | 1131 |
foreach ($gresults as $grp) { |
1132 |
if (((isset($authcfg['ldap_rfc2307'])) && (stristr($grp["dn"], "CN=") !== false)) |
|
1133 |
|| ((!isset($authcfg['ldap_rfc2307'])) && (stristr($grp, "CN=") !== false))) {
|
|
1132 |
if (((isset($authcfg['ldap_rfc2307'])) && (stristr($grp["dn"], "CN=") !== false)) ||
|
|
1133 |
((!isset($authcfg['ldap_rfc2307'])) && (stristr($grp, "CN=") !== false))) {
|
|
1134 | 1134 |
$grpsplit = isset($authcfg['ldap_rfc2307']) ? explode(",", $grp["dn"]) : explode(",", $grp); |
1135 | 1135 |
$memberof[] = preg_replace("/CN=/i", "", $grpsplit[0]); |
1136 | 1136 |
} |
src/etc/inc/authgui.inc | ||
---|---|---|
130 | 130 |
$cssfile = "/bootstrap/css/pfSense.css"; |
131 | 131 |
|
132 | 132 |
if (isset($config['system']['webgui']['webguicss'])) { |
133 |
if(file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) { |
|
133 |
if (file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
|
|
134 | 134 |
$cssfile = "/bootstrap/css/" . $config['system']['webgui']['webguicss']; |
135 | 135 |
} |
136 | 136 |
} |
... | ... | |
233 | 233 |
$cssfile = "/bootstrap/css/pfSense.css"; |
234 | 234 |
|
235 | 235 |
if (isset($config['system']['webgui']['webguicss'])) { |
236 |
if(file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) { |
|
236 |
if (file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
|
|
237 | 237 |
$cssfile = "/bootstrap/css/" . $config['system']['webgui']['webguicss']; |
238 | 238 |
} |
239 | 239 |
} |
src/etc/inc/captiveportal.inc | ||
---|---|---|
545 | 545 |
$rulenum++; |
546 | 546 |
$cprules .= "add {$rulenum} pass ip from table(100) to any out\n"; |
547 | 547 |
$rulenum++; |
548 |
foreach ($cpips as $cpip) |
|
548 |
foreach ($cpips as $cpip) {
|
|
549 | 549 |
$cprules .= "table 100 add {$cpip}\n"; |
550 |
} |
|
550 | 551 |
$cprules .= "add {$rulenum} pass ip from any to 255.255.255.255 in\n"; |
551 | 552 |
$rulenum++; |
552 | 553 |
$cprules .= "add {$rulenum} pass ip from 255.255.255.255 to any out\n"; |
src/etc/inc/dyndns.class | ||
---|---|---|
300 | 300 |
$ch = curl_init(); |
301 | 301 |
|
302 | 302 |
if ($this->_useIPv6 == false) { |
303 |
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
|
|
303 |
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
|
304 | 304 |
} |
305 | 305 |
|
306 | 306 |
if ($this->_dnsService != 'ods' and $this->_dnsService != 'route53 ') { |
... | ... | |
691 | 691 |
case 'cloudflare': |
692 | 692 |
$needsIP = TRUE; |
693 | 693 |
$dnsServer ='api.cloudflare.com'; |
694 |
$dnsHost = str_replace(' ','', $this->_dnsHost); |
|
694 |
$dnsHost = str_replace(' ', '', $this->_dnsHost);
|
|
695 | 695 |
$host_names = explode(".", $dnsHost); |
696 | 696 |
$bottom_host_name = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1]; |
697 | 697 |
|
... | ... | |
707 | 707 |
curl_setopt($ch, CURLOPT_URL, $getZoneId); |
708 | 708 |
$output = json_decode(curl_exec($ch)); |
709 | 709 |
$zone = $output->result[0]->id; |
710 |
if ($zone){ // If zone ID was found get host ID |
|
710 |
if ($zone) { // If zone ID was found get host ID
|
|
711 | 711 |
$getHostId = "https://{$dnsServer}/client/v4/zones/{$zone}/dns_records?name={$this->_dnsHost}"; |
712 | 712 |
curl_setopt($ch, CURLOPT_URL, $getHostId); |
713 | 713 |
$output = json_decode(curl_exec($ch)); |
714 | 714 |
$host = $output->result[0]->id; |
715 |
if ($host){ // If host ID was found update host |
|
715 |
if ($host) { // If host ID was found update host
|
|
716 | 716 |
$hostData = array( |
717 | 717 |
"content" => "{$this->_dnsIP}", |
718 | 718 |
"type" => "A", |
... | ... | |
724 | 724 |
$updateHostId = "https://{$dnsServer}/client/v4/zones/{$zone}/dns_records/{$host}"; |
725 | 725 |
curl_setopt($ch, CURLOPT_URL, $updateHostId); |
726 | 726 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); |
727 |
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json); |
|
727 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
|
|
728 | 728 |
} |
729 | 729 |
} |
730 | 730 |
break; |
... | ... | |
831 | 831 |
case 'spdns': |
832 | 832 |
case 'spdns-v6': |
833 | 833 |
$needsIP = FALSE; |
834 |
if ($this->_dnsVerboseLog) |
|
834 |
if ($this->_dnsVerboseLog) {
|
|
835 | 835 |
log_error("SPDNS: ({$this->_dnsHost}) DNS update() starting."); |
836 |
} |
|
836 | 837 |
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass); |
837 | 838 |
$server = "https://update.spdns.de/nic/update"; |
838 | 839 |
$port = ""; |
839 |
if($this->_dnsServer)
|
|
840 |
if ($this->_dnsServer) {
|
|
840 | 841 |
$server = $this->_dnsServer; |
841 |
if($this->_dnsPort) |
|
842 |
} |
|
843 |
if ($this->_dnsPort) { |
|
842 | 844 |
$port = ":" . $this->_dnsPort; |
845 |
} |
|
843 | 846 |
curl_setopt($ch, CURLOPT_URL, $server .$port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP); |
844 | 847 |
break; |
845 | 848 |
default: |
... | ... | |
1300 | 1303 |
break; |
1301 | 1304 |
case 'cloudflare': |
1302 | 1305 |
$output = json_decode($data); |
1303 |
if ($output->result->content === $this->_dnsIP){ |
|
1306 |
if ($output->result->content === $this->_dnsIP) {
|
|
1304 | 1307 |
$status = "DynDNS: (Success) {$this->_dnsHost} updated to {$this->_dnsIP}"; |
1305 | 1308 |
$successful_update = true; |
1306 |
} |
|
1307 |
elseif ($output->errors[0]->code === 9103){ |
|
1309 |
} elseif ($output->errors[0]->code === 9103) { |
|
1308 | 1310 |
$status = "DynDNS ({$this->_dnsHost}): ERROR - Invalid Credentials! Don't forget to use API Key for password field with CloudFlare."; |
1309 |
} |
|
1310 |
elseif (($output->success) && (!$output->result[0]->id)) { |
|
1311 |
} elseif (($output->success) && (!$output->result[0]->id)) { |
|
1311 | 1312 |
$status = "DynDNS ({$this->_dnsHost}): ERROR - Zone or Host ID was not found, check your hostname."; |
1312 |
} |
|
1313 |
else { |
|
1313 |
} else { |
|
1314 | 1314 |
$status = "DynDNS ({$this->_dnsHost}): UNKNOWN ERROR - {$output->errors[0]->message}"; |
1315 | 1315 |
log_error("DynDNS ({$this->_dnsHost}): PAYLOAD: {$data}"); |
1316 | 1316 |
} |
src/etc/inc/easyrule.inc | ||
---|---|---|
53 | 53 |
} |
54 | 54 |
|
55 | 55 |
/* add ipsec interfaces */ |
56 |
if (ipsec_enabled()) |
|
56 |
if (ipsec_enabled()) {
|
|
57 | 57 |
$iflist["enc0"] = "IPSEC"; |
58 |
} |
|
58 | 59 |
|
59 | 60 |
if (isset($iflist[$int])) { |
60 | 61 |
return $int; |
src/etc/inc/filter.inc | ||
---|---|---|
430 | 430 |
* then output the contents of the error to the caller |
431 | 431 |
*/ |
432 | 432 |
if ($rules_loading <> 0) { |
433 |
foreach($rules_error as $errorline) { |
|
433 |
foreach ($rules_error as $errorline) {
|
|
434 | 434 |
$saved_line_error = $errorline; |
435 | 435 |
$line_error = explode(":", $errorline); |
436 | 436 |
$line_number = $line_error[1]; |
... | ... | |
2872 | 2872 |
(isset($rule['max-src-conn-rate']) and $rule['max-src-conn-rate'] <> "") or |
2873 | 2873 |
(isset($rule['max-src-conn-rates']) and $rule['max-src-conn-rates'] <> ""))) or |
2874 | 2874 |
(isset($rule['sloppy'])) or |
2875 |
(isset($rule['nopfsync'])) ) {
|
|
2875 |
(isset($rule['nopfsync']))) { |
|
2876 | 2876 |
$aline['flags'] .= "( "; |
2877 | 2877 |
if (isset($rule['sloppy'])) { |
2878 | 2878 |
$aline['flags'] .= "sloppy "; |
... | ... | |
3324 | 3324 |
|
3325 | 3325 |
} |
3326 | 3326 |
/* allow access to DHCP relay on interfaces */ |
3327 |
if(isset($config['dhcrelay']['enable'])) { |
|
3327 |
if (isset($config['dhcrelay']['enable'])) {
|
|
3328 | 3328 |
$dhcifaces = explode(",", $dhcrelaycfg['interface']); |
3329 | 3329 |
foreach ($dhcifaces as $dhcrelayif) { |
3330 | 3330 |
if ($dhcrelayif == $on) { |
src/etc/inc/filter_log.inc | ||
---|---|---|
230 | 230 |
|
231 | 231 |
$pattern = "/^" . $date_pattern . "\ +" . $log_message_pattern . "$/"; |
232 | 232 |
|
233 |
if (!preg_match($pattern, $line, $log_split)) |
|
233 |
if (!preg_match($pattern, $line, $log_split)) {
|
|
234 | 234 |
return ""; |
235 |
} |
|
235 | 236 |
|
236 | 237 |
list($all, $flent['time'], $flent['message']) = $log_split; |
237 | 238 |
|
... | ... | |
241 | 242 |
} |
242 | 243 |
|
243 | 244 |
/* If there is time, and message, fields, then the line should be usable/good */ |
244 |
if (!( (trim($flent['time']) == "") && (trim($flent['message']) == "") )) {
|
|
245 |
if (!((trim($flent['time']) == "") && (trim($flent['message']) == ""))) {
|
|
245 | 246 |
return $flent; |
246 | 247 |
} else { |
247 |
if($g['debug']) { |
|
248 |
if ($g['debug']) {
|
|
248 | 249 |
log_error(sprintf(gettext("There was a error parsing log entry: %s. Please report to mailing list or forum."), $errline)); |
249 | 250 |
} |
250 | 251 |
return ""; |
... | ... | |
269 | 270 |
|
270 | 271 |
$pattern = "/^" . $date_pattern . "\ +" . $process_pattern . "\ +" . $pid_pattern . "\ +" . $log_message_pattern . "$/"; |
271 | 272 |
|
272 |
if (!preg_match($pattern, $line, $log_split)) |
|
273 |
if (!preg_match($pattern, $line, $log_split)) {
|
|
273 | 274 |
return ""; |
275 |
} |
|
274 | 276 |
|
275 | 277 |
list($all, $flent['time'], $flent['host'], $flent['process'], $flent['pid'], $flent['message']) = $log_split; |
276 | 278 |
|
... | ... | |
280 | 282 |
} |
281 | 283 |
|
282 | 284 |
/* If there is time, process, and message, fields, then the line should be usable/good */ |
283 |
if (!( (trim($flent['time']) == "") && (trim($flent['process']) == "") && (trim($flent['message']) == "") )) {
|
|
285 |
if (!((trim($flent['time']) == "") && (trim($flent['process']) == "") && (trim($flent['message']) == ""))) {
|
|
284 | 286 |
return $flent; |
285 | 287 |
} else { |
286 |
if($g['debug']) { |
|
288 |
if ($g['debug']) {
|
|
287 | 289 |
log_error(sprintf(gettext("There was a error parsing log entry: %s. Please report to mailing list or forum."), $errline)); |
288 | 290 |
} |
289 | 291 |
return ""; |
... | ... | |
552 | 554 |
function handle_ajax($nentries, $tail = 50) { |
553 | 555 |
global $config; |
554 | 556 |
if ($_GET['lastsawtime'] or $_POST['lastsawtime']) { |
555 |
global $filter_logfile,$filterent; |
|
557 |
global $filter_logfile, $filterent;
|
|
556 | 558 |
if ($_GET['lastsawtime']) { |
557 | 559 |
$lastsawtime = $_GET['lastsawtime']; |
558 | 560 |
} |
src/etc/inc/interfaces.inc | ||
---|---|---|
824 | 824 |
/* Do not change the order here for more see gre(4) NOTES section. */ |
825 | 825 |
if (is_ipaddrv6($gre['remote-addr'])) { |
826 | 826 |
mwexec("/sbin/ifconfig {$greif} inet6 tunnel {$realifip6} " . escapeshellarg($gre['remote-addr'])); |
827 |
}else{
|
|
827 |
} else {
|
|
828 | 828 |
mwexec("/sbin/ifconfig {$greif} tunnel {$realifip} " . escapeshellarg($gre['remote-addr'])); |
829 | 829 |
} |
830 | 830 |
if ((is_ipaddrv6($gre['tunnel-local-addr'])) || (is_ipaddrv6($gre['tunnel-remote-addr']))) { |
... | ... | |
945 | 945 |
if (is_ipaddrv6($gif['remote-addr'])) { |
946 | 946 |
mwexec("/sbin/ifconfig {$gifif} inet6 tunnel {$realifip} " . escapeshellarg($gif['remote-addr'])); |
947 | 947 |
} else { |
948 |
mwexec("/sbin/ifconfig {$gifif} tunnel {$realifip} " . escapeshellarg($gif['remote-addr']));
|
|
948 |
mwexec("/sbin/ifconfig {$gifif} tunnel {$realifip} " . escapeshellarg($gif['remote-addr'])); |
|
949 | 949 |
} |
950 | 950 |
if ((is_ipaddrv6($gif['tunnel-local-addr'])) || (is_ipaddrv6($gif['tunnel-remote-addr']))) { |
951 | 951 |
/* XXX: The prefixlen argument for tunnels of ipv6 is useless since it needs to be 128 as enforced by kernel */ |
... | ... | |
5241 | 5241 |
/* XXX: Maybe use array_merge below? */ |
5242 | 5242 |
$carplist = get_configured_carp_interface_list(); |
5243 | 5243 |
foreach ($carplist as $cif => $carpip) { |
5244 |
if (get_vip_descr($carpip)) |
|
5244 |
if (get_vip_descr($carpip)) {
|
|
5245 | 5245 |
$interfaces[$cif] = $carpip . ' (' . get_vip_descr($carpip) . ')'; |
5246 |
else
|
|
5246 |
} else {
|
|
5247 | 5247 |
$interfaces[$cif] = $carpip; |
5248 |
} |
|
5248 | 5249 |
} |
5249 | 5250 |
$aliaslist = get_configured_ip_aliases_list(); |
5250 | 5251 |
foreach ($aliaslist as $aliasip => $aliasif) { |
5251 |
if (get_vip_descr($aliasip)) |
|
5252 |
if (get_vip_descr($aliasip)) {
|
|
5252 | 5253 |
$interfaces[$aliasip] = $aliasip . ' (' . get_vip_descr($aliasip) . ')'; |
5253 |
else
|
|
5254 |
} else {
|
|
5254 | 5255 |
$interfaces[$aliasip] = $aliasip; |
5256 |
} |
|
5255 | 5257 |
} |
5256 | 5258 |
|
5257 | 5259 |
$interfaces['lo0'] = 'Localhost'; |
src/etc/inc/ipsec.inc | ||
---|---|---|
205 | 205 |
function ipsec_enabled() { |
206 | 206 |
global $config; |
207 | 207 |
|
208 |
if (!isset($config['ipsec']) || !is_array($config['ipsec'])) |
|
208 |
if (!isset($config['ipsec']) || !is_array($config['ipsec'])) {
|
|
209 | 209 |
return false; |
210 |
} |
|
210 | 211 |
|
211 | 212 |
/* Check if we have at least one phase 1 entry. */ |
212 | 213 |
if (!isset($config['ipsec']['phase1']) || |
... | ... | |
216 | 217 |
} |
217 | 218 |
/* Check if at least one phase 1 entry is enabled. */ |
218 | 219 |
foreach ($config['ipsec']['phase1'] as $phase1) { |
219 |
if (!isset($phase1['disabled'])) |
|
220 |
if (!isset($phase1['disabled'])) {
|
|
220 | 221 |
return true; |
222 |
} |
|
221 | 223 |
} |
222 | 224 |
|
223 | 225 |
return false; |
... | ... | |
477 | 479 |
*/ |
478 | 480 |
function ipsec_list_sa() { |
479 | 481 |
|
480 |
if (ipsec_enabled()) |
|
482 |
if (ipsec_enabled()) {
|
|
481 | 483 |
return pfSense_ipsec_list_sa(); |
484 |
} |
|
482 | 485 |
|
483 | 486 |
return array(); |
484 | 487 |
} |
src/etc/inc/openvpn.inc | ||
---|---|---|
131 | 131 |
|
132 | 132 |
$list = array(); |
133 | 133 |
|
134 |
foreach ($openvpn_server_modes as $name => $desc) |
|
134 |
foreach ($openvpn_server_modes as $name => $desc) {
|
|
135 | 135 |
$list[$name] = $desc; |
136 |
} |
|
136 | 137 |
|
137 | 138 |
return($list); |
138 | 139 |
} |
... | ... | |
143 | 144 |
$interfaces = get_configured_interface_with_descr(); |
144 | 145 |
$carplist = get_configured_carp_interface_list(); |
145 | 146 |
|
146 |
foreach ($carplist as $cif => $carpip) |
|
147 |
foreach ($carplist as $cif => $carpip) {
|
|
147 | 148 |
$interfaces[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")"; |
149 |
} |
|
148 | 150 |
|
149 | 151 |
$aliaslist = get_configured_ip_aliases_list(); |
150 | 152 |
|
151 |
foreach ($aliaslist as $aliasip => $aliasif) |
|
153 |
foreach ($aliaslist as $aliasip => $aliasif) {
|
|
152 | 154 |
$interfaces[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")"; |
155 |
} |
|
153 | 156 |
|
154 | 157 |
$grouplist = return_gateway_groups_array(); |
155 | 158 |
|
156 | 159 |
foreach ($grouplist as $name => $group) { |
157 |
if($group['ipprotocol'] != inet)
|
|
160 |
if ($group['ipprotocol'] != inet) {
|
|
158 | 161 |
continue; |
162 |
} |
|
159 | 163 |
|
160 |
if($group[0]['vip'] != "")
|
|
164 |
if ($group[0]['vip'] != "") {
|
|
161 | 165 |
$vipif = $group[0]['vip']; |
162 |
else
|
|
166 |
} else {
|
|
163 | 167 |
$vipif = $group[0]['int']; |
168 |
} |
|
164 | 169 |
|
165 | 170 |
$interfaces[$name] = "GW Group {$name}"; |
166 | 171 |
} |
... | ... | |
168 | 173 |
$interfaces['lo0'] = "Localhost"; |
169 | 174 |
$interfaces['any'] = "any"; |
170 | 175 |
|
171 |
foreach ($interfaces as $iface => $ifacename) |
|
176 |
foreach ($interfaces as $iface => $ifacename) {
|
|
172 | 177 |
$list[$iface] = $ifacename; |
178 |
} |
|
173 | 179 |
|
174 | 180 |
return($list); |
175 | 181 |
} |
... | ... | |
183 | 189 |
$caname = ""; |
184 | 190 |
$ca = lookup_ca($crl['caref']); |
185 | 191 |
|
186 |
if ($ca) |
|
192 |
if ($ca) {
|
|
187 | 193 |
$caname = " (CA: {$ca['descr']})"; |
194 |
} |
|
188 | 195 |
|
189 | 196 |
$list[$crl['refid']] = $crl['descr'] . $caname; |
190 | 197 |
} |
... | ... | |
257 | 264 |
$serverbridge_interface = array_merge($serverbridge_interface, get_configured_interface_with_descr()); |
258 | 265 |
$carplist = get_configured_carp_interface_list(); |
259 | 266 |
|
260 |
foreach ($carplist as $cif => $carpip) |
|
267 |
foreach ($carplist as $cif => $carpip) {
|
|
261 | 268 |
$serverbridge_interface[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")"; |
269 |
} |
|
262 | 270 |
|
263 | 271 |
$aliaslist = get_configured_ip_aliases_list(); |
264 | 272 |
|
265 |
foreach ($aliaslist as $aliasip => $aliasif) |
|
273 |
foreach ($aliaslist as $aliasip => $aliasif) {
|
|
266 | 274 |
$serverbridge_interface[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")"; |
275 |
} |
|
267 | 276 |
|
268 |
foreach ($serverbridge_interface as $iface => $ifacename) |
|
277 |
foreach ($serverbridge_interface as $iface => $ifacename) {
|
|
269 | 278 |
$list[$iface] = htmlspecialchars($ifacename); |
279 |
} |
|
270 | 280 |
|
271 | 281 |
return($list); |
272 | 282 |
} |
src/etc/inc/pfsense-utils.inc | ||
---|---|---|
408 | 408 |
global $config; |
409 | 409 |
|
410 | 410 |
foreach ($config['virtualip']['vip'] as $carp) { |
411 |
if ($carp['mode'] != "carp") |
|
411 |
if ($carp['mode'] != "carp") {
|
|
412 | 412 |
continue; |
413 |
} |
|
413 | 414 |
$carpif = "_vip{$carp['uniqid']}"; |
414 |
if ($carpinterface !== $carpif) |
|
415 |
if ($carpinterface !== $carpif) {
|
|
415 | 416 |
continue; |
417 |
} |
|
416 | 418 |
|
417 | 419 |
$interface = get_real_interface($carp['interface']); |
418 | 420 |
$vhid = $carp['vhid']; |
src/etc/inc/pkg-utils.inc | ||
---|---|---|
192 | 192 |
|
193 | 193 |
$now = time(); |
194 | 194 |
|
195 |
if(($now - $started) >= $maxwaittime) { |
|
195 |
if (($now - $started) >= $maxwaittime) {
|
|
196 | 196 |
$rc = -1; |
197 | 197 |
proc_terminate($process); |
198 | 198 |
break; |
... | ... | |
204 | 204 |
fclose($pipes[2]); |
205 | 205 |
proc_close($process); |
206 | 206 |
|
207 |
if(!isset($rc)) { |
|
207 |
if (!isset($rc)) {
|
|
208 | 208 |
$rc = $status['exitcode']; |
209 | 209 |
} |
210 | 210 |
|
... | ... | |
353 | 353 |
|
354 | 354 |
foreach ($config['installedpackages']['package'] as $idx => $pkg) { |
355 | 355 |
if ($pkg['name'] == $package_name || |
356 |
get_package_internal_name($pkg) == $package_name) {
|
|
356 |
get_package_internal_name($pkg) == $package_name) {
|
|
357 | 357 |
return $idx; |
358 | 358 |
} |
359 | 359 |
} |
src/etc/inc/rrd.inc | ||
---|---|---|
278 | 278 |
$captiveportalvalid = $rrdcaptiveportalinterval * 2; |
279 | 279 |
$ntpdvalid = $rrdntpdinterval * 2; |
280 | 280 |
$dhcpdvalid = $rrddhcpdinterval * 2; |
281 |
|
|
281 |
|
|
282 | 282 |
/* Assume 2*10GigE for now */ |
283 | 283 |
$downstream = 2500000000; |
284 | 284 |
$upstream = 2500000000; |
... | ... | |
915 | 915 |
|
916 | 916 |
} |
917 | 917 |
/* End NTP statistics */ |
918 |
|
|
918 |
|
|
919 | 919 |
/* Start dhcpd statistics */ |
920 | 920 |
if (is_array($config['dhcpd'])) { |
921 | 921 |
foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) { |
922 |
if (isset($config['dhcpd'][$dhcpif]['statsgraph'])) {
|
|
922 |
if (isset($config['dhcpd'][$dhcpif]['statsgraph'])) { |
|
923 | 923 |
if (!file_exists("$rrddbpath$dhcpif$dhcpd")) { |
924 | 924 |
$rrdcreate = "$rrdtool create $rrddbpath$dhcpif$dhcpd --step $rrddhcpdinterval "; |
925 | 925 |
$rrdcreate .= "DS:leases:GAUGE:$dhcpdvalid:0:100000 "; |
... | ... | |
950 | 950 |
$rrdupdatesh .= "# polling leases for dhcp \n"; |
951 | 951 |
$rrdupdatesh .= "DHCP=`${php} -q ${dhcpd_gather} '${dhcpif}'`\n"; |
952 | 952 |
$rrdupdatesh .= "$rrdtool update $rrddbpath$dhcpif$dhcpd \${DHCP}\n"; |
953 |
|
|
953 |
|
|
954 | 954 |
} |
955 | 955 |
} |
956 | 956 |
} |
src/etc/inc/shaper.inc | ||
---|---|---|
3761 | 3761 |
$form .= "<tbody>"; |
3762 | 3762 |
|
3763 | 3763 |
// If there are no bandwidths defined, make a blank one for convenience |
3764 |
if(empty($bandwidth))
|
|
3764 |
if (empty($bandwidth)) {
|
|
3765 | 3765 |
$bandwidth = array(0 => array('bw' => '', 'bwscale' => 'Kb', 'bwsched' => 'none')); |
3766 |
} |
|
3766 | 3767 |
|
3767 | 3768 |
if (is_array($bandwidth)) { |
3768 | 3769 |
foreach ($bandwidth as $bwidx => $bw) { |
... | ... | |
4190 | 4191 |
$bandwidth = $this->GetBandwidth(); |
4191 | 4192 |
|
4192 | 4193 |
// Delete a row |
4193 |
if(isset($_GET['delbwrow']) && (count($bandwidth) > 0))
|
|
4194 |
if (isset($_GET['delbwrow']) && (count($bandwidth) > 0)) {
|
|
4194 | 4195 |
unset($bandwidth[$_GET['delbwrow']]); |
4196 |
} |
|
4195 | 4197 |
|
4196 | 4198 |
// Add a row |
4197 |
if($_GET['newbwrow']) { |
|
4199 |
if ($_GET['newbwrow']) {
|
|
4198 | 4200 |
array_push($bandwidth, array(count($bandwidth) => array('bw' => '', 'burst' => '', 'bwscale' => 'Kb', 'bwsched' => 'none') )); |
4199 | 4201 |
|
4200 | 4202 |
} |
... | ... | |
4203 | 4205 |
$row = 0; |
4204 | 4206 |
$numrows = count($bandwidth) - 1; |
4205 | 4207 |
|
4206 |
if($numrows >= 0) { |
|
4208 |
if ($numrows >= 0) {
|
|
4207 | 4209 |
foreach ($bandwidth as $bwidx => $bw) { |
4208 | 4210 |
$group = new Form_Group($row == 0 ? 'Bandwidth':null); |
4209 | 4211 |
|
... | ... | |
4234 | 4236 |
'firewall_shaper_vinterface.php?pipe=' . $pipe . '&queue=' . $qname . '&action=' . $action . '&delbwrow=' . $bwidx |
4235 | 4237 |
))->removeClass('btn-primary')->addClass('btn-danger btn-sm'); |
4236 | 4238 |
|
4237 |
if($row == $numrows)
|
|
4239 |
if ($row == $numrows) {
|
|
4238 | 4240 |
$group->setHelp('Bandwidth is the rate (e.g. Mbit/s) to which traffic in this limiter will be restricted.'); |
4241 |
} |
|
4239 | 4242 |
|
4240 | 4243 |
$section->add($group); |
4241 | 4244 |
$row++; |
src/etc/inc/system.inc | ||
---|---|---|
587 | 587 |
} |
588 | 588 |
|
589 | 589 |
$gateways_arr = return_gateways_array(false, true); |
590 |
foreach($gateways_arr as $gateway) { |
|
590 |
foreach ($gateways_arr as $gateway) {
|
|
591 | 591 |
// setup static interface routes for nonlocal gateways |
592 | 592 |
if (isset($gateway["nonlocalgateway"])) { |
593 | 593 |
$srgatewayip = $gateway['gateway']; |
src/etc/inc/upgrade_config.inc | ||
---|---|---|
4033 | 4033 |
/* subtract 2 from ipsec log levels. the value stored in the config.xml |
4034 | 4034 |
* will now match the strongswan level exactly. |
4035 | 4035 |
*/ |
4036 |
foreach(array_keys($ipsec_log_cats) as $cat) { |
|
4036 |
foreach (array_keys($ipsec_log_cats) as $cat) {
|
|
4037 | 4037 |
if (!isset($config['ipsec']["ipsec_{$cat}"])) { |
4038 | 4038 |
$new_level = $def_loglevel; |
4039 | 4039 |
} else { |
... | ... | |
4121 | 4121 |
} |
4122 | 4122 |
|
4123 | 4123 |
/* IPSEC is always on in 2.3. */ |
4124 |
if (isset($config['ipsec']['enable'])) |
|
4124 |
if (isset($config['ipsec']['enable'])) {
|
|
4125 | 4125 |
unset($config['ipsec']['enable']); |
4126 |
} |
|
4126 | 4127 |
} |
4127 | 4128 |
|
4128 | 4129 |
function upgrade_129_to_130() { |
src/etc/inc/util.inc | ||
---|---|---|
1041 | 1041 |
|
1042 | 1042 |
$iflist = array(); |
1043 | 1043 |
|
1044 |
if (!is_array($config['virtualip']['vip']) || empty($config['virtualip']['vip'])) |
|
1044 |
if (!is_array($config['virtualip']['vip']) || empty($config['virtualip']['vip'])) {
|
|
1045 | 1045 |
return $iflist; |
1046 |
} |
|
1046 | 1047 |
|
1047 | 1048 |
$viparr = &$config['virtualip']['vip']; |
1048 | 1049 |
foreach ($viparr as $vip) { |
1049 |
if ($vip['mode'] != "carp") |
|
1050 |
if ($vip['mode'] != "carp") {
|
|
1050 | 1051 |
continue; |
1052 |
} |
|
1051 | 1053 |
|
1052 | 1054 |
if (empty($carpinterface)) { |
1053 | 1055 |
$iflist["_vip{$vip['uniqid']}"] = $vip['subnet']; |
1054 | 1056 |
continue; |
1055 | 1057 |
} |
1056 | 1058 |
|
1057 |
if ($carpinterface != "_vip{$vip['uniqid']}") |
|
1059 |
if ($carpinterface != "_vip{$vip['uniqid']}") {
|
|
1058 | 1060 |
continue; |
1061 |
} |
|
1059 | 1062 |
|
1060 | 1063 |
switch ($what) { |
1061 | 1064 |
case 'subnet': |
... | ... | |
1478 | 1481 |
// run in foreground, and (optionally) log if nonzero return |
1479 | 1482 |
$outputarray = array(); |
1480 | 1483 |
exec("$command 2>&1", $outputarray, $retval); |
1481 |
if (($retval <> 0) && (!$nologentry || isset($config['system']['developerspew']))) |
|
1484 |
if (($retval <> 0) && (!$nologentry || isset($config['system']['developerspew']))) {
|
|
1482 | 1485 |
log_error(sprintf(gettext("The command '%1\$s' returned exit code '%2\$d', the output was '%3\$s' "), $command, $retval, implode(" ", $outputarray))); |
1486 |
} |
|
1483 | 1487 |
} |
1484 | 1488 |
|
1485 | 1489 |
if ($clearsigmask) { |
... | ... | |
1495 | 1499 |
} |
1496 | 1500 |
|
1497 | 1501 |
/* unlink a file, or pattern-match of a file, if it exists |
1498 |
if the file/path contains glob() compatible wildcards, all matching files will be unlinked
|
|
1502 |
if the file/path contains glob() compatible wildcards, all matching files will be unlinked |
|
1499 | 1503 |
if no matches, no error occurs */ |
1500 | 1504 |
function unlink_if_exists($fn) { |
1501 | 1505 |
$to_do = glob($fn); |
src/etc/inc/voucher.inc | ||
---|---|---|
588 | 588 |
|
589 | 589 |
$roll = $rollent['number']; |
590 | 590 |
$len = ($rollent['count'] >> 3) + 1; |
591 |
if (strlen(base64_decode($rollent['used'])) != $len) |
|
591 |
if (strlen(base64_decode($rollent['used'])) != $len) {
|
|
592 | 592 |
$rollent['used'] = base64_encode(str_repeat("\000", $len)); |
593 |
} |
|
593 | 594 |
voucher_write_used_db($roll, $rollent['used']); |
594 | 595 |
$minutes = $rollent['minutes']; |
595 | 596 |
$active_vouchers = array(); |
src/etc/inc/vpn.inc | ||
---|---|---|
1223 | 1223 |
$tunneltype = "type = transport"; |
1224 | 1224 |
|
1225 | 1225 |
if ((($ph1ent['authentication_method'] == "xauth_psk_server") || |
1226 |
($ph1ent['authentication_method'] == "pre_shared_key")) && isset($ph1ent['mobile'])) { |
|
1226 |
($ph1ent['authentication_method'] == "pre_shared_key")) && |
|
1227 |
isset($ph1ent['mobile'])) { |
|
1227 | 1228 |
$left_spec = "%any"; |
1228 | 1229 |
} else { |
1229 | 1230 |
$tmpsubnet = ipsec_get_phase1_src($ph1ent); |
src/etc/login.conf | ||
---|---|---|
35 | 35 |
:maxproc=unlimited:\ |
36 | 36 |
:sbsize=unlimited:\ |
37 | 37 |
:vmemoryuse=unlimited:\ |
38 |
:idletime=unlimited:\
|
|
38 |
:idletime=unlimited:\ |
|
39 | 39 |
:priority=0:\ |
40 | 40 |
:ignoretime@:\ |
41 | 41 |
:umask=022: |
... | ... | |
81 | 81 |
###################################################################### |
82 | 82 |
## |
83 | 83 |
## Example entries |
84 |
##
|
|
84 |
## |
|
85 | 85 |
###################################################################### |
86 | 86 |
###################################################################### |
87 | 87 |
|
src/etc/phpshellsessions/gitsync | ||
---|---|---|
48 | 48 |
switch ($arg) { |
49 | 49 |
case "--help": |
50 | 50 |
echo "Usage: playback gitsync [options] [[repository] <branch>]\nOptions:\n"; |
51 |
foreach($valid_args as $arg_name => $arg_desc) { |
|
51 |
foreach ($valid_args as $arg_name => $arg_desc) {
|
|
52 | 52 |
echo $arg_name . "\n" . $arg_desc; |
53 | 53 |
} |
54 | 54 |
exit; |
src/etc/rc.carpbackup | ||
---|---|---|
50 | 50 |
$vips = link_interface_to_vips($friendly, '', $vhid); |
51 | 51 |
$carp_iface = "{$friendly}_vip{$vhid}"; |
52 | 52 |
|
53 |
if(is_array($vips)) { |
|
53 |
if (is_array($vips)) {
|
|
54 | 54 |
foreach ($vips as $vip) { |
55 | 55 |
$notificationmsg = sprintf('Carp cluster member "(%1$s): (%2$s)" has resumed the state "BACKUP" for vhid %3$s', $argument, $friendly_descr, $vhid); |
56 | 56 |
|
src/etc/rc.initial.password | ||
---|---|---|
40 | 40 |
|
41 | 41 |
echo "\n" . gettext(' |
42 | 42 |
The webConfigurator admin password and privileges will be reset to the default (which is "' . strtolower($g['product_name']) . '").') . "\n" . |
43 |
gettext('Do you want to proceed [y|n]?'); |
|
43 |
gettext('Do you want to proceed [y|n]?') . " ";
|
|
44 | 44 |
|
45 | 45 |
if (strcasecmp(chop(fgets($fp)), "y") == 0) { |
46 | 46 |
if (isset($config['system']['webgui']['authmode']) && |
47 |
$config['system']['webgui']['authmode'] != "Local Database") {
|
|
47 |
$config['system']['webgui']['authmode'] != "Local Database") {
|
|
48 | 48 |
echo "\n" . gettext(' |
49 | 49 |
The User manager authentication server is set to "' . $config['system']['webgui']['authmode'] . '".') . "\n" . |
50 |
gettext('Do you want to set it back to Local Database [y|n]?'); |
|
50 |
gettext('Do you want to set it back to Local Database [y|n]?') . " ";
|
|
51 | 51 |
if (strcasecmp(chop(fgets($fp)), "y") == 0) { |
52 | 52 |
$config['system']['webgui']['authmode'] = "Local Database"; |
53 | 53 |
} |
... | ... | |
76 | 76 |
write_config(gettext("password changed from console menu")); |
77 | 77 |
|
78 | 78 |
echo "\n" . gettext(' |
79 |
The password for the webConfigurator has been reset and
|
|
79 |
The password for the webConfigurator has been reset and |
|
80 | 80 |
the default username has been set to "admin".') . "\n" . |
81 | 81 |
gettext(' |
82 | 82 |
Remember to set the password to something else than |
src/etc/rc.newwanip | ||
---|---|---|
216 | 216 |
/* |
217 | 217 |
* Some services (e.g. dyndns, see ticket #4066) depend on |
218 | 218 |
* filter_configure() to be called before, otherwise pass out |
219 |
* route-to rules have the old ip set in 'from' and connection |
|
220 |
* do not go through correct link |
|
219 |
* route-to rules have the old ip set in 'from' and connections
|
|
220 |
* do not go through the correct link
|
|
221 | 221 |
*/ |
222 | 222 |
filter_configure_sync(); |
223 | 223 |
|
src/etc/rc.openvpn | ||
---|---|---|
76 | 76 |
} |
77 | 77 |
|
78 | 78 |
if ((is_array($config['openvpn']['openvpn-server']) && count($config['openvpn']['openvpn-server'])) || |
79 |
(is_array($config['openvpn']['openvpn-client']) && count($config['openvpn']['openvpn-client']))) {
|
|
79 |
(is_array($config['openvpn']['openvpn-client']) && count($config['openvpn']['openvpn-client']))) {
|
|
80 | 80 |
if (empty($argument) || $argument == "all") { |
81 | 81 |
$argument = "all"; |
82 | 82 |
$log_text = "all"; |
src/etc/rc.packages | ||
---|---|---|
73 | 73 |
pkg_remove_prefix($pkg); |
74 | 74 |
|
75 | 75 |
switch ($when) { |
76 |
case "post-install": |
|
77 |
install_package_xml($pkg); |
|
78 |
break; |
|
79 |
case "deinstall": |
|
80 |
case "post-deinstall": |
|
81 |
delete_package_xml($pkg, $when); |
|
82 |
break; |
|
83 |
default: |
|
84 |
usage(); |
|
76 |
case "post-install":
|
|
77 |
install_package_xml($pkg);
|
|
78 |
break;
|
|
79 |
case "deinstall":
|
|
80 |
case "post-deinstall":
|
|
81 |
delete_package_xml($pkg, $when);
|
|
82 |
break;
|
|
83 |
default:
|
|
84 |
usage();
|
|
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
?> |
src/etc/services | ||
---|---|---|
134 | 134 |
bootpc 68/udp dhcpc #Bootstrap Protocol Client |
135 | 135 |
tftp 69/tcp #Trivial File Transfer |
136 | 136 |
tftp 69/udp #Trivial File Transfer |
137 |
tftp-proxy 6969/udp
|
|
137 |
tftp-proxy 6969/udp |
|
138 | 138 |
gopher 70/tcp |
139 | 139 |
gopher 70/udp |
140 | 140 |
netrjs-1 71/tcp #Remote Job Service |
src/etc/sshd | ||
---|---|---|
163 | 163 |
$generate_keys = array(); |
164 | 164 |
foreach ($keys as $key) { |
165 | 165 |
if (!file_exists("{$sshConfigDir}/ssh_host_{$key['suffix']}key") || |
166 |
!file_exists("{$sshConfigDir}/ssh_host_{$key['suffix']}key.pub")) {
|
|
166 |
!file_exists("{$sshConfigDir}/ssh_host_{$key['suffix']}key.pub")) {
|
|
167 | 167 |
$generate_keys[] = $key; |
168 | 168 |
} |
169 | 169 |
} |
src/etc/ssl/openssl.cnf | ||
---|---|---|
275 | 275 |
# So we do this instead. |
276 | 276 |
basicConstraints = CA:true |
277 | 277 |
|
278 |
# Key usage: this is typical for a CA certificate.
|
|
278 |
# Key usage: this is typical for a CA certificate. |
|
279 | 279 |
keyUsage = cRLSign, keyCertSign |
280 | 280 |
|
281 | 281 |
# Some might want this also |
Also available in: Unified diff
Code style and white space in etc