summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 387a8ff)
raw | patch | inline | side by side (parent: 387a8ff)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 15 Oct 2007 15:19:34 +0000 (15:19 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 15 Oct 2007 15:19:34 +0000 (15:19 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7558 594d385d-05f5-0310-b6e9-bd551577e9d8
index c5bab8115604c22a27722bfafbacbe6288fd79c9..07ef318d010f7c6985a40033539c466462fbcb20 100644 (file)
"passwordMethodssha" => "include/class_password-methods-ssha.inc",
"ppdManager" => "include/class_ppdManager.inc",
"passwordMethodkerberos" => "include/class_password-methods-kerberos.inc",
- "passwordMethodsasl" => "include/class_password-methods-kerberos.inc",
"mailMethodSendmailCyrus" => "include/class_mail-methods-sendmail-cyrus.inc",
"LDAP" => "include/class_ldap.inc",
"mailMethod" => "include/class_mail-methods.inc",
"pluglist" => "include/class_pluglist.inc",
"divSelectBox" => "include/class_divSelectBox.inc",
"userinfo" => "include/class_userinfo.inc",
+ "passwordMethodheimdal" => "include/class_password-methods-heimdal.inc",
"sieve_block_start" => "include/sieve/class_sieveElement_Block_Start.inc",
"Semantics" => "include/sieve/class_semantics.inc",
"sieve_keep" => "include/sieve/class_sieveElement_Keep.inc",
index e4d28e993765bc65fc471baf58f9773503eacac7..89e6c7b9ed02c26751785324091a420fda7b2a7d 100644 (file)
{
return $pwd;
}
+
+
+ function get_hash_name()
+ {
+ return ("clear");
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 28cda87e04f7bf496a09e19a7343189de7c5cf41..2c979aa9e7188f197850bbf36008c9937a5bd3c6 100644 (file)
{
return "{CRYPT}".crypt($pwd, substr(session_id(),0,2));
}
+
+
+ function get_hash_name()
+ {
+ return "crypt";
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/include/class_password-methods-heimdal.inc b/include/class_password-methods-heimdal.inc
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2004 Fabian Hickert
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+class passwordMethodheimdal extends passwordMethod
+{
+ function passwordMethodheimdal(&$config)
+ {
+ $this->config= $config;
+ }
+
+
+ function is_available()
+ {
+ # Check if heimdal information is available
+ # in configuration and return true/false
+ return true;
+ }
+
+
+ function generate_hash($pwd)
+ {
+ $mode= "kerberos";
+ if (isset($this->config->current['KRBSASL']) && preg_match('/^true$/i', $this->config->current['KRBSASL'])){
+ $mode= "sasl";
+ }
+
+ return "{".$mode."}".$this->attrs['uid'][0]."@".$cfg= $this->config->data['SERVERS']['KERBEROS']['REALM'];
+ }
+
+
+ function remove_from_parent()
+ {
+ # Find and remove kerberos entry below $this->dn
+ }
+
+
+ function set_password()
+ {
+ # Add or modify kerberos entry below $this->dn
+ }
+
+
+ function get_hash_name()
+ {
+ $mode= "kerberos";
+ if (isset($this->config->current['KRBSASL']) && preg_match('/^true$/i', $this->config->current['KRBSASL'])){
+ $mode= "sasl";
+ }
+ return "$mode";
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/include/class_password-methods-kerberos.inc b/include/class_password-methods-kerberos.inc
index af48ee998497b8ddd001d903c2f00ad6fc6d367a..24240bad576c6a6c266e78362fa9a96f2163df27 100644 (file)
if (isset($this->config->current['KRBSASL']) && preg_match('/^true$/i', $this->config->current['KRBSASL'])){
$mode= "sasl";
}
- $newpass= "{$mode}".$this->attrs['uid'][0]."@".$cfg['REALM'];
+ $newpass= "{".$mode."}".$this->attrs['uid'][0]."@".$cfg['REALM'];
return $newpass;
}
}
}
-}
+ function get_hash_name()
+ {
+ $mode= "kerberos";
+ if (isset($this->config->current['KRBSASL']) && preg_match('/^true$/i', $this->config->current['KRBSASL'])){
+ $mode= "sasl";
+ }
+ return "$mode";
+ }
-/* Dummy class for OpenLDAP Kerberos/SASL change */
-class passwordMethodsasl extends passwordMethodkerberos
-{
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 43b3ec74c5b9811b6ddfe8163ff70ee53268401e..ea16ce99c9a933378b57461ddb68a05540af9ee5 100644 (file)
{
return "{MD5}".base64_encode( pack('H*', md5($pwd)));
}
+
+
+ function get_hash_name()
+ {
+ return "md5";
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 0780a76e08aa9de288ccb6f91207a9d7ad697894..5a6d266ab6f3fea471adb7bf6fe3f6b4a864e825 100644 (file)
return(true);
}elseif(function_exists('mhash')){
return true;
- }elseif(function_exists('crypt')){
- return true;
}else{
return false;
}
$hash = "{SHA}" . base64_encode(pack("H*",sha1($password)));
}elseif (function_exists('mhash')) {
$hash = "{SHA}" . base64_encode(mHash(MHASH_SHA1, $password));
- }elseif(function_exists('crypt')) {
- $hash = "{CRYPT}" . crypt($password);
}else{
- print_red(_("Can't use sha for encryption, missing function sha1 / mhash / crypt"));
+ print_red(_("Can't use sha for encryption, missing function sha1 / mhash"));
return false;
}
return $hash;
}
+
+
+ function get_hash_name()
+ {
+ return "sha";
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index fea58f6990d199b4e7974932d468f7056ba21bdb..dff2362553421f6f50a0acf834f201d489fd3d5e 100644 (file)
$hash = "{SMD5}".base64_encode(pack("H*",md5($pwd . $salt)) . $salt);
return $hash;
}
+
+ function get_hash_name()
+ {
+ return "smd5";
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 1f68192726b69a88c148677dd854daed2e4261f3..34cb303fe8fe75dd7a208b710ce12ec568113b9b 100644 (file)
}
return $pwd;
}
+
+
+ function get_hash_name()
+ {
+ return "ssha";
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index a23e55e07988a02b94aaa4bb0bec0d8a98dd4240..f4a3c0b7291a6ec4a88f0814d67a91d74cc20309 100644 (file)
{
}
+
+ function get_hash_name()
+ {
+ }
+
// Loads Methods in annother way as get_available_methods do, (For setup ..)
// and loads them,.
function get_available_methods_if_not_loaded($path_to_load="../include")
-
// Crypts a single string, with given Method
function crypt_single_str($string,$method)
{
// this function returns all loaded classes for password encryption
static function get_available_methods()
{
- global $class_mapping;
+ global $class_mapping, $config;
$ret =false;
$i =0;
foreach($class_mapping as $class => $path) {
if(preg_match('/passwordMethod/i', $class) && !preg_match("/^passwordMethod$/i", $class)){
$name = preg_replace ("/passwordMethod/i", "", $class);
- $test = new $class(false);
+ $test = new $class($config);
if($test->is_available()) {
- $plugname= strtolower(preg_replace ("/passwordMethod/i","",$class));
+ $plugname= $test->get_hash_name();
$ret['name'][$i]= $plugname;
$ret['class'][$i]=$class;
$ret[$i]['name']= $plugname;
diff --git a/include/functions.inc b/include/functions.inc
index 2d5dd7b6dcd0989279549a620a3c5d512625900c..7b36499ab637dd19c4105ebf6010347ba8111f7c 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
}
$test = new $available[$hash]($config);
- $newpass = $test->generate_hash($password);
} else {
// User MD5 by default
$hash= "md5";
$test = new $available['md5']($config);
- $newpass = $test->generate_hash($password);
}
/* Feed password backends with information */
$test->dn= $dn;
$test->attrs= $attrs;
+ $newpass= $test->generate_hash($password);
// Update shadow timestamp?
if (isset($attrs["shadowLastChange"][0])){