Summary: | Gentoo is returning the wrong value for getdomainname | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Luke-Jr <luke-jr+gentoobugs> |
Component: | [OLD] Server | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | base-system, gengor, gentoo, paul |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Luke-Jr
2007-11-22 06:04:18 UTC
linux-1 etc # postconf -c /tmp/empty myhostname myhostname = linux-1.localdomain linux-1 etc # hostname -f linux-1.dombr.org (In reply to comment #1) > linux-1 etc # postconf -c /tmp/empty myhostname > myhostname = linux-1.localdomain > linux-1 etc # hostname -f > linux-1.dombr.org > I have the same problem - suddenly all my mail is rejected because the sender address has 'localdomain' instead of my actual domain. I temporarily fixed by setting myhostname,mydomain and mydestination explicitly (In reply to comment #2) > (In reply to comment #1) > > linux-1 etc # postconf -c /tmp/empty myhostname > > myhostname = linux-1.localdomain > > linux-1 etc # hostname -f > > linux-1.dombr.org > > > I have the same problem - suddenly all my mail is rejected because the sender > address has 'localdomain' instead of my actual domain. I temporarily fixed by > setting myhostname,mydomain and mydestination explicitly I joined the postfix mailing list and asked for help. Postfix uses the gethostname/getdomainname calls to get the necessary values. On gentoo the getdomainname call always returns (none). For some reason, postfix 2.3.6 handles this correctly but postfix 2.4.5 does not. I see that one can now specify the domainname by adding dns_domain_lo="..." to the file /etc/conf.d/net but that did not work. (In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > I see that one can now specify the domainname by adding dns_domain_lo="..." to > the file /etc/conf.d/net but that did not work. > I have enquired on the postfix mailing list about this and run the following program: #include <unistd.h> #include <stdlib.h> #include <stdio.h> #define MAXNAME 1024 int main(void) { char namebuf[MAXNAME]; if (gethostname(namebuf, sizeof(namebuf)) != 0) perror("gethostname"); else printf("hostname=%.*s\n", MAXNAME, namebuf); if (getdomainname(namebuf, sizeof(namebuf)) != 0) perror("getdomainname"); else printf("Domain=%.*s\n", MAXNAME, namebuf); exit(0); } No matter what combinations of settings in gentoo the getdomainname() call always returns (none). The settings I tried were the /etc/hosts entry: 127.0.0.1 hostname.domainname hostname localhost and in /etc/conf.d/net: dns_domain_lo="domainname" and in /etc/conf.d/hostname: hostname="hostname.domainname" In all cases getdomainname returns (none). In the last case, postfix 2.4.5 did work as expected - however the hostname command then returns the FQDN instead of hostname -f and I am unsure of the ramifications of this. The postfix developers are adamant that postfix is now right and gentoo is incorrect - in the meantime I am downgrading to 2.3.6 (In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #2) > > > (In reply to comment #1) > The postfix developers are adamant that postfix is now right and gentoo is > incorrect - in the meantime I am downgrading to 2.3.6 > This is my last post on this Careful reading of this link http://www.gnu.org/software/libc/manual/html_node/Host-Identification.html#Host-Identification indicates that the way gentoo sets the host name is incorrect. I modified the file /etc/conf.d/hostname to set a new variable FQDN to the canonical hostname FQDN="hostname.domain" and then modified /etc/init.d/hostname to do: HOSTNAME=$( echo ${FQDN} | cut -d'.' -f1 ) hostname ${FQDN} postfix then worked. The only other change I have made is to remove '.\O' from the /etc/issue file. Everything else appears to work. The getdomainname problems in previous comments is a red herring. How do you figure? Everything in that link defines "hostname" as the FQDN and defines getdomainname to be (unused, for most people) NIS/YP stuff. "host name", that is (In reply to comment #7) > "host name", that is > Ah yes - the gentoo installation instructions have the file /etc/conf.d/hostname as: HOSTNAME="myhostname" and the script /etc/init.d/hostname executes: hostname ${HOSTNAME} which is not the canonical FQDN. Ok, now it makes sense :) Basically, the problem then is that Gentoo makes the FQDN second-class... :/ Hi,
from what i understand, the Gentoo ebuild has nothing to do with it. Postfix 2.4 release notes warn about that changing behaviour:
Major changes - small office/home office support
------------------------------------------------
[Incompat 20061217] Postfix no longer requires a domain name. It
uses "localdomain" as the default Internet domain name when no
domain is specified via main.cf or via the machine's hostname.
Viktor from the postfix ML said:
" you are (finally) seeing a correctly behaving Postfix, no longer
broken by misguided patches. On systems whose hostname is not an fqdn,
the main.cf file must contain an explicit "mydomain" setting unless
"localdomain" is acceptable (systems lacking a proper FQDN)."
so, "not a bug but a feature" (tm)
And :
On Wed, Dec 05, 2007 at 12:39:12PM +0200, Paul Hewlett wrote:
> Just a quick note of thanks for the help from you and others.
> I now set my hostname to the canonical FQDN on my gentoo boxes .
> This , of course, contradicts the standard described in the gentoo
> installation instructions.
Viktor answered:
"You don't have to do that. You can instead set "mydomain = ..." in
main.cf. Mail systems need a stable domain because user email addresses
must not change randomly when a dynamically addressed system gets a new
name from DHCP. The "localdomain" approach is quite sensible for most
end-systems."
So you have several solutions in your hands, now.
Correct, it is not a problem with the ebuild. This bug is still a bug in Gentoo though, as long as Gentoo is returning the wrong value for getdomainname Re-assigning to toolchain@ as glibc provides getdomainname, also CC'ing base-system@ ... whoever might be interested in that bug. the behavior of glibc looks correct to me. i think you're confusing DNS behavior with non-DNS behavior. `hostname` and `domainname` do not set DNS info, just like gethostname() and getdomainname() do not return DNS info. whatever you give to `hostname` is taken straight without parsing. that is because it isnt a DNS name. the test case in Comment #4 works fine for me after correctly using the programs in question: # hostname vapier # domainname wh0rd.org # ./a.out hostname=vapier Domain=wh0rd.org |