summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 303cbe2)
raw | patch | inline | side by side (parent: 303cbe2)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 21 Feb 2008 14:28:12 +0000 (14:28 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 21 Feb 2008 14:28:12 +0000 (14:28 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9024 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/functions.inc | patch | blob | history |
index c0281e7430481d769512e5e1e47e281773bab0c7..7b135d285396b3d1e4e03ec28366e1314bff7f4a 100644 (file)
function generate_smb_nt_hash($password)
{
global $config;
- $tmp= $config->data['MAIN']['SMBHASH']." ".escapeshellarg($password);
- @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");
- exec($tmp, $ar);
- flush();
- reset($ar);
- $hash= current($ar);
+ # Try to use gosa-si?
+ if (isset($config->data['MAIN']['GOSA_SI'])){
+ $hash= gosaSupportDaemon::send("gosa_gen_smb_hash", "GOSA", array("password" => $password));
+ } else {
+ $tmp= $config->data['MAIN']['SMBHASH']." ".escapeshellarg($password);
+ @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");
+
+ exec($tmp, $ar);
+ flush();
+ reset($ar);
+ $hash= current($ar);
+ }
+
if ($hash == "") {
- msg_dialog::display(_("Configuration error"), _("Setting for SMBHASH in gosa.conf is incorrect! Cannot change Samba password."), ERROR_DIALOG);
+ msg_dialog::display(_("Configuration error"), _("Cannot generate samba hash!"), ERROR_DIALOG);
+ return ("");
+ }
+
+ list($lm,$nt)= split (":", trim($hash));
+
+ if ($config->current['SAMBAVERSION'] == 3) {
+ $attrs['sambaLMPassword']= $lm;
+ $attrs['sambaNTPassword']= $nt;
+ $attrs['sambaPwdLastSet']= date('U');
+ $attrs['sambaBadPasswordCount']= "0";
+ $attrs['sambaBadPasswordTime']= "0";
} else {
- list($lm,$nt)= split (":", trim($hash));
-
- if ($config->current['SAMBAVERSION'] == 3) {
- $attrs['sambaLMPassword']= $lm;
- $attrs['sambaNTPassword']= $nt;
- $attrs['sambaPwdLastSet']= date('U');
- $attrs['sambaBadPasswordCount']= "0";
- $attrs['sambaBadPasswordTime']= "0";
- } else {
- $attrs['lmPassword']= $lm;
- $attrs['ntPassword']= $nt;
- $attrs['pwdLastSet']= date('U');
- }
- return($attrs);
+ $attrs['lmPassword']= $lm;
+ $attrs['ntPassword']= $nt;
+ $attrs['pwdLastSet']= date('U');
}
+ return($attrs);
}