[git] merge master
This commit is contained in:
parent
67081465c0
commit
3c59b9f45e
|
@ -654,6 +654,7 @@ src/generate_apache_conf.php -text
|
|||
src/generate_bind_conf.php -text
|
||||
src/inotify_do_actions.sh -text
|
||||
src/inotify_update_domains.sh -text
|
||||
src/mail_add.php -text
|
||||
src/mail_dodelete.php -text
|
||||
src/mem_add -text
|
||||
src/mem_del -text
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
language: php
|
||||
php:
|
||||
- 5.5
|
||||
- 5.4
|
||||
- 5.3
|
||||
script: phpunit --coverage-clover=coverage.clover
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Appelé seul, lance les stats AWStats du jour.
|
||||
# Appelé avec "all" lance les stats avec tous les fichiers .gz situés dans /var/log/apache
|
||||
# Appelé avec un nom de domaine en paramètre, rescanne tous les fichiers .gz pour ce domaine uniquement.
|
||||
# Called with no parameters, launch the daily awstats stats
|
||||
# called with "all", launch all stats with all apache log files from /var/log/alternc/sites/
|
||||
# called with a domain name, launch the stats for this domain from all apache log files
|
||||
|
||||
# Include some usefull functions
|
||||
. /usr/lib/alternc/functions.sh
|
||||
cd /usr/lib/alternc
|
||||
# AlternC system functions
|
||||
. ./functions.sh
|
||||
|
||||
# Regenerate the awstat etc cache files :
|
||||
if [ -x ./awstats.cache.php ]
|
||||
|
|
|
@ -478,7 +478,7 @@ class m_aws {
|
|||
$err->raise("aws",_("Login already exist"));
|
||||
return false;
|
||||
}
|
||||
$pass=_md5cr($pass);
|
||||
$pass=$this->crypt_apr1_md5($pass);
|
||||
// FIXME retourner une erreur l'insert se passe pas bien
|
||||
$db->query("INSERT INTO aws_users (uid,login,pass) VALUES ('$cuid','$login','$pass');");
|
||||
return $this->_createhtpasswd();
|
||||
|
@ -498,7 +498,7 @@ class m_aws {
|
|||
$err->raise("aws",_("Login does not exists")); // Login does not exists
|
||||
return false;
|
||||
}
|
||||
$pass=_md5c($pass);
|
||||
$pass=$this->crypt_apr1_md5($pass);
|
||||
$db->query("UPDATE aws_users SET pass='$pass' WHERE login='$login';");
|
||||
return $this->_createhtpasswd();
|
||||
}
|
||||
|
@ -794,6 +794,42 @@ class m_aws {
|
|||
return $str;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/**
|
||||
* from http://php.net/crypt#73619
|
||||
*/
|
||||
function crypt_apr1_md5($plainpasswd) {
|
||||
$salt = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"), 0, 8);
|
||||
$len = strlen($plainpasswd);
|
||||
$text = $plainpasswd.'$apr1$'.$salt;
|
||||
$bin = pack("H32", md5($plainpasswd.$salt.$plainpasswd));
|
||||
for($i = $len; $i > 0; $i -= 16) { $text .= substr($bin, 0, min(16, $i)); }
|
||||
for($i = $len; $i > 0; $i >>= 1) { $text .= ($i & 1) ? chr(0) : $plainpasswd{0}; }
|
||||
$bin = pack("H32", md5($text));
|
||||
for($i = 0; $i < 1000; $i++) {
|
||||
$new = ($i & 1) ? $plainpasswd : $bin;
|
||||
if ($i % 3) $new .= $salt;
|
||||
if ($i % 7) $new .= $plainpasswd;
|
||||
$new .= ($i & 1) ? $bin : $plainpasswd;
|
||||
$bin = pack("H32", md5($new));
|
||||
}
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$k = $i + 6;
|
||||
$j = $i + 12;
|
||||
if ($j == 16) $j = 5;
|
||||
$tmp = $bin[$i].$bin[$k].$bin[$j].$tmp;
|
||||
}
|
||||
$tmp = chr(0).chr(0).$bin[11].$tmp;
|
||||
$tmp = strtr(strrev(substr(base64_encode($tmp), 2)),
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
|
||||
return "$"."apr1"."$".$salt."$".$tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} /* CLASSE m_aws */
|
||||
|
||||
?>
|
||||
|
|
|
@ -74,12 +74,9 @@ if ( empty($logo) || ! $logo ) {
|
|||
<br/>
|
||||
<?php
|
||||
if (isset($_GET['authip_token'])) $authip_token=$_GET['authip_token'];
|
||||
/*
|
||||
if (!$_SERVER[HTTPS]) {
|
||||
echo "<h4>ATTENTION : vous allez acc<63>der <20> votre panel en mode *non s<>curis<69>*<br/>
|
||||
<a href=\"https://".$_SERVER["HTTP_HOST"]."/\">Cliquez ici pour passer en mode s<>curis<69></a></h4>";
|
||||
if (variable_get('https_warning', true, 'warn users to switch to HTTPS') && !isset($_SERVER['HTTPS'])) {
|
||||
echo '<h4>' . sprintf(_('WARNING: you are trying to access the control panel insecurely, click <a href="https://%s">here</a> to go to secure mode'), $_SERVER["HTTP_HOST"]) . '</h4>';
|
||||
}
|
||||
*/
|
||||
?>
|
||||
<div style="margin: 0 auto 30px auto; width: 700px;">
|
||||
<table width="100%"><tr><td>
|
||||
|
|
|
@ -202,6 +202,7 @@ if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"]
|
|||
|
||||
<?php __("Which protocol shall you use?"); ?>
|
||||
<div id="accordion-mailout">
|
||||
<?php if ($mail->srv_submission) { ?>
|
||||
<h4><?php __("Submission");?></h4>
|
||||
<div>
|
||||
<ul>
|
||||
|
@ -213,6 +214,8 @@ if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"]
|
|||
<li><b><?php __("Connection security:");?></b> STARTTLS</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ($mail->srv_smtp) { ?>
|
||||
<h4><?php __("SMTP");?></h4>
|
||||
<div>
|
||||
<ul>
|
||||
|
@ -224,6 +227,8 @@ if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"]
|
|||
<li><b><?php __("Connection security:");?></b> STARTTLS</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ($mail->srv_smtps) { ?>
|
||||
<h4><?php __("SMTPS");?></h4>
|
||||
<div>
|
||||
<ul>
|
||||
|
@ -235,6 +240,7 @@ if (date("Y-m-d")==substr($val["lastlogin"],0,10)) echo substr($val["lastlogin"]
|
|||
<li><b><?php __("Connection security:");?></b> SSL</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div><!-- accordion-mailout -->
|
||||
|
||||
</div><!-- tabs-mailhelp-out -->
|
||||
|
|
|
@ -68,9 +68,11 @@ class m_admin {
|
|||
);
|
||||
$this->archive=variable_get('archive_del_data','','If folder specified html folder of deleted user is archived, else it is deleted. ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the admin menu
|
||||
*
|
||||
* @global type $mem
|
||||
* @global m_mem $mem
|
||||
* @global type $cuid
|
||||
* @global type $debug_alternc
|
||||
* @global type $L_INOTIFY_UPDATE_DOMAIN
|
||||
|
@ -173,6 +175,21 @@ class m_admin {
|
|||
return $db->f('uid');
|
||||
}
|
||||
|
||||
/**
|
||||
* return the name of an alternc account
|
||||
*
|
||||
* @global type $db
|
||||
* @param type $uid
|
||||
* @return null if missing
|
||||
*/
|
||||
function get_login_by_uid($uid) {
|
||||
global $db;
|
||||
$db->query("SELECT login FROM membres WHERE uid=$uid;");
|
||||
if (! $db->next_record()) {
|
||||
return null;
|
||||
}
|
||||
return $db->f('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the known information about a hosted account
|
||||
|
|
|
@ -279,7 +279,7 @@ class m_ftp {
|
|||
}
|
||||
|
||||
// Explicitly look for only allowed chars
|
||||
if ( ! preg_match("/^[A-Za-z0-9_\.\-]+$/", $l) ) {
|
||||
if ( ! preg_match("/^[A-Za-z0-9]+[A-Za-z0-9_\.\-]*$/", $l) ) {
|
||||
$err->raise('ftp', _("FTP login is incorrect"));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -85,9 +85,9 @@ class m_mail {
|
|||
*
|
||||
*/
|
||||
function m_mail() {
|
||||
$this->srv_submission = variable_get('mail_human_submission', '%%FQDN%%','Human name for mail server (submission protocol)', array('desc'=>'Name','type'=>'string'));
|
||||
$this->srv_smtp = variable_get('mail_human_smtp', '%%FQDN%%','Human name for mail server (SMTP protocol)', array('desc'=>'Name','type'=>'string'));
|
||||
$this->srv_smtps = variable_get('mail_human_smtps', '%%FQDN%%','Human name for mail server (SMTPS protocol)', array('desc'=>'Name','type'=>'string'));
|
||||
$this->srv_submission = variable_get('mail_human_submission', '%%FQDN%%','Human name for mail server (submission protocol), leave empty to disable help', array('desc'=>'Name','type'=>'string'));
|
||||
$this->srv_smtp = variable_get('mail_human_smtp', '%%FQDN%%','Human name for mail server (SMTP protocol), leave empty to disable help', array('desc'=>'Name','type'=>'string'));
|
||||
$this->srv_smtps = variable_get('mail_human_smtps', '%%FQDN%%','Human name for mail server (SMTPS protocol), leave empty to disable help', array('desc'=>'Name','type'=>'string'));
|
||||
$this->srv_imap = variable_get('mail_human_imap', '%%FQDN%%','Human name for IMAP mail server', array('desc'=>'Name','type'=>'string'));
|
||||
$this->srv_imaps = variable_get('mail_human_imaps', '%%FQDN%%','Human name for IMAPS mail server', array('desc'=>'Name','type'=>'string'));
|
||||
$this->srv_pop3 = variable_get('mail_human_pop3', '%%FQDN%%','Human name for POP3 mail server', array('desc'=>'Name','type'=>'string'));
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
class m_mem {
|
||||
|
||||
/** Original uid for the temporary uid swapping (for administrators) */
|
||||
var $olduid=0;
|
||||
var $olduid = 0;
|
||||
|
||||
/** This array contains the Tableau contenant les champs de la table "membres" du membre courant
|
||||
* Ce tableau est utilisable globalement par toutes les classes filles.
|
||||
|
@ -54,11 +54,9 @@ class m_mem {
|
|||
|
||||
/**
|
||||
* Password kind used in this class (hook for admin class)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
function alternc_password_policy() {
|
||||
return array("mem"=>"AlternC's account password");
|
||||
}
|
||||
|
@ -68,7 +66,7 @@ class m_mem {
|
|||
* @return type
|
||||
*/
|
||||
function hook_menu() {
|
||||
$obj = array(
|
||||
$obj = array(
|
||||
'title' => _("Settings"),
|
||||
'ico' => 'images/settings.png',
|
||||
'link' => 'mem_param.php',
|
||||
|
@ -109,17 +107,17 @@ class m_mem {
|
|||
* @param type $authip_token
|
||||
* @return boolean
|
||||
*/
|
||||
function login($username,$password,$restrictip=0,$authip_token=false) {
|
||||
function login($username,$password,$restrictip = 0,$authip_token = false) {
|
||||
global $db,$err,$cuid,$authip,$admin;
|
||||
$err->log("mem","login",$username);
|
||||
$db->query("select * from membres where login='$username';");
|
||||
$db->query("select * from membres where login = '$username';");
|
||||
if ($db->num_rows()==0) {
|
||||
$err->raise("mem",_("User or password incorrect"));
|
||||
return false;
|
||||
}
|
||||
$db->next_record();
|
||||
if (_md5cr($password,$db->f("pass"))!=$db->f("pass")) {
|
||||
$db->query("UPDATE membres SET lastfail=lastfail+1 WHERE uid='".$db->f("uid")."';");
|
||||
$db->query("UPDATE membres SET lastfail = lastfail+1 WHERE uid = '".$db->f("uid")."';");
|
||||
$err->raise("mem",_("User or password incorrect"));
|
||||
return false;
|
||||
}
|
||||
|
@ -127,20 +125,20 @@ class m_mem {
|
|||
$err->raise("mem",_("This account is locked, contact the administrator"));
|
||||
return false;
|
||||
}
|
||||
$this->user=$db->Record;
|
||||
$cuid=$db->f("uid");
|
||||
$this->user = $db->Record;
|
||||
$cuid = $db->f("uid");
|
||||
|
||||
if (panel_islocked() && $cuid != 2000) {
|
||||
$err->raise("mem",_("This website is currently under maintenance, login is currently disabled."));
|
||||
return false;
|
||||
}
|
||||
|
||||
$allowed_ip=false;
|
||||
$allowed_ip = false;
|
||||
if ( $authip_token ) $allowed_ip = $this->authip_tokencheck($authip_token);
|
||||
|
||||
$aga = $authip->get_allowed('panel');
|
||||
$aga = $authip->get_allowed('panel');
|
||||
foreach ($aga as $k=>$v ) {
|
||||
if ( $authip->is_in_subnet(get_remote_ip(), $v['ip'], $v['subnet']) ) $allowed=true ;
|
||||
if ( $authip->is_in_subnet(get_remote_ip(), $v['ip'], $v['subnet']) ) $allowed = true ;
|
||||
}
|
||||
|
||||
if ( sizeof($aga)>1 && !$allowed_ip && !$authip->is_wl(get_remote_ip()) ) {
|
||||
|
@ -149,19 +147,21 @@ class m_mem {
|
|||
}
|
||||
|
||||
if ($restrictip) {
|
||||
$ip="'".get_remote_ip()."'";
|
||||
} else $ip="''";
|
||||
$ip = "'".get_remote_ip()."'";
|
||||
} else $ip = "''";
|
||||
$db->query("DELETE FROM sessions WHERE DATE_ADD(ts,INTERVAL 2 DAY)<NOW();");
|
||||
if ( isset($_COOKIE["oldid"]) ) setcookie('oldid','',0,'/');
|
||||
$sess=md5(uniqid(mt_rand()));
|
||||
$_REQUEST["session"]=$sess;
|
||||
$sess = md5(uniqid(mt_rand()));
|
||||
$_REQUEST["session"] = $sess;
|
||||
$db->query("insert into sessions (sid,ip,uid) values ('$sess',$ip,'$cuid');");
|
||||
setcookie("session",$sess,0,"/");
|
||||
$err->error=0;
|
||||
$db->query("SELECT * FROM local WHERE uid='$cuid';");
|
||||
if( !preg_match("/^cli/",PHP_SAPI) ){
|
||||
setcookie("session",$sess,0,"/");
|
||||
}
|
||||
$err->error = 0;
|
||||
$db->query("SELECT * FROM local WHERE uid = '$cuid';");
|
||||
if ($db->num_rows()) {
|
||||
$db->next_record();
|
||||
$this->local=$db->Record;
|
||||
$this->local = $db->Record;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -187,26 +187,26 @@ class m_mem {
|
|||
function setid($id) {
|
||||
global $db,$err,$cuid,$mysql,$quota;
|
||||
$err->log("mem","setid",$id);
|
||||
$db->query("select * from membres where uid='$id';");
|
||||
$db->query("select * from membres where uid = '$id';");
|
||||
if ($db->num_rows()==0) {
|
||||
$err->raise("mem",_("User or password incorrect"));
|
||||
return false;
|
||||
}
|
||||
$db->next_record();
|
||||
$this->user=$db->Record;
|
||||
$cuid=$db->f("uid");
|
||||
$this->user = $db->Record;
|
||||
$cuid = $db->f("uid");
|
||||
$mysql->reload_dbus();
|
||||
|
||||
$ip=get_remote_ip();
|
||||
$sess=md5(uniqid(mt_rand()));
|
||||
$_REQUEST["session"]=$sess;
|
||||
$ip = get_remote_ip();
|
||||
$sess = md5(uniqid(mt_rand()));
|
||||
$_REQUEST["session"] = $sess;
|
||||
$db->query("insert into sessions (sid,ip,uid) values ('$sess','$ip','$cuid');");
|
||||
setcookie("session",$sess,0,"/");
|
||||
$err->error=0;
|
||||
$db->query("SELECT * FROM local WHERE uid='$cuid';");
|
||||
$err->error = 0;
|
||||
$db->query("SELECT * FROM local WHERE uid = '$cuid';");
|
||||
if ($db->num_rows()) {
|
||||
$db->next_record();
|
||||
$this->local=$db->Record;
|
||||
$this->local = $db->Record;
|
||||
}
|
||||
$quota->getquota('', true);
|
||||
return true;
|
||||
|
@ -221,9 +221,9 @@ class m_mem {
|
|||
*/
|
||||
function resetlast() {
|
||||
global $db,$cuid;
|
||||
$ip=addslashes(getenv("REMOTE_HOST"));
|
||||
if (!$ip) $ip=addslashes(get_remote_ip());
|
||||
$db->query("UPDATE membres SET lastlogin=NOW(), lastfail=0, lastip='$ip' WHERE uid='$cuid';");
|
||||
$ip = addslashes(getenv("REMOTE_HOST"));
|
||||
if (!$ip) $ip = addslashes(get_remote_ip());
|
||||
$db->query("UPDATE membres SET lastlogin = NOW(), lastfail = 0, lastip = '$ip' WHERE uid = '$cuid';");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -233,19 +233,17 @@ class m_mem {
|
|||
* @param type $bis
|
||||
* @return type
|
||||
*/
|
||||
function authip_token($bis=false) {
|
||||
function authip_token($bis = false) {
|
||||
global $db,$cuid;
|
||||
$db->query("select pass from membres where uid='$cuid';");
|
||||
$db->query("select pass from membres where uid = '$cuid';");
|
||||
$db->next_record();
|
||||
$i=intval(time()/3600);
|
||||
$i = intval(time()/3600);
|
||||
if ($bis) ++$i;
|
||||
return md5("$i--".$db->f('pass'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $t
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @param type $t
|
||||
* @return boolean
|
||||
|
@ -263,10 +261,10 @@ class m_mem {
|
|||
*/
|
||||
function authip_class() {
|
||||
global $cuid;
|
||||
$c = Array();
|
||||
$c['name']="Panel access";
|
||||
$c['protocol']="mem";
|
||||
$c['values']=Array($cuid=>'');
|
||||
$c = Array();
|
||||
$c['name'] = "Panel access";
|
||||
$c['protocol'] = "mem";
|
||||
$c['values'] = Array($cuid=>'');
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
@ -299,13 +297,13 @@ class m_mem {
|
|||
return $this->login($_REQUEST["username"],$_REQUEST["password"], (isset($_REQUEST["restrictip"])?$_REQUEST["restrictip"]:0) );
|
||||
}
|
||||
} // end isset
|
||||
$_COOKIE["session"]=isset($_COOKIE["session"])?addslashes($_COOKIE["session"]):"";
|
||||
$_COOKIE["session"] = isset($_COOKIE["session"])?addslashes($_COOKIE["session"]):"";
|
||||
if (strlen($_COOKIE["session"])!=32) {
|
||||
$err->raise("mem",_("Identity lost or unknown, please login"));
|
||||
return false;
|
||||
}
|
||||
$ip=get_remote_ip();
|
||||
$db->query("select uid,'$ip' as me,ip from sessions where sid='".$_COOKIE["session"]."'");
|
||||
$ip = get_remote_ip();
|
||||
$db->query("select uid,'$ip' as me,ip from sessions where sid = '".$_COOKIE["session"]."'");
|
||||
if ($db->num_rows()==0) {
|
||||
$err->raise("mem",_("Session unknown, contact the administrator"));
|
||||
return false;
|
||||
|
@ -317,21 +315,21 @@ class m_mem {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
$cuid=$db->f("uid");
|
||||
$cuid = $db->f("uid");
|
||||
|
||||
if (panel_islocked() && $cuid != 2000) {
|
||||
$err->raise("mem",_("This website is currently under maintenance, login is currently disabled."));
|
||||
return false;
|
||||
}
|
||||
|
||||
$db->query("select * from membres where uid='$cuid';");
|
||||
$db->query("select * from membres where uid = '$cuid';");
|
||||
$db->next_record();
|
||||
$this->user=$db->Record;
|
||||
$err->error=0;
|
||||
$db->query("SELECT * FROM local WHERE uid='$cuid';");
|
||||
$this->user = $db->Record;
|
||||
$err->error = 0;
|
||||
$db->query("SELECT * FROM local WHERE uid = '$cuid';");
|
||||
if ($db->num_rows()) {
|
||||
$db->next_record();
|
||||
$this->local=$db->Record;
|
||||
$this->local = $db->Record;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -352,15 +350,15 @@ class m_mem {
|
|||
function su($uid) {
|
||||
global $cuid,$db,$err,$mysql;
|
||||
if (!$this->olduid)
|
||||
$this->olduid=$cuid;
|
||||
$db->query("select * from membres where uid='$uid';");
|
||||
$this->olduid = $cuid;
|
||||
$db->query("select * from membres where uid = '$uid';");
|
||||
if ($db->num_rows()==0) {
|
||||
$err->raise("mem",_("User or password incorrect"));
|
||||
return false;
|
||||
}
|
||||
$db->next_record();
|
||||
$this->user=$db->Record;
|
||||
$cuid=$db->f("uid");
|
||||
$this->user = $db->Record;
|
||||
$cuid = $db->f("uid");
|
||||
|
||||
$mysql->reload_dbus();
|
||||
return true;
|
||||
|
@ -380,7 +378,7 @@ class m_mem {
|
|||
if (!$this->olduid)
|
||||
return false;
|
||||
$this->su($this->olduid);
|
||||
$this->olduid=0;
|
||||
$this->olduid = 0;
|
||||
$mysql->reload_dbus();
|
||||
return true;
|
||||
}
|
||||
|
@ -400,19 +398,19 @@ class m_mem {
|
|||
*/
|
||||
function del_session() {
|
||||
global $db,$err,$cuid,$classes,$hooks;
|
||||
$_COOKIE["session"]=addslashes(isset($_COOKIE["session"])?$_COOKIE["session"]:'');
|
||||
$_COOKIE["session"] = addslashes(isset($_COOKIE["session"])?$_COOKIE["session"]:'');
|
||||
setcookie("session","",0,"/");
|
||||
setcookie("oldid","",0,"/");
|
||||
if ($_COOKIE["session"]=="") {
|
||||
$err->error=0;
|
||||
$err->error = 0;
|
||||
return true;
|
||||
}
|
||||
if (strlen($_COOKIE["session"])!=32) {
|
||||
$err->raise("mem",_("Cookie incorrect, please accept the session cookie"));
|
||||
return false;
|
||||
}
|
||||
$ip=get_remote_ip();
|
||||
$db->query("select uid,'$ip' as me,ip from sessions where sid='".$_COOKIE["session"]."'");
|
||||
$ip = get_remote_ip();
|
||||
$db->query("select uid,'$ip' as me,ip from sessions where sid = '".$_COOKIE["session"]."'");
|
||||
if ($db->num_rows()==0) {
|
||||
$err->raise("mem",_("Session unknown, contact the administrator"));
|
||||
return false;
|
||||
|
@ -422,9 +420,9 @@ class m_mem {
|
|||
$err->raise("mem",_("IP address incorrect, please contact the administrator"));
|
||||
return false;
|
||||
}
|
||||
$cuid=$db->f("uid");
|
||||
$db->query("delete from sessions where sid='".$_COOKIE["session"]."';");
|
||||
$err->error=0;
|
||||
$cuid = $db->f("uid");
|
||||
$db->query("delete from sessions where sid = '".$_COOKIE["session"]."';");
|
||||
$err->error = 0;
|
||||
|
||||
# Invoker le logout dans toutes les autres classes
|
||||
|
||||
|
@ -455,9 +453,9 @@ class m_mem {
|
|||
function passwd($oldpass,$newpass,$newpass2) {
|
||||
global $db,$err,$cuid,$admin;
|
||||
$err->log("mem","passwd");
|
||||
$oldpass=stripslashes($oldpass);
|
||||
$newpass=stripslashes($newpass);
|
||||
$newpass2=stripslashes($newpass2);
|
||||
$oldpass = stripslashes($oldpass);
|
||||
$newpass = stripslashes($newpass);
|
||||
$newpass2 = stripslashes($newpass2);
|
||||
if (!$this->user["canpass"]) {
|
||||
$err->raise("mem",_("You are not allowed to change your password."));
|
||||
return false;
|
||||
|
@ -470,20 +468,20 @@ class m_mem {
|
|||
$err->raise("mem",_("The new passwords are differents, please retry"));
|
||||
return false;
|
||||
}
|
||||
$db->query("SELECT login FROM membres WHERE uid='$cuid';");
|
||||
$db->query("SELECT login FROM membres WHERE uid = '$cuid';");
|
||||
$db->next_record();
|
||||
$login=$db->Record["login"];
|
||||
$login = $db->Record["login"];
|
||||
if (!$admin->checkPolicy("mem",$login,$newpass)) {
|
||||
return false; // The error has been raised by checkPolicy()
|
||||
}
|
||||
$newpass=_md5cr($newpass);
|
||||
$db->query("UPDATE membres SET pass='$newpass' WHERE uid='$cuid';");
|
||||
$err->error=0;
|
||||
$newpass = _md5cr($newpass);
|
||||
$db->query("UPDATE membres SET pass = '$newpass' WHERE uid = '$cuid';");
|
||||
$err->error = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Change les pr<EFBFBD>f<EFBFBD>rences administrateur d'un compte
|
||||
* @param integer $admlist Mode de visualisation des membres (0=large 1=courte)
|
||||
* @param integer $admlist Mode de visualisation des membres (0 = large 1 = courte)
|
||||
* @return boolean TRUE si les pr<EFBFBD>f<EFBFBD>rences ont <EFBFBD>t<EFBFBD> chang<EFBFBD>es, FALSE sinon.
|
||||
*/
|
||||
/**
|
||||
|
@ -501,8 +499,8 @@ class m_mem {
|
|||
$err->raise("mem",_("You must be a system administrator to do this."));
|
||||
return false;
|
||||
}
|
||||
$db->query("UPDATE membres SET admlist='$admlist' WHERE uid='$cuid';");
|
||||
$err->error=0;
|
||||
$db->query("UPDATE membres SET admlist = '$admlist' WHERE uid = '$cuid';");
|
||||
$err->error = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -524,7 +522,7 @@ class m_mem {
|
|||
function send_pass($login) {
|
||||
global $err,$db,$L_HOSTING,$L_FQDN;
|
||||
$err->log("mem","send_pass");
|
||||
$db->query("SELECT * FROM membres WHERE login='$login';");
|
||||
$db->query("SELECT * FROM membres WHERE login = '$login';");
|
||||
if (!$db->num_rows()) {
|
||||
$err->raise("mem",_("This account is locked, contact the administrator."));
|
||||
return false;
|
||||
|
@ -534,7 +532,7 @@ class m_mem {
|
|||
$err->raise("mem",_("The new passwords are differents, please retry"));
|
||||
return false;
|
||||
}
|
||||
$txt=sprintf(_("Hello,
|
||||
$txt = sprintf(_("Hello,
|
||||
|
||||
You requested the modification of your password for your
|
||||
account %s on %s
|
||||
|
@ -554,7 +552,7 @@ If it happens again, please contact your server's Administrator.
|
|||
Cordially.
|
||||
"), $login, $L_HOSTING, $db->f("login"), $db->f("pass"));
|
||||
mail($db->f("mail"),"Your password on $L_HOSTING",$txt,"From: postmaster@$L_FQDN\nReply-to: postmaster@$L_FQDN");
|
||||
$db->query("UPDATE membres SET lastaskpass=".time()." WHERE login='$login';");
|
||||
$db->query("UPDATE membres SET lastaskpass = ".time()." WHERE login = '$login';");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -576,17 +574,17 @@ Cordially.
|
|||
function ChangeMail1($newmail) {
|
||||
global $err,$db,$L_HOSTING,$L_FQDN,$cuid;
|
||||
$err->log("mem","changemail1",$newmail);
|
||||
$db->query("SELECT * FROM membres WHERE uid='$cuid';");
|
||||
$db->query("SELECT * FROM membres WHERE uid = '$cuid';");
|
||||
if (!$db->num_rows()) {
|
||||
$err->raise("mem",_("This account is locked, contact the administrator"));
|
||||
return false;
|
||||
}
|
||||
$db->next_record();
|
||||
|
||||
$COOKIE=substr(md5(uniqid(rand(), true)),0,20);
|
||||
$KEY=substr(md5(uniqid(rand(), true)),0,6);
|
||||
$link="https://$L_FQDN/mem_cm.php?usr=$cuid&cookie=$COOKIE";
|
||||
$txt=sprintf(_("Hello,
|
||||
$COOKIE = substr(md5(uniqid(rand(), true)),0,20);
|
||||
$KEY = substr(md5(uniqid(rand(), true)),0,6);
|
||||
$link = "https://$L_FQDN/mem_cm.php?usr = $cuid&cookie = $COOKIE";
|
||||
$txt = sprintf(_("Hello,
|
||||
|
||||
Someone (maybe you) requested an email's address modification of the account
|
||||
%s on %s
|
||||
|
@ -606,9 +604,9 @@ again, please contact your server's administrator.
|
|||
Cordially.
|
||||
"), $db->f("login"), $L_HOSTING, $link);
|
||||
mail($newmail,"Email modification request on $L_HOSTING",$txt,"From: postmaster@$L_FQDN\nReply-to: postmaster@$L_FQDN");
|
||||
$db->query("DELETE FROM chgmail WHERE uid='$cuid';");
|
||||
$db->query("DELETE FROM chgmail WHERE uid = '$cuid';");
|
||||
$db->query("INSERT INTO chgmail (cookie,ckey,uid,mail,ts) VALUES ('$COOKIE','$KEY','$cuid','$newmail',".time().");");
|
||||
$lts=time()-86400;
|
||||
$lts = time()-86400;
|
||||
$db->query("DELETE FROM chgmail WHERE ts<'$lts';");
|
||||
return $KEY;
|
||||
}
|
||||
|
@ -633,17 +631,17 @@ Cordially.
|
|||
function ChangeMail2($COOKIE,$KEY,$uid) {
|
||||
global $err,$db,$L_HOSTING,$L_FQDN;
|
||||
$err->log("mem","changemail2",$uid);
|
||||
$db->query("SELECT * FROM chgmail WHERE cookie='$COOKIE' and ckey='$KEY' and uid='$uid';");
|
||||
$db->query("SELECT * FROM chgmail WHERE cookie = '$COOKIE' and ckey = '$KEY' and uid = '$uid';");
|
||||
if (!$db->num_rows()) {
|
||||
$err->raise("mem",_("The information you entered is incorrect."));
|
||||
return false;
|
||||
}
|
||||
$db->next_record();
|
||||
|
||||
$db->query("UPDATE membres SET mail='".$db->f("mail")."' WHERE uid='$uid';");
|
||||
$db->query("UPDATE membres SET mail = '".$db->f("mail")."' WHERE uid = '$uid';");
|
||||
|
||||
$db->query("DELETE FROM chgmail WHERE uid='$uid';");
|
||||
$lts=time()-86400;
|
||||
$db->query("DELETE FROM chgmail WHERE uid = '$uid';");
|
||||
$lts = time()-86400;
|
||||
$db->query("DELETE FROM chgmail WHERE ts<'$lts';");
|
||||
return true;
|
||||
}
|
||||
|
@ -661,7 +659,7 @@ Cordially.
|
|||
function set_help_param($show) {
|
||||
global $db,$err,$cuid;
|
||||
$err->log("mem","set_help_param",$show);
|
||||
$db->query("UPDATE membres SET show_help='$show' WHERE uid='$cuid';");
|
||||
$db->query("UPDATE membres SET show_help = '$show' WHERE uid = '$cuid';");
|
||||
}
|
||||
|
||||
/** Dit si l'aide en ligne est demand<EFBFBD>e
|
||||
|
@ -686,15 +684,15 @@ Cordially.
|
|||
* @param type $force
|
||||
* @return boolean
|
||||
*/
|
||||
function show_help($file,$force=false) {
|
||||
function show_help($file,$force = false) {
|
||||
global $err;
|
||||
if ($this->user["show_help"] || $force) {
|
||||
$hlp=_("hlp_$file");
|
||||
$hlp = _("hlp_$file");
|
||||
if ($hlp!="hlp_$file") {
|
||||
$hlp=preg_replace(
|
||||
$hlp = preg_replace(
|
||||
"#HELPID_([0-9]*)#",
|
||||
"<a href=\"javascript:help(\\1);\"><img src=\"/aide/help.png\" width=\"17\" height=\"17\" style=\"vertical-align: middle;\" alt=\""._("Help")."\" /></a>",$hlp);
|
||||
echo "<p class=\"hlp\">".$hlp."</p>";
|
||||
"<a href = \"javascript:help(\\1);\"><img src = \"/aide/help.png\" width = \"17\" height = \"17\" style = \"vertical-align: middle;\" alt = \""._("Help")."\" /></a>",$hlp);
|
||||
echo "<p class = \"hlp\">".$hlp."</p>";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -716,7 +714,7 @@ Cordially.
|
|||
function get_creator_by_uid($uid) {
|
||||
global $db,$err;
|
||||
$err->log("dom","get_creator_by_uid");
|
||||
$uid=mysql_real_escape_string(intval($uid));
|
||||
$uid = mysql_real_escape_string(intval($uid));
|
||||
$db->query("select creator from membres where uid = '$uid';");
|
||||
if (! $db->next_record()) return false;
|
||||
return intval($db->f('creator') );
|
||||
|
@ -736,19 +734,19 @@ Cordially.
|
|||
function alternc_export_conf() {
|
||||
global $db,$err;
|
||||
$err->log("mem","export");
|
||||
$str=" <member>\n";
|
||||
$users=$this->user;
|
||||
$str.=" <uid>".$users["uid"]."</uid>\n";
|
||||
$str.=" <login>".$users["login"]."</login>\n";
|
||||
$str.=" <enabled>".$users["enabled"]."</enabled>\n";
|
||||
$str.=" <su>".$users["su"]."</su>\n";
|
||||
$str.=" <password>".$users["pass"]."</password>\n";
|
||||
$str.=" <mail>".$users["mail"]."</mail>\n";
|
||||
$str.=" <created>".$users["created"]."</created>\n";
|
||||
$str.=" <lastip>".$users["lastip"]."</lastip>\n";
|
||||
$str.=" <lastlogin>".$users["lastlogin"]."</lastlogin>\n";
|
||||
$str.=" <lastfail>".$users["lastfail"]."</lastfail>\n";
|
||||
$str.=" </member>\n";
|
||||
$str = " <member>\n";
|
||||
$users = $this->user;
|
||||
$str .= " <uid>".$users["uid"]."</uid>\n";
|
||||
$str .= " <login>".$users["login"]."</login>\n";
|
||||
$str .= " <enabled>".$users["enabled"]."</enabled>\n";
|
||||
$str .= " <su>".$users["su"]."</su>\n";
|
||||
$str .= " <password>".$users["pass"]."</password>\n";
|
||||
$str .= " <mail>".$users["mail"]."</mail>\n";
|
||||
$str .= " <created>".$users["created"]."</created>\n";
|
||||
$str .= " <lastip>".$users["lastip"]."</lastip>\n";
|
||||
$str .= " <lastlogin>".$users["lastlogin"]."</lastlogin>\n";
|
||||
$str .= " <lastfail>".$users["lastfail"]."</lastfail>\n";
|
||||
$str .= " </member>\n";
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
@ -761,12 +759,12 @@ Cordially.
|
|||
function session_tempo_params_get($v) {
|
||||
global $uid;
|
||||
if (empty($_COOKIE['session'])) return false;
|
||||
$sid=$_COOKIE['session'];
|
||||
$sid = $_COOKIE['session'];
|
||||
if ( empty($_SESSION[$sid.'-'.$uid]) ) { // si pas de session de params tempo
|
||||
return false;
|
||||
}
|
||||
$j=$_SESSION[$sid.'-'.$uid];
|
||||
$j=json_decode($j, true);
|
||||
$j = $_SESSION[$sid.'-'.$uid];
|
||||
$j = json_decode($j, true);
|
||||
if ( ! empty($j[$v] ) ) { // si on a bien qque chose a retourner :)
|
||||
return $j[$v];
|
||||
}
|
||||
|
@ -781,20 +779,20 @@ Cordially.
|
|||
* @param type $ecrase
|
||||
* @return boolean
|
||||
*/
|
||||
function session_tempo_params_set($k, $v, $ecrase=false) {
|
||||
function session_tempo_params_set($k, $v, $ecrase = false) {
|
||||
global $uid;
|
||||
if (empty($_COOKIE['session'])) return false;
|
||||
$sid=$_COOKIE['session'];
|
||||
$p=Array();
|
||||
$sid = $_COOKIE['session'];
|
||||
$p = Array();
|
||||
if ( ! empty($_SESSION[$sid.'-'.$uid]) ) {
|
||||
$p = json_decode($_SESSION[$sid.'-'.$uid], true);
|
||||
$p = json_decode($_SESSION[$sid.'-'.$uid], true);
|
||||
}
|
||||
if (! $ecrase && (isset($p[$k]) && is_array($p[$k])) && is_array($v) ) {
|
||||
$v=array_merge($p[$k], $v); // overwrite entry with the same name
|
||||
$v = array_merge($p[$k], $v); // overwrite entry with the same name
|
||||
}
|
||||
|
||||
$p[$k]=$v;
|
||||
$_SESSION[$sid.'-'.$uid]=json_encode($p);
|
||||
$p[$k] = $v;
|
||||
$_SESSION[$sid.'-'.$uid] = json_encode($p);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,8 +133,7 @@ class m_piwik {
|
|||
|
||||
$user_login = $this->clean_user_name($user_login);
|
||||
$user_pass = create_pass();
|
||||
$user_mail = $user_mail ? $user_mail : $mem->user['mail'];
|
||||
$user_mail = create_pass(4) . '@gmail.com'; // FIXME $user_mail; Unicité sur les emails ... Soit on ajoute + random soit, on prompt
|
||||
$user_mail = $mem->user['mail'];
|
||||
$user_alias = $user_login;
|
||||
|
||||
$api_data = $this->call_privileged_page('API', 'UsersManager.addUser', array('userLogin' => $user_login, 'password' => $user_pass, 'email' => $user_mail, 'alias' => $user_alias), 'JSON');
|
||||
|
@ -405,9 +404,10 @@ class m_piwik {
|
|||
* @return boolean
|
||||
*/
|
||||
function site_add($siteName, $urls, $ecommerce = FALSE) {
|
||||
global $db, $cuid;
|
||||
$urls = is_array($urls) ? implode(',', $urls) : $urls;
|
||||
$api_data = $this->call_privileged_page('API', 'SitesManager.addSite', array('siteName' => $siteName, 'urls' => $urls));
|
||||
printvar($api_data);
|
||||
$db->query("INSERT INTO piwik_sites set uid='$cuid', piwik_id='{$api_data->value}'");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,8 @@ class m_piwik {
|
|||
* @return type
|
||||
*/
|
||||
function clean_user_name($username) {
|
||||
return mysql_real_escape_string(trim($username));
|
||||
global $admin, $cuid;
|
||||
return 'alternc_' . $admin->get_login_by_uid($cuid) . '_' . mysql_real_escape_string(trim($username));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
30 4 * * * root /usr/lib/alternc/alternc-awstats
|
||||
30 4 * * * root /usr/lib/alternc/alternc-awstats
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
#!/bin/bash -e
|
||||
|
||||
# Source debconf library.
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
db_capb backup
|
||||
|
||||
|
||||
#Return if everything is good, exit error number otherwise
|
||||
# Validate an IPv4 address.
|
||||
function valid_ip()
|
||||
{
|
||||
local ip=$1
|
||||
|
@ -27,7 +24,7 @@ function valid_ip()
|
|||
}
|
||||
|
||||
|
||||
#checking mysql connectivity and updating local.sh variables accordingly
|
||||
# Checking mysql connectivity and updating local.sh environment variables accordingly
|
||||
check_mysql()
|
||||
{
|
||||
STATE=0
|
||||
|
@ -68,12 +65,9 @@ check_mysql()
|
|||
done
|
||||
}
|
||||
|
||||
# Return the deepest existing directory in a path
|
||||
function get_first_existing_dir()
|
||||
{
|
||||
# Prend en premier parametre un chemin
|
||||
# Retourne le répertoire parent existant le plus "proche"
|
||||
# Exemple: on lui donne /var/www/alternc/gerard/dupont/ mais
|
||||
# seul /var/www/alternc existe, ca répond /var/www/alternc
|
||||
dir="$1"
|
||||
if [ -z "$dir" ] ; then
|
||||
return 0
|
||||
|
@ -86,7 +80,7 @@ function get_first_existing_dir()
|
|||
}
|
||||
|
||||
|
||||
# default values for local.sh
|
||||
# Compute default values for local.sh
|
||||
MYSQL_HOST=127.0.0.1
|
||||
MYSQL_DATABASE=alternc
|
||||
MYSQL_USER=sysusr
|
||||
|
@ -114,6 +108,28 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
|||
if [ -r /etc/alternc/local.sh ]; then
|
||||
# source the current config
|
||||
. /etc/alternc/local.sh
|
||||
# and push it into debconf (its values have priority over anything!)
|
||||
db_set alternc/hostingname "$HOSTING"
|
||||
db_set alternc/desktopname "`echo $FQDN | tr '[:upper:]' '[:lower:]'`"
|
||||
db_set alternc/public_ip "$PUBLIC_IP"
|
||||
db_set alternc/internal_ip "$INTERNAL_IP"
|
||||
db_set alternc/ns1 "$NS1_HOSTNAME"
|
||||
db_set alternc/ns2 "$NS2_HOSTNAME"
|
||||
db_set alternc/default_mx "$DEFAULT_MX"
|
||||
db_set alternc/alternc_html "$ALTERNC_HTML"
|
||||
db_set alternc/alternc_mail "$ALTERNC_MAIL"
|
||||
db_set alternc/alternc_logs "$ALTERNC_LOGS"
|
||||
db_set alternc/monitor_ip "$MONITOR_IP"
|
||||
db_set alternc/default_mx2 "$DEFAULT_SECONDARY_MX"
|
||||
db_set alternc/mysql/host "$MYSQL_HOST"
|
||||
db_set alternc/mysql/db "$MYSQL_DATABASE"
|
||||
db_set alternc/mysql/user "$MYSQL_USER"
|
||||
db_set alternc/mysql/password "$MYSQL_PASS"
|
||||
db_set alternc/mysql/client "$MYSQL_CLIENT"
|
||||
db_set alternc/sql/backup_type "$SQLBACKUP_TYPE"
|
||||
db_set alternc/sql/backup_overwrite "$SQLBACKUP_OVERWRITE"
|
||||
db_set alternc/mysql/alternc_mail_user "$MYSQL_MAIL_USER"
|
||||
db_set alternc/mysql/alternc_mail_password "$MYSQL_MAIL_PASS"
|
||||
fi
|
||||
# upgrade <= 3.0 to >= 3.1
|
||||
if [ "x$ALTERNC_LOC" != "x" ]; then
|
||||
|
@ -121,7 +137,7 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
|||
ALTERNC_MAIL="$ALTERNC_LOC/mail"
|
||||
fi
|
||||
|
||||
#We ask for the hosting name and the FQDN
|
||||
# We ask for the hosting name and the FQDN
|
||||
db_get alternc/hostingname
|
||||
if [ -z "$RET" ]; then
|
||||
db_set alternc/hostingname "$HOSTING"
|
||||
|
@ -135,13 +151,12 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
|||
db_set alternc/desktopname "$FQDN"
|
||||
db_input high alternc/desktopname || true
|
||||
fi
|
||||
# Be sure that the FQDN is lowercase (Bug #1405)
|
||||
# Ensure that the FQDN is lowercase (Fixes #1405)
|
||||
db_get alternc/desktopname
|
||||
db_set alternc/desktopname "`echo $RET | tr '[:upper:]' '[:lower:]'`"
|
||||
# End bug #1405
|
||||
;;
|
||||
3)
|
||||
#we ask for the public and private ip
|
||||
# Ask for the public and private ip
|
||||
db_get alternc/public_ip
|
||||
if [ -z "$RET" ]; then
|
||||
db_set alternc/public_ip "$PUBLIC_IP"
|
||||
|
@ -172,7 +187,7 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
|||
done
|
||||
;;
|
||||
4)
|
||||
#private IP
|
||||
# Private IP
|
||||
db_get alternc/internal_ip
|
||||
if [ -z "$RET" ]; then
|
||||
db_set alternc/internal_ip "$INTERNAL_IP"
|
||||
|
@ -190,7 +205,7 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
|||
done
|
||||
;;
|
||||
5)
|
||||
#We ask for the DNS server for the ip
|
||||
# Ask for the DNS servers
|
||||
db_get alternc/ns1
|
||||
if [ -z "$RET" ]; then
|
||||
db_set alternc/ns1 "$NS1_HOSTNAME"
|
||||
|
@ -225,7 +240,7 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
|||
10)
|
||||
db_get alternc/use_remote_mysql
|
||||
if [ "$RET" == "true" ]; then
|
||||
# user want to use a remote server
|
||||
# User want to use a remote server
|
||||
check_mysql
|
||||
fi
|
||||
;;
|
||||
|
@ -240,10 +255,10 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
|||
db_get alternc/alternc_html
|
||||
|
||||
ALTERNC_HTML="$RET"
|
||||
#checking acl and quota activation.
|
||||
# Checking acl and quota activation.
|
||||
basedir=`get_first_existing_dir "$ALTERNC_HTML"`;
|
||||
MOUNT_POINT=$(df -P ${basedir} | tail -n 1 | awk '{print $6}')
|
||||
#we get the first existing dir
|
||||
# Get the first existing dir
|
||||
aclcheckfile="$basedir/test-acl"
|
||||
touch "$aclcheckfile"
|
||||
setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null || (
|
||||
|
@ -259,7 +274,6 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
|||
if [ -z "$RET" ]; then
|
||||
db_input critical alternc/quotauninstalled || true
|
||||
db_go
|
||||
#db_reset alternc/quotauninstalled || true
|
||||
db_set alternc/quotauninstalled "false" || true
|
||||
fi
|
||||
)
|
||||
|
@ -323,8 +337,8 @@ if [ -z "$RET" ]; then
|
|||
db_set alternc/mysql/host "$MYSQL_HOST"
|
||||
fi
|
||||
|
||||
#Even if we asked the question concerning the database earlier in the process
|
||||
#those calls are needed to pass the variable of remote sql server to AlternC
|
||||
# Even if we asked the question concerning the database earlier in the process
|
||||
# Those calls are needed to pass the variable of remote sql server to AlternC
|
||||
db_get alternc/mysql/db
|
||||
if [ -z "$RET" ]; then
|
||||
db_set alternc/mysql/db "$MYSQL_DATABASE"
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
alternc (3.3~rc1) stable; urgency=low
|
||||
|
||||
* unofficial Prerelease of AlternC 3.3
|
||||
* update_domaines now in PHP and using classes and hooks instead of BASH
|
||||
|
||||
-- Benjamin Sonntag <benjamin@sonntag.fr> Thu, 26 Jun 2014 15:13:00 +0200
|
||||
|
||||
alternc (3.2.1) stable; urgency=low
|
||||
|
||||
* Version identical to 3.1 for Squeeze
|
||||
* Includes a small dovecot patch / dependency for dovecot 2.0 for Wheezy
|
||||
|
||||
-- Benjamin Sonntag <benjamin@sonntag.fr> Thu, 28 Mar 2014 18:19:00 +0200
|
||||
|
||||
alternc (3.1.1) oldstable; urgency=low
|
||||
|
||||
* many bugfixed from 3.1 / 3.2 :
|
||||
|
|
|
@ -9,7 +9,7 @@ Standards-Version: 3.9.4
|
|||
Package: alternc
|
||||
Architecture: all
|
||||
Pre-depends: debconf (>= 0.5.00) | debconf-2.0, bash (>= 4), acl
|
||||
Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, bind9, wget, rsync, ca-certificates, locales, perl-suid | perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), sudo, adduser, mysql-client, dnsutils, dovecot-common (>=1:1.2.15), dovecot-common(<< 1:2.0), dovecot-imapd (>= 1:1.2.15), dovecot-pop3d (>= 1:1.2.15), vlogger, mailutils | mailx, incron, cron, opendkim, mysql-client(>= 5.0), ${misc:Depends}
|
||||
Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, bind9, wget, rsync, ca-certificates, locales, perl-suid | perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), sudo, adduser, mysql-client, dnsutils, dovecot-common (>=1:2.1.7), dovecot-imapd, dovecot-pop3d, dovecot-mysql, vlogger, mailutils | mailx, incron, cron, opendkim, opendkim-tools, dovecot-sieve, dovecot-managesieved, ${misc:Depends}
|
||||
Recommends: mysql-server(>= 5.0), ntp, quota, unzip, bzip2
|
||||
Conflicts: alternc-admintools, alternc-awstats (<< 1.0), alternc-webalizer (<= 0.9.4), alternc-mailman (<< 2.0), courier-authlib
|
||||
Provides: alternc-admintools
|
||||
|
@ -38,8 +38,8 @@ Description-fr.UTF-8: Suite logicielle d'hébergement mutualisé pour Debian
|
|||
Package: alternc-slave
|
||||
Architecture: all
|
||||
Pre-depends: debconf (>= 0.5.00) | debconf-2.0, acl
|
||||
Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, postfix-tls, bind9, wget, rsync, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), adduser, mysql-client, sudo, dovecot-common (>= 1:1.2.15), dovecot-imapd, dovecot-pop3d, vlogger, mailutils | mailx, incron, cron, opendkim, ${misc:Depends}
|
||||
Recommends: dovecot-managesieved, dovecot-sieve, dovecot-mysql, quota
|
||||
Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, postfix-tls, bind9, wget, rsync, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), adduser, mysql-client, sudo, dovecot-common (>= 1:2.1.7), dovecot-imapd, dovecot-pop3d, dovecot-mysql, vlogger, mailutils | mailx, incron, cron, opendkim, opendkim-tools, dovecot-managesieved, dovecot-sieve, dovecot-mysql, ${misc:Depends}
|
||||
Recommends: quota
|
||||
Conflicts: alternc-admintools, alternc-awstats (<= 0.3.2), alternc-webalizer (<= 0.9.4), alternc
|
||||
Provides: alternc
|
||||
Replaces: alternc
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
# AUTO GENERATED FILE
|
||||
# Modify template in /etc/alternc/templates/
|
||||
# and launch alternc.install if you want
|
||||
# to modify this file.
|
||||
#
|
||||
|
||||
connect=host=%%dbhost%% dbname=%%dbname%% user=%%db_mail_user%% password=%%db_mail_pwd%%
|
||||
#connect = host=localhost dbname=mails user=testuser password=pass
|
||||
|
||||
# CREATE TABLE quota (
|
||||
# username varchar(100) not null,
|
||||
# bytes bigint not null default 0,
|
||||
# messages integer not null default 0,
|
||||
# primary key (username)
|
||||
# );
|
||||
|
||||
map {
|
||||
pattern = priv/quota/storage
|
||||
table = dovecot_view
|
||||
username_field = user
|
||||
value_field = quota_dovecot
|
||||
}
|
||||
map {
|
||||
pattern = priv/quota/messages
|
||||
table = dovecot_view
|
||||
username_field = user
|
||||
value_field = nb_messages
|
||||
}
|
||||
|
||||
# CREATE TABLE expires (
|
||||
# username varchar(100) not null,
|
||||
# mailbox varchar(255) not null,
|
||||
# expire_stamp integer not null,
|
||||
# primary key (username, mailbox)
|
||||
# );
|
||||
|
||||
#map {
|
||||
# pattern = shared/expire/$user/$mailbox
|
||||
# table = expires
|
||||
# value_field = expire_stamp
|
||||
|
||||
# fields {
|
||||
# username = $user
|
||||
# mailbox = $mailbox
|
||||
# }
|
||||
#}
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
# AUTO GENERATED FILE
|
||||
# Modify template in /etc/alternc/templates/
|
||||
# and launch alternc.install if you want
|
||||
# to modify this file.
|
||||
#
|
||||
|
||||
# This file is opened as root, so it should be owned by root and mode 0600.
|
||||
#
|
||||
# http://wiki.dovecot.org/AuthDatabase/SQL
|
||||
#
|
||||
# For the sql passdb module, you'll need a database with a table that
|
||||
# contains fields for at least the username and password. If you want to
|
||||
# use the user@domain syntax, you might want to have a separate domain
|
||||
# field as well.
|
||||
#
|
||||
# If your users all have the same uig/gid, and have predictable home
|
||||
# directories, you can use the static userdb module to generate the home
|
||||
# dir based on the username and domain. In this case, you won't need fields
|
||||
# for home, uid, or gid in the database.
|
||||
#
|
||||
# If you prefer to use the sql userdb module, you'll want to add fields
|
||||
# for home, uid, and gid. Here is an example table:
|
||||
#
|
||||
# CREATE TABLE users (
|
||||
# username VARCHAR(128) NOT NULL,
|
||||
# domain VARCHAR(128) NOT NULL,
|
||||
# password VARCHAR(64) NOT NULL,
|
||||
# home VARCHAR(255) NOT NULL,
|
||||
# uid INTEGER NOT NULL,
|
||||
# gid INTEGER NOT NULL,
|
||||
# active CHAR(1) DEFAULT 'Y' NOT NULL
|
||||
# );
|
||||
|
||||
# Database driver: mysql, pgsql, sqlite
|
||||
driver = mysql
|
||||
|
||||
# Database connection string. This is driver-specific setting.
|
||||
#
|
||||
# pgsql:
|
||||
# For available options, see the PostgreSQL documention for the
|
||||
# PQconnectdb function of libpq.
|
||||
#
|
||||
# mysql:
|
||||
# Basic options emulate PostgreSQL option names:
|
||||
# host, port, user, password, dbname
|
||||
#
|
||||
# But also adds some new settings:
|
||||
# client_flags - See MySQL manual
|
||||
# ssl_ca, ssl_ca_path - Set either one or both to enable SSL
|
||||
# ssl_cert, ssl_key - For sending client-side certificates to server
|
||||
# ssl_cipher - Set minimum allowed cipher security (default: HIGH)
|
||||
# option_file - Read options from the given file instead of
|
||||
# the default my.cnf location
|
||||
# option_group - Read options from the given group (default: client)
|
||||
#
|
||||
# You can connect to UNIX sockets by using host: host=/var/run/mysqld/mysqld.sock
|
||||
# Note that currently you can't use spaces in parameters.
|
||||
#
|
||||
# MySQL supports multiple host parameters for load balancing / HA.
|
||||
#
|
||||
# sqlite:
|
||||
# The path to the database file.
|
||||
#
|
||||
# Examples:
|
||||
# connect = host=192.168.1.1 dbname=users
|
||||
# connect = host=sql.example.com dbname=virtual user=virtual password=blarg
|
||||
# connect = /etc/dovecot/authdb.sqlite
|
||||
#
|
||||
connect = host=%%dbhost%% dbname=%%dbname%% user=%%db_mail_user%% password=%%db_mail_pwd%%
|
||||
|
||||
# Default password scheme.
|
||||
#
|
||||
# List of supported schemes is in
|
||||
# http://wiki.dovecot.org/Authentication/PasswordSchemes
|
||||
#
|
||||
default_pass_scheme = MD5
|
||||
|
||||
# passdb query to retrieve the password. It can return fields:
|
||||
# password - The user's password. This field must be returned.
|
||||
# user - user@domain from the database. Needed with case-insensitive lookups.
|
||||
# username and domain - An alternative way to represent the "user" field.
|
||||
#
|
||||
# The "user" field is often necessary with case-insensitive lookups to avoid
|
||||
# e.g. "name" and "nAme" logins creating two different mail directories. If
|
||||
# your user and domain names are in separate fields, you can return "username"
|
||||
# and "domain" fields instead of "user".
|
||||
#
|
||||
# The query can also return other fields which have a special meaning, see
|
||||
# http://wiki.dovecot.org/PasswordDatabase/ExtraFields
|
||||
#
|
||||
# Commonly used available substitutions (see http://wiki.dovecot.org/Variables
|
||||
# for full list):
|
||||
# %u = entire user@domain
|
||||
# %n = user part of user@domain
|
||||
# %d = domain part of user@domain
|
||||
#
|
||||
# Note that these can be used only as input to SQL query. If the query outputs
|
||||
# any of these substitutions, they're not touched. Otherwise it would be
|
||||
# difficult to have eg. usernames containing '%' characters.
|
||||
#
|
||||
# Example:
|
||||
# password_query = SELECT userid AS user, pw AS password \
|
||||
# FROM users WHERE userid = '%u' AND active = 'Y'
|
||||
#
|
||||
#password_query = \
|
||||
# SELECT username, domain, password \
|
||||
# FROM users WHERE username = '%n' AND domain = '%d'
|
||||
|
||||
# userdb query to retrieve the user information. It can return fields:
|
||||
# uid - System UID (overrides mail_uid setting)
|
||||
# gid - System GID (overrides mail_gid setting)
|
||||
# home - Home directory
|
||||
# mail - Mail location (overrides mail_location setting)
|
||||
#
|
||||
# None of these are strictly required. If you use a single UID and GID, and
|
||||
# home or mail directory fits to a template string, you could use userdb static
|
||||
# instead. For a list of all fields that can be returned, see
|
||||
# http://wiki.dovecot.org/UserDatabase/ExtraFields
|
||||
#
|
||||
# Examples:
|
||||
# user_query = SELECT home, uid, gid FROM users WHERE userid = '%u'
|
||||
# user_query = SELECT dir AS home, user AS uid, group AS gid FROM users where userid = '%u'
|
||||
# user_query = SELECT home, 501 AS uid, 501 AS gid FROM users WHERE userid = '%u'
|
||||
#
|
||||
user_query = SELECT userdb_home AS home, userdb_uid AS uid, 1998 AS gid, userdb_quota_rule AS quota_rule FROM dovecot_view WHERE user = '%u';
|
||||
|
||||
# If you wish to avoid two SQL lookups (passdb + userdb), you can use
|
||||
# userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll
|
||||
# also have to return userdb fields in password_query prefixed with "userdb_"
|
||||
# string. For example:
|
||||
password_query = SELECT user, password, userdb_home, userdb_uid, 1998 AS userdb_gid,userdb_quota_rule FROM dovecot_view where user= '%u';
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -113,6 +113,6 @@ mailman unix - n n - - pipe
|
|||
${nexthop} ${user}
|
||||
#dovecot LDA, as explained here: http://wiki.dovecot.org/LDA/Postfix
|
||||
dovecot unix - n n - 0 pipe
|
||||
flags=DRhu user=vmail:vmail argv=/usr/bin/sudo /usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
|
||||
flags=DRhu user=vmail:vmail argv=/usr/bin/sudo /usr/lib/dovecot/deliver -f ${sender} -a ${recipient} -d ${user}@${nexthop}
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ if [ -e /etc/default/saslauthd ]; then
|
|||
fi
|
||||
|
||||
if [ -e /etc/dovecot/dovecot.conf ]; then
|
||||
CONFIG_FILES="$CONFIG_FILES etc/dovecot/dovecot.conf etc/dovecot/dovecot-sql.conf etc/dovecot/dovecot-dict-quota.conf"
|
||||
CONFIG_FILES="$CONFIG_FILES etc/dovecot/alternc-sql.conf etc/dovecot/alternc-dict-quota.conf etc/dovecot/conf.d/95_alternc.conf"
|
||||
fi
|
||||
|
||||
INSTALLED_CONFIG_TAR="/var/lib/alternc/backups/etc-installed.tar.gz"
|
||||
|
@ -315,7 +315,7 @@ if [ -x /usr/sbin/apache2 ]; then
|
|||
fi
|
||||
|
||||
# We enable dovecot SSL certificate instructions: (on wheezy we should use a new file in /etc/dovecot/conf.d/ )
|
||||
sed -i -e 's#^ssl_cert_file.*$#ssl_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem#' -e 's#^ssl_key_file.*$#ssl_key_file = /etc/ssl/private/ssl-cert-snakeoil.key#' /etc/dovecot/dovecot.conf
|
||||
( echo "ssl_cert = </etc/alternc/apache.pem" ; echo "ssl_key = </etc/alternc/apache.pem" ) >/etc/dovecot/conf.d/96_ssl.conf
|
||||
|
||||
else
|
||||
# We disable proftpd tls module
|
||||
|
@ -324,7 +324,7 @@ if [ -x /usr/sbin/apache2 ]; then
|
|||
cp /etc/proftpd/modules.conf /etc/alternc/templates/proftpd/
|
||||
|
||||
# We disable dovecot SSL certificate instructions: (on wheezy we should remove a file in /etc/dovecot/conf.d/ )
|
||||
sed -i -e 's#^ssl_cert_file.*$#ssl_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem#' -e 's#^ssl_key_file.*$#ssl_key_file = /etc/ssl/private/ssl-cert-snakeoil.key#' /etc/dovecot/dovecot.conf
|
||||
( echo "ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem" ; echo "ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key" ) >/etc/dovecot/conf.d/96_ssl.conf
|
||||
|
||||
echo "SSL not configured"
|
||||
echo "create a certificate in /etc/alternc/apache.pem and rerun alternc.install"
|
||||
|
@ -569,9 +569,11 @@ if [ "$HAS_ROOT" != "1" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
#giving vmail user read access on dovecot sql file
|
||||
chgrp vmail /etc/dovecot/dovecot.conf
|
||||
chmod g+r /etc/dovecot/dovecot.conf
|
||||
# giving vmail user read access on dovecot sql file
|
||||
chgrp vmail /etc/dovecot/alternc-sql.conf
|
||||
chmod g+r /etc/dovecot/alternc-sql.conf
|
||||
# Override some dovecot 2.0 configuration that may have happened during dovecot postinst:
|
||||
sed -i -e 's/^ *!include/#!include/' /etc/dovecot/conf.d/10-auth.conf
|
||||
|
||||
# Changing owner of web panel's files
|
||||
chown -R alterncpanel:alterncpanel "/usr/share/alternc/panel/"
|
||||
|
|
|
@ -2,7 +2,7 @@ membres:
|
|||
-
|
||||
uid : 2000
|
||||
login : admin
|
||||
pass : admin
|
||||
pass : $1$GB4d6Hq7$HxND.Qbn5xDuO3xCbW/dV/
|
||||
enabled : 1
|
||||
su : 1
|
||||
mail : root@alternc.org
|
||||
|
@ -13,7 +13,7 @@ membres:
|
|||
-
|
||||
uid : 2001
|
||||
login : phpunit
|
||||
pass : phpunit
|
||||
pass : phqzC1nAjK7Vs
|
||||
enabled : 1
|
||||
su : 0
|
||||
mail : phpunit@alternc.org
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-13 at 15:55:58.
|
||||
*/
|
||||
class m_adminTest extends PHPUnit_Framework_TestCase
|
||||
class m_adminTest extends AlterncTest
|
||||
{
|
||||
/**
|
||||
* @var m_admin
|
||||
|
@ -15,10 +15,39 @@ class m_adminTest extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $mem;
|
||||
parent::setUp();
|
||||
$this->object = new m_admin;
|
||||
$mem = new m_mem();
|
||||
$mem->user["su"] = 1;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Extensions_Database_DataSet_IDataSet
|
||||
*/
|
||||
public function getDataSet() {
|
||||
|
||||
$dataset_file = "membres.yml";
|
||||
// $list = array(
|
||||
// "testPurge" => "actions-purgeable.yml",
|
||||
// "testGet_action" => "actions-purgeable.yml",
|
||||
// "testGet_old" => "actions-purgeable.yml",
|
||||
// "testFinish" => "actions-purgeable.yml",
|
||||
// "testReset_job" => "actions-began.yml",
|
||||
// "testGet_job" => "actions-ready.yml",
|
||||
// "testCancel" => "actions-purgeable.yml",
|
||||
// "default" => "actions-purgeable.yml"
|
||||
// );
|
||||
// if (isset($list[$this->getName()])) {
|
||||
// $dataset_file = $list[$this->getName()];
|
||||
// } else {
|
||||
// $dataset_file = "actions-empty.yml";
|
||||
// }
|
||||
return parent::loadDataSet($dataset_file);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
|
@ -30,14 +59,11 @@ class m_adminTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers m_admin::hook_menu
|
||||
* @todo Implement testHook_menu().
|
||||
*/
|
||||
public function testHook_menu()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$result = $this->object->hook_menu();
|
||||
$this->assertInternalType("array",$result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -118,10 +118,13 @@ class m_ftpTest extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testCheck_login()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
// Allowed
|
||||
$this->assertTrue($this->object->check_login('plop'));
|
||||
$this->assertTrue($this->object->check_login('00'));
|
||||
|
||||
// Forbidden
|
||||
$this->assertFalse($this->object->check_login('_plop'));
|
||||
$this->assertFalse($this->object->check_login('arf+'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,9 +241,6 @@ class m_ftpTest extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testHook_upnp_list()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->assertArrayHasKey('ftp', $this->object->hook_upnp_list());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,13 @@
|
|||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-03-13 at 15:55:59.
|
||||
*/
|
||||
class m_memTest extends PHPUnit_Framework_TestCase
|
||||
class m_memTest extends AlterncTest
|
||||
{
|
||||
|
||||
protected $login = "phpunit";
|
||||
protected $pass = "phpunit";
|
||||
|
||||
|
||||
/**
|
||||
* @var m_mem
|
||||
*/
|
||||
|
@ -19,6 +24,31 @@ class m_memTest extends PHPUnit_Framework_TestCase
|
|||
$this->object = new m_mem;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Extensions_Database_DataSet_IDataSet
|
||||
*/
|
||||
public function getDataSet() {
|
||||
|
||||
$dataset_file = "membres.yml";
|
||||
// $list = array(
|
||||
// "testPurge" => "actions-purgeable.yml",
|
||||
// "testGet_action" => "actions-purgeable.yml",
|
||||
// "testGet_old" => "actions-purgeable.yml",
|
||||
// "testFinish" => "actions-purgeable.yml",
|
||||
// "testReset_job" => "actions-began.yml",
|
||||
// "testGet_job" => "actions-ready.yml",
|
||||
// "testCancel" => "actions-purgeable.yml",
|
||||
// "default" => "actions-purgeable.yml"
|
||||
// );
|
||||
// if (isset($list[$this->getName()])) {
|
||||
// $dataset_file = $list[$this->getName()];
|
||||
// } else {
|
||||
// $dataset_file = "actions-empty.yml";
|
||||
// }
|
||||
return parent::loadDataSet($dataset_file);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
|
@ -30,26 +60,21 @@ class m_memTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @covers m_mem::alternc_password_policy
|
||||
* @todo Implement testAlternc_password_policy().
|
||||
*/
|
||||
public function testAlternc_password_policy()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
|
||||
$result = $this->object->alternc_password_policy();
|
||||
$this->assertInternalType("array",$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers m_mem::hook_menu
|
||||
* @todo Implement testHook_menu().
|
||||
*/
|
||||
public function testHook_menu()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$result = $this->object->hook_menu();
|
||||
$this->assertInternalType("array",$result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,22 +83,35 @@ class m_memTest extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testCheckright()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$result = $this->object->checkright();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers m_mem::login
|
||||
* @todo Implement testLogin().
|
||||
*/
|
||||
public function testLogin()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$result = $this->object->login($this->login, $this->pass);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers m_mem::login
|
||||
*/
|
||||
public function testWrongLogin()
|
||||
{
|
||||
$result = $this->object->login($this->login, "null");
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers m_mem::login
|
||||
*/
|
||||
public function testWrongIPLogin()
|
||||
{
|
||||
$result = $this->object->login($this->login, $this->pass, true);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/***********************************************************************/
|
||||
|
||||
// managesieve server port
|
||||
$rcmail_config['managesieve_port'] = 2000;
|
||||
$rcmail_config['managesieve_port'] = 4190;
|
||||
|
||||
// managesieve server address, default is localhost.
|
||||
// Replacement variables supported in host name:
|
||||
|
|
|
@ -17,4 +17,4 @@ done
|
|||
stop_if_jobs_locked
|
||||
|
||||
# ALTERNC_LOGS is from local.sh
|
||||
nice -n 10 find "$ALTERNC_LOGS" -mtime +$DAYS -delete
|
||||
find "$ALTERNC_LOGS" -mtime +$DAYS -delete
|
||||
|
|
|
@ -4,55 +4,111 @@
|
|||
#You can call this script either without arguments, inwich case each maildir quotas will be recalculated
|
||||
#or you can call it with a directory reffering to a maildir to just sync one mailbox
|
||||
|
||||
#basic checks
|
||||
if [ $# -gt 1 ]; then
|
||||
echo "usage : update_quota_mail.sh (Maildir)."
|
||||
function showhelp() {
|
||||
echo "FIXME: some help"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# -eq 1 ];then
|
||||
if [ ! -d "$1" ];then
|
||||
echo "$1 is not a directory, aborting."
|
||||
|
||||
# Generate the $maildirs list based on the arguments
|
||||
while getopts "a:m:d:c:" optname
|
||||
do
|
||||
case "$optname" in
|
||||
"a")
|
||||
# All mails
|
||||
# FIXME replace it by a select in da DB
|
||||
maildirs=`find "$ALTERNC_MAIL/" -maxdepth 2 -mindepth 2 -type d`
|
||||
;;
|
||||
"m")
|
||||
# An email
|
||||
if [[ "$OPTARG" =~ ^[^\@]*@[^\@]*$ ]] ; then
|
||||
if [[ "$(mysql_query "select userdb_home from dovecot_view where user = '$OPTARG'")" ]]; then
|
||||
maildirs=$(mysql_query "select userdb_home from dovecot_view where user = '$OPTARG'")
|
||||
else
|
||||
echo "Bad mail provided"
|
||||
showhelp
|
||||
fi
|
||||
else
|
||||
echo "Bad mail provided"
|
||||
showhelp
|
||||
fi
|
||||
;;
|
||||
"d")
|
||||
# Expecting a domain
|
||||
|
||||
# Check if domain is well-formed
|
||||
if [[ ! "$OPTARG" =~ ^[a-z\-]+(\.[a-z\-]+)+$ ]] ; then
|
||||
echo "Bad domain provided"
|
||||
showhelp
|
||||
fi
|
||||
|
||||
# Attemp to get from database.
|
||||
if [[ ! "$(mysql_query "select domaine from domaines where domaine = '$OPTARG'")" ]]; then
|
||||
# Seem to be empty
|
||||
echo "Bad domain provided"
|
||||
showhelp
|
||||
fi
|
||||
|
||||
maildirs=$(mysql_query "select userdb_home from dovecot_view where user like '%@$OPTARG'")
|
||||
;;
|
||||
"c")
|
||||
# An account
|
||||
if [[ "$OPTARG" =~ ^[a-z]*$ ]] ; then
|
||||
if [[ "$(mysql_query "select domaine from domaines where domaine = '$1'")" ]]; then
|
||||
maildirs=$(mysql_query "select userdb_home from dovecot_view where userdb_uid = $OPTARG")
|
||||
else
|
||||
echo "Bad account provided"
|
||||
showhelp
|
||||
fi
|
||||
else
|
||||
echo "Bad account provided"
|
||||
showhelp
|
||||
fi
|
||||
;;
|
||||
"?")
|
||||
echo "Unknown option $OPTARG - stop processing"
|
||||
showhelp
|
||||
exit
|
||||
else
|
||||
d="$1"
|
||||
fi
|
||||
else
|
||||
#Fist we set the quotas no 0 (infinite for each already existing account
|
||||
t=`mysql_query "UPDATE mailbox SET quota='0' WHERE quota IS NULL"`
|
||||
d=`find "$ALTERNC_MAIL/" -maxdepth 2 -mindepth 2 -type d`
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#Then we loop through every maildir to get the maildir size
|
||||
for i in $d ; do
|
||||
|
||||
if [ -d "$i" ];then
|
||||
user=`ls -l $i| tail -n 1|cut -d' ' -f 3`
|
||||
# We grep only mails, not the others files
|
||||
mails=`find $i -type f | egrep "(^$i)*[0-9]+\.M"`
|
||||
|
||||
# This part only count mails size
|
||||
#size=0
|
||||
#for j in $mails
|
||||
#do
|
||||
# size=$(( $size + `du -b $j|awk '{print $1}'`))
|
||||
#done
|
||||
|
||||
# This part count the total mailbox size (mails + sieve scripts + ...)
|
||||
size=`du -b -s $i|awk '{print $1}'`
|
||||
|
||||
mail_count=`echo $mails|wc -w`
|
||||
echo "folder : "$i
|
||||
echo "mail count : "$mail_count
|
||||
echo "dir size : "$size
|
||||
echo ""
|
||||
#update the mailbox table accordingly
|
||||
mysql_query "UPDATE mailbox SET bytes=$size WHERE path='$i' "
|
||||
mysql_query "UPDATE mailbox SET messages=$mail_count WHERE path='$i' "
|
||||
else
|
||||
echo "The maildir $i does not exists. It's quota won't be resync"
|
||||
fi
|
||||
;;
|
||||
":")
|
||||
echo "No argument value for option $OPTARG - stop processing"
|
||||
showhelp
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
# Should not occur
|
||||
echo "Unknown error while processing options"
|
||||
showhelp
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Now we have $maildirs, we can work on it
|
||||
|
||||
# FIXME add check if maildir is empty
|
||||
|
||||
#Then we loop through every maildir to get the maildir size
|
||||
for i in $maildirs ; do
|
||||
|
||||
if [ ! -d "$i" ];then
|
||||
echo "The maildir $i does not exists. It's quota won't be resync"
|
||||
continue
|
||||
fi
|
||||
|
||||
# We grep only mails, not the others files
|
||||
mails=`find $i -type f | egrep "(^$i)*[0-9]+\.M"`
|
||||
|
||||
# This part count the total mailbox size (mails + sieve scripts + ...)
|
||||
size=`du -b -s $i|awk '{print $1}'`
|
||||
|
||||
mail_count=`echo $mails|wc -w`
|
||||
echo "folder : "$i
|
||||
echo "mail count : "$mail_count
|
||||
echo "dir size : "$size
|
||||
echo ""
|
||||
#update the mailbox table accordingly
|
||||
mysql_query "UPDATE mailbox SET bytes=$size WHERE path='$i' ; "
|
||||
mysql_query "UPDATE mailbox SET messages=$mail_count WHERE path='$i' ; "
|
||||
done
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ protocols = imap pop3 sieve
|
|||
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
|
||||
# matches the local IP (ie. you're connecting from the same computer), the
|
||||
# connection is considered secure and plaintext authentication is allowed.
|
||||
disable_plaintext_auth = yes
|
||||
disable_plaintext_auth = no
|
||||
|
||||
# Space separated list of wanted authentication mechanisms:
|
||||
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey
|
||||
# gss-spnego
|
||||
# NOTE: See also disable_plaintext_auth setting.
|
||||
auth_mechanisms = plain
|
||||
auth_mechanisms = plain login
|
||||
|
||||
##
|
||||
## Password and user databases
|
||||
|
@ -144,7 +144,7 @@ service auth {
|
|||
# 10-ssl.conf
|
||||
|
||||
# SSL/TLS support: yes, no, required. </usr/share/doc/dovecot-common/wiki/SSL.txt>
|
||||
ssl = required
|
||||
ssl = yes
|
||||
|
||||
# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
|
||||
# dropping root privileges, so keep the key file unreadable by anyone but
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- alternc.install 2013-08-22 09:16:54.818542162 +0200
|
||||
+++ alternc.install.wheezy 2013-08-22 09:58:06.713339922 +0200
|
||||
@@ -78,7 +78,7 @@
|
||||
--- alternc.install 2014-03-28 17:30:31.378712101 +0100
|
||||
+++ alternc.install.wheezy 2014-04-03 10:57:57.840148474 +0200
|
||||
@@ -79,7 +79,7 @@
|
||||
fi
|
||||
|
||||
if [ -e /etc/dovecot/dovecot.conf ]; then
|
||||
|
@ -9,7 +9,7 @@
|
|||
fi
|
||||
|
||||
INSTALLED_CONFIG_TAR="/var/lib/alternc/backups/etc-installed.tar.gz"
|
||||
@@ -305,7 +305,7 @@
|
||||
@@ -315,7 +315,7 @@
|
||||
fi
|
||||
|
||||
# We enable dovecot SSL certificate instructions: (on wheezy we should use a new file in /etc/dovecot/conf.d/ )
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
else
|
||||
# We disable proftpd tls module
|
||||
@@ -314,7 +314,7 @@
|
||||
@@ -324,7 +324,7 @@
|
||||
cp /etc/proftpd/modules.conf /etc/alternc/templates/proftpd/
|
||||
|
||||
# We disable dovecot SSL certificate instructions: (on wheezy we should remove a file in /etc/dovecot/conf.d/ )
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
echo "SSL not configured"
|
||||
echo "create a certificate in /etc/alternc/apache.pem and rerun alternc.install"
|
||||
@@ -533,9 +533,11 @@
|
||||
@@ -569,9 +569,11 @@
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
--- changelog 2013-10-18 15:17:57.640081683 +0200
|
||||
+++ changelog.wheezy 2013-10-18 15:19:58.442690776 +0200
|
||||
@@ -1,0 +1,7 @@
|
||||
--- changelog 2014-06-24 13:42:50.234304438 +0200
|
||||
+++ changelog.wheezy 2014-06-24 13:43:51.978313552 +0200
|
||||
@@ -1,3 +1,10 @@
|
||||
+alternc (3.2.1) stable; urgency=low
|
||||
+
|
||||
+ * Version identical to 3.1 for Squeeze
|
||||
+ * Includes a small dovecot patch / dependency for dovecot 2.0 for Wheezy
|
||||
+
|
||||
+ -- Benjamin Sonntag <benjamin@sonntag.fr> Thu, 28 Mar 2013 18:19:00 +0200
|
||||
+ -- Benjamin Sonntag <benjamin@sonntag.fr> Thu, 28 Mar 2014 18:19:00 +0200
|
||||
+
|
||||
alternc (3.1.1) oldstable; urgency=low
|
||||
|
||||
* many bugfixed from 3.1 / 3.2 :
|
||||
alternc (3.1.1) oldstable; urgency=low
|
||||
|
||||
* many bugfixed from 3.1 / 3.2 :
|
||||
|
|
Loading…
Reference in New Issue