From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tim Cross Newsgroups: gmane.emacs.devel Subject: Re: init_system_name fqdn? Date: Sun, 18 Jun 2017 11:48:26 +1000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f4030435cfe0e9a66805523236db" X-Trace: blaine.gmane.org 1497750553 17037 195.159.176.226 (18 Jun 2017 01:49:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 18 Jun 2017 01:49:13 +0000 (UTC) Cc: Emacs developers To: Ken Olum Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 18 03:49:09 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMPKv-0003qX-BY for ged-emacs-devel@m.gmane.org; Sun, 18 Jun 2017 03:49:09 +0200 Original-Received: from localhost ([::1]:36810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMPKu-0003Qb-0F for ged-emacs-devel@m.gmane.org; Sat, 17 Jun 2017 21:49:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMPKH-0003QW-6g for emacs-devel@gnu.org; Sat, 17 Jun 2017 21:48:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMPKF-0005bL-SB for emacs-devel@gnu.org; Sat, 17 Jun 2017 21:48:29 -0400 Original-Received: from mail-qt0-x22c.google.com ([2607:f8b0:400d:c0d::22c]:34314) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dMPKF-0005b6-Je for emacs-devel@gnu.org; Sat, 17 Jun 2017 21:48:27 -0400 Original-Received: by mail-qt0-x22c.google.com with SMTP id c10so91864143qtd.1 for ; Sat, 17 Jun 2017 18:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AdyqQdBw6R9JUiqXS5uP/nq9UvZj3k2H/FujoT14xLE=; b=ir9zJeCf7OYQU+GRqWtE5PQSPS3QLLnpl0wNiybUBLHLG14wQam11NHUm/XOTgjsMB AFI92S6BBcPW5riWiAli7LnwNMQTvIhb85bDKp4AB8sCuMENGctCXncilE+KKpr6oMQL egaYH90lrCBD4GFtJ/w7ZuuOYiucZt08per+C00gthOsfDkI5BVFTnwXYfP2kgCEsqju QiU3+ewaft1StIvSVXFGyXxTCMSmVoCdBCaLnNIgAiFX1X2fVKOWsCKij9hVOr4BI+vg 8OUXU0E/dlnIcFsykOvqze42dbSz0UktSuntV9cbB9H9ifTHCakBtEc6dHOaTjJ1iM// fivQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AdyqQdBw6R9JUiqXS5uP/nq9UvZj3k2H/FujoT14xLE=; b=QBmiACa9AyYQTklTVSFpjxWwLYURppPewkde3dkz+q7ht1ReKnYcD1OMXqH0ypPKXV wCKLywL3veZ95NpKhmRVcnt/T+Gj2CzqNZiSISKD0FNWYQwB0AmHFCp5GKSD5aFJymGO HCc4JD8HrLR55htp1PVqWDoNZ+xMCexeLJBwBwoi4azAKRBvuFWrbRZJXr+6bI6NZhwU shIHipMR4q7gqY/65+GhEJExOKIdBbWq5p3p4/8gNT0PAResellmn8Qc3LLNzaVEPTqy T02YfZ7dQ6P+3KaMZXB4DMp4jQY/3pE5MdSOd01IpL0paqSiypllZp/mNQTAcjksPWxD YuQA== X-Gm-Message-State: AKS2vOzKqt6cO3QyNUvwWB4MIcF6JXT+i3qiXAWXUN6HgL6HM6eBdnd2 0ZjmfoHt3Fi0EEPn/d6D7dCPCx/6hg== X-Received: by 10.200.3.97 with SMTP id w33mr21760176qtg.203.1497750506676; Sat, 17 Jun 2017 18:48:26 -0700 (PDT) Original-Received: by 10.200.37.250 with HTTP; Sat, 17 Jun 2017 18:48:26 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:215727 Archived-At: --f4030435cfe0e9a66805523236db Content-Type: text/plain; charset="UTF-8" If you have a fqdn for a host and hostname -f does not return the fqdn, then your system is not configured correctly. This would likely cause errors or problems with other software as well. Having a FQDN and a DNS entry are not the same thing. You can have a fqdn without a DNS entry, though it isn't very useful of course as nobody else can resolve the fqdn to an IP address (unless you put a manual entry in /etc/hosts of course). There are only incidental relationships between FQDN and the ability to send/receive email. You definitely do not need a fqdn to send email and there are a number of ways to have email delivered to a machine without a fqdn or DNS entry e.g. fetchmail. mailhobs with local /etc/hosts entries with 192.168.x.x or 10.x.x.x addresses etc. There are many different ways for a system to support sending/receiving email and it is extremely unlikely that Emacs will be able to determine this correctly automatically. Any attempt to do so will almost certainly be complex and error prone and a pain to maintain. Add to this that far fewer hosts actually do email anymore. 20 years ago, I always setup a local mail server on my system. Now I rarely do. ISPs now frequently block port 25 and most medium to large organisations have very strict policies in place to prevent users from setting up mail servers due to the frequency of misconfiguration that either caused errors or created an open mail relay which could be used for spam and potentially adversely impact on an organisations reputation or result i their mail being blackholed etc. I think I'm with Stefan on this one. The only sane and maintainable solution is to have emacs check for an explicit mail address configuration set by the user and if none exists, prompt the user for one when sending email. In reality, you will probably have to prompt for the name of the mail server as well and possibly a password as many mail servers now use authenticated smtp and you cannot assume the local host has a configured MTA. Or you just display a message saying to cut and paste your message into your preferred mail client and send it that way. Tim On 18 June 2017 at 00:17, Ken Olum wrote: > If your system has no fully qualified domain name, i.e., there is no DNS > entry that points to this host, then of course you cannot receive and > probably cannot send email, and I don't think it's very important > exactly how it fails. But if your system is properly set up as an > Internet host but gethostname does not return the FQDN (e.g., because > you put the short name first in /etc/hosts), then I think > init_system_name should use the FQDN. In the cases in which I have > observed this, "hostname -f" does return the FQDN. > > In emacs-24, the procedure of init_system_name was to first do > gethostname, but if that didn't return a qualified name, it would try > getaddrinfo with ai_canonname, and if that failed look in the list of > aliases given by gethostbyname. Later all this code was removed and now > it just calls gethostname. > > Ken > > -- regards, Tim -- Tim Cross --f4030435cfe0e9a66805523236db Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
If you have a fqdn for a host and hostname -f does not ret= urn the fqdn, then your system is not configured correctly. This would like= ly cause errors or problems with other software as well.=C2=A0

