Merge branch 'ent-7347-no-funciona-envio-de-mails-desde-servidor-con-sendgrid' into 'develop'

Make sure encode_base64 does not break auth strings.

See merge request artica/pandorafms!4059
This commit is contained in:
Daniel Rodriguez 2021-04-27 11:43:06 +00:00
commit 5aea0d17f0
1 changed files with 4 additions and 4 deletions

View File

@ -491,11 +491,11 @@ sub sendmail {
|| return fail("send AUTH LOGIN failed (lost connection?)");
socket_read()
|| return fail("AUTH LOGIN failed: $server_reply");
socket_write(encode_base64($auth->{user},$CRLF))
socket_write(encode_base64($auth->{user}, ""), $CRLF)
|| return fail("send LOGIN username failed (lost connection?)");
socket_read()
|| return fail("LOGIN username failed: $server_reply");
socket_write(encode_base64($auth->{password},$CRLF))
socket_write(encode_base64($auth->{password}, ""), $CRLF)
|| return fail("send LOGIN password failed (lost connection?)");
socket_read()
|| return fail("LOGIN password failed: $server_reply");
@ -504,7 +504,7 @@ sub sendmail {
warn "Trying AUTH PLAIN\n" if ($mailcfg{debug} > 9);
socket_write(
"AUTH PLAIN "
. encode_base64(join("\0", $auth->{user}, $auth->{user}, $auth->{password}), $CRLF)
. encode_base64(join("\0", $auth->{user}, $auth->{user}, $auth->{password}), ""), $CRLF
) || return fail("send AUTH PLAIN failed (lost connection?)");
socket_read()
|| return fail("AUTH PLAIN failed: $server_reply");
@ -518,7 +518,7 @@ sub sendmail {
|| return fail("AUTH CRAM-MD5 failed: $server_reply");
$challenge =~ s/^\d+\s+//;
my $response = _hmac_md5($auth->{password}, decode_base64($challenge));
socket_write(encode_base64("$auth->{user} $response", $CRLF))
socket_write(encode_base64("$auth->{user} $response", ""), $CRLF)
|| return fail("AUTH CRAM-MD5 failed: $server_reply");
socket_read()
|| return fail("AUTH CRAM-MD5 failed: $server_reply");