Merge pull request #1690 from grizmin/master

start tls and gecos
This commit is contained in:
RainLoop Team 2019-03-28 01:24:06 +03:00 committed by GitHub
commit 4235d95a39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -118,13 +118,23 @@ class ChangePasswordLdapDriver implements \RainLoop\Providers\ChangePassword\Cha
'{login}' => $oAccount->Login(),
'{imap:login}' => $oAccount->Login(),
'{imap:host}' => $oAccount->DomainIncHost(),
'{imap:port}' => $oAccount->DomainIncPort()
'{imap:port}' => $oAccount->DomainIncPort(),
'{gecos}' => posix_getpwnam($oAccount->Login())
));
$oCon = @\ldap_connect($this->sHostName, $this->iHostPort);
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))
{

View file

@ -64,7 +64,7 @@ class LdapChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
->SetType(\RainLoop\Enumerations\PluginPropertyType::INT)
->SetDefaultValue(389),
\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}'),
\RainLoop\Plugins\Property::NewInstance('password_field')->SetLabel('Password field')
->SetDefaultValue('userPassword'),