]> code.citadel.org Git - citadel.git/blobdiff - citadel/locate_host.c
In this place we don't care about the result.
[citadel.git] / citadel / locate_host.c
index 2a7568b232e4ce1fbb05d6f05c7e88fe154ccf1c..39309e943c6dd7b8ab5f30d276395bbc08366cd5 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.
@@ -130,7 +146,7 @@ int rblcheck_backend(char *domain, char *txtbuf, int txtbufsize) {
                if( len == -1 ) {
                        if (txtbuf != NULL) {
                                snprintf(txtbuf, txtbufsize,
-                                       "Message rejected due to known spammer source IP address");
+                                        "Message rejected due to known spammer source IP address");
                        }
                        if (need_to_free_answer) free(answer);
                        return(1);
@@ -168,7 +184,7 @@ int rblcheck_backend(char *domain, char *txtbuf, int txtbufsize) {
        {
                if (txtbuf != NULL) {
                        snprintf(txtbuf, txtbufsize,
-                               "Message rejected due to known spammer source IP address");
+                                "Message rejected due to known spammer source IP address");
                }
                if (need_to_free_answer) free(answer);
                free(result);
@@ -219,11 +235,17 @@ int rblcheck_backend(char *domain, char *txtbuf, int txtbufsize) {
        }
        *rp = '\0';
        if (txtbuf != NULL) {
-               snprintf(txtbuf, txtbufsize, "%s", result);
-       }
-       /* Remove nonprintable characters */
-       for (p=txtbuf; *p; ++p) {
-               if (!isprint(*p)) strcpy(p, p+1);
+               long len;
+               len = snprintf(txtbuf, txtbufsize, "%s", result);
+       
+               /* Remove nonprintable characters */
+               for (p = txtbuf; *p != '\0'; p++) {
+                       if (!isprint(*p)) {
+                               memmove (p,
+                                        p + 1,
+                                        len - (p - txtbuf) - 1);
+                       }
+               }
        }
        if (need_to_free_answer) free(answer);
        free(result);