]> code.citadel.org Git - citadel.git/blobdiff - citadel/locate_host.c
openbsd compatibility: add NS_GET16 workaround.
[citadel.git] / citadel / locate_host.c
index c3a19636930996eeecebb11db922588bf248829f..fa8cfad2f0f3d0bccd75e3e6d2ecb2fce1150ec9 100644 (file)
 #include <resolv.h>
 #endif
 
+/** START:some missing macros on OpenBSD 3.9 */
+#ifndef NS_CMPRSFLGS
+#define NS_CMPRSFLGS   0xc0
+#endif
+#if !defined(NS_MAXCDNAME) && defined (MAXCDNAME)
+#define NS_MAXCDNAME MAXCDNAME
+#endif
+#if !defined(NS_INT16SZ) && defined(INT16SZ)
+#define NS_INT16SZ INT16SZ
+#define NS_INT32SZ INT32SZ
+#endif
+#ifndef NS_GET16
+#  define NS_GET16 GETSHORT
+#endif
+
+/** END:some missing macros on OpenBSD 3.9 */
 
 /*
  * Given an open client socket, return the host name and IP address at the other end.
@@ -243,13 +259,11 @@ int rbl_check(char *message_to_spammer)
        int num_rbl;
        char rbl_domains[SIZ];
        char txt_answer[1024];
-       int ip_version = 4;
 
        strcpy(message_to_spammer, "ok");
 
        if ((strchr(CC->cs_addr, '.')) && (!strchr(CC->cs_addr, ':'))) {
                int a1, a2, a3, a4;
-               ip_version = 4;
 
                sscanf(CC->cs_addr, "%d.%d.%d.%d", &a1, &a2, &a3, &a4);
                snprintf(tbuf, sizeof tbuf, "%d.%d.%d.%d.", a4, a3, a2, a1);
@@ -261,8 +275,6 @@ int rbl_check(char *message_to_spammer)
                char workbuf[sizeof tbuf];
                char *ptr;
 
-               ip_version = 6;
-
                /* tedious code to expand and reverse an IPv6 address */
                safestrncpy(tbuf, CC->cs_addr, sizeof tbuf);
                num_colons = haschar(tbuf, ':');