aboutsummaryrefslogtreecommitdiffstats
path: root/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'env.c')
-rw-r--r--env.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/env.c b/env.c
index b3d27164..b1f05561 100644
--- a/env.c
+++ b/env.c
@@ -132,7 +132,7 @@ void envquery(int argc, char **argv)
strcat(rcfile, RCFILE_NAME);
}
-char *host_fqdn(void)
+char *host_fqdn(int required /** barf if the name cannot be resolved */)
/* get the FQDN of the machine we're running */
{
char tmpbuf[HOSTLEN+1];
@@ -163,7 +163,13 @@ char *host_fqdn(void)
fprintf(stderr,
GT_("gethostbyname failed for %s\n"), tmpbuf);
fprintf(stderr, "%s", gai_strerror(e));
- exit(PS_DNS);
+ fprintf(stderr, GT_("Cannot find my own host in hosts database to qualify it!\n"));
+ if (required)
+ exit(PS_DNS);
+ else {
+ fprintf(stderr, GT_("Trying to continue with unqualified hostname.\nDO NOT report broken Received: headers, HELO/EHLO lines or similar problems!\nDO repair your /etc/hosts, DNS, NIS or LDAP instead.\n"));
+ return 0;
+ }
}
result = xstrdup(res->ai_canonname);