From a4299c5f1cef1c2646ef7f91280424597e6dbb40 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Sat, 21 Sep 2024 00:01:02 +0200 Subject: [PATCH] Fix extensions with `login.credentials` hook parameters --- plugins/ldap-login-mapping/index.php | 15 ++++++++------- plugins/ldap-mail-accounts/index.php | 8 ++++---- plugins/login-override/index.php | 8 ++++---- plugins/login-remote/index.php | 6 +++--- plugins/login-virtuser/index.php | 13 +++++++------ plugins/proxy-auth/index.php | 6 +++--- 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/plugins/ldap-login-mapping/index.php b/plugins/ldap-login-mapping/index.php index c15347cab..73d8fae9c 100644 --- a/plugins/ldap-login-mapping/index.php +++ b/plugins/ldap-login-mapping/index.php @@ -8,10 +8,10 @@ class LDAPLoginMappingPlugin extends AbstractPlugin { const NAME = 'LDAP login mapping', - VERSION = '2.2', + VERSION = '2.3', AUTHOR = 'RainLoop Team, Ludovic Pouzenc, ZephOne', - 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"); } } diff --git a/plugins/ldap-mail-accounts/index.php b/plugins/ldap-mail-accounts/index.php index 68d802503..bc53ad4f4 100644 --- a/plugins/ldap-mail-accounts/index.php +++ b/plugins/ldap-mail-accounts/index.php @@ -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), ]); diff --git a/plugins/login-override/index.php b/plugins/login-override/index.php index 26f95d01a..cef399dd9 100644 --- a/plugins/login-override/index.php +++ b/plugins/login-override/index.php @@ -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)) { diff --git a/plugins/login-remote/index.php b/plugins/login-remote/index.php index 13452d4f0..ab1550571 100644 --- a/plugins/login-remote/index.php +++ b/plugins/login-remote/index.php @@ -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']) diff --git a/plugins/login-virtuser/index.php b/plugins/login-virtuser/index.php index c2f6b2cfd..88207baec 100644 --- a/plugins/login-virtuser/index.php +++ b/plugins/login-virtuser/index.php @@ -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; } } diff --git a/plugins/proxy-auth/index.php b/plugins/proxy-auth/index.php index e071af527..ad2fea0f4 100644 --- a/plugins/proxy-auth/index.php +++ b/plugins/proxy-auth/index.php @@ -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();