Fix extensions with login.credentials hook parameters

This commit is contained in:
the-djmaze 2024-09-21 00:01:02 +02:00
parent 2341dd9f62
commit a4299c5f1c
6 changed files with 29 additions and 27 deletions

View file

@ -8,10 +8,10 @@ class LDAPLoginMappingPlugin extends AbstractPlugin
{
const
NAME = 'LDAP login mapping',
VERSION = '2.2',
VERSION = '2.3',
AUTHOR = 'RainLoop Team, Ludovic Pouzenc<ludovic@pouzenc.fr>, ZephOne<zephone@protonmail.com>',
RELEASE = '2024-03-12',
REQUIRED = '2.35.3',
RELEASE = '2024-09-20',
REQUIRED = '2.36.1',
CATEGORY = 'Login',
DESCRIPTION = 'Enable custom mapping using ldap field';
/**
@ -79,12 +79,13 @@ class LDAPLoginMappingPlugin extends AbstractPlugin
/**
* @param string $sEmail
* @param string $sLogin
* @param string $sImapUser
* @param string $sPassword
* @param string $sSmtpUser
*
* @throws \RainLoop\Exceptions\ClientException
*/
public function FilterLoginСredentials(&$sEmail, &$sLogin, &$sPassword)
public function FilterLoginСredentials(string &$sEmail, string &$sImapUser, string &$sPassword, string &$sSmtpUser)
{
$this->oLogger = \RainLoop\Api::Logger();
@ -102,10 +103,10 @@ class LDAPLoginMappingPlugin extends AbstractPlugin
$sIP = $_SERVER['REMOTE_ADDR'];
$sResult = $this->ldapSearch($sEmail);
if ( is_array($sResult) ) {
$sLogin = $sResult['login'];
$sImapUser = $sResult['login'];
$sEmail = $sResult['email'];
}
syslog(LOG_WARNING, "plugins/ldap-login-mapping/index.php:FilterLoginСredentials() auth try: $sIP/$sEmail, resolved as $sLogin/$sEmail");
syslog(LOG_WARNING, "plugins/ldap-login-mapping/index.php:FilterLoginСredentials() auth try: $sIP/$sEmail, resolved as $sImapUser/$sEmail");
}
}

View file

