git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Gernhardt <brian@gernhardtsoftware.com>
To: Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 1/3] send-email: Don't use FQDNs without a '.'
Date: Fri,  9 Apr 2010 01:11:44 -0400	[thread overview]
Message-ID: <1270789906-23735-2-git-send-email-brian@gernhardtsoftware.com> (raw)
In-Reply-To: <1270789906-23735-1-git-send-email-brian@gernhardtsoftware.com>

Although Net::Domain::domainname attempts to be very thorough, the
host's configuration can still refuse to give a FQDN.  Check to see if
what we receive contains a dot as a basic sanity check.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
---

 My OS X machine doesn't add ".local" to it's hostname for some reason.
 Since a FQDN requires at least one . between the TLD and hostname,
 we can check for it to avoid nonsense results like "My-Computer".

 git-send-email.perl |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index ce569a9..85fe374 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -870,7 +870,8 @@ sub maildomain_net
 	if (eval { require Net::Domain; 1 }) {
 		my $domain = Net::Domain::domainname();
 		$maildomain = $domain
-			unless $^O eq 'darwin' && $domain =~ /\.local$/;
+			unless $^O eq 'darwin' && $domain =~ /\.local$/
+				or $domain !~ /\./;
 	}
 
 	return $maildomain;
@@ -888,7 +889,8 @@ sub maildomain_mta
 				$smtp->quit;
 
 				$maildomain = $domain
-					unless $^O eq 'darwin' && $domain =~ /\.local$/;
+					unless $^O eq 'darwin' && $domain =~ /\.local$/
+						or $domain !~ /\./;
 
 				last if $maildomain;
 			}
-- 
1.7.1.rc0.210.ge6da

  reply	other threads:[~2010-04-09  5:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09  5:11 [PATCH 0/3] send-email: --smtp-domain improvements Brian Gernhardt
2010-04-09  5:11 ` Brian Gernhardt [this message]
2010-04-09  5:36   ` [PATCH 1/3] send-email: Don't use FQDNs without a '.' Junio C Hamano
2010-04-13  8:43     ` [PATCH] git-send-email.perl: Add sub maildomain_sanitize Jari Aalto
2010-04-13 11:35       ` [PATCH] git-send-email.perl: add maildomain_sanitize() Jari Aalto
2010-04-15 12:47         ` Jakub Narebski
2010-04-16 15:49           ` [PATCH v2] git-send-email.perl: Add sub maildomain_sanitize Jari Aalto
2010-04-16 16:11             ` Jakub Narebski
2010-04-16 17:00               ` Start encouraging English.pm (Was: [PATCH v2] git-send-email.perl: Add sub maildomain_sanitize) Jari Aalto
2010-04-09  5:11 ` [PATCH 2/3] Document send-email --smtp-domain Brian Gernhardt
2010-04-09  5:11 ` [PATCH 3/3] send-email: Add sendemail.smtpdomain Brian Gernhardt
2010-04-09  6:56   ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1270789906-23735-2-git-send-email-brian@gernhardtsoftware.com \
    --to=brian@gernhardtsoftware.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).