mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
* added start_tls support
* added gecos token for use in user DN in case your user accounts are using cn as rdn.
This commit is contained in:
parent
841c4d59e3
commit
04bfe2686f
2 changed files with 13 additions and 3 deletions
|
|
@ -118,13 +118,23 @@ class ChangePasswordLdapDriver implements \RainLoop\Providers\ChangePassword\Cha
|
||||||
'{login}' => $oAccount->Login(),
|
'{login}' => $oAccount->Login(),
|
||||||
'{imap:login}' => $oAccount->Login(),
|
'{imap:login}' => $oAccount->Login(),
|
||||||
'{imap:host}' => $oAccount->DomainIncHost(),
|
'{imap:host}' => $oAccount->DomainIncHost(),
|
||||||
'{imap:port}' => $oAccount->DomainIncPort()
|
'{imap:port}' => $oAccount->DomainIncPort(),
|
||||||
|
'{gecos}' => posix_getpwnam($oAccount->Login())
|
||||||
));
|
));
|
||||||
|
|
||||||
$oCon = @\ldap_connect($this->sHostName, $this->iHostPort);
|
$oCon = @\ldap_connect($this->sHostName, $this->iHostPort);
|
||||||
if ($oCon)
|
if ($oCon)
|
||||||
{
|
{
|
||||||
@\ldap_set_option($oCon, LDAP_OPT_PROTOCOL_VERSION, 3);
|
if (!@\ldap_set_option($oCon, LDAP_OPT_PROTOCOL_VERSION, 3)) {
|
||||||
|
$this->oLogger->Write("Failed to set LDAP Protocol version to 3, TLS not supported.",
|
||||||
|
\MailSo\Log\Enumerations\Type::WARNING, 'LDAP');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!ldap_start_tls($oCon)) {
|
||||||
|
$this->oLogger->Write("Ldap_start_tls failed: ".$oCon,
|
||||||
|
\MailSo\Log\Enumerations\Type::WARNING, 'LDAP');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!@\ldap_bind($oCon, $sUserDn, $sPrevPassword))
|
if (!@\ldap_bind($oCon, $sUserDn, $sPrevPassword))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class LdapChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::INT)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::INT)
|
||||||
->SetDefaultValue(389),
|
->SetDefaultValue(389),
|
||||||
\RainLoop\Plugins\Property::NewInstance('user_dn_format')->SetLabel('User DN format')
|
\RainLoop\Plugins\Property::NewInstance('user_dn_format')->SetLabel('User DN format')
|
||||||
->SetDescription('LDAP user dn format. Supported tokens: {email}, {email:user}, {email:domain}, {login}, {domain}, {domain:dc}, {imap:login}, {imap:host}, {imap:port}')
|
->SetDescription('LDAP user dn format. Supported tokens: {email}, {email:user}, {email:domain}, {login}, {domain}, {domain:dc}, {imap:login}, {imap:host}, {imap:port}, {gecos}')
|
||||||
->SetDefaultValue('uid={imap:login},ou=Users,{domain:dc}'),
|
->SetDefaultValue('uid={imap:login},ou=Users,{domain:dc}'),
|
||||||
\RainLoop\Plugins\Property::NewInstance('password_field')->SetLabel('Password field')
|
\RainLoop\Plugins\Property::NewInstance('password_field')->SetLabel('Password field')
|
||||||
->SetDefaultValue('userPassword'),
|
->SetDefaultValue('userPassword'),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue