Code

Directory cleanup
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 9 Jan 2008 15:54:18 +0000 (15:54 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 9 Jan 2008 15:54:18 +0000 (15:54 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8266 594d385d-05f5-0310-b6e9-bd551577e9d8

27 files changed:
gosa-core/include/class_location.inc
gosa-core/include/class_mail-methods-cyrus.inc [deleted file]
gosa-core/include/class_mail-methods-golab.inc [deleted file]
gosa-core/include/class_mail-methods-kolab.inc [deleted file]
gosa-core/include/class_mail-methods-sendmail-cyrus.inc [deleted file]
gosa-core/include/class_mail-methods.inc [deleted file]
gosa-core/include/class_password-methods-clear.inc [deleted file]
gosa-core/include/class_password-methods-crypt.inc [deleted file]
gosa-core/include/class_password-methods-heimdal.inc [deleted file]
gosa-core/include/class_password-methods-kerberos.inc [deleted file]
gosa-core/include/class_password-methods-md5.inc [deleted file]
gosa-core/include/class_password-methods-sha.inc [deleted file]
gosa-core/include/class_password-methods-smd5.inc [deleted file]
gosa-core/include/class_password-methods-ssha.inc [deleted file]
gosa-core/include/password-methods/class_password-methods-clear.inc [new file with mode: 0644]
gosa-core/include/password-methods/class_password-methods-crypt.inc [new file with mode: 0644]
gosa-core/include/password-methods/class_password-methods-heimdal.inc [new file with mode: 0644]
gosa-core/include/password-methods/class_password-methods-kerberos.inc [new file with mode: 0644]
gosa-core/include/password-methods/class_password-methods-md5.inc [new file with mode: 0644]
gosa-core/include/password-methods/class_password-methods-sha.inc [new file with mode: 0644]
gosa-core/include/password-methods/class_password-methods-smd5.inc [new file with mode: 0644]
gosa-core/include/password-methods/class_password-methods-ssha.inc [new file with mode: 0644]
gosa-core/plugins/personal/mail/class_mail-methods-cyrus.inc [new file with mode: 0644]
gosa-core/plugins/personal/mail/class_mail-methods-golab.inc [new file with mode: 0644]
gosa-core/plugins/personal/mail/class_mail-methods-kolab.inc [new file with mode: 0644]
gosa-core/plugins/personal/mail/class_mail-methods-sendmail-cyrus.inc [new file with mode: 0644]
gosa-core/plugins/personal/mail/class_mail-methods.inc [new file with mode: 0644]

index b69b1e63d645d3019f01148f35820648d15b0b9e..155ccb19fc1db405bd47a7638347f70bdb4dd811 100644 (file)
@@ -16,19 +16,22 @@ $class_mapping= array(
                 "setup_step" => "setup/class_setupStep.inc",
                 "debconf" => "include/class_debconfTemplate.inc",
                 "certificate" => "include/class_certificate.inc",
-                "passwordMethodClear" => "include/class_password-methods-clear.inc",
-                "mailMethodCyrus" => "include/class_mail-methods-cyrus.inc",
                 "pgre_sql" => "include/class_pgsql_opengw.inc",
                 "divlist" => "include/class_divlist.inc",
+                "passwordMethodClear" => "include/password-methods/class_password-methods-clear.inc",
+                "passwordMethodMd5" => "include/password-methods/class_password-methods-md5.inc",
+                "passwordMethodssha" => "include/password-methods/class_password-methods-ssha.inc",
+                "passwordMethodheimdal" => "include/password-methods/class_password-methods-heimdal.inc",
+                "passwordMethodkerberos" => "include/password-methods/class_password-methods-kerberos.inc",
+                "passwordMethodsmd5" => "include/password-methods/class_password-methods-smd5.inc",
+                "passwordMethodCrypt" => "include/password-methods/class_password-methods-crypt.inc",
+                "passwordMethodsha" => "include/password-methods/class_password-methods-sha.inc",
                 "ppdManager" => "include/class_ppdManager.inc",
                 "divSelectBox" => "include/class_divSelectBox.inc",
                 "tabs" => "include/class_tabs.inc",
                 "hostActionQueue" => "include/class_hostActionQueue.inc",
                 "CopyPasteHandler" => "include/class_CopyPasteHandler.inc",
-                "passwordMethodMd5" => "include/class_password-methods-md5.inc",
-                "passwordMethodssha" => "include/class_password-methods-ssha.inc",
                 "plugin" => "include/class_plugin.inc",
-                "passwordMethodheimdal" => "include/class_password-methods-heimdal.inc",
                 "glpiDB" => "include/class_glpi.inc",
                 "Template_PHPLIB" => "include/php_layers_menu/lib/PHPLIB.php",
                 "PHPTreeMenu" => "include/php_layers_menu/lib/phptreemenu.inc.php",
@@ -37,10 +40,7 @@ $class_mapping= array(
                 "LayersMenu" => "include/php_layers_menu/lib/layersmenu.inc.php",
                 "LayersMenuCommon" => "include/php_layers_menu/lib/layersmenu-common.inc.php",
                 "PlainMenu" => "include/php_layers_menu/lib/plainmenu.inc.php",
-                "passwordMethodkerberos" => "include/class_password-methods-kerberos.inc",
-                "mailMethodSendmailCyrus" => "include/class_mail-methods-sendmail-cyrus.inc",
                 "acl" => "include/class_acl.inc",
-                "mailMethodKolab" => "include/class_mail-methods-kolab.inc",
                 "pluglist" => "include/class_pluglist.inc",
                 "HTML_TreeMenu" => "html/TreeMenu.php",
                 "HTML_TreeNode" => "html/TreeMenu.php",
@@ -73,12 +73,9 @@ $class_mapping= array(
                 "ogw" => "include/class_opengw.inc",
                 "gosa_cache" => "include/class_cache_handler.inc",
                 "Socket_Client" => "include/class_socketClient.inc",
-                "mailMethodGolab" => "include/class_mail-methods-golab.inc",
                 "log" => "include/class_log.inc",
-                "passwordMethodsmd5" => "include/class_password-methods-smd5.inc",
                 "multi_plug" => "include/class_multi_plug.inc",
                 "msg_dialog" => "include/class_msg_dialog.inc",
-                "passwordMethodCrypt" => "include/class_password-methods-crypt.inc",
                 "parseXml" => "include/functions_helpviewer.inc",
                 "writeexcel_biffwriter" => "include/php_writeexcel/class.writeexcel_biffwriter.inc.php",
                 "writeexcel_worksheet" => "include/php_writeexcel/class.writeexcel_worksheet.inc.php",
@@ -86,13 +83,11 @@ $class_mapping= array(
                 "writeexcel_formula" => "include/php_writeexcel/class.writeexcel_formula.inc.php",
                 "writeexcel_workbook" => "include/php_writeexcel/class.writeexcel_workbook.inc.php",
                 "writeexcel_format" => "include/php_writeexcel/class.writeexcel_format.inc.php",
-                "passwordMethodsha" => "include/class_password-methods-sha.inc",
                 "session" => "include/class_session.inc",
                 "sambaMungedDial" => "include/class_sambaMungedDial.inc",
                 "MultiSelectWindow" => "include/class_MultiSelectWindow.inc",
                 "config" => "include/class_config.inc",
                 "SnapShotDialog" => "include/class_SnapShotDialog.inc",
-                "mailMethod" => "include/class_mail-methods.inc",
                 "dhcpPlugin" => "include/class_dhcpPlugin.inc",
                 "passwordMethod" => "include/class_password-methods.inc",
                 "Print_a_class" => "include/functions_debug.inc",
@@ -103,7 +98,12 @@ $class_mapping= array(
                 "logonManagementDialog" => "plugins/personal/environment/class_logonManagementDialog.inc",
                 "selectPrinterDialog" => "plugins/personal/environment/class_selectPrinterDialog.inc",
                 "scalixAccount" => "plugins/personal/scalix/class_scalixAccount.inc",
+                "mailMethodCyrus" => "plugins/personal/mail/class_mail-methods-cyrus.inc",
+                "mailMethodSendmailCyrus" => "plugins/personal/mail/class_mail-methods-sendmail-cyrus.inc",
+                "mailMethodKolab" => "plugins/personal/mail/class_mail-methods-kolab.inc",
+                "mailMethodGolab" => "plugins/personal/mail/class_mail-methods-golab.inc",
                 "mailAccount" => "plugins/personal/mail/class_mailAccount.inc",
+                "mailMethod" => "plugins/personal/mail/class_mail-methods.inc",
                 "user" => "plugins/personal/generic/class_user.inc",
                 "sambaLogonHours" => "plugins/personal/samba/class_sambaLogonHours.inc",
                 "sambaAccount" => "plugins/personal/samba/class_sambaAccount.inc",
diff --git a/gosa-core/include/class_mail-methods-cyrus.inc b/gosa-core/include/class_mail-methods-cyrus.inc
deleted file mode 100644 (file)
index 388a5a7..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2004  Cajus Pollmeier
-
-   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 mailMethodCyrus extends mailMethod
-{
-  var $mbox= "-";
-  var $config;
-  var $gosaMailServer= "";
-  var $uattrib= "uid";
-
-  function mailMethodCyrus(&$config)
-  {
-    $this->config= $config->data['SERVERS']['IMAP'];
-  }
-
-  function connect($gosaMailServer)
-  {
-    $cfg=array();
-
-    /* Connect to IMAP server. I don't want to see these warning here... */
-    $this->gosaMailServer= $gosaMailServer;
-    if (!isset($this->config[$gosaMailServer])){
-      msg_dialog::display(_("Warning"), _("Mail server for this account is invalid!"), WARNING_DIALOG);
-    } else {
-      $cfg= $this->config[$gosaMailServer];
-    }
-    /* For some reason, hiding errors with @ does not wor here... */
-    if(!isset($cfg['connect']))   $cfg['connect']="";
-    if(!isset($cfg['admin']))     $cfg['admin']="";
-    if(!isset($cfg['password']))  $cfg['password']="";
-
-    /* Setting connect timeout to 10 seconds,
-        else the GOsa UI may freeze for 60 seconds.
-       (PHP default is 'default_socket_timeout = 60') */
-    imap_timeout(1, 10 );
-
-    $this->mbox = @imap_open($cfg['connect'], $cfg['admin'], $cfg['password'], OP_HALFOPEN);
-
-    /* Mailbox reachable? */
-    if ($this->mbox === FALSE){
-      msg_dialog::display(_("IMAP error"), _("Cannot store mail settings on IMAP server!"), ERROR_DIALOG);
-      return (FALSE);
-    }
-    return (TRUE);
-  }
-
-  function disconnect()
-  {
-    imap_close ($this->mbox);
-  }
-
-  function getQuota($folder)
-  {
-    $result= array('quotaUsage' => '', 'gosaMailQuota' => '');
-
-    /* Load quota settings */
-    error_reporting (0);
-    $quota_value = @imap_get_quota($this->mbox, $folder);
-    if(is_array($quota_value)) {
-      if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
-        /* use for PHP >= 4.3 */
-        if($quota_value["STORAGE"]['limit'] == 2147483647){
-          $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
-          $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] );
-        }else{
-          $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
-          $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
-        }
-      } else {
-        /* backward icompatible */
-        if($quota_value['usage'] == 2147483647){
-          $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
-          $result['gosaMailQuota']= (int) ($quota_value['limit'] );
-        }else{
-          $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
-          $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
-        }
-      }
-    }elseif(!$quota_value){
-      /* If there is no quota defined for this account, the function imap_get_quota returns false. */
-      return(array("quotaUsage"=>"","gosaMailQuota"=>""));
-    }
-    error_reporting (E_ALL | E_STRICT);
-    return ($result);
-  }
-
-
-  /* return all folders of the users mailbox*/
-  function getMailboxList($folder, $uid)
-  {
-    global $config;
-    $result = array();
-
-    /* Get domain an mail address if uid is an mail address */
-    $domain = "";
-    if(preg_match("/@/",$folder)){
-      $domain = "@".preg_replace("/^.*@/","",$folder);
-      $folder = preg_replace("/@.*$/","",$folder);
-    }
-
-    /* Get list of mailboxes for combo box */
-    $cfg= $this->config[$this->gosaMailServer];
-
-    /* Create search pattern
-         (user/kekse*@domain.de
-          user.kekse*@domain.de
-          user.kekse*  )
-       depending on given folder name) */
-    $q = $folder."*".$domain;
-    $list = imap_listmailbox($this->mbox, $cfg["connect"], $q);
-
-    /* Create list of returned folder names */
-    if (is_array($list)){
-      foreach ($list as $val){
-
-        /* Cut domain name */
-        $val = preg_replace("/@.*$/","",$val);
-        $result[]=preg_replace ("/^.*".normalizePreg($folder)."/","INBOX", mb_convert_encoding($val, "UTF-8", "UTF7-IMAP"));
-      }
-    }
-
-    /* Append "INBOX" to the folder array if result is empty and request comes from user dialog */
-    if(empty($result) && !empty($uid)){
-      $result[] = "INBOX";
-    }
-
-    return ($result);
-  }
-
-
-  function updateMailbox($folder)
-  {
-    /* Check if mailbox exists */
-    $cfg= $this->config[$this->gosaMailServer];
-    $list = imap_listmailbox($this->mbox, $cfg["connect"], $folder);
-    if ($list === FALSE){
-      if (!imap_createmailbox($this->mbox, $cfg["connect"]. $folder)){
-        msg_dialog::display(_("IMAP error"), sprintf(_("Cannot create IMAP mailbox: %s"), '<br><br><i>'.imap_last_error().'</i>'), ERROR_DIALOG);
-        return;
-      }
-    }
-  }
-
-
-  function setQuota($folder, $gosaMailQuota)
-  {
-    /* Workaround for the php imap extension */
-    if (($gosaMailQuota == "") || ($gosaMailQuota== "2147483647")){
-      $gosaMailQuota= "2147483647";
-    }elseif($gosaMailQuota > 0){
-      $gosaMailQuota = $gosaMailQuota *1024;
-    }
-    
-    
-    /* Write mail quota */
-    if (!imap_set_quota($this->mbox, $folder, $gosaMailQuota)){
-      msg_dialog::display(_("IMAP error"), sprintf(_("Cannot modify IMAP mailbox quota: %s"), '<br><br><i>'.imap_last_error().'</i>'), ERROR_DIALOG);
-      return (FALSE);
-    }
-    return (TRUE);
-  }
-
-
-  function setSharedFolderPermissions($folder, $permissions)
-  {
-    /* Get list of subfolders */
-    $folders= $this->getMailboxList($folder, "");
-    $folders[]= $folder;
-    
-    foreach ($folders as $subfolder){
-
-      /* Set shared folder acl's */
-      if (function_exists('imap_getacl')){
-
-        /* Remove all acl's for this folder */
-        $users= @imap_getacl ($this->mbox, $subfolder);
-        if(is_array($users)){
-          foreach ($users as $userid => $perms){
-            imap_setacl ($this->mbox, $subfolder, $userid, "");
-          }
-        }
-      } else {
-        msg_dialog::display(_("Internal error"), _("Cannot remove IMAP ACL: imap_getacl not implemented!"), ERROR_DIALOG);
-      }
-
-      /* Set permissions for this folder */
-      foreach ($permissions as $user => $acl){
-        imap_setacl ($this->mbox, $subfolder, $user, $acl);
-      }
-    }
-
-  }
-
-
-  function getSharedFolderPermissions($folder)
-  {
-    $result= array();
-
-    /* imap_getacl available? */
-    if (!function_exists('imap_getacl')){
-      msg_dialog::display(_("Internal error"), _("Cannot retrieve IMAP ACL: imap_getacl not implemented!"), ERROR_DIALOG);
-    }
-
-    /* Get permissions in case of shared folders */
-    else {
-      $users= imap_getacl ($this->mbox, $folder);
-
-      foreach ($users as $userid => $perms){
-        $result[preg_replace('/^user\./', '', $userid)]= $perms;
-      }
-
-    }
-
-    return ($result);
-  }
-
-
-  function deleteMailbox($folder)
-  {
-    $cfg= $this->config[$this->gosaMailServer];
-    imap_setacl ($this->mbox, $folder, $cfg["admin"], "lrswipcda");
-    if (!imap_deletemailbox($this->mbox, $cfg["connect"].$folder)){
-      msg_dialog::display(_("IMAP error"), sprintf(_('Cannot remove IMAP mailbox: %s'), '<br><br><i>'.imap_last_error().'</i>'), ERROR_DIALOG);
-      return (FALSE);
-    }
-    return (TRUE);
-  }
-
-
-  function configureFilter($user, $gosaMailDeliveryMode,
-      $mail, $gosaMailAlternateAddress,
-      $gosaMailMaxSize,
-      $gosaSpamMailbox, $gosaSpamSortLevel,
-      $gosaVacationMessage)
-  {
-    $cfg= $this->config[$this->gosaMailServer];
-
-    /* Build spamlevel. Spamassassin tags mails with "*" for each integer
-       point of spam. So a spam level of 5.3 gets "*****" which can be
-       checked easily by spam filters */
-    $spamlevel= "";
-    for ($i= 0; $i<$gosaSpamSortLevel; $i++){
-      $spamlevel .= "*";
-    }
-
-    /* Log into the mail server */
-    $sieve= new sieve($cfg["sieve_server"], $cfg["sieve_port"], $user,
-        $cfg["password"], $cfg["admin"]);
-
-    if (!$sieve->sieve_login()){
-      msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot log into SIEVE server: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
-      return;
-    }
-
-    /* Load current script from server and remove everything between the comments
-       "###GOSA" */
-    $script= "";
-    if($sieve->sieve_listscripts()){
-      if (in_array("gosa", $sieve->response)){
-
-        /* get old GOsa script */
-        if(!$sieve->sieve_getscript("gosa")){
-          msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot retrieve SIEVE script: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
-          return;
-        }
-
-        foreach ($sieve->response as $line){
-          if (preg_match ("/^###GOSA/", $line)){
-            break;
-          }
-          $line= rtrim($line);
-          if (!preg_match ('/^\s*$/', $line)){
-            $script .= $line."\n";
-          }
-        }
-
-      }
-    }
-
-    /* Only create a new one, if it is not empty */
-    if (is_integer(strpos($gosaMailDeliveryMode, "R")) ||
-        is_integer(strpos($gosaMailDeliveryMode, "C")) ||
-        !is_integer(strpos($gosaMailDeliveryMode, "L")) ||
-        is_integer(strpos($gosaMailDeliveryMode, "V")) ||
-        is_integer(strpos($gosaMailDeliveryMode, "S"))){
-
-      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-header.txt")));
-      eval ("\$script.=\"$text\";");
-    }
-
-    /* Add anti-spam code */
-    if (is_integer(strpos($gosaMailDeliveryMode, "S"))){
-      $spambox= $gosaSpamMailbox;
-      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-spam.txt")));
-      eval ("\$script.=\"$text\";");
-    }
-
-    /* Add "reject due to mailsize" code, message is currently not
-       adjustable through GOsa. */
-    if (is_integer(strpos($gosaMailDeliveryMode, "R"))){
-      $maxsize= $gosaMailMaxSize;
-      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-mailsize.txt")));
-      eval ("\$script.=\"$text\";");
-    }
-
-    /* Add vacation information */
-    if (is_integer(strpos($gosaMailDeliveryMode, "V"))){
-
-      /* Sieve wants all destination addresses for the
-         vacation message, so we've to assemble them from
-         mail and mailAlternateAddress */
-      $addrlist= "\"".$mail."\"";
-      foreach ($gosaMailAlternateAddress as $val){
-        $addrlist .= ", \"$val\"";
-      }
-      $vacmsg= $gosaVacationMessage;
-      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-vacation.txt")));
-      eval ("\$script.=\"$text\";");
-    }
-
-    /* If no local delivery is wanted, tell the script to discard the mail */
-    if (!is_integer(strpos($gosaMailDeliveryMode, "L"))){
-      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-discard.txt")));
-      eval ("\$script.=\"$text\";");
-    }
-
-    /* Just be aware of null scripts... */
-    if (!isset ($script)){
-      $script= "";
-    }
-
-    /* Upload script and make it the default one */
-    if (!$sieve->sieve_sendscript("gosa", $script)){
-      msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot store SIEVE script: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
-      return;
-    }
-    if(!$sieve->sieve_setactivescript("gosa")){
-      msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot activate SIEVE script: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
-      return;
-    }
-
-    $sieve->sieve_logout();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/class_mail-methods-golab.inc b/gosa-core/include/class_mail-methods-golab.inc
deleted file mode 100644 (file)
index dc75674..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2004  Cajus Pollmeier
-
-   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 mailMethodGolab extends mailMethodCyrus
-{
-  var $mbox= "-";
-  var $config;
-  var $gosaMailServer= "";
-  var $uattrib= "mail";
-
-  var $attribute_map= array("gosaMailAlternateAddress"  =>  "alias",
-                            "gosaMailQuota"             =>  "cyrus-userquota",
-                            "gosaMailServer"            =>  "kolabHomeServer");
-
-  function mailMethodGolab(&$config)
-  {
-    $this->config= $config->data['SERVERS']['IMAP'];
-  }
-
-  function updateMailbox($folder)
-  {
-  }
-
-  function setQuota($folder, $gosaMailQuota)
-  {
-    return (TRUE);
-  }
-
-  /* Get quota and divide it by 1024, because in gosa we display in MB
-      but we get Kb */
-  function getQuota($folder)
-  {
-    $result= array('quotaUsage' => '', 'gosaMailQuota' => '');
-
-    /* Only use lower case folder names, if folder name is like "@domain.com" */
-    if(preg_match("/@/",$folder)){
-      $folder = strtolower($folder);
-    }
-
-    error_reporting(0);  
-  
-    /* Load quota settings */
-    $quota_value = @imap_get_quota($this->mbox, $folder);
-    if(is_array($quota_value)) {
-      if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
-        /* use for PHP >= 4.3 */
-        $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
-        $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
-      } else {
-        /* backward icompatible */
-        $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
-        $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
-      }
-    }elseif(!$quota_value){
-      return(false);
-    }
-
-    error_reporting(E_ALL | E_STRICT); 
-    return ($result);
-  }
-
-
-  function fixAttributesOnLoad(&$mailObject)
-  {
-    /* Kolab shared folder names are like ' shared.uid@server.de ' 
-        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
-        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
-    if(get_class($mailObject) == "mailgroup"){
-     $mailObject->uid = $mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
-    }
-
-    /* Convert attributes and objectClasses */
-    foreach ($this->attribute_map as $dest => $source){
-      /* Hickert 11.11.05 : Alternate email addresses were saved, but not displayed again.
-      if (isset($mailObject->attrs[$source])){
-        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
-        unset ($mailObject->attrs[$source]);
-      */
-
-      if (isset($mailObject->attrs[$source])){
-        unset($mailObject->attrs[$source]['count']);
-        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
-        $mailObject->$dest=        $mailObject->attrs[$source];
-
-        unset ($mailObject->$dest['count']);
-        unset ($mailObject->attrs[$source]);
-      }
-    }
-
-    /* Adjust server name if needed */
-    foreach ($mailObject->config->data['SERVERS']['IMAP'] as $srv => $dummy){
-      if (preg_match("%".$mailObject->attrs['gosaMailServer'][0]."$%", $srv)){
-        $mailObject->attrs['gosaMailServer']= array(0 => $srv, "count" => 1);
-        break;
-      }
-    }
-  }
-
-
-  function fixAttributesOnStore(&$mailObject)
-  {
-    global $config;
-  
-    /* If quota is empty, remove quota restrictions by setting quota to 0 */
-    if(isset($mailObject->gosaMailQuota) && (empty($mailObject->gosaMailQuota))){
-      $mailObject->attrs['gosaMailQuota'] = 0;
-    }
-
-    /* Convert attributes and objectClasses */
-    foreach ($this->attribute_map as $source => $dest){
-      if (isset($mailObject->attrs[$source])){
-        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
-        unset ($mailObject->attrs[$source]);
-      }
-    }
-    $objectclasses= array();
-    foreach ($mailObject->attrs['objectClass'] as $oc){
-      if ($oc !=  'kolabInetOrgPerson' && $oc !=  'kolabSharedFolder'){
-        $objectclasses[]= $oc;
-      }
-    }
-    $mailObject->attrs['objectClass']= $objectclasses;
-    if (in_array("posixGroup", $mailObject->attrs['objectClass'])){
-  
-      /* Add kolabSharedFoleder Class */
-      $mailObject->attrs['objectClass'][]= 'kolabSharedFolder';
-
-      /* Work on acl attribute */
-      $new_acl= array();
-      foreach ($mailObject->attrs['acl'] as $uacl){
-
-        /* Get user=(mail) & acls  */
-        list($user, $acl) = split(" ", $uacl);
-      
-        /* Add al users which have seperated acls 
-           %members% are all users in this group, 
-           which have the standard group acl
-        */
-        if ($user != "%members%"){
-          $new_acl[$user]= $uacl;
-        } else {
-        
-          /* All groupmembers will be added */
-          $ldap = $config->get_ldap_link();
-          $ldap->cd($config->current['BASE']);
-          foreach ($mailObject->members as $member){
-
-            /* Get user mail address .... */
-            $ldap->search("(&(objectClass=person)(|(uid=".$member.")(mail=".$member.")))",array("mail"));
-            $res = $ldap->fetch();
-
-            /* Default mail address is set to uid - 
-               So if there is no mail address defined the uid is added 
-             */
-            $mail = $member;
-
-            /* Use mail address if it is available */
-            if(isset($res['mail'][0])){
-              $mail = $res['mail'][0];
-            }
-
-            /* only append this mail/permission string to acl,
-               if there arn't already some (special) configs for this user */
-            $found =false;
-            foreach($mailObject->imapacl as $mailA => $acl){
-              if(strtolower(trim($mailA))==strtolower(trim($mail))){
-                $found = true;
-              }
-            }
-
-            /* Skipp user, with no email adress too */     
-            if($member == $mail){
-              $found = true;
-            }
-   
-            /* Append new user acl */
-            if(!$found){
-              $new_acl[$member]= "$mail $acl";
-            }
-
-            /* Old line */
-            //  $new_acl[$member]= "$member $acl";
-          }
-        }
-      }
-      /* Save shared folder target */
-      $mailObject->attrs['gosaSharedFolderTarget']= "kolab+".$mailObject->mail;
-
-      /* Kolab shared folder names are like ' shared.uid@server.de ' 
-        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
-        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
-      $mailObject->uid = $mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
-  
-      /* Assign new acls */
-      $mailObject->attrs['acl']= array();
-      foreach ($new_acl as $key => $value){
-        $mailObject->attrs['acl'][]= $value;
-      }
-    } else {
-      $mailObject->attrs['objectClass'][]= 'kolabInetOrgPerson';
-    }
-
-    /* Remove imap:// tagging */
-    $mailObject->attrs['kolabHomeServer']= preg_replace('%imap://%', '', $mailObject->attrs['kolabHomeServer']);
-    $mailObject->attrs['gosaMailServer']= $mailObject->attrs['kolabHomeServer'];
-    $mailObject->attrs['kolabDeleteFlag']= array();
-  }
-
-  function fixAttributesOnRemove(&$mailObject)
-  {
-    /* Add attribute for object deletion and remove GOsa specific
-       values from entry. */
-    foreach($this->attribute_map as $kolabAttr){
-      $mailObject->attrs[$kolabAttr] = array();
-    }  
-
-    /* Only add kolab delete Flag in case of an user.mailAccount */
-    if(!in_array("posixGroup", $mailObject->attrs['objectClass'])){
-      $mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer);
-    }else{
-      /* Kolab shared folder names are like ' shared.uid@server.de ' 
-        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
-        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
-      $mailObject->uid = $mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
-      
-    }
-  }
-
-
-  function deleteMailbox($folder)
-  {
-    /* Remove shared folders and skip removing users. 
-       KolabD is not able to remove shared folders yet, so we do it instead */
-    if(!(preg_match("/^user\//",$folder))){
-      return mailMethodCyrus::deleteMailbox($folder);
-    }
-    return (TRUE);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/class_mail-methods-kolab.inc b/gosa-core/include/class_mail-methods-kolab.inc
deleted file mode 100644 (file)
index c060604..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2004  Cajus Pollmeier
-
-   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 mailMethodKolab extends mailMethodCyrus
-{
-  var $mbox= "-";
-  var $config;
-  var $gosaMailServer= "";
-  var $uattrib= "mail";
-
-  var $attribute_map= array("gosaMailAlternateAddress"  =>  "alias",
-                            "gosaMailQuota"             =>  "cyrus-userquota",
-                            "gosaMailServer"            =>  "kolabHomeServer");
-
-  function mailMethodKolab(&$config)
-  {
-    $this->config= $config->data['SERVERS']['IMAP'];
-  }
-
-  function updateMailbox($folder)
-  {
-  }
-
-  function setQuota($folder, $gosaMailQuota)
-  {
-    return (TRUE);
-  }
-
-  /* Get quota and divide it by 1024, because in gosa we display in MB
-      but we get Kb */
-  function getQuota($folder)
-  {
-    $result= array('quotaUsage' => '', 'gosaMailQuota' => '');
-
-    /* Only use lower case folder names, if folder name is like "@domain.com" */
-    if(preg_match("/@/",$folder)){
-      $folder = strtolower($folder);
-    }
-
-    error_reporting(0);  
-  
-    /* Load quota settings */
-    $quota_value = @imap_get_quota($this->mbox, $folder);
-    if(is_array($quota_value)) {
-      if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
-        /* use for PHP >= 4.3 */
-        $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
-        $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
-      } else {
-        /* backward icompatible */
-        $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
-        $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
-      }
-    }elseif(!$quota_value){
-      return(false);
-    }
-
-    error_reporting(E_ALL | E_STRICT); 
-    return ($result);
-  }
-
-
-  function fixAttributesOnLoad(&$mailObject)
-  {
-    /* Kolab shared folder names are like ' shared.uid@server.de ' 
-        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
-        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
-    if(get_class($mailObject) == "mailgroup"){
-     $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
-    }
-
-    /* Convert attributes and objectClasses */
-    foreach ($this->attribute_map as $dest => $source){
-      /* Hickert 11.11.05 : Alternate email addresses were saved, but not displayed again.
-      if (isset($mailObject->attrs[$source])){
-        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
-        unset ($mailObject->attrs[$source]);
-      */
-
-      if (isset($mailObject->attrs[$source])){
-        unset($mailObject->attrs[$source]['count']);
-        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
-        $mailObject->$dest=        $mailObject->attrs[$source];
-
-        /* Ensure that cleanup will recognize the ampped attributes too */
-        if(isset($mailObject->saved_attributes)){
-          $mailObject->saved_attributes[$dest] = $mailObject->attrs[$source];
-          $mailObject->saved_attributes[$source] = $mailObject->attrs[$source];
-        }       
-
-        unset ($mailObject->$dest['count']);
-        unset ($mailObject->attrs[$source]);
-      }
-    }
-
-    /* Adjust server name if needed */
-    foreach ($mailObject->config->data['SERVERS']['IMAP'] as $srv => $dummy){
-      if (preg_match("%".$mailObject->attrs['gosaMailServer'][0]."$%", $srv)){
-        $mailObject->attrs['gosaMailServer']= array(0 => $srv, "count" => 1);
-        break;
-      }
-    }
-  }
-
-
-  function fixAttributesOnStore(&$mailObject)
-  {
-    global $config;
-  
-    /* If quota is empty, remove quota restrictions by setting quota to 0 */
-    if(isset($mailObject->gosaMailQuota) && (empty($mailObject->gosaMailQuota))){
-      $mailObject->attrs['gosaMailQuota'] = 0;
-    }
-
-    /* Convert attributes and objectClasses */
-    foreach ($this->attribute_map as $source => $dest){
-      if (isset($mailObject->attrs[$source])){
-        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
-        unset ($mailObject->attrs[$source]);
-      }
-    }
-    $objectclasses= array();
-    foreach ($mailObject->attrs['objectClass'] as $oc){
-      if ($oc !=  'kolabInetOrgPerson' && $oc !=  'kolabSharedFolder'){
-        $objectclasses[]= $oc;
-      }
-    }
-    $mailObject->attrs['objectClass']= $objectclasses;
-    if (in_array("posixGroup", $mailObject->attrs['objectClass'])){
-  
-      /* Add kolabSharedFoleder Class */
-      $mailObject->attrs['objectClass'][]= 'kolabSharedFolder';
-
-      /* Work on acl attribute */
-      $new_acl= array();
-      foreach ($mailObject->attrs['acl'] as $uacl){
-
-        /* Get user=(mail) & acls  */
-        list($user, $acl) = split(" ", $uacl);
-      
-        /* Add al users which have seperated acls 
-           %members% are all users in this group, 
-           which have the standard group acl
-        */
-        if ($user != "%members%"){
-          $new_acl[$user]= $uacl;
-        } else {
-        
-          /* All groupmembers will be added */
-          $ldap = $config->get_ldap_link();
-          $ldap->cd($config->current['BASE']);
-          foreach ($mailObject->members as $member){
-
-            /* Get user mail address .... */
-            $ldap->search("(&(objectClass=person)(|(uid=".$member.")(mail=".$member.")))",array("mail"));
-            $res = $ldap->fetch();
-
-            /* Default mail address is set to uid - 
-               So if there is no mail address defined the uid is added 
-             */
-            $mail = $member;
-
-            /* Use mail address if it is available */
-            if(isset($res['mail'][0])){
-              $mail = $res['mail'][0];
-            }
-
-            /* only append this mail/permission string to acl,
-               if there arn't already some (special) configs for this user */
-            $found =false;
-            foreach($mailObject->imapacl as $mailA => $acl){
-              if(strtolower(trim($mailA))==strtolower(trim($mail))){
-                $found = true;
-              }
-            }
-
-            /* Skipp user, with no email adress too */     
-            if($member == $mail){
-              $found = true;
-            }
-   
-            /* Append new user acl */
-            if(!$found){
-              $new_acl[$member]= "$mail $acl";
-            }
-
-            /* Old line */
-            //  $new_acl[$member]= "$member $acl";
-          }
-        }
-      }
-      /* Save shared folder target */
-      $mailObject->attrs['gosaSharedFolderTarget']= "kolab+shared.".$mailObject->mail;
-
-      /* Kolab shared folder names are like ' shared.uid@server.de ' 
-        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
-        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
-      $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
-  
-      /* Assign new acls */
-      $mailObject->attrs['acl']= array();
-      foreach ($new_acl as $key => $value){
-        $mailObject->attrs['acl'][]= $value;
-      }
-    } else {
-      $mailObject->attrs['objectClass'][]= 'kolabInetOrgPerson';
-    }
-
-    /* Remove imap:// tagging */
-    $mailObject->attrs['kolabHomeServer']= preg_replace('%imap://%', '', $mailObject->attrs['kolabHomeServer']);
-    $mailObject->attrs['gosaMailServer']= $mailObject->attrs['kolabHomeServer'];
-    $mailObject->attrs['kolabDeleteFlag']= array();
-  }
-
-  function fixAttributesOnRemove(&$mailObject)
-  {
-    /* Add attribute for object deletion and remove GOsa specific
-       values from entry. */
-    foreach($this->attribute_map as $kolabAttr){
-      $mailObject->attrs[$kolabAttr] = array();
-    }  
-
-    /* Only add kolab delete Flag in case of an user.mailAccount */
-    if(!in_array("posixGroup", $mailObject->attrs['objectClass'])){
-      $mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer);
-    }else{
-      /* Kolab shared folder names are like ' shared.uid@server.de ' 
-        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
-        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
-      $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
-      
-    }
-  }
-
-
-  function deleteMailbox($folder)
-  {
-    /* Remove shared folders and skip removing users. 
-       KolabD is not able to remove shared folders yet, so we do it instead */
-    if(preg_match("/^shared/",$folder)){
-      return mailMethodCyrus::deleteMailbox($folder);
-    }
-    return (TRUE);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/class_mail-methods-sendmail-cyrus.inc b/gosa-core/include/class_mail-methods-sendmail-cyrus.inc
deleted file mode 100644 (file)
index 8bb8d73..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2004  Cajus Pollmeier
-
-   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 mailMethodSendmailCyrus extends mailMethodCyrus
-{
-
-  function mailMethodSendmailCyrus(&$config)
-  {
-    $this->config= $config->data['SERVERS']['IMAP'];
-  }
-
-  function fixAttributesOnLoad(&$mailObject)
-  {
-    /* Remove possible local alias from forwarders */
-    $newForwarder= array();
-    foreach ($mailObject->gosaMailForwardingAddress as $addr){
-      if (!preg_match('/^\\\\/', $addr)){
-        $newForwarder[]= $addr;
-      }
-    }
-    $mailObject->gosaMailForwardingAddress= $newForwarder;
-  }
-
-  function fixAttributesOnStore(&$mailObject)
-  {
-    /* Add local user if checked */
-    if (preg_match("/L/", $mailObject->gosaMailDeliveryMode)) {
-      $mailObject->gosaMailForwardingAddress[]= "\\".$mailObject->uid;
-    }
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/class_mail-methods.inc b/gosa-core/include/class_mail-methods.inc
deleted file mode 100644 (file)
index 1874648..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2004  Cajus Pollmeier
-
-   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 mailMethod
-{
-  var $uattrib= "uid";
-  
-  function mailMethod(&$config)
-  {
-  }
-
-  function connect($gosaMailServer)
-  {
-    return (TRUE);
-  }
-
-  function disconnect()
-  {
-  }
-
-  function getQuota($folder)
-  {
-    return (array('quotaUsage' => 0, 'gosaMailQuota' => 0));
-  }
-
-  function getMailboxList($folder, $uid)
-  {
-    return (array("INBOX"));
-  }
-
-  function setQuota($folder, $gosaMailQuota)
-  {
-    return (TRUE);
-  }
-
-  function updateMailbox($folder)
-  {
-  }
-
-  function deleteMailbox($folder)
-  {
-    return (TRUE);
-  }
-
-  function setSharedFolderPermissions($folder, $permissions)
-  {
-  }
-
-  function configureFilter($user, $gosaMailDeliveryMode,
-      $mail, $gosaMailAlternateAddress,
-      $gosaMailMaxSize,
-      $gosaSpamMailbox, $gosaSpamSortLevel,
-      $gosaVacationMessage)
-  {
-  }
-
-  function fixAttributesOnLoad(&$mailObject)
-  {
-  }
-
-  function fixAttributesOnStore(&$mailObject)
-  {
-  }
-
-  function fixAttributesOnRemove(&$mailObject)
-  {
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/class_password-methods-clear.inc b/gosa-core/include/class_password-methods-clear.inc
deleted file mode 100644 (file)
index 89e6c7b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?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 passwordMethodClear extends passwordMethod
-{
-
-       function passwordMethodClear($config)  
-       {
-       }
-
-       function is_available()
-       {
-               return true;
-       }
-
-
-       function generate_hash($pwd)
-       {
-               return $pwd;       
-       }
-
-  
-  function get_hash_name()
-  {
-    return ("clear");
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/class_password-methods-crypt.inc b/gosa-core/include/class_password-methods-crypt.inc
deleted file mode 100644 (file)
index 2c979aa..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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 passwordMethodCrypt extends passwordMethod
-{
-  function passwordMethodCrypt($config)  
-  {
-  }
-
-  function is_available()
-  {
-    if(function_exists("crypt")){
-      return true;
-    }else{
-      return false;
-    }
-  }
-
-
-  function generate_hash($pwd)
-  {
-    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/gosa-core/include/class_password-methods-heimdal.inc b/gosa-core/include/class_password-methods-heimdal.inc
deleted file mode 100644 (file)
index 05e9dc5..0000000
+++ /dev/null
@@ -1,411 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Cajus Pollmeier
-
-   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
-{
-
-  var $krb5MaxLife      = "";
-  var $krb5MaxRenew     = "";
-  var $krb5ValidStart   = "";
-  var $krb5ValidEnd     = "";
-  var $krb5PasswordEnd  = "";
-  var $krb5ValidStart_clear   = TRUE;
-  var $krb5ValidEnd_clear     = TRUE;
-  var $krb5PasswordEnd_clear  = TRUE;
-
-  var $display = TRUE;
-
-  var $flag_list = array(
-      "0"=>"initial" , 
-      "1"=>"forwardable" , 
-      "2"=>"proxiable" , 
-      "3"=>"renewable" , 
-      "4"=>"postdate" , 
-      "5"=>"server" , 
-      "6"=>"client" , 
-      "7"=>"invalid" , 
-      "8"=>"require-preauth" , 
-      "9"=>"change-pw" , 
-      "10"=>"require-hwauth" , 
-      "11"=>"ok-as-delegate" , 
-      "12"=>"user-to-user" , 
-      "13"=>"immutable");
-  var $krb5KDCFlags     = 123;
-
-  var $dn                     = "new";
-  var $parent_dn              = "new";
-  var $attributes             = array("krb5MaxLife","krb5MaxRenew","krb5KDCFlags",
-                                      "krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
-  var $attrs                  = array();
-  var $is_account             = FALSE;
-
-       function passwordMethodheimdal(&$config,$dn = "new")  
-       {
-    $this->config= $config;
-    $this->parent_dn = $dn;
-
-    $this->is_account = FALSE;
-    $this->krb5MaxLife    = 86400;
-    $this->krb5MaxRenew   = 604800;
-    $this->krb5ValidStart = date("Ymd",time())."0000Z";
-    $this->krb5ValidEnd   = date("Ymd",time())."0000Z";
-    $this->krb5PasswordEnd= date("Ymd",time())."0000Z";
-
-    /* Load existing entries */
-    if($dn != "new"){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($dn);
-      $ldap->ls("objectClass=krb5Principal",$dn,array("*"));
-      if($ldap->count()==1){
-        $this->is_account = TRUE;
-        $this->attrs = $ldap->fetch();
-        $this->dn = $this->attrs['dn'];
-        foreach($this->attributes as $attr){
-          if(isset($this->attrs[$attr][0])){
-            $this->$attr = $this->attrs[$attr][0];
-          }else{
-            $this->$attr = "";
-          }
-        }
-        $date_values = array("krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
-        foreach($date_values as $date_val){
-          $clear = $date_val."_clear";
-          if(empty($this->$date_val)){
-            $this->$clear = TRUE;
-          }else{
-            $this->$clear = FALSE;
-          }
-        }
-      }elseif($ldap->count() >= 2){
-        new msg_dialog(_("Heimdal"),sprintf(_("Error loading heimdal configuration, more than one configuration entry was found for '%s'."),$this->parent_dn));
-      }
-    }
-       }
-
-
-       function is_available()
-       {
-    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)
-       {
-    $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()
-  {
-    if($this->is_account && $this->dn != "new"){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cat($this->dn,array("dn"));
-      if($ldap->count()){
-        $ldap->rmdir($this->dn);
-        show_ldap_error($ldap->get_error(),_("Tried to remove heimdal extension."));
-      }
-    }
-  }
-
-
-  function set_password($password)
-  {
-    #TODO
-    # Add or modify kerberos entry below $this->dn
-    # See https://oss.gonicus.de/labs/gosa/ticket/223
-    # Order: create entries, then call the heimdal_keygen hook with the realm (returned by generate_hash)
-    #        to let it add the missing kerberos keys.
-
-    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 ($cmd != ""){
-
-      /* Display in error message */
-      $cmdd = $cmd." '".$this->generate_hash($password)."' 'PASSWORD'";
-
-      /* Execute command and check return value */
-      $cmd  = $cmd." '".$this->generate_hash($password)."' '".$password."'" ;
-      exec($cmd,$out,$res);
-      if($res != 0){
-        new msg_dialog(_("Heimdal"),sprintf(_("The configured HEIMDAL_KEYGEN '%s' wasn't successfully executed. Command does not return 0."),$cmdd),WARNING_DIALOG);
-      }
-    }
-  }
-
-
-  function get_hash_name()
-  {
-    $mode= "kerberos";
-    if (isset($this->config->current['KRBSASL']) && preg_match('/^true$/i', $this->config->current['KRBSASL'])){
-      $mode= "sasl";
-    }
-    return "$mode";
-  }
-
-
-  function is_configurable()
-  {
-    return TRUE;
-  }
-
-
-  function configure()
-  {
-    $this->save_object();
-
-    /* Cancel heimdal options */
-    if (isset($_POST['pw_abort'])){
-      return "";
-    }
-
-    /* Cancel heimdal options */
-    if (isset($_POST['pw_save'])){
-      $msgs = $this->check();
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          msg_dialog::display(_("Heimdal"),$msg,WARNING_DIALOG);
-        }
-      }else{
-        $this->display = FALSE;
-        return "";
-      }
-    }
-
-    $years = array();
-    $start = date("Y")-1;
-    for($i = $start; $i < ($start +20) ; $i++){
-      $years[$i] = $i;
-    }
-    $month= array();
-    for($i = 1; $i <= 12  ; $i++){
-      $month[str_pad($i,2,"0",STR_PAD_LEFT)] = $i;
-    }
-    $days= array();
-    for($i = 1; $i <= 31  ; $i++){
-      $days[str_pad($i,2,"0",STR_PAD_LEFT)] = $i;
-    }
-    $hours= array();
-    for($i = 0; $i <= 23  ; $i++){
-      $hours[str_pad($i,2,"0",STR_PAD_LEFT)] = $i;
-    }
-    $minutes= array();
-    for($i = 0; $i <= 59  ; $i++){
-      $minutes[str_pad($i,2,"0",STR_PAD_LEFT)] = $i;
-    }
-  
-
-    $smarty = get_smarty();
-    $smarty->assign("years",$years);
-    $smarty->assign("month",$month);
-    $smarty->assign("days",$days);
-    $smarty->assign("hours",$hours);
-    $smarty->assign("minutes",$minutes);
-
-    $date_values = array("krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
-    foreach($date_values as $date_val){
-      $clear = $date_val."_clear";
-      $smarty->assign($date_val."_clear",$this->$clear);
-      $smarty->assign($date_val."_y",substr($this->$date_val,0,4));
-      $smarty->assign($date_val."_m",substr($this->$date_val,4,2));
-      $smarty->assign($date_val."_d",substr($this->$date_val,6,2));
-      $smarty->assign($date_val."_h",substr($this->$date_val,8,2));
-      $smarty->assign($date_val."_i",substr($this->$date_val,10,2));
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr ,$this->$attr);
-    }
-    foreach($this->flag_list as $key => $name){
-      $val = pow(2,$key);
-      if($this->krb5KDCFlags & $val){
-        $smarty->assign("krb5KDCFlags_".$key,TRUE);
-      }else{
-        $smarty->assign("krb5KDCFlags_".$key,FALSE);
-      }
-    }
-
-    return($smarty->fetch(get_template_path("pwd_heimdal.tpl")));
-  }
-
-  
-  function save_object()
-  {
-    if(isset($_POST['pwd_heimdal_posted'])){
-
-      $date_values = array("krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
-      foreach($date_values as $date_value){
-        $clear = $date_value."_clear";
-        if(isset($_POST[$date_value."_clear"])){
-          $this->$clear = TRUE;
-        }else{
-          $this->$clear = FALSE;
-          $str = "";
-          foreach(array("y","m","d","h","i") as $val){
-            if(isset($_POST[$date_value."_".$val])){
-              $str .= $_POST[$date_value."_".$val]; 
-            }
-          }
-          $this->$date_value = $str."Z";
-        }
-      }
-
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr])){
-          $this->$attr = get_post($attr);
-        }
-      }
-  
-      $int = "";
-      foreach($this->flag_list as $key => $name){
-        $post = "krb5KDCFlags_".$key;
-        if(isset($_POST[$post])){
-          $int |= pow(2,$key);
-        }
-      }
-      $this->krb5KDCFlags = $int;
-    }
-  }
-
-  function check()
-  {
-    $message = array();
-    if(!is_numeric($this->krb5MaxLife) && !empty($this->krb5MaxLife)){
-      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Max life"));
-    }
-    if(!is_numeric($this->krb5MaxRenew) && !empty($this->krb5MaxRenew)){
-      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Max renew"));
-    }
-   if(!$this->krb5ValidStart_clear && !$this->chk_times($this->krb5ValidStart)){
-     $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid start"));
-   }
-   if(!$this->krb5ValidEnd_clear && !$this->chk_times($this->krb5ValidEnd)){
-     $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid end"));
-   }
-   if(!$this->krb5PasswordEnd_clear && !$this->chk_times($this->krb5PasswordEnd)){
-     $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid password"));
-   }
-    return($message);
-  }
-
-
-  function chk_times($str)
-  {
-    if(preg_match("/^([0-9]){12,12}[a-z]$/i",$str)){
-      return(true);
-    }
-    return(false);
-  }
-  function save($dn)
-  {
-    $realm = $this->config->data['SERVERS']['KERBEROS']['REALM'];
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($dn);
-    $ldap->cat($dn,array('uid'));
-    $attrs = $ldap->fetch();
-    if(isset($attrs['uid'][0])){
-
-      $uid  = $attrs['uid'][0];
-      $name = $uid."@".strtoupper($realm); 
-      $dn   = "krb5PrincipalName=".$name.",".$dn;
-
-      $data = array();
-      $data['krb5PrincipalName'] = $name;
-      $data['objectClass']  = array("top","account","krb5Principal","krb5KDCEntry");
-      $data['krb5PrincipalName'] =$name;
-      $data['uid'] = $uid;
-      $data['krb5KeyVersionNumber'] = rand(100000,99999999);
-
-      if($this->is_account){ 
-        foreach($this->attributes as $attr){
-          $data[$attr] = array();
-        }
-      }
-
-      /* Append Flags */
-      $data['krb5KDCFlags']   = $this->krb5KDCFlags;
-      if(!empty($this->krb5MaxLife)){
-        $data['krb5MaxLife']    = $this->krb5MaxLife;
-      }
-      if(!empty($this->krb5MaxRenew)){
-        $data['krb5MaxRenew']   = $this->krb5MaxRenew;
-      }
-      if(!$this->krb5ValidStart_clear){
-        $data['krb5ValidStart'] = $this->krb5ValidStart;
-      }
-      if(!$this->krb5ValidEnd_clear){
-        $data['krb5ValidEnd']   = $this->krb5ValidEnd;
-      }
-      if(!$this->krb5PasswordEnd_clear){
-        $data['krb5PasswordEnd']= $this->krb5PasswordEnd;
-      }
-
-      /* Add / Updated data */
-      $ldap->cd($dn);
-      if(!$this->is_account){ 
-        $ldap->add($data);
-      }else{
-        $ldap->modify($data);
-      }
-      show_ldap_error($ldap->get_error(),_("Could not add or update heimdal extensions."));   
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/class_password-methods-kerberos.inc b/gosa-core/include/class_password-methods-kerberos.inc
deleted file mode 100644 (file)
index 24240ba..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-<?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 passwordMethodkerberos extends passwordMethod
-{
-
-       function passwordMethodkerberos($config)  
-       {
-    $this->config= &$config;
-       }
-
-  function is_available()
-  {
-    if (function_exists('kadm5_init_with_password')){
-      return(true);
-    }else{
-      return false;
-    }
-  }
-
-       function generate_hash($pwd)
-       {
-               $cfg= $this->config->data['SERVERS']['KERBEROS'];
-
-               if (!function_exists('kadm5_init_with_password'))
-               {
-                       print_red (_("Warning: Can't set kerberos password. Your PHP version has no kerberos support, password has not been changed."));
-               } 
-               else 
-               {
-                       $handle = kadm5_init_with_password($cfg['SERVER'],
-                                       $cfg['REALM'], $cfg['ADMIN'], $cfg['PASSWORD']);
-
-                       if ($handle === FALSE)
-                       {
-                               print_red (_("Kerberos database communication failed!"));
-                       }
-
-                       $ret= kadm5_chpass_principal($handle, $this->attrs['uid'][0]."@".$cfg['REALM'],$pwd);
-
-                       if ($ret === FALSE)
-                       {
-                               print_red (_("Changing password in kerberos database failed!"));
-                       }
-
-                       kadm5_destroy($handle);
-
-      $mode= "kerberos";
-      if (isset($this->config->current['KRBSASL']) && preg_match('/^true$/i', $this->config->current['KRBSASL'])){
-        $mode= "sasl";
-      }
-                       $newpass= "{".$mode."}".$this->attrs['uid'][0]."@".$cfg['REALM'];
-
-                       return $newpass;       
-               }
-       }
-
-
-  function remove_from_parent()
-  {
-    /* Kerberos server defined? */
-    if (isset($this->config->data['SERVERS']['KERBEROS'])){
-      $cfg= $this->config->data['SERVERS']['KERBEROS'];
-    }
-    if (isset($cfg['SERVER']) && function_exists('kadm5_init_with_password')){
-
-      /* Connect to the admin interface */
-      $handle = kadm5_init_with_password($cfg['SERVER'], $cfg['REALM'],
-          $cfg['ADMIN'], $cfg['PASSWORD']);
-
-      /* Errors? */
-      if ($handle === FALSE){
-        print_red (_("Kerberos database communication failed"));
-        return (2);
-      }
-
-      /* Build user principal, get list of existsing principals */
-      $principal= $this->uid."@".$cfg['REALM'];
-      $principals = kadm5_get_principals($handle);
-
-      /* User exists in database? */
-      if (in_array($principal, $principals)){
-
-        /* Ok. User exists. Remove him/her */
-          $ret= kadm5_delete_principal ( $handle, $principal);
-          if ($ret === FALSE){
-            print_red (_("Can't remove user from kerberos database."));
-          }
-      }
-
-      /* Free kerberos admin handle */
-      kadm5_destroy($handle);
-    }
-  }
-
-  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/gosa-core/include/class_password-methods-md5.inc b/gosa-core/include/class_password-methods-md5.inc
deleted file mode 100644 (file)
index ea16ce9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?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 passwordMethodMd5 extends passwordMethod
-{
-       function passwordMethodMd5($config)  
-       {
-       }
-
-
-       function is_available()
-       {
-               if (function_exists('md5')){
-                       return(true);
-               }else{
-                       return false;
-               }
-       }
-
-
-       function generate_hash($pwd)
-       {
-               return  "{MD5}".base64_encode( pack('H*', md5($pwd)));
-       }
-
-
-  function get_hash_name()
-  {
-    return "md5";
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/class_password-methods-sha.inc b/gosa-core/include/class_password-methods-sha.inc
deleted file mode 100644 (file)
index 5a6d266..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?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 passwordMethodsha extends passwordMethod
-{
-  function passwordMethodsha($config)  
-  {
-  }
-
-  function is_available()
-  {
-    if (function_exists('sha1')){
-      return(true);
-    }elseif(function_exists('mhash')){
-      return true;
-    }else{
-      return false;
-    }
-  }
-
-
-  function generate_hash($password)
-  {
-    if (function_exists('sha1')) {
-      $hash = "{SHA}" . base64_encode(pack("H*",sha1($password)));
-    }elseif (function_exists('mhash')) {
-      $hash = "{SHA}" . base64_encode(mHash(MHASH_SHA1, $password));
-    }else{
-      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:
-?>
diff --git a/gosa-core/include/class_password-methods-smd5.inc b/gosa-core/include/class_password-methods-smd5.inc
deleted file mode 100644 (file)
index dff2362..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?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 passwordMethodsmd5 extends passwordMethod
-{
-  function passwordMethodsmd5($config)  
-  {
-  }
-
-  function is_available()
-  {
-    if ((!function_exists('md5'))){
-      return false;    
-    }else{
-      return true;
-    }
-  }
-
-  function generate_hash($pwd)
-  {
-    mt_srand(microtime()* 10000000);
-    $salt0= substr(pack("h*", md5(mt_rand())), 0, 8);
-    $salt = substr(pack("H*", md5($salt0 . $pwd)), 0, 4);
-    $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:
-?>
diff --git a/gosa-core/include/class_password-methods-ssha.inc b/gosa-core/include/class_password-methods-ssha.inc
deleted file mode 100644 (file)
index 34cb303..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?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 passwordMethodssha extends passwordMethod
-{
-  function passwordMethodssha($config)  
-  {
-  }
-
-  function is_available()
-  {
-    if(function_exists("sha1")){
-      return true;
-    }elseif(function_exists("mhash")){
-      return true;
-    }else{
-      return false;
-    }
-  }
-
-  function generate_hash($pwd)
-  {
-    if (function_exists("sha1")) {
-      $salt= substr(pack("h*", md5(mt_rand())), 0, 8);
-      $salt= substr(pack("H*", sha1($salt.$pwd)), 0, 4);
-      $pwd= "{SSHA}".base64_encode(pack("H*", sha1($pwd.$salt)).$salt);
-      return $pwd;       
-    } elseif(function_exists("mhash")) {
-      $salt=mhash_keygen_s2k(MHASH_SHA1,$pwd, substr(pack("h*",md5(mt_rand())),0,8),4);
-      $pwd= "{SSHA}".base64_encode(mhash(MHASH_SHA1, $pwd.$salt).$salt);
-    } else {
-      print_red(_("Can't use ssha for encryption. (Missing function mhash / sha1)"));
-      return(false);
-    }
-    return $pwd;
-  }
-
-
-  function get_hash_name()
-  {
-    return "ssha";
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/include/password-methods/class_password-methods-clear.inc b/gosa-core/include/password-methods/class_password-methods-clear.inc
new file mode 100644 (file)
index 0000000..89e6c7b
--- /dev/null
@@ -0,0 +1,48 @@
+<?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 passwordMethodClear extends passwordMethod
+{
+
+       function passwordMethodClear($config)  
+       {
+       }
+
+       function is_available()
+       {
+               return true;
+       }
+
+
+       function generate_hash($pwd)
+       {
+               return $pwd;       
+       }
+
+  
+  function get_hash_name()
+  {
+    return ("clear");
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/include/password-methods/class_password-methods-crypt.inc b/gosa-core/include/password-methods/class_password-methods-crypt.inc
new file mode 100644 (file)
index 0000000..2c979aa
--- /dev/null
@@ -0,0 +1,51 @@
+<?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 passwordMethodCrypt extends passwordMethod
+{
+  function passwordMethodCrypt($config)  
+  {
+  }
+
+  function is_available()
+  {
+    if(function_exists("crypt")){
+      return true;
+    }else{
+      return false;
+    }
+  }
+
+
+  function generate_hash($pwd)
+  {
+    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/gosa-core/include/password-methods/class_password-methods-heimdal.inc b/gosa-core/include/password-methods/class_password-methods-heimdal.inc
new file mode 100644 (file)
index 0000000..05e9dc5
--- /dev/null
@@ -0,0 +1,411 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Cajus Pollmeier
+
+   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
+{
+
+  var $krb5MaxLife      = "";
+  var $krb5MaxRenew     = "";
+  var $krb5ValidStart   = "";
+  var $krb5ValidEnd     = "";
+  var $krb5PasswordEnd  = "";
+  var $krb5ValidStart_clear   = TRUE;
+  var $krb5ValidEnd_clear     = TRUE;
+  var $krb5PasswordEnd_clear  = TRUE;
+
+  var $display = TRUE;
+
+  var $flag_list = array(
+      "0"=>"initial" , 
+      "1"=>"forwardable" , 
+      "2"=>"proxiable" , 
+      "3"=>"renewable" , 
+      "4"=>"postdate" , 
+      "5"=>"server" , 
+      "6"=>"client" , 
+      "7"=>"invalid" , 
+      "8"=>"require-preauth" , 
+      "9"=>"change-pw" , 
+      "10"=>"require-hwauth" , 
+      "11"=>"ok-as-delegate" , 
+      "12"=>"user-to-user" , 
+      "13"=>"immutable");
+  var $krb5KDCFlags     = 123;
+
+  var $dn                     = "new";
+  var $parent_dn              = "new";
+  var $attributes             = array("krb5MaxLife","krb5MaxRenew","krb5KDCFlags",
+                                      "krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
+  var $attrs                  = array();
+  var $is_account             = FALSE;
+
+       function passwordMethodheimdal(&$config,$dn = "new")  
+       {
+    $this->config= $config;
+    $this->parent_dn = $dn;
+
+    $this->is_account = FALSE;
+    $this->krb5MaxLife    = 86400;
+    $this->krb5MaxRenew   = 604800;
+    $this->krb5ValidStart = date("Ymd",time())."0000Z";
+    $this->krb5ValidEnd   = date("Ymd",time())."0000Z";
+    $this->krb5PasswordEnd= date("Ymd",time())."0000Z";
+
+    /* Load existing entries */
+    if($dn != "new"){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($dn);
+      $ldap->ls("objectClass=krb5Principal",$dn,array("*"));
+      if($ldap->count()==1){
+        $this->is_account = TRUE;
+        $this->attrs = $ldap->fetch();
+        $this->dn = $this->attrs['dn'];
+        foreach($this->attributes as $attr){
+          if(isset($this->attrs[$attr][0])){
+            $this->$attr = $this->attrs[$attr][0];
+          }else{
+            $this->$attr = "";
+          }
+        }
+        $date_values = array("krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
+        foreach($date_values as $date_val){
+          $clear = $date_val."_clear";
+          if(empty($this->$date_val)){
+            $this->$clear = TRUE;
+          }else{
+            $this->$clear = FALSE;
+          }
+        }
+      }elseif($ldap->count() >= 2){
+        new msg_dialog(_("Heimdal"),sprintf(_("Error loading heimdal configuration, more than one configuration entry was found for '%s'."),$this->parent_dn));
+      }
+    }
+       }
+
+
+       function is_available()
+       {
+    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)
+       {
+    $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()
+  {
+    if($this->is_account && $this->dn != "new"){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cat($this->dn,array("dn"));
+      if($ldap->count()){
+        $ldap->rmdir($this->dn);
+        show_ldap_error($ldap->get_error(),_("Tried to remove heimdal extension."));
+      }
+    }
+  }
+
+
+  function set_password($password)
+  {
+    #TODO
+    # Add or modify kerberos entry below $this->dn
+    # See https://oss.gonicus.de/labs/gosa/ticket/223
+    # Order: create entries, then call the heimdal_keygen hook with the realm (returned by generate_hash)
+    #        to let it add the missing kerberos keys.
+
+    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 ($cmd != ""){
+
+      /* Display in error message */
+      $cmdd = $cmd." '".$this->generate_hash($password)."' 'PASSWORD'";
+
+      /* Execute command and check return value */
+      $cmd  = $cmd." '".$this->generate_hash($password)."' '".$password."'" ;
+      exec($cmd,$out,$res);
+      if($res != 0){
+        new msg_dialog(_("Heimdal"),sprintf(_("The configured HEIMDAL_KEYGEN '%s' wasn't successfully executed. Command does not return 0."),$cmdd),WARNING_DIALOG);
+      }
+    }
+  }
+
+
+  function get_hash_name()
+  {
+    $mode= "kerberos";
+    if (isset($this->config->current['KRBSASL']) && preg_match('/^true$/i', $this->config->current['KRBSASL'])){
+      $mode= "sasl";
+    }
+    return "$mode";
+  }
+
+
+  function is_configurable()
+  {
+    return TRUE;
+  }
+
+
+  function configure()
+  {
+    $this->save_object();
+
+    /* Cancel heimdal options */
+    if (isset($_POST['pw_abort'])){
+      return "";
+    }
+
+    /* Cancel heimdal options */
+    if (isset($_POST['pw_save'])){
+      $msgs = $this->check();
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          msg_dialog::display(_("Heimdal"),$msg,WARNING_DIALOG);
+        }
+      }else{
+        $this->display = FALSE;
+        return "";
+      }
+    }
+
+    $years = array();
+    $start = date("Y")-1;
+    for($i = $start; $i < ($start +20) ; $i++){
+      $years[$i] = $i;
+    }
+    $month= array();
+    for($i = 1; $i <= 12  ; $i++){
+      $month[str_pad($i,2,"0",STR_PAD_LEFT)] = $i;
+    }
+    $days= array();
+    for($i = 1; $i <= 31  ; $i++){
+      $days[str_pad($i,2,"0",STR_PAD_LEFT)] = $i;
+    }
+    $hours= array();
+    for($i = 0; $i <= 23  ; $i++){
+      $hours[str_pad($i,2,"0",STR_PAD_LEFT)] = $i;
+    }
+    $minutes= array();
+    for($i = 0; $i <= 59  ; $i++){
+      $minutes[str_pad($i,2,"0",STR_PAD_LEFT)] = $i;
+    }
+  
+
+    $smarty = get_smarty();
+    $smarty->assign("years",$years);
+    $smarty->assign("month",$month);
+    $smarty->assign("days",$days);
+    $smarty->assign("hours",$hours);
+    $smarty->assign("minutes",$minutes);
+
+    $date_values = array("krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
+    foreach($date_values as $date_val){
+      $clear = $date_val."_clear";
+      $smarty->assign($date_val."_clear",$this->$clear);
+      $smarty->assign($date_val."_y",substr($this->$date_val,0,4));
+      $smarty->assign($date_val."_m",substr($this->$date_val,4,2));
+      $smarty->assign($date_val."_d",substr($this->$date_val,6,2));
+      $smarty->assign($date_val."_h",substr($this->$date_val,8,2));
+      $smarty->assign($date_val."_i",substr($this->$date_val,10,2));
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr ,$this->$attr);
+    }
+    foreach($this->flag_list as $key => $name){
+      $val = pow(2,$key);
+      if($this->krb5KDCFlags & $val){
+        $smarty->assign("krb5KDCFlags_".$key,TRUE);
+      }else{
+        $smarty->assign("krb5KDCFlags_".$key,FALSE);
+      }
+    }
+
+    return($smarty->fetch(get_template_path("pwd_heimdal.tpl")));
+  }
+
+  
+  function save_object()
+  {
+    if(isset($_POST['pwd_heimdal_posted'])){
+
+      $date_values = array("krb5ValidStart","krb5ValidEnd","krb5PasswordEnd");
+      foreach($date_values as $date_value){
+        $clear = $date_value."_clear";
+        if(isset($_POST[$date_value."_clear"])){
+          $this->$clear = TRUE;
+        }else{
+          $this->$clear = FALSE;
+          $str = "";
+          foreach(array("y","m","d","h","i") as $val){
+            if(isset($_POST[$date_value."_".$val])){
+              $str .= $_POST[$date_value."_".$val]; 
+            }
+          }
+          $this->$date_value = $str."Z";
+        }
+      }
+
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = get_post($attr);
+        }
+      }
+  
+      $int = "";
+      foreach($this->flag_list as $key => $name){
+        $post = "krb5KDCFlags_".$key;
+        if(isset($_POST[$post])){
+          $int |= pow(2,$key);
+        }
+      }
+      $this->krb5KDCFlags = $int;
+    }
+  }
+
+  function check()
+  {
+    $message = array();
+    if(!is_numeric($this->krb5MaxLife) && !empty($this->krb5MaxLife)){
+      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Max life"));
+    }
+    if(!is_numeric($this->krb5MaxRenew) && !empty($this->krb5MaxRenew)){
+      $message[] = sprintf(_("Please specify a numeric value for %s."),_("Max renew"));
+    }
+   if(!$this->krb5ValidStart_clear && !$this->chk_times($this->krb5ValidStart)){
+     $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid start"));
+   }
+   if(!$this->krb5ValidEnd_clear && !$this->chk_times($this->krb5ValidEnd)){
+     $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid end"));
+   }
+   if(!$this->krb5PasswordEnd_clear && !$this->chk_times($this->krb5PasswordEnd)){
+     $message[] = sprintf(_("Please specify a numeric value for %s."),_("Valid password"));
+   }
+    return($message);
+  }
+
+
+  function chk_times($str)
+  {
+    if(preg_match("/^([0-9]){12,12}[a-z]$/i",$str)){
+      return(true);
+    }
+    return(false);
+  }
+  function save($dn)
+  {
+    $realm = $this->config->data['SERVERS']['KERBEROS']['REALM'];
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($dn);
+    $ldap->cat($dn,array('uid'));
+    $attrs = $ldap->fetch();
+    if(isset($attrs['uid'][0])){
+
+      $uid  = $attrs['uid'][0];
+      $name = $uid."@".strtoupper($realm); 
+      $dn   = "krb5PrincipalName=".$name.",".$dn;
+
+      $data = array();
+      $data['krb5PrincipalName'] = $name;
+      $data['objectClass']  = array("top","account","krb5Principal","krb5KDCEntry");
+      $data['krb5PrincipalName'] =$name;
+      $data['uid'] = $uid;
+      $data['krb5KeyVersionNumber'] = rand(100000,99999999);
+
+      if($this->is_account){ 
+        foreach($this->attributes as $attr){
+          $data[$attr] = array();
+        }
+      }
+
+      /* Append Flags */
+      $data['krb5KDCFlags']   = $this->krb5KDCFlags;
+      if(!empty($this->krb5MaxLife)){
+        $data['krb5MaxLife']    = $this->krb5MaxLife;
+      }
+      if(!empty($this->krb5MaxRenew)){
+        $data['krb5MaxRenew']   = $this->krb5MaxRenew;
+      }
+      if(!$this->krb5ValidStart_clear){
+        $data['krb5ValidStart'] = $this->krb5ValidStart;
+      }
+      if(!$this->krb5ValidEnd_clear){
+        $data['krb5ValidEnd']   = $this->krb5ValidEnd;
+      }
+      if(!$this->krb5PasswordEnd_clear){
+        $data['krb5PasswordEnd']= $this->krb5PasswordEnd;
+      }
+
+      /* Add / Updated data */
+      $ldap->cd($dn);
+      if(!$this->is_account){ 
+        $ldap->add($data);
+      }else{
+        $ldap->modify($data);
+      }
+      show_ldap_error($ldap->get_error(),_("Could not add or update heimdal extensions."));   
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/include/password-methods/class_password-methods-kerberos.inc b/gosa-core/include/password-methods/class_password-methods-kerberos.inc
new file mode 100644 (file)
index 0000000..24240ba
--- /dev/null
@@ -0,0 +1,125 @@
+<?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 passwordMethodkerberos extends passwordMethod
+{
+
+       function passwordMethodkerberos($config)  
+       {
+    $this->config= &$config;
+       }
+
+  function is_available()
+  {
+    if (function_exists('kadm5_init_with_password')){
+      return(true);
+    }else{
+      return false;
+    }
+  }
+
+       function generate_hash($pwd)
+       {
+               $cfg= $this->config->data['SERVERS']['KERBEROS'];
+
+               if (!function_exists('kadm5_init_with_password'))
+               {
+                       print_red (_("Warning: Can't set kerberos password. Your PHP version has no kerberos support, password has not been changed."));
+               } 
+               else 
+               {
+                       $handle = kadm5_init_with_password($cfg['SERVER'],
+                                       $cfg['REALM'], $cfg['ADMIN'], $cfg['PASSWORD']);
+
+                       if ($handle === FALSE)
+                       {
+                               print_red (_("Kerberos database communication failed!"));
+                       }
+
+                       $ret= kadm5_chpass_principal($handle, $this->attrs['uid'][0]."@".$cfg['REALM'],$pwd);
+
+                       if ($ret === FALSE)
+                       {
+                               print_red (_("Changing password in kerberos database failed!"));
+                       }
+
+                       kadm5_destroy($handle);
+
+      $mode= "kerberos";
+      if (isset($this->config->current['KRBSASL']) && preg_match('/^true$/i', $this->config->current['KRBSASL'])){
+        $mode= "sasl";
+      }
+                       $newpass= "{".$mode."}".$this->attrs['uid'][0]."@".$cfg['REALM'];
+
+                       return $newpass;       
+               }
+       }
+
+
+  function remove_from_parent()
+  {
+    /* Kerberos server defined? */
+    if (isset($this->config->data['SERVERS']['KERBEROS'])){
+      $cfg= $this->config->data['SERVERS']['KERBEROS'];
+    }
+    if (isset($cfg['SERVER']) && function_exists('kadm5_init_with_password')){
+
+      /* Connect to the admin interface */
+      $handle = kadm5_init_with_password($cfg['SERVER'], $cfg['REALM'],
+          $cfg['ADMIN'], $cfg['PASSWORD']);
+
+      /* Errors? */
+      if ($handle === FALSE){
+        print_red (_("Kerberos database communication failed"));
+        return (2);
+      }
+
+      /* Build user principal, get list of existsing principals */
+      $principal= $this->uid."@".$cfg['REALM'];
+      $principals = kadm5_get_principals($handle);
+
+      /* User exists in database? */
+      if (in_array($principal, $principals)){
+
+        /* Ok. User exists. Remove him/her */
+          $ret= kadm5_delete_principal ( $handle, $principal);
+          if ($ret === FALSE){
+            print_red (_("Can't remove user from kerberos database."));
+          }
+      }
+
+      /* Free kerberos admin handle */
+      kadm5_destroy($handle);
+    }
+  }
+
+  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/gosa-core/include/password-methods/class_password-methods-md5.inc b/gosa-core/include/password-methods/class_password-methods-md5.inc
new file mode 100644 (file)
index 0000000..ea16ce9
--- /dev/null
@@ -0,0 +1,52 @@
+<?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 passwordMethodMd5 extends passwordMethod
+{
+       function passwordMethodMd5($config)  
+       {
+       }
+
+
+       function is_available()
+       {
+               if (function_exists('md5')){
+                       return(true);
+               }else{
+                       return false;
+               }
+       }
+
+
+       function generate_hash($pwd)
+       {
+               return  "{MD5}".base64_encode( pack('H*', md5($pwd)));
+       }
+
+
+  function get_hash_name()
+  {
+    return "md5";
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/include/password-methods/class_password-methods-sha.inc b/gosa-core/include/password-methods/class_password-methods-sha.inc
new file mode 100644 (file)
index 0000000..5a6d266
--- /dev/null
@@ -0,0 +1,62 @@
+<?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 passwordMethodsha extends passwordMethod
+{
+  function passwordMethodsha($config)  
+  {
+  }
+
+  function is_available()
+  {
+    if (function_exists('sha1')){
+      return(true);
+    }elseif(function_exists('mhash')){
+      return true;
+    }else{
+      return false;
+    }
+  }
+
+
+  function generate_hash($password)
+  {
+    if (function_exists('sha1')) {
+      $hash = "{SHA}" . base64_encode(pack("H*",sha1($password)));
+    }elseif (function_exists('mhash')) {
+      $hash = "{SHA}" . base64_encode(mHash(MHASH_SHA1, $password));
+    }else{
+      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:
+?>
diff --git a/gosa-core/include/password-methods/class_password-methods-smd5.inc b/gosa-core/include/password-methods/class_password-methods-smd5.inc
new file mode 100644 (file)
index 0000000..dff2362
--- /dev/null
@@ -0,0 +1,54 @@
+<?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 passwordMethodsmd5 extends passwordMethod
+{
+  function passwordMethodsmd5($config)  
+  {
+  }
+
+  function is_available()
+  {
+    if ((!function_exists('md5'))){
+      return false;    
+    }else{
+      return true;
+    }
+  }
+
+  function generate_hash($pwd)
+  {
+    mt_srand(microtime()* 10000000);
+    $salt0= substr(pack("h*", md5(mt_rand())), 0, 8);
+    $salt = substr(pack("H*", md5($salt0 . $pwd)), 0, 4);
+    $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:
+?>
diff --git a/gosa-core/include/password-methods/class_password-methods-ssha.inc b/gosa-core/include/password-methods/class_password-methods-ssha.inc
new file mode 100644 (file)
index 0000000..34cb303
--- /dev/null
@@ -0,0 +1,66 @@
+<?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 passwordMethodssha extends passwordMethod
+{
+  function passwordMethodssha($config)  
+  {
+  }
+
+  function is_available()
+  {
+    if(function_exists("sha1")){
+      return true;
+    }elseif(function_exists("mhash")){
+      return true;
+    }else{
+      return false;
+    }
+  }
+
+  function generate_hash($pwd)
+  {
+    if (function_exists("sha1")) {
+      $salt= substr(pack("h*", md5(mt_rand())), 0, 8);
+      $salt= substr(pack("H*", sha1($salt.$pwd)), 0, 4);
+      $pwd= "{SSHA}".base64_encode(pack("H*", sha1($pwd.$salt)).$salt);
+      return $pwd;       
+    } elseif(function_exists("mhash")) {
+      $salt=mhash_keygen_s2k(MHASH_SHA1,$pwd, substr(pack("h*",md5(mt_rand())),0,8),4);
+      $pwd= "{SSHA}".base64_encode(mhash(MHASH_SHA1, $pwd.$salt).$salt);
+    } else {
+      print_red(_("Can't use ssha for encryption. (Missing function mhash / sha1)"));
+      return(false);
+    }
+    return $pwd;
+  }
+
+
+  function get_hash_name()
+  {
+    return "ssha";
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/mail/class_mail-methods-cyrus.inc b/gosa-core/plugins/personal/mail/class_mail-methods-cyrus.inc
new file mode 100644 (file)
index 0000000..388a5a7
--- /dev/null
@@ -0,0 +1,366 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2004  Cajus Pollmeier
+
+   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 mailMethodCyrus extends mailMethod
+{
+  var $mbox= "-";
+  var $config;
+  var $gosaMailServer= "";
+  var $uattrib= "uid";
+
+  function mailMethodCyrus(&$config)
+  {
+    $this->config= $config->data['SERVERS']['IMAP'];
+  }
+
+  function connect($gosaMailServer)
+  {
+    $cfg=array();
+
+    /* Connect to IMAP server. I don't want to see these warning here... */
+    $this->gosaMailServer= $gosaMailServer;
+    if (!isset($this->config[$gosaMailServer])){
+      msg_dialog::display(_("Warning"), _("Mail server for this account is invalid!"), WARNING_DIALOG);
+    } else {
+      $cfg= $this->config[$gosaMailServer];
+    }
+    /* For some reason, hiding errors with @ does not wor here... */
+    if(!isset($cfg['connect']))   $cfg['connect']="";
+    if(!isset($cfg['admin']))     $cfg['admin']="";
+    if(!isset($cfg['password']))  $cfg['password']="";
+
+    /* Setting connect timeout to 10 seconds,
+        else the GOsa UI may freeze for 60 seconds.
+       (PHP default is 'default_socket_timeout = 60') */
+    imap_timeout(1, 10 );
+
+    $this->mbox = @imap_open($cfg['connect'], $cfg['admin'], $cfg['password'], OP_HALFOPEN);
+
+    /* Mailbox reachable? */
+    if ($this->mbox === FALSE){
+      msg_dialog::display(_("IMAP error"), _("Cannot store mail settings on IMAP server!"), ERROR_DIALOG);
+      return (FALSE);
+    }
+    return (TRUE);
+  }
+
+  function disconnect()
+  {
+    imap_close ($this->mbox);
+  }
+
+  function getQuota($folder)
+  {
+    $result= array('quotaUsage' => '', 'gosaMailQuota' => '');
+
+    /* Load quota settings */
+    error_reporting (0);
+    $quota_value = @imap_get_quota($this->mbox, $folder);
+    if(is_array($quota_value)) {
+      if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
+        /* use for PHP >= 4.3 */
+        if($quota_value["STORAGE"]['limit'] == 2147483647){
+          $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
+          $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] );
+        }else{
+          $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
+          $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
+        }
+      } else {
+        /* backward icompatible */
+        if($quota_value['usage'] == 2147483647){
+          $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
+          $result['gosaMailQuota']= (int) ($quota_value['limit'] );
+        }else{
+          $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
+          $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
+        }
+      }
+    }elseif(!$quota_value){
+      /* If there is no quota defined for this account, the function imap_get_quota returns false. */
+      return(array("quotaUsage"=>"","gosaMailQuota"=>""));
+    }
+    error_reporting (E_ALL | E_STRICT);
+    return ($result);
+  }
+
+
+  /* return all folders of the users mailbox*/
+  function getMailboxList($folder, $uid)
+  {
+    global $config;
+    $result = array();
+
+    /* Get domain an mail address if uid is an mail address */
+    $domain = "";
+    if(preg_match("/@/",$folder)){
+      $domain = "@".preg_replace("/^.*@/","",$folder);
+      $folder = preg_replace("/@.*$/","",$folder);
+    }
+
+    /* Get list of mailboxes for combo box */
+    $cfg= $this->config[$this->gosaMailServer];
+
+    /* Create search pattern
+         (user/kekse*@domain.de
+          user.kekse*@domain.de
+          user.kekse*  )
+       depending on given folder name) */
+    $q = $folder."*".$domain;
+    $list = imap_listmailbox($this->mbox, $cfg["connect"], $q);
+
+    /* Create list of returned folder names */
+    if (is_array($list)){
+      foreach ($list as $val){
+
+        /* Cut domain name */
+        $val = preg_replace("/@.*$/","",$val);
+        $result[]=preg_replace ("/^.*".normalizePreg($folder)."/","INBOX", mb_convert_encoding($val, "UTF-8", "UTF7-IMAP"));
+      }
+    }
+
+    /* Append "INBOX" to the folder array if result is empty and request comes from user dialog */
+    if(empty($result) && !empty($uid)){
+      $result[] = "INBOX";
+    }
+
+    return ($result);
+  }
+
+
+  function updateMailbox($folder)
+  {
+    /* Check if mailbox exists */
+    $cfg= $this->config[$this->gosaMailServer];
+    $list = imap_listmailbox($this->mbox, $cfg["connect"], $folder);
+    if ($list === FALSE){
+      if (!imap_createmailbox($this->mbox, $cfg["connect"]. $folder)){
+        msg_dialog::display(_("IMAP error"), sprintf(_("Cannot create IMAP mailbox: %s"), '<br><br><i>'.imap_last_error().'</i>'), ERROR_DIALOG);
+        return;
+      }
+    }
+  }
+
+
+  function setQuota($folder, $gosaMailQuota)
+  {
+    /* Workaround for the php imap extension */
+    if (($gosaMailQuota == "") || ($gosaMailQuota== "2147483647")){
+      $gosaMailQuota= "2147483647";
+    }elseif($gosaMailQuota > 0){
+      $gosaMailQuota = $gosaMailQuota *1024;
+    }
+    
+    
+    /* Write mail quota */
+    if (!imap_set_quota($this->mbox, $folder, $gosaMailQuota)){
+      msg_dialog::display(_("IMAP error"), sprintf(_("Cannot modify IMAP mailbox quota: %s"), '<br><br><i>'.imap_last_error().'</i>'), ERROR_DIALOG);
+      return (FALSE);
+    }
+    return (TRUE);
+  }
+
+
+  function setSharedFolderPermissions($folder, $permissions)
+  {
+    /* Get list of subfolders */
+    $folders= $this->getMailboxList($folder, "");
+    $folders[]= $folder;
+    
+    foreach ($folders as $subfolder){
+
+      /* Set shared folder acl's */
+      if (function_exists('imap_getacl')){
+
+        /* Remove all acl's for this folder */
+        $users= @imap_getacl ($this->mbox, $subfolder);
+        if(is_array($users)){
+          foreach ($users as $userid => $perms){
+            imap_setacl ($this->mbox, $subfolder, $userid, "");
+          }
+        }
+      } else {
+        msg_dialog::display(_("Internal error"), _("Cannot remove IMAP ACL: imap_getacl not implemented!"), ERROR_DIALOG);
+      }
+
+      /* Set permissions for this folder */
+      foreach ($permissions as $user => $acl){
+        imap_setacl ($this->mbox, $subfolder, $user, $acl);
+      }
+    }
+
+  }
+
+
+  function getSharedFolderPermissions($folder)
+  {
+    $result= array();
+
+    /* imap_getacl available? */
+    if (!function_exists('imap_getacl')){
+      msg_dialog::display(_("Internal error"), _("Cannot retrieve IMAP ACL: imap_getacl not implemented!"), ERROR_DIALOG);
+    }
+
+    /* Get permissions in case of shared folders */
+    else {
+      $users= imap_getacl ($this->mbox, $folder);
+
+      foreach ($users as $userid => $perms){
+        $result[preg_replace('/^user\./', '', $userid)]= $perms;
+      }
+
+    }
+
+    return ($result);
+  }
+
+
+  function deleteMailbox($folder)
+  {
+    $cfg= $this->config[$this->gosaMailServer];
+    imap_setacl ($this->mbox, $folder, $cfg["admin"], "lrswipcda");
+    if (!imap_deletemailbox($this->mbox, $cfg["connect"].$folder)){
+      msg_dialog::display(_("IMAP error"), sprintf(_('Cannot remove IMAP mailbox: %s'), '<br><br><i>'.imap_last_error().'</i>'), ERROR_DIALOG);
+      return (FALSE);
+    }
+    return (TRUE);
+  }
+
+
+  function configureFilter($user, $gosaMailDeliveryMode,
+      $mail, $gosaMailAlternateAddress,
+      $gosaMailMaxSize,
+      $gosaSpamMailbox, $gosaSpamSortLevel,
+      $gosaVacationMessage)
+  {
+    $cfg= $this->config[$this->gosaMailServer];
+
+    /* Build spamlevel. Spamassassin tags mails with "*" for each integer
+       point of spam. So a spam level of 5.3 gets "*****" which can be
+       checked easily by spam filters */
+    $spamlevel= "";
+    for ($i= 0; $i<$gosaSpamSortLevel; $i++){
+      $spamlevel .= "*";
+    }
+
+    /* Log into the mail server */
+    $sieve= new sieve($cfg["sieve_server"], $cfg["sieve_port"], $user,
+        $cfg["password"], $cfg["admin"]);
+
+    if (!$sieve->sieve_login()){
+      msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot log into SIEVE server: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
+      return;
+    }
+
+    /* Load current script from server and remove everything between the comments
+       "###GOSA" */
+    $script= "";
+    if($sieve->sieve_listscripts()){
+      if (in_array("gosa", $sieve->response)){
+
+        /* get old GOsa script */
+        if(!$sieve->sieve_getscript("gosa")){
+          msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot retrieve SIEVE script: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
+          return;
+        }
+
+        foreach ($sieve->response as $line){
+          if (preg_match ("/^###GOSA/", $line)){
+            break;
+          }
+          $line= rtrim($line);
+          if (!preg_match ('/^\s*$/', $line)){
+            $script .= $line."\n";
+          }
+        }
+
+      }
+    }
+
+    /* Only create a new one, if it is not empty */
+    if (is_integer(strpos($gosaMailDeliveryMode, "R")) ||
+        is_integer(strpos($gosaMailDeliveryMode, "C")) ||
+        !is_integer(strpos($gosaMailDeliveryMode, "L")) ||
+        is_integer(strpos($gosaMailDeliveryMode, "V")) ||
+        is_integer(strpos($gosaMailDeliveryMode, "S"))){
+
+      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-header.txt")));
+      eval ("\$script.=\"$text\";");
+    }
+
+    /* Add anti-spam code */
+    if (is_integer(strpos($gosaMailDeliveryMode, "S"))){
+      $spambox= $gosaSpamMailbox;
+      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-spam.txt")));
+      eval ("\$script.=\"$text\";");
+    }
+
+    /* Add "reject due to mailsize" code, message is currently not
+       adjustable through GOsa. */
+    if (is_integer(strpos($gosaMailDeliveryMode, "R"))){
+      $maxsize= $gosaMailMaxSize;
+      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-mailsize.txt")));
+      eval ("\$script.=\"$text\";");
+    }
+
+    /* Add vacation information */
+    if (is_integer(strpos($gosaMailDeliveryMode, "V"))){
+
+      /* Sieve wants all destination addresses for the
+         vacation message, so we've to assemble them from
+         mail and mailAlternateAddress */
+      $addrlist= "\"".$mail."\"";
+      foreach ($gosaMailAlternateAddress as $val){
+        $addrlist .= ", \"$val\"";
+      }
+      $vacmsg= $gosaVacationMessage;
+      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-vacation.txt")));
+      eval ("\$script.=\"$text\";");
+    }
+
+    /* If no local delivery is wanted, tell the script to discard the mail */
+    if (!is_integer(strpos($gosaMailDeliveryMode, "L"))){
+      $text= preg_replace('/"/', '\\"', implode ("", file(CONFIG_DIR."/sieve-discard.txt")));
+      eval ("\$script.=\"$text\";");
+    }
+
+    /* Just be aware of null scripts... */
+    if (!isset ($script)){
+      $script= "";
+    }
+
+    /* Upload script and make it the default one */
+    if (!$sieve->sieve_sendscript("gosa", $script)){
+      msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot store SIEVE script: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
+      return;
+    }
+    if(!$sieve->sieve_setactivescript("gosa")){
+      msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot activate SIEVE script: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
+      return;
+    }
+
+    $sieve->sieve_logout();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/mail/class_mail-methods-golab.inc b/gosa-core/plugins/personal/mail/class_mail-methods-golab.inc
new file mode 100644 (file)
index 0000000..dc75674
--- /dev/null
@@ -0,0 +1,261 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2004  Cajus Pollmeier
+
+   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 mailMethodGolab extends mailMethodCyrus
+{
+  var $mbox= "-";
+  var $config;
+  var $gosaMailServer= "";
+  var $uattrib= "mail";
+
+  var $attribute_map= array("gosaMailAlternateAddress"  =>  "alias",
+                            "gosaMailQuota"             =>  "cyrus-userquota",
+                            "gosaMailServer"            =>  "kolabHomeServer");
+
+  function mailMethodGolab(&$config)
+  {
+    $this->config= $config->data['SERVERS']['IMAP'];
+  }
+
+  function updateMailbox($folder)
+  {
+  }
+
+  function setQuota($folder, $gosaMailQuota)
+  {
+    return (TRUE);
+  }
+
+  /* Get quota and divide it by 1024, because in gosa we display in MB
+      but we get Kb */
+  function getQuota($folder)
+  {
+    $result= array('quotaUsage' => '', 'gosaMailQuota' => '');
+
+    /* Only use lower case folder names, if folder name is like "@domain.com" */
+    if(preg_match("/@/",$folder)){
+      $folder = strtolower($folder);
+    }
+
+    error_reporting(0);  
+  
+    /* Load quota settings */
+    $quota_value = @imap_get_quota($this->mbox, $folder);
+    if(is_array($quota_value)) {
+      if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
+        /* use for PHP >= 4.3 */
+        $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
+        $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
+      } else {
+        /* backward icompatible */
+        $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
+        $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
+      }
+    }elseif(!$quota_value){
+      return(false);
+    }
+
+    error_reporting(E_ALL | E_STRICT); 
+    return ($result);
+  }
+
+
+  function fixAttributesOnLoad(&$mailObject)
+  {
+    /* Kolab shared folder names are like ' shared.uid@server.de ' 
+        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
+        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
+    if(get_class($mailObject) == "mailgroup"){
+     $mailObject->uid = $mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
+    }
+
+    /* Convert attributes and objectClasses */
+    foreach ($this->attribute_map as $dest => $source){
+      /* Hickert 11.11.05 : Alternate email addresses were saved, but not displayed again.
+      if (isset($mailObject->attrs[$source])){
+        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
+        unset ($mailObject->attrs[$source]);
+      */
+
+      if (isset($mailObject->attrs[$source])){
+        unset($mailObject->attrs[$source]['count']);
+        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
+        $mailObject->$dest=        $mailObject->attrs[$source];
+
+        unset ($mailObject->$dest['count']);
+        unset ($mailObject->attrs[$source]);
+      }
+    }
+
+    /* Adjust server name if needed */
+    foreach ($mailObject->config->data['SERVERS']['IMAP'] as $srv => $dummy){
+      if (preg_match("%".$mailObject->attrs['gosaMailServer'][0]."$%", $srv)){
+        $mailObject->attrs['gosaMailServer']= array(0 => $srv, "count" => 1);
+        break;
+      }
+    }
+  }
+
+
+  function fixAttributesOnStore(&$mailObject)
+  {
+    global $config;
+  
+    /* If quota is empty, remove quota restrictions by setting quota to 0 */
+    if(isset($mailObject->gosaMailQuota) && (empty($mailObject->gosaMailQuota))){
+      $mailObject->attrs['gosaMailQuota'] = 0;
+    }
+
+    /* Convert attributes and objectClasses */
+    foreach ($this->attribute_map as $source => $dest){
+      if (isset($mailObject->attrs[$source])){
+        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
+        unset ($mailObject->attrs[$source]);
+      }
+    }
+    $objectclasses= array();
+    foreach ($mailObject->attrs['objectClass'] as $oc){
+      if ($oc !=  'kolabInetOrgPerson' && $oc !=  'kolabSharedFolder'){
+        $objectclasses[]= $oc;
+      }
+    }
+    $mailObject->attrs['objectClass']= $objectclasses;
+    if (in_array("posixGroup", $mailObject->attrs['objectClass'])){
+  
+      /* Add kolabSharedFoleder Class */
+      $mailObject->attrs['objectClass'][]= 'kolabSharedFolder';
+
+      /* Work on acl attribute */
+      $new_acl= array();
+      foreach ($mailObject->attrs['acl'] as $uacl){
+
+        /* Get user=(mail) & acls  */
+        list($user, $acl) = split(" ", $uacl);
+      
+        /* Add al users which have seperated acls 
+           %members% are all users in this group, 
+           which have the standard group acl
+        */
+        if ($user != "%members%"){
+          $new_acl[$user]= $uacl;
+        } else {
+        
+          /* All groupmembers will be added */
+          $ldap = $config->get_ldap_link();
+          $ldap->cd($config->current['BASE']);
+          foreach ($mailObject->members as $member){
+
+            /* Get user mail address .... */
+            $ldap->search("(&(objectClass=person)(|(uid=".$member.")(mail=".$member.")))",array("mail"));
+            $res = $ldap->fetch();
+
+            /* Default mail address is set to uid - 
+               So if there is no mail address defined the uid is added 
+             */
+            $mail = $member;
+
+            /* Use mail address if it is available */
+            if(isset($res['mail'][0])){
+              $mail = $res['mail'][0];
+            }
+
+            /* only append this mail/permission string to acl,
+               if there arn't already some (special) configs for this user */
+            $found =false;
+            foreach($mailObject->imapacl as $mailA => $acl){
+              if(strtolower(trim($mailA))==strtolower(trim($mail))){
+                $found = true;
+              }
+            }
+
+            /* Skipp user, with no email adress too */     
+            if($member == $mail){
+              $found = true;
+            }
+   
+            /* Append new user acl */
+            if(!$found){
+              $new_acl[$member]= "$mail $acl";
+            }
+
+            /* Old line */
+            //  $new_acl[$member]= "$member $acl";
+          }
+        }
+      }
+      /* Save shared folder target */
+      $mailObject->attrs['gosaSharedFolderTarget']= "kolab+".$mailObject->mail;
+
+      /* Kolab shared folder names are like ' shared.uid@server.de ' 
+        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
+        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
+      $mailObject->uid = $mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
+  
+      /* Assign new acls */
+      $mailObject->attrs['acl']= array();
+      foreach ($new_acl as $key => $value){
+        $mailObject->attrs['acl'][]= $value;
+      }
+    } else {
+      $mailObject->attrs['objectClass'][]= 'kolabInetOrgPerson';
+    }
+
+    /* Remove imap:// tagging */
+    $mailObject->attrs['kolabHomeServer']= preg_replace('%imap://%', '', $mailObject->attrs['kolabHomeServer']);
+    $mailObject->attrs['gosaMailServer']= $mailObject->attrs['kolabHomeServer'];
+    $mailObject->attrs['kolabDeleteFlag']= array();
+  }
+
+  function fixAttributesOnRemove(&$mailObject)
+  {
+    /* Add attribute for object deletion and remove GOsa specific
+       values from entry. */
+    foreach($this->attribute_map as $kolabAttr){
+      $mailObject->attrs[$kolabAttr] = array();
+    }  
+
+    /* Only add kolab delete Flag in case of an user.mailAccount */
+    if(!in_array("posixGroup", $mailObject->attrs['objectClass'])){
+      $mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer);
+    }else{
+      /* Kolab shared folder names are like ' shared.uid@server.de ' 
+        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
+        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
+      $mailObject->uid = $mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
+      
+    }
+  }
+
+
+  function deleteMailbox($folder)
+  {
+    /* Remove shared folders and skip removing users. 
+       KolabD is not able to remove shared folders yet, so we do it instead */
+    if(!(preg_match("/^user\//",$folder))){
+      return mailMethodCyrus::deleteMailbox($folder);
+    }
+    return (TRUE);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/mail/class_mail-methods-kolab.inc b/gosa-core/plugins/personal/mail/class_mail-methods-kolab.inc
new file mode 100644 (file)
index 0000000..c060604
--- /dev/null
@@ -0,0 +1,267 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2004  Cajus Pollmeier
+
+   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 mailMethodKolab extends mailMethodCyrus
+{
+  var $mbox= "-";
+  var $config;
+  var $gosaMailServer= "";
+  var $uattrib= "mail";
+
+  var $attribute_map= array("gosaMailAlternateAddress"  =>  "alias",
+                            "gosaMailQuota"             =>  "cyrus-userquota",
+                            "gosaMailServer"            =>  "kolabHomeServer");
+
+  function mailMethodKolab(&$config)
+  {
+    $this->config= $config->data['SERVERS']['IMAP'];
+  }
+
+  function updateMailbox($folder)
+  {
+  }
+
+  function setQuota($folder, $gosaMailQuota)
+  {
+    return (TRUE);
+  }
+
+  /* Get quota and divide it by 1024, because in gosa we display in MB
+      but we get Kb */
+  function getQuota($folder)
+  {
+    $result= array('quotaUsage' => '', 'gosaMailQuota' => '');
+
+    /* Only use lower case folder names, if folder name is like "@domain.com" */
+    if(preg_match("/@/",$folder)){
+      $folder = strtolower($folder);
+    }
+
+    error_reporting(0);  
+  
+    /* Load quota settings */
+    $quota_value = @imap_get_quota($this->mbox, $folder);
+    if(is_array($quota_value)) {
+      if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
+        /* use for PHP >= 4.3 */
+        $result['quotaUsage']=    (int) ($quota_value["STORAGE"]['usage'] / 1024);
+        $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
+      } else {
+        /* backward icompatible */
+        $result['quotaUsage']=    (int) ($quota_value['usage'] / 1024);
+        $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
+      }
+    }elseif(!$quota_value){
+      return(false);
+    }
+
+    error_reporting(E_ALL | E_STRICT); 
+    return ($result);
+  }
+
+
+  function fixAttributesOnLoad(&$mailObject)
+  {
+    /* Kolab shared folder names are like ' shared.uid@server.de ' 
+        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
+        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
+    if(get_class($mailObject) == "mailgroup"){
+     $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
+    }
+
+    /* Convert attributes and objectClasses */
+    foreach ($this->attribute_map as $dest => $source){
+      /* Hickert 11.11.05 : Alternate email addresses were saved, but not displayed again.
+      if (isset($mailObject->attrs[$source])){
+        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
+        unset ($mailObject->attrs[$source]);
+      */
+
+      if (isset($mailObject->attrs[$source])){
+        unset($mailObject->attrs[$source]['count']);
+        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
+        $mailObject->$dest=        $mailObject->attrs[$source];
+
+        /* Ensure that cleanup will recognize the ampped attributes too */
+        if(isset($mailObject->saved_attributes)){
+          $mailObject->saved_attributes[$dest] = $mailObject->attrs[$source];
+          $mailObject->saved_attributes[$source] = $mailObject->attrs[$source];
+        }       
+
+        unset ($mailObject->$dest['count']);
+        unset ($mailObject->attrs[$source]);
+      }
+    }
+
+    /* Adjust server name if needed */
+    foreach ($mailObject->config->data['SERVERS']['IMAP'] as $srv => $dummy){
+      if (preg_match("%".$mailObject->attrs['gosaMailServer'][0]."$%", $srv)){
+        $mailObject->attrs['gosaMailServer']= array(0 => $srv, "count" => 1);
+        break;
+      }
+    }
+  }
+
+
+  function fixAttributesOnStore(&$mailObject)
+  {
+    global $config;
+  
+    /* If quota is empty, remove quota restrictions by setting quota to 0 */
+    if(isset($mailObject->gosaMailQuota) && (empty($mailObject->gosaMailQuota))){
+      $mailObject->attrs['gosaMailQuota'] = 0;
+    }
+
+    /* Convert attributes and objectClasses */
+    foreach ($this->attribute_map as $source => $dest){
+      if (isset($mailObject->attrs[$source])){
+        $mailObject->attrs[$dest]= $mailObject->attrs[$source];
+        unset ($mailObject->attrs[$source]);
+      }
+    }
+    $objectclasses= array();
+    foreach ($mailObject->attrs['objectClass'] as $oc){
+      if ($oc !=  'kolabInetOrgPerson' && $oc !=  'kolabSharedFolder'){
+        $objectclasses[]= $oc;
+      }
+    }
+    $mailObject->attrs['objectClass']= $objectclasses;
+    if (in_array("posixGroup", $mailObject->attrs['objectClass'])){
+  
+      /* Add kolabSharedFoleder Class */
+      $mailObject->attrs['objectClass'][]= 'kolabSharedFolder';
+
+      /* Work on acl attribute */
+      $new_acl= array();
+      foreach ($mailObject->attrs['acl'] as $uacl){
+
+        /* Get user=(mail) & acls  */
+        list($user, $acl) = split(" ", $uacl);
+      
+        /* Add al users which have seperated acls 
+           %members% are all users in this group, 
+           which have the standard group acl
+        */
+        if ($user != "%members%"){
+          $new_acl[$user]= $uacl;
+        } else {
+        
+          /* All groupmembers will be added */
+          $ldap = $config->get_ldap_link();
+          $ldap->cd($config->current['BASE']);
+          foreach ($mailObject->members as $member){
+
+            /* Get user mail address .... */
+            $ldap->search("(&(objectClass=person)(|(uid=".$member.")(mail=".$member.")))",array("mail"));
+            $res = $ldap->fetch();
+
+            /* Default mail address is set to uid - 
+               So if there is no mail address defined the uid is added 
+             */
+            $mail = $member;
+
+            /* Use mail address if it is available */
+            if(isset($res['mail'][0])){
+              $mail = $res['mail'][0];
+            }
+
+            /* only append this mail/permission string to acl,
+               if there arn't already some (special) configs for this user */
+            $found =false;
+            foreach($mailObject->imapacl as $mailA => $acl){
+              if(strtolower(trim($mailA))==strtolower(trim($mail))){
+                $found = true;
+              }
+            }
+
+            /* Skipp user, with no email adress too */     
+            if($member == $mail){
+              $found = true;
+            }
+   
+            /* Append new user acl */
+            if(!$found){
+              $new_acl[$member]= "$mail $acl";
+            }
+
+            /* Old line */
+            //  $new_acl[$member]= "$member $acl";
+          }
+        }
+      }
+      /* Save shared folder target */
+      $mailObject->attrs['gosaSharedFolderTarget']= "kolab+shared.".$mailObject->mail;
+
+      /* Kolab shared folder names are like ' shared.uid@server.de ' 
+        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
+        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
+      $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
+  
+      /* Assign new acls */
+      $mailObject->attrs['acl']= array();
+      foreach ($new_acl as $key => $value){
+        $mailObject->attrs['acl'][]= $value;
+      }
+    } else {
+      $mailObject->attrs['objectClass'][]= 'kolabInetOrgPerson';
+    }
+
+    /* Remove imap:// tagging */
+    $mailObject->attrs['kolabHomeServer']= preg_replace('%imap://%', '', $mailObject->attrs['kolabHomeServer']);
+    $mailObject->attrs['gosaMailServer']= $mailObject->attrs['kolabHomeServer'];
+    $mailObject->attrs['kolabDeleteFlag']= array();
+  }
+
+  function fixAttributesOnRemove(&$mailObject)
+  {
+    /* Add attribute for object deletion and remove GOsa specific
+       values from entry. */
+    foreach($this->attribute_map as $kolabAttr){
+      $mailObject->attrs[$kolabAttr] = array();
+    }  
+
+    /* Only add kolab delete Flag in case of an user.mailAccount */
+    if(!in_array("posixGroup", $mailObject->attrs['objectClass'])){
+      $mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer);
+    }else{
+      /* Kolab shared folder names are like ' shared.uid@server.de ' 
+        So overwrite uid to match these folder names. Else we can't read quota settings etc. 
+        #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/
+      $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail);
+      
+    }
+  }
+
+
+  function deleteMailbox($folder)
+  {
+    /* Remove shared folders and skip removing users. 
+       KolabD is not able to remove shared folders yet, so we do it instead */
+    if(preg_match("/^shared/",$folder)){
+      return mailMethodCyrus::deleteMailbox($folder);
+    }
+    return (TRUE);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/mail/class_mail-methods-sendmail-cyrus.inc b/gosa-core/plugins/personal/mail/class_mail-methods-sendmail-cyrus.inc
new file mode 100644 (file)
index 0000000..8bb8d73
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2004  Cajus Pollmeier
+
+   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 mailMethodSendmailCyrus extends mailMethodCyrus
+{
+
+  function mailMethodSendmailCyrus(&$config)
+  {
+    $this->config= $config->data['SERVERS']['IMAP'];
+  }
+
+  function fixAttributesOnLoad(&$mailObject)
+  {
+    /* Remove possible local alias from forwarders */
+    $newForwarder= array();
+    foreach ($mailObject->gosaMailForwardingAddress as $addr){
+      if (!preg_match('/^\\\\/', $addr)){
+        $newForwarder[]= $addr;
+      }
+    }
+    $mailObject->gosaMailForwardingAddress= $newForwarder;
+  }
+
+  function fixAttributesOnStore(&$mailObject)
+  {
+    /* Add local user if checked */
+    if (preg_match("/L/", $mailObject->gosaMailDeliveryMode)) {
+      $mailObject->gosaMailForwardingAddress[]= "\\".$mailObject->uid;
+    }
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/mail/class_mail-methods.inc b/gosa-core/plugins/personal/mail/class_mail-methods.inc
new file mode 100644 (file)
index 0000000..1874648
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2004  Cajus Pollmeier
+
+   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 mailMethod
+{
+  var $uattrib= "uid";
+  
+  function mailMethod(&$config)
+  {
+  }
+
+  function connect($gosaMailServer)
+  {
+    return (TRUE);
+  }
+
+  function disconnect()
+  {
+  }
+
+  function getQuota($folder)
+  {
+    return (array('quotaUsage' => 0, 'gosaMailQuota' => 0));
+  }
+
+  function getMailboxList($folder, $uid)
+  {
+    return (array("INBOX"));
+  }
+
+  function setQuota($folder, $gosaMailQuota)
+  {
+    return (TRUE);
+  }
+
+  function updateMailbox($folder)
+  {
+  }
+
+  function deleteMailbox($folder)
+  {
+    return (TRUE);
+  }
+
+  function setSharedFolderPermissions($folder, $permissions)
+  {
+  }
+
+  function configureFilter($user, $gosaMailDeliveryMode,
+      $mail, $gosaMailAlternateAddress,
+      $gosaMailMaxSize,
+      $gosaSpamMailbox, $gosaSpamSortLevel,
+      $gosaVacationMessage)
+  {
+  }
+
+  function fixAttributesOnLoad(&$mailObject)
+  {
+  }
+
+  function fixAttributesOnStore(&$mailObject)
+  {
+  }
+
+  function fixAttributesOnRemove(&$mailObject)
+  {
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>