HUGE PATCH. This moves all of mime_parser.c and all
[citadel.git] / citadel / locate_host.c
index 68eb64dd07e56a0e86bb19b8476e0f0beff27a9c..4df8e19e72b29c8aae6d1aec44ef75e301c9860d 100644 (file)
 #include <limits.h>
 #include <netdb.h>
 #include <string.h>
+#include <libcitadel.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "locate_host.h"
 #include "sysdep_decls.h"
 #include "config.h"
-#include "tools.h"
 #include "domain.h"
 
 #ifdef HAVE_RESOLV_H
 #endif
 
 
+/* Hacks to work around nameser.h declarations missing on OpenBSD
+ * see also: http://search.cpan.org/src/MIKER/Net-DNS-ToolKit-0.30/ToolKit.h
+ */
+
+#ifndef NS_INT16SZ
+# ifdef INT16SZ
+#  define NS_INT16SZ INT16SZ
+# endif
+#endif
+
+#ifndef NS_INT32SZ
+# ifdef INT32SZ
+#  define NS_INT32SZ INT32SZ
+# endif
+#endif
+
+#ifndef NS_GET16
+# ifdef GETSHORT
+#  define NS_GET16 GETSHORT
+# endif
+#endif
+
+
+/***************************************************************************/
+
+
 void locate_host(char *tbuf, size_t n,
                char *abuf, size_t na,
                const struct in_addr *addr)
@@ -270,6 +295,8 @@ int rbl_check(char *message_to_spammer) {
        struct sockaddr_in sin;
        int len;        /* should be socklen_t but doesn't work on Macintosh */
 
+       len = 0;
+       memset (&sin, 0, sizeof (struct sockaddr_in));
        if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, (socklen_t *)&len)) {
                return(rbl_check_addr(&sin.sin_addr, message_to_spammer));
        }