mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 00:47:04 +03:00
Fix extensions with login.credentials hook parameters
This commit is contained in:
parent
2341dd9f62
commit
a4299c5f1c
6 changed files with 29 additions and 27 deletions
|
|
@ -8,10 +8,10 @@ class LDAPLoginMappingPlugin extends AbstractPlugin
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
NAME = 'LDAP login mapping',
|
NAME = 'LDAP login mapping',
|
||||||
VERSION = '2.2',
|
VERSION = '2.3',
|
||||||
AUTHOR = 'RainLoop Team, Ludovic Pouzenc<ludovic@pouzenc.fr>, ZephOne<zephone@protonmail.com>',
|
AUTHOR = 'RainLoop Team, Ludovic Pouzenc<ludovic@pouzenc.fr>, ZephOne<zephone@protonmail.com>',
|
||||||
RELEASE = '2024-03-12',
|
RELEASE = '2024-09-20',
|
||||||
REQUIRED = '2.35.3',
|
REQUIRED = '2.36.1',
|
||||||
CATEGORY = 'Login',
|
CATEGORY = 'Login',
|
||||||
DESCRIPTION = 'Enable custom mapping using ldap field';
|
DESCRIPTION = 'Enable custom mapping using ldap field';
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,12 +79,13 @@ class LDAPLoginMappingPlugin extends AbstractPlugin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sEmail
|
* @param string $sEmail
|
||||||
* @param string $sLogin
|
* @param string $sImapUser
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
|
* @param string $sSmtpUser
|
||||||
*
|
*
|
||||||
* @throws \RainLoop\Exceptions\ClientException
|
* @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();
|
$this->oLogger = \RainLoop\Api::Logger();
|
||||||
|
|
||||||
|
|
@ -102,10 +103,10 @@ class LDAPLoginMappingPlugin extends AbstractPlugin
|
||||||
$sIP = $_SERVER['REMOTE_ADDR'];
|
$sIP = $_SERVER['REMOTE_ADDR'];
|
||||||
$sResult = $this->ldapSearch($sEmail);
|
$sResult = $this->ldapSearch($sEmail);
|
||||||
if ( is_array($sResult) ) {
|
if ( is_array($sResult) ) {
|
||||||
$sLogin = $sResult['login'];
|
$sImapUser = $sResult['login'];
|
||||||
$sEmail = $sResult['email'];
|
$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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ class LdapMailAccountsPlugin extends AbstractPlugin
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
NAME = 'LDAP Mail Accounts',
|
NAME = 'LDAP Mail Accounts',
|
||||||
VERSION = '2.2.0',
|
VERSION = '2.2.1',
|
||||||
AUTHOR = 'cm-schl',
|
AUTHOR = 'cm-schl',
|
||||||
URL = 'https://github.com/cm-sch',
|
URL = 'https://github.com/cm-sch',
|
||||||
RELEASE = '2024-05-28',
|
RELEASE = '2024-09-20',
|
||||||
REQUIRED = '2.36.1',
|
REQUIRED = '2.36.1',
|
||||||
CATEGORY = 'Accounts',
|
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).';
|
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 &$sPassword
|
||||||
* @param string &$sSmtpUser
|
* @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");
|
$this->Manager()->Actions()->Logger()->Write("Login DATA: login: $sImapUser email: $sEmail", \LOG_WARNING, "LDAP MAIL ACCOUNTS PLUGIN");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ class LoginOverridePlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
NAME = 'Login Override',
|
NAME = 'Login Override',
|
||||||
VERSION = '2.3',
|
VERSION = '2.4',
|
||||||
RELEASE = '2024-03-12',
|
RELEASE = '2024-09-20',
|
||||||
REQUIRED = '2.35.3',
|
REQUIRED = '2.36.1',
|
||||||
CATEGORY = 'Filters',
|
CATEGORY = 'Filters',
|
||||||
DESCRIPTION = 'Override IMAP/SMTP login credentials for specific users.';
|
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');
|
$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', ''));
|
$sMapping = \trim($this->Config()->Get('plugin', 'email_mapping', ''));
|
||||||
if (!empty($sMapping)) {
|
if (!empty($sMapping)) {
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ class LoginRemotePlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
NAME = 'Login Remote',
|
NAME = 'Login Remote',
|
||||||
AUTHOR = 'SnappyMail',
|
AUTHOR = 'SnappyMail',
|
||||||
URL = 'https://snappymail.eu/',
|
URL = 'https://snappymail.eu/',
|
||||||
VERSION = '1.4',
|
VERSION = '1.5',
|
||||||
RELEASE = '2024-03-27',
|
RELEASE = '2024-09-20',
|
||||||
REQUIRED = '2.36.1',
|
REQUIRED = '2.36.1',
|
||||||
CATEGORY = 'Login',
|
CATEGORY = 'Login',
|
||||||
LICENSE = 'MIT',
|
LICENSE = 'MIT',
|
||||||
|
|
@ -56,7 +56,7 @@ class LoginRemotePlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
return true;
|
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
|
// cPanel https://github.com/the-djmaze/snappymail/issues/697
|
||||||
// && !empty($_ENV['CPANEL'])
|
// && !empty($_ENV['CPANEL'])
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ class LoginVirtuserPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
NAME = 'Virtuser Login',
|
NAME = 'Virtuser Login',
|
||||||
AUTHOR = 'v20z',
|
AUTHOR = 'v20z',
|
||||||
URL = 'https://github.com/the-djmaze/snappymail/issues/1691',
|
URL = 'https://github.com/the-djmaze/snappymail/issues/1691',
|
||||||
VERSION = '0.1',
|
VERSION = '0.2',
|
||||||
RELEASE = '2024-06-01',
|
RELEASE = '2024-09-20',
|
||||||
REQUIRED = '2.5.0',
|
REQUIRED = '2.36.1',
|
||||||
CATEGORY = 'Login',
|
CATEGORY = 'Login',
|
||||||
DESCRIPTION = 'File based Email-to-User lookup.';
|
DESCRIPTION = 'File based Email-to-User lookup.';
|
||||||
|
|
||||||
|
|
@ -19,12 +19,13 @@ class LoginVirtuserPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sEmail
|
* @param string $sEmail
|
||||||
* @param string $sLogin
|
* @param string $sImapUser
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
|
* @param string $sSmtpUser
|
||||||
*
|
*
|
||||||
* @throws \RainLoop\Exceptions\ClientException
|
* @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', ''));
|
$sFiles = \trim($this->Config()->Get('plugin', 'virtuser_files', ''));
|
||||||
if (!empty($sFiles))
|
if (!empty($sFiles))
|
||||||
|
|
@ -46,7 +47,7 @@ class LoginVirtuserPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
$aData = preg_split( '/[[:blank:]]+/', $sLine, 3, PREG_SPLIT_NO_EMPTY);
|
$aData = preg_split( '/[[:blank:]]+/', $sLine, 3, PREG_SPLIT_NO_EMPTY);
|
||||||
if (is_array($aData) && !empty($aData[0]) && isset($aData[1])) {
|
if (is_array($aData) && !empty($aData[0]) && isset($aData[1])) {
|
||||||
if ($sEmail === $aData[0] && 0 < strlen($aData[1])) {
|
if ($sEmail === $aData[0] && 0 < strlen($aData[1])) {
|
||||||
$sLogin = $aData[1];
|
$sImapUser = $aData[1];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
NAME = 'Proxy Auth',
|
NAME = 'Proxy Auth',
|
||||||
AUTHOR = 'Philipp',
|
AUTHOR = 'Philipp',
|
||||||
URL = 'https://www.mundhenk.org/',
|
URL = 'https://www.mundhenk.org/',
|
||||||
VERSION = '0.4',
|
VERSION = '0.5',
|
||||||
RELEASE = '2024-05-26',
|
RELEASE = '2024-09-20',
|
||||||
REQUIRED = '2.36.1',
|
REQUIRED = '2.36.1',
|
||||||
CATEGORY = 'Login',
|
CATEGORY = 'Login',
|
||||||
LICENSE = 'MIT',
|
LICENSE = 'MIT',
|
||||||
|
|
@ -41,7 +41,7 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
return ( ( $ip_decimal & $netmask_decimal ) == ( $range_decimal & $netmask_decimal ) );
|
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();
|
$oActions = \RainLoop\Api::Actions();
|
||||||
$oLogger = $oActions->Logger();
|
$oLogger = $oActions->Logger();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue