send-email: don't call methods on undefined values
authorBrian M. Carlson <sandals@crustytoothpaste.net>
Sun, 8 Sep 2013 20:54:34 +0000 (20:54 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Sep 2013 15:49:22 +0000 (08:49 -0700)
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>
git-send-email.perl
index 2162478392728f156ba6c541cdc69447aa9b0119..3782c3b0cb4f9356790ae581c0d408dc4f4cae75 100755 (executable)
@@ -1234,7 +1234,7 @@ sub send_message {
                                if ($smtp->code == 220) {
                                        $smtp = Net::SMTP::SSL->start_SSL($smtp,
                                                                          ssl_verify_params())
-                                               or die "STARTTLS failed! ".$smtp->message;
+                                               or die "STARTTLS failed! ".IO::Socket::SSL::errstr();
                                        $smtp_encryption = '';
                                        # Send EHLO again to receive fresh
                                        # supported commands