From 0f354d4429f8d53caa935524e061755c21110d50 Mon Sep 17 00:00:00 2001
From: Benoit Mortier <benoit.mortier@opensides.be>
Date: Sun, 15 Jan 2012 14:22:22 +0100
Subject: [PATCH] Fixes: #520 removing fixed path from setup

---
 include/variables.inc             |  3 +++
 setup/class_setupStep_Config2.inc | 10 +++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/variables.inc b/include/variables.inc
index 29945e104..d8981e3b0 100644
--- a/include/variables.inc
+++ b/include/variables.inc
@@ -74,4 +74,7 @@ define("SMARTY3", "/usr/share/php/smarty3/Smarty.class.php");
 /* name of the class.cache file */
 define("CLASS_CACHE", "class.cache");
 
+/* name of the utility used to create windows passwords */
+define ("MKNTPWD", "/usr/bin/fusiondirectory-mkntpassword");
+
 ?>
diff --git a/setup/class_setupStep_Config2.inc b/setup/class_setupStep_Config2.inc
index 45f2555b8..e80bfeb7f 100644
--- a/setup/class_setupStep_Config2.inc
+++ b/setup/class_setupStep_Config2.inc
@@ -61,12 +61,12 @@ class Step_Config2 extends setup_step
     $this->mail_methods = $this->get_available_mail_classes();
 
     /* Look for samba password generation method */
-    if(file_exists("/usr/bin/fusiondirectory-mkntpassword")){
-      $pwdhash  = "/usr/bin/fusiondirectory-mkntpassword";
-    } elseif (preg_match("/^Usage: fusiondirectory-mkntpassword /", shell_exec ("mkntpwd 2>&1"))){
-      $pwdhash= "mkntpwd";
+    if(file_exists(MKNTPWD)){
+      $pwdhash = MKNTPWD;
+    } elseif (preg_match("/^Usage: fusiondirectory-mkntpassword <password>/", shell_exec (MKNTPWD))){
+      $pwdhash = MKNTPWD;
     } else {
-      $pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
+      $pwdhash = 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
     }
 
     $this->timezones = timezone::_get_tz_zones();
-- 
GitLab