hm... Mist, ist nur ein Passwort Wechsler...
ich kann dir nur meine Änderungen auflisten, die ich bei horde-vacation gemacht habe (ich fuinde horde-webmail besser als squirrel):
die conf.php (Ausschnitt):
Code:
$conf['vacation']['default_subject'] = _("On vacation message");
$conf['vacation']['default_message'] = _("I'm on vacation and will not be reading my mail for a while.\nYour mail will be dealt with when I return.");
$conf['vacation']['subject'] = false;
$conf['vacation']['from'] = false;
$conf['server']['params']['default']['query_set'] = 'UPDATE `ispcp`.`mail_users` SET `mail_auto_respond_text` = \M, `mail_auto_respond` = 1, `status` = \'change\' WHERE mail_add
$conf['server']['params']['default']['query_unset'] = 'UPDATE `ispcp`.`mail_users` SET `mail_auto_respond` = 0, `status` = \'change\' WHERE mail_addr = \U AND `mail_pass` = \P';
$conf['server']['params']['default']['query_get'] = "SELECT IF(`mail_auto_respond`=1,'Y', 'N') AS `vacation`, `mail_auto_respond_text` AS `message`, '' AS `subject` FROM `ispcp`
$conf['server']['params']['default']['driverconfig'] = 'horde';
$conf['server']['params']['default']['hordeauth'] = false;
$conf['server']['params']['encryption'] = 'plain';
$conf['server']['params']['show_encryption'] = false;
$conf['server']['driver'] = 'ispcp';
und die Datei lib/Driver/ispcp.php als "diff-u" von customsql.php:
Code:
--- customsql.php 2009-01-29 17:02:55.000000000 +0100
+++ ispcp.php 2010-01-28 17:33:17.000000000 +0100
@@ -13,7 +13,7 @@
* @since Vacation 3.1
* @package Vacation
*/
-class Vacation_Driver_customsql extends Vacation_Driver {
+class Vacation_Driver_ispcp extends Vacation_Driver {
/**
* SQL connection object.
@@ -35,7 +35,7 @@
* @param string $user A user name.
* @param array $params Configuration parameters for the backend.
*/
- function Vacation_Driver_customsql($user, $params = array())
+ function Vacation_Driver_ispcp($user, $params = array())
{
$params = Horde::getDriverConfig('server', 'sql');
parent::Vacation_Driver($user, $params);
@@ -65,6 +65,9 @@
// Build username.
$myuser = $this->_buildUsername();
+ # ispcp
+ $password = $this->encrypt_db_password($password);
+
// Encrypt password.
$crypted_password = $this->_encryptPassword($password, $this->_getCurrentPassword($myuser));
@@ -91,6 +94,8 @@
if ($result !== DB_OK) {
return PEAR::raiseError(_("An unknown error occured while enabling the vacation notice."));
}
+ # ispCP Update...
+ $this->send_request();
}
/**
@@ -113,6 +118,9 @@
// Build username.
$myuser = $this->_buildUsername();
+ # ispcp
+ $password = $this->encrypt_db_password($password);
+
// Encrypt password.
$crypted_password = $this->_encryptPassword($password, $this->_getCurrentPassword($myuser));
@@ -135,6 +143,9 @@
if ($result !== DB_OK) {
return PEAR::raiseError(_("An unknown error occured while enabling the vacation notice."));
}
+
+ # ispCP Update...
+ $this->send_request();
}
/**
@@ -166,6 +177,9 @@
// Build username.
$myuser = $this->_buildUsername();
+ # ispcp
+ $password = $this->encrypt_db_password($password);
+
// Encrypt password.
$crypted_password = $this->_encryptPassword($password, $this->_getCurrentPassword($myuser));
@@ -205,7 +219,7 @@
if (empty($this->_params[$this->_realm]['query_password'])) {
return '';
}
-
+
// Build the SQL query.
$query = str_replace('\U',
$this->_db->quote($this->_buildUsername()),
@@ -230,7 +244,12 @@
{
if ($this->_realm === 'default' ||
$this->_realm === '') {
- return $this->_user;
+
+ $userid = Auth::getAuth();
+// $userid = Auth::getBareAuth();
+
+// return $this->_user;
+ return $userid;
} else {
return $this->_user . '@' . $this->_realm;
}
@@ -308,4 +327,120 @@
$this->_connected = true;
}
+# ispcp Funktionen
+function read_line(&$socket) {
+ $ch = '';
+ $line = '';
+ do {
+ $ch = socket_read($socket,1);
+ $line = $line . $ch;
+ } while($ch != "\r" && $ch != "\n");
+ return $line;
+}
+
+function send_request() {
+
+# global $Version;
+ $Version = 'ispCP-Horde-Passwd';
+
+ $code = 999;
+
+ @$socket = socket_create (AF_INET, SOCK_STREAM, 0);
+ if ($socket < 0) {
+ $errno = "socket_create() failed.\n";
+ return $errno;
+ }
+
+ @$result = socket_connect ($socket, '127.0.0.1', 9876);
+ if ($result == FALSE) {
+ $errno = "socket_connect() failed.\n";
+ return $errno;
+ }
+
+ /* read one line with welcome string */
+ $out = $this->read_line($socket);
+
+ list($code) = explode(' ', $out);
+ if ($code == 999) {
+ return $out;
+ }
+
+ /* send hello query */
+ $query = "helo $Version\r\n";
+ socket_write ($socket, $query, strlen ($query));
+
+ /* read one line with helo answer */
+ $out = $this->read_line($socket);
+
+ list($code) = explode(' ', $out);
+ if ($code == 999) {
+ return $out;
+ }
+
+ /* send reg check query */
+ $query = "execute query\r\n";
+ socket_write ($socket, $query, strlen ($query));
+ /* read one line key replay */
+ $execute_reply = $this->read_line($socket);
+
+ list($code) = explode(' ', $execute_reply);
+ if ($code == 999) {
+ return $out;
+ }
+
+ /* send quit query */
+ $quit_query = "bye\r\n";
+ socket_write ($socket, $quit_query, strlen ($quit_query));
+ /* read quit answer */
+ $quit_reply = $this->read_line($socket);
+
+ list($code) = explode(' ', $quit_reply);
+ if ($code == 999) {
+ return $out;
+ }
+
+ list($answer) = explode(' ', $execute_reply);
+
+ socket_close ($socket);
+
+ return $answer;
+}
+
+function encrypt_db_password($db_pass) {
+ require '/var/www/ispcp/gui/include/ispcp-db-keys.php';
+# global $ispcp_db_pass_key, $ispcp_db_pass_iv;
+
+ if (extension_loaded('mcrypt') || @dl('mcrypt.' . PHP_SHLIB_SUFFIX)) {
+ $td = @mcrypt_module_open(MCRYPT_BLOWFISH, '', 'cbc', '');
+ // Create key
+ $key = $ispcp_db_pass_key;
+ // Create the IV and determine the keysize length
+ $iv = $ispcp_db_pass_iv;
+
+ // compatibility with used perl pads
+ $block_size = @mcrypt_enc_get_block_size($td);
+ $strlen = strlen($db_pass);
+
+ $pads = $block_size-$strlen % $block_size;
+
+ $db_pass .= str_repeat(' ', $pads);
+
+ // Initialize encryption
+ @mcrypt_generic_init($td, $key, $iv);
+ // Encrypt string
+ $encrypted = @mcrypt_generic ($td, $db_pass);
+ @mcrypt_generic_deinit($td);
+ @mcrypt_module_close($td);
+
+ $text = @base64_encode("$encrypted");
+
+ // Show encrypted string
+ return trim($text);
+ } else {
+ //system_message("ERROR: The php-extension 'mcrypt' not loaded!");
+ die("ERROR: The php-extension 'mcrypt' not loaded!");
+ }
+}
+
+
}
Vielleicht siehst du damit, was ca nötig ist...
Natürlich muss der sql-User diese Tabellen ändern können (der sql-user von horde... - das habe ich mal geschrieben im Forum...)
Edit: das könnte so aussehen:
INSERT INTO `tables_priv` (`Host`, `Db`, `User`, `Table_name`, `Grantor`, `Timestamp`, `Table_priv`, `Column_priv`) VALUES
('localhost', 'ispcp', 'horde-webmail', 'mail_users', 'root', '2009-06-20 23:16:31', 'Select', 'Select,Update');
INSERT INTO `columns_priv` (`Host`, `Db`, `User`, `Table_name`, `Column_name`, `Timestamp`, `Column_priv`) VALUES
('localhost', 'ispcp', 'horde-webmail', 'mail_users', 'mail_auto_respond_text', '2009-06-20 23:17:18', 'Update'),
('localhost', 'ispcp', 'horde-webmail', 'mail_users', 'mail_auto_respond', '2009-06-20 23:17:18', 'Update'),
('localhost', 'ispcp', 'horde-webmail', 'mail_users', 'status', '2009-06-20 23:17:18', 'Update'),
('localhost', 'ispcp', 'horde-webmail', 'mail_users', 'mail_pass', '2009-06-20 23:17:18', 'Update');
oder so...
Gruss Joxi