Bugzilla – Attachment 118697 Details for
Bug 28017
Allow non-FQDN and IP addresses in emails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28017: Allow non-FQDN (@localhost) addresses
Bug-28017-Allow-non-FQDN-localhost-addresses.patch (text/plain), 2.38 KB, created by
Kyle M Hall (khall)
on 2021-03-23 16:59:50 UTC
(
hide
)
Description:
Bug 28017: Allow non-FQDN (@localhost) addresses
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-03-23 16:59:50 UTC
Size:
2.38 KB
patch
obsolete
>From e83a18fd3670381644433882a1b5bab624c9515c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 22 Mar 2021 14:47:33 -0300 >Subject: [PATCH] Bug 28017: Allow non-FQDN (@localhost) addresses > >This patch makes Koha::Email support using @localhost addresses. > >To test: >1. Apply the regression tests >2. Run: > $ kshell > k$ prove t/Koha/Email.t >=> FAIL: Koha::Email doesn't support non-fqdn addresses >3. Apply this patch >4. Repeat 2 >=> SUCCESS: All tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Email.pm | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > >diff --git a/Koha/Email.pm b/Koha/Email.pm >index e91a49e402..d6a330ca0c 100644 >--- a/Koha/Email.pm >+++ b/Koha/Email.pm >@@ -76,7 +76,7 @@ sub create { > my $args = {}; > $args->{from} = $params->{from} || C4::Context->preference('KohaAdminEmailAddress'); > Koha::Exceptions::BadParameter->throw("Invalid 'from' parameter: ".$args->{from}) >- unless Email::Valid->address($args->{from}); # from is mandatory >+ unless Email::Valid->address( -address => $args->{from}, -fqdn => 0 ); # from is mandatory > > $args->{subject} = $params->{subject} // ''; > >@@ -88,7 +88,7 @@ sub create { > } > > Koha::Exceptions::BadParameter->throw("Invalid 'to' parameter: ".$args->{to}) >- unless Email::Valid->address($args->{to}); # to is mandatory >+ unless Email::Valid->address( -address => $args->{to}, -fqdn => 0 ); # to is mandatory > > my $addresses = {}; > $addresses->{reply_to} = $params->{reply_to}; >@@ -106,9 +106,13 @@ sub create { > if exists $params->{bcc}; > } > >- foreach my $address ( keys %{ $addresses } ) { >- Koha::Exceptions::BadParameter->throw("Invalid '$address' parameter: ".$addresses->{$address}) >- if $addresses->{$address} and !Email::Valid->address($addresses->{$address}); >+ foreach my $address ( keys %{$addresses} ) { >+ Koha::Exceptions::BadParameter->throw( >+ "Invalid '$address' parameter: " . $addresses->{$address} ) >+ if $addresses->{$address} and !Email::Valid->address( >+ -address => $addresses->{$address}, >+ -fqdn => 0 >+ ); > } > > $args->{cc} = $addresses->{cc} >-- >2.24.1 (Apple Git-126)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28017
:
118620
|
118621
|
118622
|
118644
|
118645
|
118646
|
118668
|
118696
| 118697 |
118698
|
119208