Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions plugins/ldap-change-password/ChangePasswordLdapDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,23 @@ public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNe
'{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))
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/ldap-change-password/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function configMapping()
->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'),
Expand Down