Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smtpd -n fails with 'invalid hostname' if local host name is an unresolvable non-FQDN #645

Closed
mjb2010 opened this issue Oct 29, 2015 · 3 comments

Comments

@mjb2010
Copy link

mjb2010 commented Oct 29, 2015

If gethostname(3) / hostname(1) returns a non-FQDN (e.g. 'myhost' rather than 'myhost.example.org') which is not resolvable, then 'smtpd -n' fails with this message:

invalid hostname: getaddrinfo() failed: hostname nor servname provided, or not known

It seems to work OK if the hostname is a FQDN (even if unresolvable), or if the unqualified hostname is resolvable (e.g. it is in /etc/hosts as a localhost alias).

I don't know what the desired behavior is in this situation, but it seems that smtpd should be able to start up with no less difficulty than sendmail. Or, if smtpd is not designed to work with a non-FQDN hostname, the error message should be clearer about what the user should do, since it's not a problem with the smtpd config, per se. The message could say "smtpd requires that the local hostname, currently 'foo', be resolvable", and maybe also direct the user to check /etc/hosts.

[I first reported this on the opensmtpd-misc list, and was advised to file the report here. This first came up for me when using OpenSMTPD 5.7.3p1 from the FreeBSD ports collection on my BeagleBone Black. The FreeBSD snapshots for the BeagleBone come configured with a hostname of just "beaglebone" and no corresponding entry in /etc/hosts.]

@snimmagadda
Copy link
Contributor

This is now fixed in master branch. Please test using the latest code.

@poolpOrg
Copy link
Member

poolpOrg commented Feb 2, 2016

OP timeout ;-)

@mjb2010
Copy link
Author

mjb2010 commented Feb 2, 2016

Sorry; I was waiting for the FreeBSD port to be updated before I could easily test the fix for this and #642 on my BeagleBone Black. The port was finally updated today, so I will be testing soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants