Skip to content

Commit

Permalink
Drop support for IMAP PROXYAUTH as it is a non-standard X-NETSCAPE thing
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Mar 12, 2024
1 parent 521f5e0 commit fd54796
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 126 deletions.
20 changes: 0 additions & 20 deletions plugins/proxyauth-login-example/LICENSE

This file was deleted.

43 changes: 0 additions & 43 deletions plugins/proxyauth-login-example/index.php

This file was deleted.

16 changes: 2 additions & 14 deletions snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,8 @@ public function Login(Settings $oSettings) : self
return $this;
}

if (!empty($oSettings->ProxyAuthUser) && $oSettings->ProxyAuthPassword) {
$sLogin = $oSettings->ProxyAuthUser;
$sPassword = $oSettings->ProxyAuthPassword->getValue();
$sProxyAuthUser = $oSettings->Login;
} else {
$sLogin = $oSettings->Login;
$sPassword = $oSettings->Password;
$sProxyAuthUser = '';
}

$sLogin = \MailSo\Base\Utils::IdnToAscii(\MailSo\Base\Utils::Trim($sLogin));
$sLogin = \MailSo\Base\Utils::IdnToAscii(\MailSo\Base\Utils::Trim($oSettings->Login));
$sPassword = $oSettings->Password;

if (!\strlen($sLogin) || !\strlen($sPassword)) {
$this->writeLogException(new \UnexpectedValueException, \LOG_ERR);
Expand Down Expand Up @@ -221,9 +212,6 @@ public function Login(Settings $oSettings) : self

$this->setCapabilities($oResponse);

if (\strlen($sProxyAuthUser)) {
$this->SendRequestGetResponse('PROXYAUTH', array($this->EscapeString($sProxyAuthUser)));
}
/*
// TODO: RFC 9051
if ($this->hasCapability('IMAP4rev2')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class ConnectSettings implements \JsonSerializable
];
public string $Login = '';
private ?SensitiveString $Password = null;
public string $ProxyAuthUser = '';
public ?SensitiveString $ProxyAuthPassword = null;

public function __construct()
{
Expand Down
30 changes: 0 additions & 30 deletions snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ abstract class Account implements \JsonSerializable

private ?SensitiveString $sSmtpPassword = null;

private string $sProxyAuthUser = '';

private ?SensitiveString $sProxyAuthPassword = null;

private Domain $oDomain;

public function Email() : string
Expand Down Expand Up @@ -85,19 +81,6 @@ public function SetSmtpPassword(
$this->sSmtpPassword = new SensitiveString($sPassword);
}

public function SetProxyAuthUser(string $sProxyAuthUser) : void
{
$this->sProxyAuthUser = $sProxyAuthUser;
}

public function SetProxyAuthPassword(
#[\SensitiveParameter]
string $sProxyAuthPassword
) : void
{
$this->sProxyAuthPassword = new SensitiveString($sProxyAuthPassword);
}

#[\ReturnTypeWillChange]
public function jsonSerialize()
{
Expand All @@ -113,12 +96,6 @@ public function jsonSerialize()
'pass' => $this->sSmtpPassword->getValue()
];
}
if ($this->sProxyAuthUser && $this->sProxyAuthPassword) {
$result['proxy'] = [
'user' => $this->sProxyAuthUser,
'pass' => $this->sProxyAuthPassword->getValue()
];
}
return $result;
}

Expand Down Expand Up @@ -204,11 +181,6 @@ public static function NewInstanceFromTokenArray(
$oAccount->sSmtpLogin = $aAccountHash['smtp']['user'];
$oAccount->SetSmtpPassword($aAccountHash['smtp']['pass']);
}
// init proxy user/password
if (isset($aAccountHash['proxy'])) {
$oAccount->sProxyAuthUser = $aAccountHash['proxy']['user'];
$oAccount->SetProxyAuthPassword($aAccountHash['proxy']['pass']);
}
}
}
return $oAccount;
Expand Down Expand Up @@ -290,8 +262,6 @@ private function netClientLogin(\MailSo\Net\NetClient $oClient, \RainLoop\Plugin
)
*/
$oSettings = $oClient->Settings;
$oSettings->ProxyAuthUser = $this->sProxyAuthUser;
$oSettings->ProxyAuthPassword = $this->sProxyAuthPassword;

$client_name = \strtolower($oClient->getLogName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public function asTokenArray(MainAccount $oMainAccount) : array
if (!empty($aData['smtp']['pass'])) {
$aData['smtp']['pass'] = \SnappyMail\Crypt::EncryptUrlSafe($aData['smtp']['pass'], $sHash);
}
if (!empty($aData['proxy']['pass'])) {
$aData['proxy']['pass'] = \SnappyMail\Crypt::EncryptUrlSafe($aData['proxy']['pass'], $sHash); // sProxyAuthPassword
}
$aData['hmac'] = \hash_hmac('sha1', $aData['pass'], $sHash);
return $aData;
}
Expand All @@ -58,17 +55,11 @@ public static function NewInstanceFromTokenArray(
if (!empty($aData['smtp']['pass'])) {
$aAccountHash['smtp']['pass'] = \SnappyMail\Crypt::DecryptUrlSafe($aAccountHash['smtp']['pass'], $sHash);
}
if (!empty($aData['proxy']['pass'])) {
$aAccountHash['proxy']['pass'] = \SnappyMail\Crypt::DecryptUrlSafe($aAccountHash['proxy']['pass'], $sHash);
}
} else {
$aAccountHash['pass'] = '';
if (!empty($aData['smtp']['pass'])) {
$aAccountHash['smtp']['pass'] = '';
}
if (!empty($aData['proxy']['pass'])) {
$aAccountHash['proxy']['pass'] = '';
}
}
}
return parent::NewInstanceFromTokenArray($oActions, $aAccountHash, $bThrowExceptionOnFalse);
Expand Down
6 changes: 0 additions & 6 deletions snappymail/v/0.0.0/app/libraries/snappymail/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ public static function ConvertInsecureAccounts(\RainLoop\Actions $oActions, \Rai
'pass' => $aAccountHash[3],
'hmac' => \hash_hmac('sha1', $aAccountHash[3], $sHash)
];
if ($aAccountHash[8] && $aAccountHash[9]) {
$aNewAccounts[$sEmail]['proxy'] = [
'user' => $aAccount[5],
'pass' => $aAccount[6]
];
}
} catch (\Throwable $e) {
\SnappyMail\Log::warning('UPGRADE', "ConvertInsecureAccount {$sEmail} failed");
}
Expand Down
2 changes: 0 additions & 2 deletions snappymail/v/0.0.0/imapsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ function getImapClient(int $host)
}
$ImapSettings->Login = $options["user{$host}"]; // convert to punycode?
$ImapSettings->Password = $options["password{$host}"];
// $ImapSettings1->ProxyAuthUser = '';
// $ImapSettings1->ProxyAuthPassword = '';
$ImapSettings->useAuth = true;

$oImapClient = new \MailSo\Imap\ImapClient;
Expand Down

0 comments on commit fd54796

Please sign in to comment.