diff options
author | Darren Embry <dse@webonastick.com> | 2012-06-14 12:30:55 -0400 |
---|---|---|
committer | Darren Embry <dse@webonastick.com> | 2012-06-14 12:30:55 -0400 |
commit | a0b379c8d1a9b9c73823dd311166164e45a7b20f (patch) | |
tree | 1f9b0ec3bc6f3efc15f9a5af1f6a6966203b4d1d /usr/local/www/services_dnsmasq_domainoverride_edit.php | |
parent | 391cd07027746ce1e13cb92b2c93b80d49030ba7 (diff) | |
download | pfsense-a0b379c8d1a9b9c73823dd311166164e45a7b20f.zip pfsense-a0b379c8d1a9b9c73823dd311166164e45a7b20f.tar.gz |
hugh blanford patch: dnsmasq, source interface and ipsec vpns
fixes #1361
Diffstat (limited to 'usr/local/www/services_dnsmasq_domainoverride_edit.php')
-rwxr-xr-x | usr/local/www/services_dnsmasq_domainoverride_edit.php | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/usr/local/www/services_dnsmasq_domainoverride_edit.php b/usr/local/www/services_dnsmasq_domainoverride_edit.php index ae1a0d5..dd2c403 100755 --- a/usr/local/www/services_dnsmasq_domainoverride_edit.php +++ b/usr/local/www/services_dnsmasq_domainoverride_edit.php @@ -51,7 +51,14 @@ if (isset($_POST['id'])) if (isset($id) && $a_domainOverrides[$id]) { $pconfig['domain'] = $a_domainOverrides[$id]['domain']; - $pconfig['ip'] = $a_domainOverrides[$id]['ip']; + if (is_ipaddr($a_domainOverrides[$id]['ip']) && ($a_domainOverrides[$id]['ip'] != '#')) { + $pconfig['ip'] = $a_domainOverrides[$id]['ip']; + } + else { + $dnsmasqpieces = explode('@', $a_domainOverrides[$id]['ip'], 2); + $pconfig['ip'] = $dnsmasqpieces[0]; + $pconfig['dnssrcip'] = $dnsmasqpieces[1]; + } $pconfig['descr'] = $a_domainOverrides[$id]['descr']; } @@ -66,17 +73,32 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - if (($_POST['domain'] && !is_domain($_POST['domain']))) { + function String_Begins_With($needle, $haystack) { + return (substr($haystack, 0, strlen($needle))==$needle); + } + + if (String_Begins_With(_msdcs, $_POST['domain'])) { + $subdomainstr = substr($_POST['domain'], 7); + if ($subdomainstr && !is_domain($subdomainstr)) { + $input_errors[] = gettext("A valid domain must be specified after _msdcs."); + } + } + elseif ($_POST['domain'] && !is_domain($_POST['domain'])) { $input_errors[] = gettext("A valid domain must be specified."); } if ($_POST['ip'] && !is_ipaddr($_POST['ip']) && ($_POST['ip'] != '#')) { - $input_errors[] = gettext("A valid IP address must be specified, or # for an exclusion."); + $input_errors[] = gettext("A valid IP address must be specified, or # for an exclusion."); + } + if ($_POST['dnssrcip'] && !in_array($_POST['dnssrcip'], get_configured_ip_addresses())) { + $input_errors[] = gettext("An interface IP address must be specified for the DNS query source."); } - if (!$input_errors) { $doment = array(); $doment['domain'] = $_POST['domain']; - $doment['ip'] = $_POST['ip']; + if (empty($_POST['dnssrcip'])) + $doment['ip'] = $_POST['ip']; + else + $doment['ip'] = $_POST['ip'] . "@" . $_POST['dnssrcip']; $doment['descr'] = $_POST['descr']; if (isset($id) && $a_domainOverrides[$id]) @@ -118,6 +140,13 @@ include("head.inc"); <?=gettext("e.g."); ?> <em>192.168.100.100</em><br/><?=gettext("Or enter # for an exclusion to pass through this host/subdomain to standard nameservers instead of a previous override."); ?></span></td> </tr> <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Source IP");?></td> + <td width="78%" class="vtable"> + <?=$mandfldhtml;?><input name="dnssrcip" type="text" class="formfld unknown" id="dnssrcip" size="40" value="<?=htmlspecialchars($pconfig['dnssrcip']);?>"> + <br> <span class="vexpl"><?=gettext("Source IP address for queries to the DNS server for the override domain."); ?><br> + <?=gettext("Leave blank unless your DNS server is accessed through a VPN tunnel."); ?></span></td> + </tr> + <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> <td width="78%" class="vtable"> <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> |