@ -12,10 +12,10 @@ class LdapMailAccountsPlugin extends AbstractPlugin
{
const
NAME = 'LDAP Mail Accounts',
VERSION = '2.2.0',
VERSION = '2.2.1',
AUTHOR = 'cm-schl',
URL = 'https://github.com/cm-sch',
RELEASE = '2024-05-28',
RELEASE = '2024-09-20',
REQUIRED = '2.36.1',
CATEGORY = 'Accounts',
DESCRIPTION = 'Add additional mail accounts the SnappyMail user has access to by a LDAP query. Basing on the work of FWest98 (https://github.com/FWest98).';
@ -44,7 +44,7 @@ class LdapMailAccountsPlugin extends AbstractPlugin
* @param string &$sPassword
* @param string &$sSmtpUser
*/
public function overwriteMainAccountEmail(&$sEmail, &$sImapUser, &$sPassword, &$sSmtpUser)
public function overwriteMainAccountEmail(string &$sEmail, string &$sImapUser, string &$sPassword, string &$sSmtpUser)
{
$this->Manager()->Actions()->Logger()->Write("Login DATA: login: $sImapUser email: $sEmail", \LOG_WARNING, "LDAP MAIL ACCOUNTS PLUGIN");
@ -100,7 +100,7 @@ class LdapMailAccountsPlugin extends AbstractPlugin
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
->SetDescription("SnappyMail saves the passwords of the additional accounts by encrypting them using a cryptkey that is saved in the file \".cryptkey\". When the password of the main account changes, SnappyMail asks the user for the old password to reencrypt the keys with the new userpassword.
\nOn a password change using ldap (or when the password has been forgotten by the user) this makes problems and asks the user to insert the old password. Therefore activating this option overwrites the .cryptkey file on login in order to always accept the actual ldap password of the user.
\nATTENTION: This has side effects on pgp keys because these are also secured by the cryptkey and could therefore not be accessible anymore!
\nATTENTION: This has side effects on pgp keys because these are also secured by the cryptkey and could therefore not be accessible anymore!
\nSee https://github.com/the-djmaze/snappymail/issues/1570#issuecomment-2085528061")
->SetDefaultValue(false),
]);

View file

@ -4,9 +4,9 @@ class LoginOverridePlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Login Override',
VERSION = '2.3',
RELEASE = '2024-03-12',
REQUIRED = '2.35.3',
VERSION = '2.4',
RELEASE = '2024-09-20',
REQUIRED = '2.36.1',
CATEGORY = 'Filters',
DESCRIPTION = 'Override IMAP/SMTP login credentials for specific users.';
@ -17,7 +17,7 @@ class LoginOverridePlugin extends \RainLoop\Plugins\AbstractPlugin
$this->addHook('smtp.before-login', 'MapSmtpCredentials');
}
public function MapEmailAddress(string &$sEmail, string &$sLogin, string &$sPassword)
public function MapEmailAddress(string &$sEmail, string &$sImapUser, string &$sPassword, string &$sSmtpUser)
{
$sMapping = \trim($this->Config()->Get('plugin', 'email_mapping', ''));
if (!empty($sMapping)) {

View file

@ -6,8 +6,8 @@ class LoginRemotePlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Login Remote',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '1.4',
RELEASE = '2024-03-27',
VERSION = '1.5',
RELEASE = '2024-09-20',
REQUIRED = '2.36.1',
CATEGORY = 'Login',
LICENSE = 'MIT',
@ -56,7 +56,7 @@ class LoginRemotePlugin extends \RainLoop\Plugins\AbstractPlugin
return true;
}
public function FilterLoginCredentials(&$sEmail, &$sImapUser, &$sPassword, &$sSmtpUser)
public function FilterLoginCredentials(string &$sEmail, string &$sImapUser, string &$sPassword, string &$sSmtpUser)
{
// cPanel https://github.com/the-djmaze/snappymail/issues/697
// && !empty($_ENV['CPANEL'])

View file

@ -6,9 +6,9 @@ class LoginVirtuserPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Virtuser Login',
AUTHOR = 'v20z',
URL = 'https://github.com/the-djmaze/snappymail/issues/1691',
VERSION = '0.1',
RELEASE = '2024-06-01',
REQUIRED = '2.5.0',
VERSION = '0.2',
RELEASE = '2024-09-20',
REQUIRED = '2.36.1',
CATEGORY = 'Login',
DESCRIPTION = 'File based Email-to-User lookup.';
@ -19,12 +19,13 @@ class LoginVirtuserPlugin extends \RainLoop\Plugins\AbstractPlugin
/**
* @param string $sEmail
* @param string $sLogin
* @param string $sImapUser
* @param string $sPassword
* @param string $sSmtpUser
*
* @throws \RainLoop\Exceptions\ClientException
*/
public function ParseVirtuserFiles(&$sEmail, &$sLogin, &$sPassword)
public function ParseVirtuserFiles(string &$sEmail, string &$sImapUser, string &$sPassword, string &$sSmtpUser)
{
$sFiles = \trim($this->Config()->Get('plugin', 'virtuser_files', ''));
if (!empty($sFiles))
@ -46,7 +47,7 @@ class LoginVirtuserPlugin extends \RainLoop\Plugins\AbstractPlugin
$aData = preg_split( '/[[:blank:]]+/', $sLine, 3, PREG_SPLIT_NO_EMPTY);
if (is_array($aData) && !empty($aData[0]) && isset($aData[1])) {
if ($sEmail === $aData[0] && 0 < strlen($aData[1])) {
$sLogin = $aData[1];
$sImapUser = $aData[1];
return;
}
}

View file

@ -6,8 +6,8 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Proxy Auth',
AUTHOR = 'Philipp',
URL = 'https://www.mundhenk.org/',
VERSION = '0.4',
RELEASE = '2024-05-26',
VERSION = '0.5',
RELEASE = '2024-09-20',
REQUIRED = '2.36.1',
CATEGORY = 'Login',
LICENSE = 'MIT',
@ -41,7 +41,7 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
return ( ( $ip_decimal & $netmask_decimal ) == ( $range_decimal & $netmask_decimal ) );
}
public function MapEmailAddress(string &$sEmail, string &$sLogin, string &$sPassword)
public function MapEmailAddress(string &$sEmail, string &$sImapUser, string &$sPassword, string &$sSmtpUser)
{
$oActions = \RainLoop\Api::Actions();
$oLogger = $oActions->Logger();