1 <?php
3 class servdhcp extends goService
4 {
5 /* attribute list for save action */
6 var $attributes= array("dhcpServiceDN");
7 var $objectclasses= array("dhcpServer");
8 var $conflicts = array("servdhcp");
9 var $dhcpServiceDN= "";
11 /* Section storage */
12 var $dhcpSections= array();
13 var $dhcpObjectCache= array();
14 var $current_object= "";
15 var $types= array();
16 var $serviceDN= "";
18 var $quote_option = array("domain-name");
20 var $orig_dn = "";
22 var $dhcp_server_list = array("ENTRIES"=> array(),"FOR_LIST"=> array());
23 var $take_over_id = -1;
24 var $display_warning = TRUE;
26 function servdhcp (&$config, $dn= NULL, $parent= NULL)
27 {
28 plugin::plugin ($config, $dn, $parent);
30 $this->serviceDN = "cn=dhcp,".$dn;
31 $this->orig_dn = $dn;
33 $this->DisplayName = _("DHCP service");
35 $this->types= array( "dhcpLog" => _("Logging"),
36 "dhcpService" => _("Global options"),
37 "dhcpClass" => _("Class"),
38 "dhcpSubClass" => _("Subclass"),
39 "dhcpHost" => _("Host"),
40 "dhcpGroup" => _("Group"),
41 "dhcpPool" => _("Pool"),
42 "dhcpSubnet" => _("Subnet"),
43 "dhcpFailOverPeer" => _("Failover peer"),
44 "dhcpSharedNetwork" => _("Shared network"));
47 /* Backport: PHP4 compatibility */
48 foreach($this->types as $type => $translation){
49 $this->types[strtolower($type)] = $translation;
50 }
52 /* Load information about available services */
53 $this->reload();
54 if (!count($this->dhcpSections)){
55 $this->is_account= FALSE;
56 $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
57 }
58 }
61 function execute()
62 {
63 /* Call parent execute */
64 plugin::execute();
66 /* Fill templating stuff */
67 $smarty= get_smarty();
68 $smarty->assign("dns_take_over",FALSE);
69 $display= "";
72 /*****************/
73 /* Handle Take Over Actions
74 /*****************/
76 /* Give smarty the required informations */
77 $smarty->assign("dhcp_server_list", $this->dhcp_server_list['FOR_LIST']);
78 $smarty->assign("dhcp_server_list_cnt", count($this->dhcp_server_list['FOR_LIST']));
80 /* Take over requested, save id */
81 if(isset($_POST['take_over_src']) && isset($_POST['take_over'])){
82 $id = $_POST['take_over_src'];
83 if(isset($this->dhcp_server_list['ENTRIES'][$id])){
84 $this->take_over_id = $id;
85 }
86 }
88 /* Abort take over action */
89 if(isset($_POST['cancel_take_over'])){
90 $this->dialog =false;
91 $this->take_over_id = -1;
92 $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
93 }
95 /* Display informartion about take over that will be started when saving this server
96 * and hide default dhcp output
97 */
98 if($this->take_over_id != -1){
100 $this->dialog = FALSE;
101 $id = $this->take_over_id;
102 $smarty->assign("dns_take_over",TRUE);
103 $warning = sprintf(_("You are going to migrate the DHCP setup from server '%s'."),
104 $this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
105 $warning.= " "._("The migration will be started when you save this system. To cancel this action, use the cancel button below.");
107 if($this->display_warning){
108 print_red($warning);
109 $this->display_warning = FALSE;
110 }
111 return($smarty->fetch(get_template_path('servdhcp.tpl', TRUE)));
112 }
115 /*****************/
116 /* List handling
117 /*****************/
119 /* Section Creation? */
120 if (isset($_POST['create_section']) && isset($_POST['section'])){
121 $section= $_POST['section'];
122 $tmp = new dhcpNewSectionDialog(NULL);
123 if (isset($tmp->sectionMap[$section])){
124 $this->dialog= new $section($this->current_object);
125 $this->current_object= "";
126 } else {
127 $this->dialog= FALSE;
128 }
129 }
131 /* Cancel section creation? */
132 if (isset($_POST['cancel_section']) || isset($_POST['cancel_dhcp'])){
133 $this->dialog= FALSE;
134 }
136 /* Save changes */
137 if (isset($_POST['save_dhcp'])){
138 $this->dialog->save_object();
139 $messages= $this->dialog->check();
140 if (count($messages)){
141 show_errors($messages);
142 } else {
143 $dn= $this->dialog->dn;
144 $class= get_class($this->dialog);
145 $type= $this->types[$class];
146 if(empty($this->serviceDN)){
147 $indent= substr_count(preg_replace("/".$this->dn."/", '', $dn), ",") -1;
148 }else{
149 $indent= substr_count(preg_replace("/".$this->serviceDN."/", '', $dn), ",");
150 }
151 $spaces= "";
152 for ($i= 0; $i<$indent; $i++){
153 $spaces.= " ";
154 }
155 $data= $this->dialog->save();
156 if ($this->current_object == ""){
157 /* New object */
158 $newsects= array();
159 foreach ($this->dhcpSections as $key => $dsc){
160 $newsects[$key]= $dsc;
161 if ($key == $dn){
162 $spaces.= " ";
163 $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'";
164 }
165 }
166 $this->dhcpObjectCache[$data['dn']]= $data;
167 $this->dhcpSections= $newsects;
168 } else {
169 if ($dn != $data['dn']){
170 /* Old object, new name */
171 $this->dhcpObjectCache[$dn]= array();
172 $this->dhcpObjectCache[$data['dn']]= $data;
174 /* If we renamed a section, we've to rename a couple of objects, too */
175 foreach ($this->dhcpObjectCache as $key => $dsc){
176 if (preg_match("/,$dn$/", $key)){
177 $new_dn= preg_replace("/,$dn$/", ",".$data['dn'], $key);
178 $dsc['MODIFIED']= TRUE;
179 $this->dhcpObjectCache[$new_dn]= $dsc;
180 unset($this->dhcpObjectCache[$key]);
181 }
182 }
183 $newsects= array();
184 foreach ($this->dhcpSections as $key => $dsc){
185 if ($key == $dn){
186 $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'";
187 continue;
188 }
189 if (preg_match("/,$dn$/", $key)){
190 $new_dn= preg_replace("/,$dn$/", ",".$data['dn'], $key);
191 $newsects[$new_dn]= $dsc;
192 } else {
193 $newsects[$key]= $dsc;
194 }
195 }
196 $this->dhcpSections= $newsects;
198 } else {
199 /* Old object, old name */
200 $this->dhcpObjectCache[$data['dn']]= $data;
201 }
202 }
203 $this->dialog= FALSE;
204 }
205 }
207 /* Remove section? */
208 if (isset($_POST['delete_dhcp_confirm'])){
209 if ($this->acl_is_removeable()){
210 unset($this->dhcpSections[$this->current_object]);
211 unset($this->dhcpObjectCache[$this->current_object]);
212 $this->dhcpObjectCache[$this->current_object]= array();
213 foreach ($this->dhcpSections as $key => $value){
214 if (preg_match("/".$this->current_object."$/", $key)){
215 unset($this->dhcpSections[$key]);
216 unset($this->dhcpObjectCache[$key]);
217 $this->dhcpObjectCache[$key]= array();
218 }
219 }
220 } else {
221 print_red(_("You're not allowed to remove DHCP sections!"));
222 }
223 $this->dialog= FALSE;
224 }
226 /* Look for post entries */
227 foreach($_POST as $name => $value){
229 /* Insert new section? */
230 if (preg_match('/^insertDhcp_.*_x$/', $name)){
231 $dn= base64_decode(preg_replace('/^insertDhcp_([^_]+)_x$/', '\1', $name));
232 if (isset($this->dhcpObjectCache[$dn])){
233 $this->dialog= new dhcpNewSectionDialog($this->objectType($dn));
234 $this->current_object= $dn;
235 $this->dialog->acl= $this->acl;
236 }
237 }
239 /* Edit section? */
240 if (preg_match('/^editDhcp_.*_x$/', $name)){
241 $dn= base64_decode(preg_replace('/^editDhcp_([^_]+)_x$/', '\1', $name));
242 if (isset($this->dhcpObjectCache[$dn])){
243 $section= $this->objectType($dn);
244 $this->current_object= $dn;
245 $this->dialog= new $section($this->dhcpObjectCache[$dn]);
246 }
247 }
249 /* Remove section? */
250 if (preg_match('/^delDhcp_.*_x$/', $name)){
251 $dn= base64_decode(preg_replace('/^delDhcp_([^_]+)_x$/', '\1', $name));
252 if (isset($this->dhcpObjectCache[$dn])){
253 $this->current_object= $dn;
254 $this->dialog= 1;
255 $smarty->assign("warning", sprintf(_("You're about to delete the DHCP section '%s'."), $dn));
256 return($smarty->fetch(get_template_path('remove_dhcp.tpl', TRUE)));
257 }
258 }
260 }
262 if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
263 $dn = base64_decode($_GET['id']);
264 if (isset($this->dhcpObjectCache[$dn])){
265 $section= $this->objectType($dn);
266 $this->current_object= $dn;
267 $this->dialog= new $section($this->dhcpObjectCache[$dn]);
268 }
269 }
272 if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
273 $dn = base64_decode($_GET['id']);
274 if (isset($this->dhcpObjectCache[$dn])){
275 $section= $this->objectType($dn);
276 $this->current_object= $dn;
277 $this->dialog= new $section($this->dhcpObjectCache[$dn]);
278 }
279 }
282 /* Do we need to flip is_account state? */
283 if (isset($_POST['modify_state'])){
284 $this->is_account= !$this->is_account;
285 }
287 /* Show tab dialog headers */
288 if ($this->is_account){
289 # $display= $this->show_header(_("Remove DHCP service"),
290 # _("This server has DHCP features enabled. You can disable them by clicking below."));
292 if (!count($this->dhcpObjectCache)){
293 $attrs= array();
294 $attrs['dn']= 'cn=dhcp,'.$this->dn;
295 $attrs['cn']= array('dhcp');
296 $attrs['objectClass']= array('top', 'dhcpService');
297 $attrs['dhcpPrimaryDN']= array($this->dn);
298 $attrs['dhcpStatements']= array("default-lease-time 600",
299 "max-lease-time 1200",
300 "authoritative",
301 "ddns-update-style none");
302 $attrs['MODIFIED']= TRUE;
303 $this->dhcpSections['cn=dhcp,'.$this->dn]= _("Global options");
304 $this->dhcpObjectCache['cn=dhcp,'.$this->dn]= $attrs;
305 }
307 } else {
308 # $display= $this->show_header(_("Add DHCP service"),
310 # _("This server has DHCP features disabled. You can enable them by clicking below."));
311 return ($display);
312 }
315 /* Show dialog
316 */
317 if(isset($this->dialog) && is_object($this->dialog)){
318 $this->dialog->save_object();
319 $this->dialog->parent = $this;
320 return($this->dialog->execute());
321 }
323 /* Create Listbox with existing Zones
324 */
325 $DhcpList = new divSelectBox("dhcpSections");
326 $DhcpList->SetHeight(400);
328 /* Add entries to divlist
329 */
330 $editImgIns = "<input type='image' src='images/list_new.png' name='insertDhcp_%s' title='"._("Insert new DHCP section")."'>".
331 "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
332 "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
333 $editImgInsNoDel = "<input type='image' src='images/list_new.png' name='insertDhcp_%s' title='"._("Insert new DHCP section")."'>".
334 "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>";
335 $editImg = "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
336 "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
338 $tmp = new dhcpNewSectionDialog(NULL);
339 foreach($this->dhcpSections as $section => $values ){
341 $values = "<a href='?plug=".$_GET['plug']."&act=edit&id=".base64_encode($section)."'>".$values."</a>";
343 if (count($tmp->sectionMap[$this->objectType($section)])){
344 if ($this->objectType($section) == "dhcpService"){
345 $DhcpList->AddEntry(array(
346 array("string" => $values),
347 array("string" => str_replace("%s",base64_encode($section),$editImgInsNoDel), "attach" => "style='text-align:right;'")
348 ));
349 } else {
350 $DhcpList->AddEntry(array(
351 array("string" => $values),
352 array("string" => str_replace("%s",base64_encode($section),$editImgIns), "attach" => "style='text-align:right;'")
353 ));
354 }
355 } else {
356 $DhcpList->AddEntry(array(
357 array("string" => $values),
358 array("string" => str_replace("%s",base64_encode($section),$editImg), "attach" => "style='text-align:right;'")
359 ));
360 }
361 }
363 /* Display tempalte */
364 $smarty->assign("DhcpList",$DhcpList->DrawList());
365 $display.= $smarty->fetch(get_template_path('servdhcp.tpl', TRUE));
366 return($display);
367 }
370 function remove_from_parent()
371 {
372 /* Cancel if there's nothing to do here */
373 if (!$this->initially_was_account){
374 return;
375 }
377 /* Remove subtrees */
378 $ldap= $this->config->get_ldap_link();
379 foreach ($this->dhcpObjectCache as $dn => $content){
380 if ($this->objectType($dn) == 'dhcpService'){
381 $ldap->rmdir_recursive($dn);
382 show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
383 }
384 }
386 /* Remove from self */
387 $ldap= $this->config->get_ldap_link();
389 /* Remove and write to LDAP */
390 plugin::remove_from_parent();
392 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save");
393 $ldap->cd($this->dn);
394 $this->cleanup();
395 $ldap->modify ($this->attrs);
397 show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
399 /* Optionally execute a command after we're done */
400 $this->handle_post_events("remove");
401 }
404 /* Save data to object */
405 function save_object()
406 {
407 plugin::save_object();
408 }
411 /* Check supplied data */
412 function check()
413 {
414 /* Call common method to give check the hook */
415 $message= plugin::check();
417 return ($message);
418 }
421 /* Save to LDAP */
422 function save()
423 {
424 /* Take over handling
425 * - Load servdhcp class and dhcpObjectCache for the source dhcp setup.
426 * - Assign dhcpObjectCache to this configuration.
427 * - Save this setup and remove source setup from ldap.
428 */
429 if($this->take_over_id != -1){
430 $id = $this->take_over_id;
431 $src = preg_replace("/cn=dhcp,/","",$this->dhcp_server_list['ENTRIES'][$id]['dn']);
432 $tmp = new servdhcp ($this->config, $src);
433 $this->orig_dn = $src;
434 $this->dhcpObjectCache = $tmp->dhcpObjectCache;
435 }
437 /* Save dhcp setttings */
438 $ldap= $this->config->get_ldap_link();
439 foreach ($this->dhcpObjectCache as $dn => $data){
441 if($this->dn != $this->orig_dn){
442 $dn = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$dn);
443 }
445 /* Remove entry? */
446 if (count($data) == 0){
447 /* Check if exists, then remove... */
448 if($ldap->cat($dn)){
449 $ldap->rmdir_recursive($dn);
450 show_ldap_error($ldap->get_error(), _("Can't remove DHCP object!"));
451 }
452 continue;
453 }
455 /* Opdate dhcp option 'server-name' to actual server name */
456 if($this->dn != $this->orig_dn){
457 $fixed = FALSE;
458 foreach(array("dhcpHost","dhcpSubnet","dhcpGroup","dhcpSharedNetwork") as $object){
459 if(in_array($object,$data['objectClass']) && isset($data['dhcpOption'])){
460 foreach($data['dhcpOption'] as $key => $option){
461 if(preg_match("/^server-name /",$option)){
462 $data['dhcpOption'][$key] = "server-name ".$this->cn;
463 $data['MODIFIED'] = TRUE;
464 break;
465 }
466 }
467 }
469 /* Skip next loops if entry is updated */
470 if($fixed){
471 break;
472 }
473 }
474 }
476 /* Modify existing entry? */
477 if (isset($data['MODIFIED']) || $this->orig_dn != $this->dn){
479 if($ldap->cat($dn)){
480 $modify= TRUE;
481 } else {
482 $modify= FALSE;
483 }
485 /* Build new entry */
486 $attrs= array();
487 foreach ($data as $attribute => $values){
488 if ($attribute == "MODIFIED" || $attribute == "dn"){
489 continue;
490 }
492 if(in_array($attribute,array("dhcpPrimaryDN","dhcpSecondaryDN","dhcpServerDN","dhcpFailOverPeerDN"))){
493 foreach($values as $v_key => $value){
494 $values[$v_key] = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$value);
495 }
496 }
498 if (count($values)){
500 if($attribute == "dhcpOption"){
501 foreach($values as $key => $value){
502 $option_name = trim(preg_replace("/[^ ]*$/","",$value));
503 $option_value= trim(preg_replace("/^[^ ]*/","",$value));
504 if(in_array($option_name,$this->quote_option)){
505 $values[$key] = $option_name." \"".$option_value."\"";
506 }
507 }
508 }
509 if (count($values) == 1){
510 $attrs[$attribute]= $values[0];
511 } else {
512 $attrs[$attribute]= $values;
513 }
514 } else {
515 if ($modify){
516 $attrs[$attribute]= array();
517 }
518 }
519 }
521 $ldap->cd($dn);
522 if ($modify){
523 $ldap->modify($attrs);
524 show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
525 } else {
526 $ldap->add($attrs);
527 show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
528 }
529 }
530 }
532 $this->dhcpServiceDN= $this->serviceDN;
533 if($this->dn != $this->orig_dn){
534 $this->dhcpServiceDN= preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$this->dhcpServiceDN);
535 }
537 /* Replace 'new' dn */
538 if(preg_match("/new$/",$this->dhcpServiceDN)){
539 $this->dhcpServiceDN = preg_replace("/new$/",$this->dn,$this->dhcpServiceDN);
540 }
542 plugin::save();
544 /* Save data to LDAP */
545 $ldap->cd($this->dn);
546 $this->cleanup();
547 $ldap->modify ($this->attrs);
549 show_ldap_error($ldap->get_error(), _("Saving DHCP service failed"));
551 /* Optionally execute a command after we're done */
552 if ($this->initially_was_account == $this->is_account){
553 if ($this->is_modified){
554 $this->handle_post_events("modify");
555 }
556 } else {
557 $this->handle_post_events("add");
558 }
560 /* Take over handling
561 * - Remove old dhcp config from source server
562 */
563 if($this->take_over_id != -1){
564 $id = $this->take_over_id;
565 $src = $this->dhcp_server_list['ENTRIES'][$id]['dn'];
566 $tmp = new servdhcp ($this->config, $src);
567 $tmp->remove_from_parent();
568 }
569 }
572 function reload()
573 {
574 /* Init LDAP and load list */
575 $ldap= $this->config->get_ldap_link();
576 $ui= get_userinfo();
577 $me= $this->dn;
579 $filter = "(&(objectClass=dhcpService)(|(dhcpPrimaryDN=$me)(dhcpSecondaryDN=$me)(dhcpServerDN=$me)(dhcpFailOverPeerDN=$me)))";
581 $list= get_list($filter, array("server"), $this->config->current['BASE'], array("cn"),GL_SIZELIMIT | GL_SUBSEARCH);
582 $final= array();
584 foreach ($list as $value){
586 /* Set header */
587 $sortpart= split(",", $value['dn']);
588 $sortpart= array_reverse($sortpart);
589 $tmp= implode(",", $sortpart);
591 $final[$value['dn']]= $tmp."!"._("Global options");
593 /* Read all sub entries to place here */
594 $ldap->cd($value['dn']);
595 $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpLog)(objectClass=dhcpClass)(objectClass=dhcpSubClass)(objectClass=dhcpHost)(objectClass=dhcpGroup)(objectClass=dhcpPool)(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork)(objectClass=dhcpOptions)(objectClass=dhcpTSigKey)(objectClass=dhcpDnsZone)(objectClass=dhcpFailOverPeer))", array());
596 $this->serviceDN= $value['dn'];
598 while ($attrs= $ldap->fetch()){
599 $sattrs= array();
600 for ($i= 0; $i<$attrs['count']; $i++){
601 $sattrs[$attrs[$i]]= $attrs[$attrs[$i]];
602 unset($sattrs[$attrs[$i]]['count']);
603 }
604 $sattrs['dn']= $ldap->getDN();
606 foreach($sattrs as $name => $values){
607 if($name == "dhcpOption"){
608 foreach($values as $key => $value){
609 $value_name = trim(preg_replace("/[^ ]*$/","",$value));
610 $value_value= trim(preg_replace("/^[^ ]*/","",$value));
611 if(in_array($value_name,$this->quote_option)){
612 $value_value = preg_replace("/^\"/","",$value_value);
613 $value_value = preg_replace("/\"$/","",$value_value);
614 $sattrs[$name][$key] = $value_name." ".$value_value;
615 }
616 }
617 }
618 }
620 $this->dhcpObjectCache[$ldap->getDN()]= $sattrs;
621 $tmp= preg_replace("/".$this->serviceDN."/", "", $ldap->getDN());
622 $indent= substr_count($tmp, ",");
623 $spaces= "";
624 for ($i= 0; $i<$indent; $i++){
625 $spaces.= " ";
626 }
628 foreach ($this->types as $key => $val){
629 if (in_array("$key", $attrs['objectClass'])){
630 $type= $val;
631 break;
632 }
633 }
635 /* Prepare for sorting... */
636 $sortpart= split(",", $ldap->getDN());
637 $sortpart= array_reverse($sortpart);
638 $tmp= implode(",", $sortpart);
639 $final[$ldap->getDN()]= $tmp."!".$spaces.$type." '".$attrs['cn'][0]."'";
640 }
641 }
643 /* Sort it... */
644 natsort($final);
645 $this->dhcpSections= array();
646 foreach ($final as $key => $val){
647 $this->dhcpSections[$key]= preg_replace('/^[^!]+!(.*)$/', '\\1', $val);
648 }
650 }
653 function objectType($dn)
654 {
655 $type= "";
656 $types= array("dhcpService", "dhcpClass", "dhcpSubClass", "dhcpHost",
657 "dhcpGroup", "dhcpPool", "dhcpSubnet", "dhcpSharedNetwork");
659 foreach ($this->dhcpObjectCache[$dn]['objectClass'] as $oc){
660 if (in_array($oc, $types)){
661 $type= $oc;
662 break;
663 }
664 }
666 /* That should not happen... */
667 if ($type == ""){
668 print_red(_("DHCP configuration set is unknown. Please contact your system administrator."));
669 }
671 return ($type);
672 }
675 /* Return plugin informations for acl handling */
676 function plInfo()
677 {
678 return (array(
679 "plShortName" => _("DHCP service"),
680 "plDescription" => _("DHCP service")." ("._("Services").")",
681 "plSelfModify" => FALSE,
682 "plDepends" => array(),
683 "plPriority" => 84,
684 "plSection" => array("administration"),
685 "plCategory" => array("server"),
687 "plProvidedAcls"=> array(
689 )
690 ));
691 }
694 function take_over_service()
695 {
697 }
700 function get_list_of_dhcp_servers()
701 {
702 $ret = array("ENTRIES"=> array(),"FOR_LIST"=> array());
703 $ldap = $this->config->get_ldap_link();
704 $ldap->cd($this->config->current['BASE']);
705 $ldap->search("(&(objectClass=goServer)(dhcpServiceDN=*))",array("dn","cn","dhcpServiceDN"));
706 while($attrs = $ldap->fetch()){
708 /* Skip own config */
709 if($this->dn != "new" && preg_match("/".normalizePreg($this->dn)."$/",$attrs['dn'])){
710 continue;
711 }
713 $ret['ENTRIES'][] = $attrs;
714 }
715 foreach($ret['ENTRIES'] as $key => $data){
716 $ret['FOR_LIST'][$key] = $data['cn'][0];
717 }
718 return($ret);
719 }
722 function getListEntry()
723 {
724 $fields = goService::getListEntry();
725 $fields['Message'] = _("DHCP service");
726 $fields['AllowEdit'] = true;
727 return($fields);
728 }
730 }
732 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
733 ?>