aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2005-10-30 21:27:25 +0000
committerMatthias Andree <matthias.andree@gmx.de>2005-10-30 21:27:25 +0000
commit4d6d492fa367899570abf5f9ceaca629697db13f (patch)
tree1aad4ad1522cfbed95d504cfb62b36ed0587e945
parentded4cbd54398858f9105eb8c2c98884a7bc2a471 (diff)
downloadfetchmail-4d6d492fa367899570abf5f9ceaca629697db13f.tar.gz
fetchmail-4d6d492fa367899570abf5f9ceaca629697db13f.tar.bz2
fetchmail-4d6d492fa367899570abf5f9ceaca629697db13f.zip
Add parameter to host_fqdn() to state if the domain name is required, i. e.
if fetchmail should exit if it cannot resolve (canonicalize) its own hostname. svn path=/trunk/; revision=4381
-rw-r--r--env.c10
-rw-r--r--fetchmail.h2
2 files changed, 9 insertions, 3 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);
diff --git a/fetchmail.h b/fetchmail.h
index c75d07b0..257d84cd 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -647,7 +647,7 @@ char *visbuf(const char *);
const char *showproto(int);
void dump_config(struct runctl *runp, struct query *querylist);
int is_host_alias(const char *, struct query *);
-char *host_fqdn(void);
+char *host_fqdn(int required);
char *rfc822timestamp(void);
flag is_a_file(int);
char *rfc2047e(const char*, const char *);