X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Flocate_host.c;h=3c742c2e2ea953c6fb2ad32a57c49d87b95a1b34;hb=94c2f05c0230a64c9515b2835303fd760e218e48;hp=26c844024515bd2c354a4d46ff358c1c54fad74a;hpb=9d3894b421e74cdde8ab109ef4714b8a42d97bc4;p=citadel.git diff --git a/citadel/locate_host.c b/citadel/locate_host.c index 26c844024..3c742c2e2 100644 --- a/citadel/locate_host.c +++ b/citadel/locate_host.c @@ -1,7 +1,7 @@ /* * Functions which handle hostname/address lookups and resolution * - * Copyright (c) 1987-2011 by the citadel.org team + * Copyright (c) 1987-2017 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. @@ -20,10 +20,8 @@ #include #include #include - #include - #include "context.h" #ifdef HAVE_RESOLV_H #include @@ -123,15 +121,14 @@ int rblcheck_backend(char *domain, char *txtbuf, int txtbufsize) { return(0); } - if( len > PACKETSZ ) + if (len > PACKETSZ) { answer = malloc(len); need_to_free_answer = 1; len = res_query(domain, C_IN, T_A, answer, len); if( len == -1 ) { if (txtbuf != NULL) { - snprintf(txtbuf, txtbufsize, - "Message rejected due to known spammer source IP address"); + snprintf(txtbuf, txtbufsize, "Message rejected due to known spammer source IP address"); } if (need_to_free_answer) free(answer); return(1); @@ -139,15 +136,15 @@ int rblcheck_backend(char *domain, char *txtbuf, int txtbufsize) { } if (server_shutting_down) { - if (txtbuf != NULL) + if (txtbuf != NULL) { snprintf(txtbuf, txtbufsize, "System shutting down"); + } if (need_to_free_answer) free(answer); return (1); } result = (char *) malloc(RESULT_SIZE); - result[ 0 ] = '\0'; - + result[0] = '\0'; /* Make another DNS query for textual data; this shouldn't * be a performance hit, since it'll now be cached at the @@ -168,8 +165,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"); + snprintf(txtbuf, txtbufsize, "Message rejected due to known spammer source IP address"); } if (need_to_free_answer) free(answer); free(result); @@ -296,11 +292,11 @@ int rbl_check(char *message_to_spammer) for (i=0; i<8; ++i) { char tokbuf[5]; extract_token(tokbuf, workbuf, i, ':', sizeof tokbuf); - memcpy(&tbuf[ (i*4) + (4-strlen(tokbuf)) ], tokbuf, strlen(tokbuf) ); } - if (strlen(tbuf) != 32) + if (strlen(tbuf) != 32) { goto finish_rbl; + } /* now reverse it and add dots */ strcpy(workbuf, tbuf);