Add TFTP and LDAP server options to dhcpd

This commit is contained in:
Martin Fuchs 2007-08-01 20:19:50 +00:00
parent 9c55515a26
commit 6c23757bb8
2 changed files with 49 additions and 0 deletions

View File

@ -113,6 +113,7 @@ function services_dhcpd_configure() {
$dhcpdconf = <<<EOD
option domain-name "{$syscfg['domain']}";
option ldap-server code 95 = text;
default-lease-time 7200;
max-lease-time 86400;
log-facility local7;
@ -275,6 +276,12 @@ EOD;
if (is_array($dhcpifconf['ntpserver']) && $dhcpifconf['ntpserver'][0])
$dhcpdconf .= " option ntp-servers " . join(",", $dhcpifconf['ntpserver']) . ";\n";
if (isset($dhcpifconf['tftp']))
$dhcpdconf .= " option tftp-server-name \"{$dhcpifconf['tftp']}\";\n";
if (isset($dhcpifconf['ldap']))
$dhcpdconf .= " option ldap-server \"{$dhcpifconf['ldap']}\";\n";
if(isset($dhcpifconf['netboot'])) {
if (($dhcpifconf['next-server'] <> "") && ($dhcpifconf['filename'] <> "")) {
$dhcpdconf .= " next-server {$dhcpifconf['next-server']};\n";

View File

@ -73,6 +73,8 @@ $pconfig['staticarp'] = isset($config['dhcpd'][$if]['staticarp']);
$pconfig['ddnsdomain'] = $config['dhcpd'][$if]['ddnsdomain'];
$pconfig['ddnsupdate'] = isset($config['dhcpd'][$if]['ddnsupdate']);
list($pconfig['ntp1'],$pconfig['ntp2']) = $config['dhcpd'][$if]['ntpserver'];
$pconfig['tftp'] = $config['dhcpd'][$if]['tftp'];
$pconfig['ldap'] = $config['dhcpd'][$if]['ldap'];
$pconfig['netboot'] = isset($config['dhcpd'][$if]['netboot']);
$pconfig['nextserver'] = $config['dhcpd'][$if]['next-server'];
$pconfig['filename'] = $config['dhcpd'][$if]['filename'];
@ -202,6 +204,8 @@ if ($_POST) {
if ($_POST['ntp2'])
$config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp2'];
$config['dhcpd'][$if]['tftp'] = $_POST['tftp'];
$config['dhcpd'][$if]['ldap'] = $_POST['ldap'];
$config['dhcpd'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
$config['dhcpd'][$if]['filename'] = $_POST['filename'];
@ -278,6 +282,8 @@ function enable_change(enable_over) {
document.iform.ddnsupdate.disabled = endis;
document.iform.ntp1.disabled = endis;
document.iform.ntp2.disabled = endis;
document.iform.tftp.disabled = endis;
document.iform.ldap.disabled = endis;
document.iform.netboot.disabled = endis;
document.iform.nextserver.disabled = endis;
document.iform.filename.disabled = endis;
@ -296,6 +302,18 @@ function show_ntp_config() {
aodiv.style.display = "block";
}
function show_tftp_config() {
document.getElementById("showtftpbox").innerHTML='';
aodiv = document.getElementById('showtftp');
aodiv.style.display = "block";
}
function show_ldap_config() {
document.getElementById("showldapbox").innerHTML='';
aodiv = document.getElementById('showldap');
aodiv.style.display = "block";
}
function show_netboot_config() {
document.getElementById("shownetbootbox").innerHTML='';
aodiv = document.getElementById('shownetboot');
@ -498,6 +516,30 @@ function show_netboot_config() {
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">TFTP server</td>
<td width="78%" class="vtable">
<div id="showtftpbox">
<input type="button" onClick="show_tftp_config()" value="Advanced"></input> - Show TFTP configuration</a>
</div>
<div id="showtftp" style="display:none">
<input name="tftp" type="text" class="formfld" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>"><br>
Leave blank to disable. Enter a full hostname or IP for the TFTP server.
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">LDAP URI</td>
<td width="78%" class="vtable">
<div id="showldapbox">
<input type="button" onClick="show_ldap_config()" value="Advanced"></input> - Show LDAP configuration</a>
</div>
<div id="showldap" style="display:none">
<input name="ldap" type="text" class="formfld" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>"><br>
Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com
</div>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Enable Network booting</td>
<td width="78%" class="vtable">