Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-01-11 17:59:57 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-01-11 22:59:44 +0300
commit7ecb65f725d7243d3f1433bb8d2cd1f981c90c07 (patch)
treea32be16a82b5f07c529faf82aca2982400917646 /lib
parentd4a5e480ab9fb2337909f1be3c30048a8eb14d78 (diff)
Add check before sending email that email address is valid
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index 53a223b38dd..aae6f305981 100644
--- a/lib/private/Collaboration/Collaborators/MailPlugin.php
+++ b/lib/private/Collaboration/Collaborators/MailPlugin.php
@@ -38,6 +38,7 @@ use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Share\IShare;
+use OCP\Mail\IMailer;
class MailPlugin implements ISearchPlugin {
/* @var bool */
@@ -64,19 +65,23 @@ class MailPlugin implements ISearchPlugin {
private $knownUserService;
/** @var IUserSession */
private $userSession;
+ /** @var IMailer */
+ private $mailer;
public function __construct(IManager $contactsManager,
ICloudIdManager $cloudIdManager,
IConfig $config,
IGroupManager $groupManager,
KnownUserService $knownUserService,
- IUserSession $userSession) {
+ IUserSession $userSession,
+ IMailer $mailer) {
$this->contactsManager = $contactsManager;
$this->cloudIdManager = $cloudIdManager;
$this->config = $config;
$this->groupManager = $groupManager;
$this->knownUserService = $knownUserService;
$this->userSession = $userSession;
+ $this->mailer = $mailer;
$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
$this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
@@ -247,14 +252,10 @@ class MailPlugin implements ISearchPlugin {
$userResults['wide'] = array_slice($userResults['wide'], $offset, $limit);
}
- [$username, $domain] = explode('@', $search);
- $domain = idn_to_ascii($domain);
- $searchIdn = $username . '@' . $domain;
-
- if (!$searchResult->hasExactIdMatch($emailType) && filter_var($searchIdn, FILTER_VALIDATE_EMAIL)) {
+ if (!$searchResult->hasExactIdMatch($emailType) && $this->mailer->validateMailAddress($search)) {
$result['exact'][] = [
'label' => $search,
- 'uuid' => $searchIdn,
+ 'uuid' => $search,
'value' => [
'shareType' => IShare::TYPE_EMAIL,
'shareWith' => $search,