summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorBill Marquette <bill.marquette@gmail.com>2011-05-14 17:44:40 -0500
committerBill Marquette <bill.marquette@gmail.com>2011-05-14 17:44:40 -0500
commit325e316391adaaf2968aadd385c3b8d3ed08569b (patch)
treed65b96d96f6383f9a1ed090b3df79649a84da47a /etc/inc
parent3f9492a77093865d4fdebfa76d6a7fdd6161f129 (diff)
parent4450527f90d05a6d267ed376e968935ed99382e8 (diff)
downloadpfsense-325e316391adaaf2968aadd385c3b8d3ed08569b.zip
pfsense-325e316391adaaf2968aadd385c3b8d3ed08569b.tar.gz
Merge branch 'master' into smos-ipv6
Conflicts: etc/inc/pfsense-utils.inc
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/certs.inc19
-rw-r--r--etc/inc/dyndns.class36
-rw-r--r--etc/inc/notices.inc4
-rw-r--r--etc/inc/pfsense-utils.inc24
-rw-r--r--etc/inc/services.inc2
-rw-r--r--etc/inc/voucher.inc2
6 files changed, 83 insertions, 4 deletions
diff --git a/etc/inc/certs.inc b/etc/inc/certs.inc
index 357ac05..3595f45 100644
--- a/etc/inc/certs.inc
+++ b/etc/inc/certs.inc
@@ -369,6 +369,25 @@ function cert_get_issuer($str_crt, $decode = true) {
return $issuer;
}
+/* this function works on x509 (crt), rsa key (prv), and req(csr) */
+function cert_get_modulus($str_crt, $decode = true, $type = "crt"){
+ if ($decode)
+ $str_crt = base64_decode($str_crt);
+
+ $modulus = "";
+ if ( in_array($type, array("crt", "prv", "csr")) ) {
+ $type = str_replace( array("crt","prv","csr"), array("x509","rsa","req"), $type);
+ $modulus = exec("echo \"{$str_crt}\" | openssl {$type} -noout -modulus");
+ }
+ return $modulus;
+}
+function csr_get_modulus($str_crt, $decode = true){
+ return cert_get_modulus($str_crt, $decode, "csr");
+}
+function prv_get_modulus($str_crt, $decode = true){
+ return cert_get_modulus($str_crt, $decode, "prv");
+}
+
function is_user_cert($certref) {
global $config;
if (!is_array($config['system']['user']))
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index dcde894..150dedc 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -18,6 +18,7 @@
* - DNSexit (dnsexit.com)
* - OpenDNS (opendns.com)
* - Namecheap (namecheap.com)
+ * - HE.net (dns.he.net)
* +----------------------------------------------------+
* Requirements:
* - PHP version 4.0.2 or higher with CURL Library
@@ -49,6 +50,7 @@
* DNSexit - Last Tested: 20 July 2008
* OpenDNS - Last Tested: 4 August 2008
* Namecheap - Last Tested: 31 August 2010
+ * HE.net - Last Tested: NEVER
* +====================================================+
*
* @author E.Kristensen
@@ -152,6 +154,7 @@
case 'dnsexit':
case 'opendns':
case 'namecheap':
+ case 'he-net':
$this->_update();
break;
default:
@@ -434,6 +437,19 @@
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
curl_close($ch);
$this->_checkStatus($data);
+ break;
+ case 'he-net':
+ $needsIP = FALSE;
+ log_error("HE.net: DNS update() starting.");
+ $server = "https://dyn.dns.he.net/nic/update?";
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsHost . ':' . $this->_dnsPass);
+ curl_setopt($ch, CURLOPT_URL, $server . 'hostname=' . $this->_dnsHost);
+ $data = curl_exec($ch);
+ if(@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
+ curl_close($ch);
+ $this->_checkStatus($data);
+ break;
default:
break;
}
@@ -754,6 +770,26 @@
$this->_debug($data);
}
break;
+
+ case 'he-net':
+ if (preg_match("/badip/i", $data)) {
+ $status = "phpDynDNS: (Error) Bad Request - The IP provided was invalid.";
+ } else if (preg_match('/nohost/i', $data)) {
+ $status = "phpDynDNS: (Error) Bad Request - A hostname was not provided.";
+ } else if (preg_match('/badauth/i', $data)) {
+ $status = "phpDynDNS: (Error) Invalid username or password.";
+ } else if (preg_match('/good/i', $data)) {
+ $status = "phpDynDNS: (Success) IP Address Updated Successfully!";
+ $successful_update = true;
+ } else if (preg_match('/nochg/i', $data)) {
+ $status = "phpDynDNS: (Success) No Change In IP Address.";
+ $successful_update = true;
+ } else {
+ $status = "phpDynDNS: (Unknown Response)";
+ log_error("phpDynDNS: PAYLOAD: {$data}");
+ $this->_debug($data);
+ }
+ break;
}
if($successful_update == true) {
diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc
index 9ccd373..9edd32b 100644
--- a/etc/inc/notices.inc
+++ b/etc/inc/notices.inc
@@ -295,7 +295,7 @@ function notify_via_smtp($message) {
$smtp->host_port = empty($config['notifications']['smtp']['port']) ? 25 : $config['notifications']['smtp']['port'];
$smtp->direct_delivery = 0;
- $smtp->ssl = 0;
+ $smtp->ssl = ($config['notifications']['smtp']['ssl'] == "checked") ? 1 : 0;
$smtp->debug = 0;
$smtp->html_debug = 0;
$smtp->localhost=$config['system']['hostname'].".".$config['system']['domain'];
@@ -393,4 +393,4 @@ function register_via_growl() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index e00c6b9..c48cb31 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -2242,4 +2242,28 @@ function generate_ipv6_from_mac($mac) {
}
return $ipv6;
}
+
+/****f* pfsense-utils/load_mac_manufacturer_table
+ * NAME
+ * load_mac_manufacturer_table
+ * INPUTS
+ * none
+ * RESULT
+ * returns associative array with MAC-Manufacturer pairs
+ ******/
+function load_mac_manufacturer_table() {
+ /* load MAC-Manufacture data from the file */
+ $macs=file("/usr/local/share/nmap/nmap-mac-prefixes");
+ if ($macs){
+ foreach ($macs as $line){
+ if (preg_match('/([0-9A-Fa-f]{6}) (.*)$/', $line, $matches)){
+ /* store values like this $mac_man['000C29']='VMware' */
+ $mac_man["$matches[1]"]=$matches[2];
+ }
+ }
+ return $mac_man;
+ } else
+ return -1;
+
+}
?>
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index f88ed32..4ca1ebb 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -1018,7 +1018,7 @@ function services_dhcrelay_configure() {
foreach($route_str as $routeline) {
$items = preg_split("/[ ]+/i", $routeline);
if (ip_in_subnet($srvip, $items[0])) {
- $destif = trim($items[2]);
+ $destif = trim($items[6]);
break;
}
}
diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc
index d5c040b..ec59716 100644
--- a/etc/inc/voucher.inc
+++ b/etc/inc/voucher.inc
@@ -129,7 +129,7 @@ EOF;
log_error("CaptivePortalVoucherSync XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php).");
}
$toreturn = XML_RPC_Decode($resp->value());
- if(count($toreturn['voucher']['roll']) <> count($config['voucher']['roll'])) {
+ if (is_array($toreturn['voucher']) && (count($toreturn['voucher']['roll']) <> count($config['voucher']['roll']))) {
$config['voucher']['roll'] = $toreturn['voucher']['roll'];
write_config("Captive Portal Voucher database synchronized with {$url}");
voucher_configure(true);
OpenPOWER on IntegriCloud