/*
* 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.
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-
#include <libcitadel.h>
-
#include "context.h"
#ifdef HAVE_RESOLV_H
#include <arpa/nameser.h>
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);
}
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
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);
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);