Code

Updated krb service to use the servers macaddress
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Apr 2008 08:12:40 +0000 (08:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Apr 2008 08:12:40 +0000 (08:12 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10680 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/heimdal/admin/systems/services/kerberos/class_goKrbServer.inc

index aea90721160b80c115b1c7ff113a4d36bc6b4e5b..9478b9c0bd003ec50dc402a427e62592698ba542 100644 (file)
@@ -23,23 +23,34 @@ class goKrbServer extends goService{
 
   var $policies         = array();
   var $id               = -1;
-  var $macAddress       = "00:01:6c:9d:aa:16" ;
+  var $macAddress       = "" ;
+
  
-  public function goKrbServer(&$config,$dn)
+  public function goKrbServer(&$config,$dn,$parent)
   {
     goService::goService($config,$dn);
     $this->DisplayName = _("Kerberos service");
+    $this->parent = $parent;
+
+    /* Detect macAddress of this device 
+     */
+    $this->macAddress = "";
+    if(isset($this->parent->parent->netConfigDNS->macAddress)){
+      $this->macAddress = &$this->parent->parent->netConfigDNS->macAddress;
+    }
 
     /* Get configured policies 
      */ 
-    $o = new gosaSupportDaemon();
-    $tmp = $o->krb5_list_policies($this->macAddress);
-    if($o->is_error()){
-      msg_dialog::display(_("Service infrastructure"),msgPool::siError($o->get_error()),ERROR_DIALOG);
-    }else{
-      $this->policies = array();
-      foreach($tmp as $policy){
-        $this->policies[] = array("NAME" => $policy,"STATUS" => "LOADED","DATA" => array());
+    if(!empty($this->macAddress) && $this->is_account){
+      $o = new gosaSupportDaemon();
+      $tmp = $o->krb5_list_policies($this->macAddress);
+      if($o->is_error()){
+        msg_dialog::display(_("Service infrastructure"),msgPool::siError($o->get_error()),ERROR_DIALOG);
+      }else{
+        $this->policies = array();
+        foreach($tmp as $policy){
+          $this->policies[] = array("NAME" => $policy,"STATUS" => "LOADED","DATA" => array());
+        }
       }
     }
   }
@@ -140,6 +151,9 @@ class goKrbServer extends goService{
     if (empty($this->goKrbRealm)){
       $message[]= msgPool::required(_("Realm"));
     }
+    if(count($this->policies) && (empty($this->macAddress) || !tests::is_mac($this->macAddress))){
+      $message[] = _("In order to save policy changes, the server reqiures a valid mac address.");
+    }
     return($message);
   }