* Began (but did not finish) applying GPL3+ declarations to each source file. This...
[citadel.git] / citadel / domain.c
index d7bd402de868f2352e71b8ba91331c43c868da91..304cf0ef846d9fc63ba9f863e05adf3c03bc20dd 100644 (file)
@@ -3,6 +3,22 @@
  *
  * DNS lookup for SMTP sender
  *
+ *
+ * Copyright (c) 1987-2009 by the citadel.org team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "sysdep.h"
 #endif
 #include <resolv.h>
 #endif
-
+#include <libcitadel.h>
 #include "sysdep_decls.h"
 #include "citadel.h"
 #include "domain.h"
 #include "server.h"
-#include "tools.h"
 #include "internet_addressing.h"
 
 
@@ -103,9 +118,6 @@ int getmx(char *mxbuf, char *dest) {
                        u_char bytes[1024];
                        HEADER header;
     } answer;
-#else
-       char buf[SIZ];
-       FILE *fp;
 #endif
 
        int ret;
@@ -126,24 +138,7 @@ int getmx(char *mxbuf, char *dest) {
 
        /*
         * No smart-host?  Look up the best MX for a site.
-        */
-
-#ifndef HAVE_RESOLV_H
-
-       /*
-        * On systems with b0rken or non-standard resolver libraries, learn
-        * the MX records by calling "nslookup" from the command line.
-        *
-        * Someday.
-        *
-        */
-
-       return(0);
-
-#else /* HAVE_RESOLV_H */
-
-       /*
-        * Make a call to the standard resolver library.
+        * Make a call to the resolver library.
         */
 
        ret = res_query(
@@ -168,7 +163,7 @@ int getmx(char *mxbuf, char *dest) {
        
                for (qdcount = ntohs(answer.header.qdcount); qdcount--; ptr += ret + QFIXEDSZ) {
                        if ((ret = dn_skipname(ptr, endptr)) < 0) {
-                               lprintf(CTDL_DEBUG, "dn_skipname error\n");
+                               CtdlLogPrintf(CTDL_DEBUG, "dn_skipname error\n");
                                return(0);
                        }
                }
@@ -217,7 +212,6 @@ int getmx(char *mxbuf, char *dest) {
                        }
                }
        }
-#endif /* HAVE_RESOLV_H */
 
        /* Sort the MX records by preference */
        if (num_mxrecs > 1) {