Ajout configuration squirrelmail + bugfixes pour postfix

This commit is contained in:
Steven Mondji-Lerider 2012-05-09 16:31:58 +00:00
parent b26cb694b9
commit 7c08903376
8 changed files with 84 additions and 13 deletions

1
.gitattributes vendored
View File

@ -340,6 +340,7 @@ bureau/class/m_mail_alias.php -text
bureau/class/m_mail_jabber.php -text
bureau/class/m_mail_localbox.php -text
bureau/class/m_mail_redirection.php -text
bureau/class/m_mail_squirrelmail.php -text
bureau/class/m_mem.php -text
bureau/class/m_mysql.php -text
bureau/class/m_quota.php -text

View File

@ -65,7 +65,9 @@ Class m_mail_jabber{
$return = array (
"label" => "jabberdemo", // an internal label
"short_desc" => _("Jabber Demo"), // A human short description
"class" => "mail_jabber",
"human_desc" => _("This is just a demo.<br/>Look at m_mail_jabber.php"), // A human long description
"form_param" => Array($mail_id),
"url" => "javascript:alert('Ici un renvoie vers le formulaire adequat de cette entrée.');", // The URL to go
"pass_required" => true, // This feature require the mail to have a global password ?
"advanced" => $this->advanced, // Is this an advanced feature ?

View File

@ -59,27 +59,34 @@ Class m_mail_localbox{
* @param integer $mail_id
*/
function set_localbox($mail_id){
global $db, $err;
$err->log("localbox","set_localbox");
global $db, $err, $hooks;
$err->log("localbox","set_localbox!!!!!!!!");
$path="mail/";
if(!$db->query("select distinct left(ad.address,1) as letter,ad.address ,d.domaine from address ad, domaines d where ad.domain_id = d.id and ad.id = $mail_id order by letter;"));
if(! $db->next_record()){
return null;
}
//FIXME passer par un hooks pour squirel
$hooks->invoke('hooks_squirrelmail_init',(array($db->f('address'),$db->f('domaine') )));
$path="/var/alternc/mail/".$db->f('letter')."/".$db->f('address')."_".$db->f('domaine');
//FIXME faire un touch de la maildir si dovecot ne sait pas le faire.
if(!$db->query("INSERT into mailbox (address_id,path,quota) values ($mail_id,'$path',50);"));
}
/*
* Set a localbox
* Unset a localbox
* @param integer $mail_id
*/
function unset_localbox($mail_id){
global $db, $err;
$err->log("localbox","set_localbox");
global $db, $err,$hooks;
$err->log("localbox","unset_localbox");
if(!$db->query("select address,domaine from address,domaines where address.domain_id=domaines.id and address.id=$mail_id ;"));
if(! $db->next_record()){
return null;
}
$hooks->invoke('hooks_squirrelmail_delete',(array($db->f('address'),$db->f('domaine') )));
if(!$db->query("DELETE from mailbox where address_id=$mail_id;"));
}

View File

@ -0,0 +1,58 @@
<?php
/*
* Proof of concept of what a new feature look like with the new mail interface
*
**/
Class m_mail_squirrelmail{
var $advanced;
var $enabled;
function m_mail_squirrelmail(){
// Get configuration var
}
function hooks_squirrelmail_init($mail,$dom){
global $err,$cuid,$db;
$err->log("mail_squirrelmail","squirrelmail_init",$mail."@".$dom);
$m=substr($mail,0,1);
$gecos=$mail;
if (!$mail) {
// Cas du CATCH-ALL
$gecos="Catch-All";
$m="_";
}
$f=fopen("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref","wb");
$g=0; $g=@fopen("/etc/squirrelmail/default_pref","rb");
fputs($f,"email_address=$mail@$dom\nchosen_theme=default_theme.php\n");
if ($g) {
while ($s=fgets($g,1024)) {
if (substr($s,0,14)!="email_address=" && substr($s,0,13)!="chosen_theme=") {
fputs($f,$s);
}
}
fclose($g);
}
fclose($f);
@copy("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref","/var/lib/squirrelmail/data/".$mail."@".$dom.".pref");
return true;
}
function hooks_squirrelmail_delete($mail,$dom){
global $err,$cuid,$db;
$err->log("mail_squirrelmail","squirrelmail_delete",$mail."@".$dom);
@unlink("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref");
@unlink("/var/lib/squirrelmail/data/".$mail."_".$dom.".abook");
@unlink("/var/lib/squirrelmail/data/".$mail."@".$dom.".pref");
@unlink("/var/lib/squirrelmail/data/".$mail."@".$dom.".abook");
return true;
}
}
?>

View File

@ -184,7 +184,7 @@ class m_quota {
echo "quota set :::::ciud: $cuid :::: size: $size :::: \n ";
// Now we check that the value has been written properly :
exec("/usr/lib/alternc/quota_get ".$cuid,$a);
echo "quota get :::::ciud: $cuid :::: size: $size :::: a?: $a ";
print_r($a);
if ($size!=$a[1]) {
$err->raise("quota",1);
return false;

View File

@ -240,8 +240,11 @@ EOF
# Update l18n files
/usr/share/alternc/install/dopo.sh
#sudo stuff allowing alterncpanel to use quota
#squirrelmail fix
chown -R :alterncpanel /var/lib/squirrelmail/data
chmod -R g+w /var/lib/squirrelmail
#sudo stuff allowing alterncpanel to use quota
if [ -d /etc/sudoers.d ]; then
cp /etc/alternc/alternc-sudoers /etc/sudoers.d/alternc-sudoers
chmod 0440 /etc/sudoers.d/alternc-sudoers
@ -249,7 +252,7 @@ EOF
echo "running an older version of sudo"
#FIXME
echo "copy content of /usr/share/doc/examples/example.sudoers into /etc/sudoers.d for to run properly"
fi
fi
# important: postinst gele sans ca
db_stop

View File

@ -19,7 +19,7 @@ smtpd_tls_session_cache_timeout = 3600s
smtp_tls_dcert_file = $smtpd_tls_dcert_file
smtp_tls_dkey_file = $smtpd_tls_dcert_file
smtp_tls_CApath = $smtpd_tls_CApath
smtpd_tls_auth_only = yes
smtpd_tls_auth_only = no
#SASL options
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = postfix

View File

@ -295,7 +295,7 @@ grep -v '^\ *#' $postfix_conf |while read line ; do
done
# Conviguring delivery used bu Postfix FIXME change script name
echo `/usr/bin/postfix-add-policy dovecot pipe DRhu vmail:vmail '/usr/bin/sudo /usr/lib/dovecot/deliver -f ${sender} -d ${recipient} '`
echo `/usr/bin/postfix-add-policy dovecot vmail:vmail DRhu pipe'/usr/bin/sudo /usr/lib/dovecot/deliver -f ${sender} -d ${recipient} '`
# Bug #1215: configure mydestination when $FQDN is not in
OLDDESTINATION=`postconf mydestination | awk -F '=' '{print $2}'`