X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fdomain.c;h=0e6bb7dabee767a61a70995ab9b3724f8eee9a8d;hb=aa7365c86de8e26e796d3aa3fd605c85d8c26220;hp=6e098708936cafce5d217badad11094722769cf2;hpb=5485a5966fcfeda759901f5256b7c7287d1da0df;p=citadel.git diff --git a/citadel/domain.c b/citadel/domain.c index 6e0987089..0e6bb7dab 100644 --- a/citadel/domain.c +++ b/citadel/domain.c @@ -1,8 +1,15 @@ /* - * $Id$ - * * DNS lookup for SMTP sender * + * Copyright (c) 1987-2011 by the citadel.org team + * + * This program is open source software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. */ #include "sysdep.h" @@ -11,17 +18,20 @@ #include #include #include +#include #ifdef HAVE_RESOLV_H #include +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +#include +#endif #include #endif - +#include #include "sysdep_decls.h" #include "citadel.h" #include "domain.h" #include "server.h" -#include "tools.h" #include "internet_addressing.h" @@ -35,8 +45,8 @@ int get_hosts(char *mxbuf, char *rectype) { int config_lines; int i; - char buf[SIZ]; - char host[SIZ], type[SIZ]; + char buf[256]; + char host[256], type[256]; int total_smarthosts = 0; if (inetcfg == NULL) return(0); @@ -44,9 +54,9 @@ int get_hosts(char *mxbuf, char *rectype) { config_lines = num_tokens(inetcfg, '\n'); for (i=0; i 1) { @@ -226,6 +215,10 @@ int getmx(char *mxbuf, char *dest) { strcat(mxbuf, mxrecs[n].host); strcat(mxbuf, "|"); } - phree(mxrecs); + free(mxrecs); + + /* Append any fallback smart hosts we have configured. + */ + num_mxrecs += get_hosts(&mxbuf[strlen(mxbuf)], "fallbackhost"); return(num_mxrecs); }