- Cette Foire-Aux-Questions (FAQ) devrait répondre à vos questions. Au fil du temps, de nouvelles questions/réponses seront ajoutées. Posez vos questions à .
+ Cette Foire-Aux-Questions (FAQ) devrait répondre à vos questions. Au fil du temps, de nouvelles questions/réponses seront ajoutées. Posez vos questions à .
Qu'est-ce qu'une syntaxe valide pour un compte mail ?
diff --git a/htdocs/inc/haut.php b/htdocs/inc/haut.php
index e43ed75..2b39e8a 100644
--- a/htdocs/inc/haut.php
+++ b/htdocs/inc/haut.php
@@ -4,7 +4,7 @@
-
+
diff --git a/htdocs/lib/auth.php b/htdocs/lib/auth.php
index 569a076..5c00015 100644
--- a/htdocs/lib/auth.php
+++ b/htdocs/lib/auth.php
@@ -8,7 +8,7 @@ if (empty($_SESSION['login'])) {
exit(0);
} else {
try {
- $server = new LdapServer($_SESSION['login'], LDAP_BASE, LDAP_ADMIN_DN, LDAP_ADMIN_PASS, LDAP_URI);
+ $server = new LdapServer($_SESSION['login'], $config['ldap']);
if (!empty($_GET['domain'])) {
$domain = htmlentities(strip_tags($_GET['domain']),ENT_NOQUOTES);
$domain = new LdapDomain($server, $domain);
diff --git a/htdocs/lib/class.ldapdomain.php b/htdocs/lib/class.ldapdomain.php
index 83cce8c..5d7026c 100644
--- a/htdocs/lib/class.ldapdomain.php
+++ b/htdocs/lib/class.ldapdomain.php
@@ -70,7 +70,6 @@ class LdapDomain extends LdapServer {
}
public function addAccount($uid,$name,$password,$active=false,$admin=false,$accountactive=false,$courieractive=false,$webmailactive=false,$authsmtpactive=false,$amavisBypassSpamChecks=false) {
- global $conf;
if (!preg_match('/^([a-z0-9][a-z0-9\-\.\_]{0,28}[a-z0-9])$/', $uid)) {
throw new Exception("Erreur, $name est un nom invalide.");
}
@@ -78,7 +77,7 @@ class LdapDomain extends LdapServer {
$info[LdapAccount::$dn] = $mail;
$info["cn"] = $name;
$info["homeDirectory"] = "/home/vmail/" .$this->getName(). "/" .$uid. "/";
- $info["uidNumber"] = $conf['unix']['uid'];
+ $info["uidNumber"] = 2022;
$info["gidNumber"] = $this->getGid();
$info["isActive"] = ($active) ? 'TRUE' : 'FALSE';
$info["isAdmin"] = ($admin) ? 'TRUE' : 'FALSE';
diff --git a/htdocs/lib/class.ldapserver.php b/htdocs/lib/class.ldapserver.php
index f557fb2..96681a2 100644
--- a/htdocs/lib/class.ldapserver.php
+++ b/htdocs/lib/class.ldapserver.php
@@ -54,24 +54,24 @@ class LdapServer {
return '{SSHA}'.base64_encode(mhash(MHASH_SHA1, $pass.$salt).$salt);
}
- public function __construct($login, $base, $adminDN, $adminPass, $uri='ldap://127.0.0.1') {
- global $conf;
+ public function __construct($login, $config) {
+ $uri = 'ldap://'.$config['host'].':'.$config['port'];
$this->login = $login;
if (!$this->conn = ldap_connect($uri)) {
- throw new Exception("Impossible de se connecter au serveur LDAP $uri");
+ throw new Exception("Impossible de se connecter au serveur LDAP ".$config['host']);
}
if (!ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3)) {
throw new Exception("Impossible de modifier la version du protocole LDAP à 3");
}
- if (!ldap_bind($this->conn, $adminDN, $adminPass)) {
+ if (!ldap_bind($this->conn, $config['admin_dn'], $config['admin_pass'])) {
throw new Exception("Authentification LDAP échoué !");
}
- if (in_array($this->login, $conf['admin']['logins'])) {
+ if (in_array($this->login, $config['superadmin'])) {
$this->superadmin = true;
- $this->base = $base;
+ $this->base = $config['base'];
} else {
$mydomain = preg_replace('/.*@/', '', $login);
- $this->base = LdapDomain::$dn.'='.$mydomain.','.$base;
+ $this->base = LdapDomain::$dn.'='.$mydomain.','.$config['base'];
}
}
diff --git a/htdocs/lib/config.php b/htdocs/lib/config.php
index af745db..efb2089 100644
--- a/htdocs/lib/config.php
+++ b/htdocs/lib/config.php
@@ -1,25 +1,8 @@