Code

Fixed detection of valid configured heimdal extension
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Dec 2007 15:00:12 +0000 (15:00 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Dec 2007 15:00:12 +0000 (15:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7984 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_password-methods-heimdal.inc
plugins/personal/generic/class_user.inc

index a99ee85351b650fc98a4bdc1f9940d08aab270e2..8a0257981cd366fe055f3c3008ed5c05fa4589c8 100644 (file)
@@ -93,14 +93,26 @@ class passwordMethodheimdal extends passwordMethod
 
        function is_available()
        {
-    #TODO
-    # Check if heimdal information is available
-    # in configuration and return true/false
-    #
-    # In particular, we need the "heimdal_keygen" to feed kadmin in order to return "true".
-    #
-    return true;
-       }
+    global $config;
+    $cmd = "";
+    if(isset($config->current['HEIMDAL_KEYGEN'])){
+      $cmd = $config->current['HEIMDAL_KEYGEN'];
+      if(!check_command($cmd)){
+        new msg_dialog(_("Heimdal"),sprintf(_("The configured HEIMDAL_KEYGEN '%s' is not a valid command."),$cmd),WARNING_DIALOG);
+      }
+    }
+    if(isset($this->config->data['MAIN']['HEIMDAL_KEYGEN'])){
+      $cmd = $this->config->data['MAIN']['HEIMDAL_KEYGEN'];
+      if(!check_command($cmd)){
+        new msg_dialog(_("Heimdal"),sprintf(_("The configured HEIMDAL_KEYGEN '%s' is not a valid command."),$cmd),WARNING_DIALOG);
+      }
+    }
+    if(isset($config->data['SERVERS']['KERBEROS']['REALM']) && check_command($cmd)){
+      return TRUE;
+    }else{
+      return FALSE;
+    }
+  }
 
 
        function generate_hash($pwd)
index c7504f113785ed6af9f6658ddc72ea11fd83ef80..fbb55c12a99d7be0b70cf277fc47f04eb9ff65ec 100644 (file)
@@ -560,9 +560,14 @@ class user extends plugin
     }
 
     $temp= passwordMethod::get_available_methods();
+    $is_configurable= FALSE;
     $hashes = $temp['name'];
-    $test= new $temp[$this->pw_storage]($this->config);
-    $is_configurable= $test->is_configurable();
+    if(isset($temp[$this->pw_storage])){
+      $test= new $temp[$this->pw_storage]($this->config);
+      $is_configurable= $test->is_configurable();
+    }else{
+      new msg_dialog(_("Password method"),_("The selected password method is no longer available."),WARNING_DIALOG);
+    }
     
     /* Load attributes and acl's */
     $ui =get_userinfo();