{"thread":{"id":"34349","subject":"[PATCH] send-email: provide port separately from hostname","startedAt":"2013-07-04T22:04:52Z","lastAt":"2013-07-04T23:11:00Z","messageCount":3,"participants":["brian m. carlson","Ramkumar Ramachandra"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"222593","messageId":"1372975492-981035-1-git-send-email-sandals@crustytoothpaste.net","threadId":"34349","inReplyTo":null,"subject":"[PATCH] send-email: provide port separately from hostname","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2013-07-04T22:04:52Z","receivedAt":"2013-07-04T22:04:52Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: \"brian m. carlson\" <sandals@crustytoothpaste.net>\n\nIf the SMTP port is provided as part of the hostname to Net::SMTP, it passes\nthe combined string to the SASL provider; this causes GSSAPI authentication to\nfail since Kerberos does not want the port information.  Instead, pass the port\nas a separate argument as is done for SSL connections.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n git-send-email.perl | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex bd13cc8..ca86a13 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1199,9 +1199,11 @@ X-Mailer: git-send-email $gitversion\n \t\telse {\n \t\t\trequire Net::SMTP;\n \t\t\t$smtp_domain ||= maildomain();\n-\t\t\t$smtp ||= Net::SMTP->new(smtp_host_string(),\n+\t\t\t$smtp_server_port ||= 25;\n+\t\t\t$smtp ||= Net::SMTP->new($smtp_server,\n \t\t\t\t\t\t Hello => $smtp_domain,\n-\t\t\t\t\t\t Debug => $debug_net_smtp);\n+\t\t\t\t\t\t Debug => $debug_net_smtp,\n+\t\t\t\t\t\t Port => $smtp_server_port);\n \t\t\tif ($smtp_encryption eq 'tls' && $smtp) {\n \t\t\t\trequire Net::SMTP::SSL;\n \t\t\t\t$smtp->command('STARTTLS');\n-- \n1.8.3.2.923.g2a18ff8.dirty\n"},{"id":"222594","messageId":"CALkWK0mJAx+-iZ0e+jRQE14Vve=ea=fbzgmNEjUh5ANpDCriCA@mail.gmail.com","threadId":"34349","inReplyTo":"1372975492-981035-1-git-send-email-sandals@crustytoothpaste.net","subject":"Re: [PATCH] send-email: provide port separately from hostname","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-07-04T22:42:19Z","receivedAt":"2013-07-04T22:42:19Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"brian m. carlson wrote:\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index bd13cc8..ca86a13 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1199,9 +1199,11 @@ X-Mailer: git-send-email $gitversion\n>                 else {\n>                         require Net::SMTP;\n>                         $smtp_domain ||= maildomain();\n> -                       $smtp ||= Net::SMTP->new(smtp_host_string(),\n\nHm, so the problem occurs when you give smtp_host_string() to\nNet::SMTP->new() as the first argument.\n\n> +                       $smtp_server_port ||= 25;\n\nSo if smtp_host_string() returns a hostname without a port, then\nNet::SMTP->new() will connect to port 25 by default?\n\n> If the SMTP port is provided as part of the hostname to Net::SMTP, it passes\n> the combined string to the SASL provider; this causes GSSAPI authentication to\n> fail since Kerberos does not want the port information.  Instead, pass the port\n> as a separate argument as is done for SSL connections.\n\nI need to be in a (firewalled?) network that uses Kerberos to\nreproduce this, right?  Even if I can't reproduce it, the change seems\nto be fine.\n\nWhile we're on the subject, do you know how to get rid of this huge\nugly warning I get everytime I send emails?\n\n*******************************************************************\n Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client\n is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER\n together with SSL_ca_file|SSL_ca_path for verification.\n If you really don't want to verify the certificate and keep the\n connection open to Man-In-The-Middle attacks please set\n SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.\n*******************************************************************\n  at /home/artagnon/src/git/git-send-email line 1200.\n\nThanks.\n"},{"id":"222595","messageId":"20130704231059.GT862789@vauxhall.crustytoothpaste.net","threadId":"34349","inReplyTo":"CALkWK0mJAx+-iZ0e+jRQE14Vve=ea=fbzgmNEjUh5ANpDCriCA@mail.gmail.com","subject":"Re: [PATCH] send-email: provide port separately from hostname","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2013-07-04T23:11:00Z","receivedAt":"2013-07-04T23:11:00Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Fri, Jul 05, 2013 at 04:12:19AM +0530, Ramkumar Ramachandra wrote:\n> Hm, so the problem occurs when you give smtp_host_string() to\n> Net::SMTP->new() as the first argument.\n\nYes.  I created a test program, and Net::SMTP was fine as long as I used\nPort, but failed when I included the port in the hostname string.\nArguably this is a bug in Net::SMTP.\n\n> So if smtp_host_string() returns a hostname without a port, then\n> Net::SMTP->new() will connect to port 25 by default?\n\nCorrect.  Port 25 is the default for Net::SMTP, so there's no change in\nbehavior.\n\n> I need to be in a (firewalled?) network that uses Kerberos to\n> reproduce this, right?  Even if I can't reproduce it, the change seems\n> to be fine.\n\nYou need to have access to a mail server that will only relay when\nauthenticated, and only accepts GSSAPI.  My personal server accepts\nGSSAPI always and PLAIN only when TLS is enabled, so I just turned off\nTLS temporarily to test.\n\nAs for Kerberos, yes, you'd need to have it set up to reproduce this.\n\n> While we're on the subject, do you know how to get rid of this huge\n> ugly warning I get everytime I send emails?\n> \n> *******************************************************************\n>  Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client\n>  is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER\n>  together with SSL_ca_file|SSL_ca_path for verification.\n>  If you really don't want to verify the certificate and keep the\n>  connection open to Man-In-The-Middle attacks please set\n>  SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.\n> *******************************************************************\n>   at /home/artagnon/src/git/git-send-email line 1200.\n\nYou need to explicitly specify an SSL_verify_mode argument to start_SSL.\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"}]}