send-email: don't call methods on undefined values

If SSL verification is enabled in git send-email, we could attempt to call a
method on an undefined value if the verification failed, since $smtp would end
up being undef.  Look up the error string in a way that will produce a helpful
error message and not cause further errors.

Signed-off-by: Brian M. Carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brian M. Carlson 2013-09-08 20:54:34 +00:00 коммит произвёл Junio C Hamano
Родитель 07b83b5d98
Коммит 6cb0c88305
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -1234,7 +1234,7 @@ X-Mailer: git-send-email $gitversion
if ($smtp->code == 220) { if ($smtp->code == 220) {
$smtp = Net::SMTP::SSL->start_SSL($smtp, $smtp = Net::SMTP::SSL->start_SSL($smtp,
ssl_verify_params()) ssl_verify_params())
or die "STARTTLS failed! ".$smtp->message; or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
$smtp_encryption = ''; $smtp_encryption = '';
# Send EHLO again to receive fresh # Send EHLO again to receive fresh
# supported commands # supported commands