Having a FQDN and a DNS entry are not the same thing. You can have a= fqdn without a DNS entry, though it isn't very useful of course as nob= ody else can resolve the fqdn to an IP address (unless you put a manual ent= ry in /etc/hosts of course).=C2=A0

There are only = incidental relationships between FQDN and the ability to send/receive email= . You definitely do not need a fqdn to send email and there are a number of= ways to have email delivered to a machine without a fqdn or DNS entry e.g.= fetchmail. mailhobs with local /etc/hosts entries with 192.168.x.x or 10.x= .x.x addresses etc.=C2=A0

There are many different= ways for a system to support sending/receiving email and it is extremely u= nlikely that Emacs will be able to determine this correctly automatically. = Any attempt to do so will almost certainly be complex and error prone and a= pain to maintain. Add to this that far fewer hosts actually do email anymo= re. 20 years ago, I always setup a local mail server on my system. Now I ra= rely do. ISPs now frequently block port 25 and most medium to large organis= ations have very strict policies in place to prevent users from setting up = mail servers due to the frequency of misconfiguration that either caused er= rors or created an open mail relay which could be used for spam and potenti= ally adversely impact on an organisations reputation or result i their mail= being blackholed etc.=C2=A0

I think I'm with = Stefan on this one. The only sane and maintainable solution is to have emac= s check for an explicit mail address configuration set by the user and if n= one exists, prompt the user for one when sending email. In reality, you wil= l probably have to prompt for the name of the mail server as well and possi= bly a password as many mail servers now use authenticated smtp and you cann= ot assume the local host has a configured MTA.

Or = you just display a message saying to cut and paste your message into your p= referred mail client and send it that way.

Tim

On 18 Jun= e 2017 at 00:17, Ken Olum <kdo@cosmos.phy.tufts.edu> = wrote:
If your system has no fully qualif= ied domain name, i.e., there is no DNS
entry that points to this host, then of course you cannot receive and
probably cannot send email, and I don't think it's very important exactly how it fails.=C2=A0 But if your system is properly set up as an
Internet host but gethostname does not return the FQDN (e.g., because
you put the short name first in /etc/hosts), then I think
init_system_name should use the FQDN.=C2=A0 In the cases in which I have observed this, "hostname -f" does return the FQDN.

In emacs-24, the procedure of init_system_name was to first do
gethostname, but if that didn't return a qualified name, it would try getaddrinfo with ai_canonname, and if that failed look in the list of
aliases given by gethostbyname.=C2=A0 Later all this code was removed and n= ow
it just calls gethostname.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Ken




--
regards,

Tim

--
Tim Cross

--f4030435cfe0e9a66805523236db--