summaryrefslogtreecommitdiff
path: root/mail/rblcheck/files/patch-aa
diff options
context:
space:
mode:
Diffstat (limited to 'mail/rblcheck/files/patch-aa')
-rw-r--r--mail/rblcheck/files/patch-aa110
1 files changed, 42 insertions, 68 deletions
diff --git a/mail/rblcheck/files/patch-aa b/mail/rblcheck/files/patch-aa
index 4caceae9bc30..3ab717674fb8 100644
--- a/mail/rblcheck/files/patch-aa
+++ b/mail/rblcheck/files/patch-aa
@@ -1,6 +1,6 @@
---- rblcheck.c.orig Thu Aug 20 00:47:03 1998
-+++ rblcheck.c Mon Jul 16 16:40:55 2001
-@@ -79,8 +79,10 @@
+--- rblcheck.c.orig Thu Nov 8 14:05:27 2001
++++ rblcheck.c Wed May 1 08:19:16 2002
+@@ -28,8 +28,10 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
@@ -9,9 +9,9 @@
#include <netdb.h>
+#include <unistd.h>
- #define VERSION "1.4"
+ /*-- PORTABILITY ------------------------------------------------------------*/
-@@ -203,7 +205,7 @@
+@@ -184,7 +186,7 @@
* domain. If "txt" is non-zero, we perform a TXT record lookup. We
* return the text returned from a TXT match, or an empty string, on
* a successful match, or NULL on an unsuccessful match. */
@@ -20,7 +20,7 @@
{
char * domain;
char * result = NULL;
-@@ -214,12 +216,15 @@
+@@ -195,12 +197,15 @@
const u_char * cend;
const u_char * rend;
int len;
@@ -37,7 +37,7 @@
/* Make our DNS query. */
res_init();
-@@ -261,8 +266,8 @@
+@@ -242,8 +247,8 @@
cp = answer + sizeof( HEADER );
while( *cp != '\0' )
{
@@ -48,7 +48,7 @@
cp++;
}
-@@ -277,8 +282,8 @@
+@@ -258,8 +263,8 @@
cp += ( NS_INT16SZ * 2 ) + NS_INT32SZ;
/* Get the length and end of the buffer. */
@@ -59,7 +59,7 @@
/* Iterate over any multiple answers we might have. In
this context, it's unlikely, but anyway. */
-@@ -286,10 +291,10 @@
+@@ -267,10 +272,10 @@
rend = result + RESULT_SIZE - 1;
while( cp < cend && rp < rend )
{
@@ -74,75 +74,49 @@
{
if( *cp == '\n' || *cp == '"' ||
*cp == '\\' )
-@@ -308,23 +313,27 @@
- char **argv;
+@@ -289,22 +294,39 @@
+ * RBL listing, handling output of results if necessary. */
+ int full_rblcheck( char * addr )
{
- extern int optind;
- int a, b, c, d;
-+ extern char *optarg;
+ struct hostent *ent;
+ struct in_addr a;
- int quiet = 0;
- int txt = 0;
- int rblfiltered = 0;
+ int count = 0;
++ int rblchecking = 0;
char * response;
- struct rbl * rblsites = NULL;
struct rbl * ptr;
+ int fail;
+ int c;
-- /* Add more sites you want in the default list of RBL-alike
-- systems here. ### An easier way to change this is needed. ### */
-- rblsites = togglesite( "rbl.maps.vix.com", rblsites );
-- rblsites = togglesite( "rbl.dorkslayers.com", rblsites );
-+/* Hack to handle the easy addition of sites at compile time */
-+#define SITE(x) rblsites = togglesite( (x), rblsites);
-+#include "rblsites.h"
-+#undef SITE
-
- progname = argv[ 0 ];
-
-- while( ( a = getopt( argc, argv, "qtls:c?hv" ) ) != EOF )
-- switch( a )
-+ while( ( c = getopt( argc, argv, "qtls:c?hv" ) ) != EOF )
-+ switch( c )
- {
- case 'q':
- /* Quiet */
-@@ -372,10 +381,23 @@
- return -1;
- }
-
-- if( sscanf( argv[ optind ], "%d.%d.%d.%d", &a, &b, &c, &d ) != 4 ||
-- a < 0 || a > 255 || b < 0 || b > 255 || c < 0 || c > 255 ||
-- d < 0 || d > 255 )
-- {
-+ fail = 0;
-+ if ((ent = gethostbyname(argv[optind])) != NULL) {
-+ memcpy(&a, ent->h_addr_list[0], sizeof(a));
-+ if (ent->h_addr_list[1]) {
-+ if (!quiet)
-+ fprintf(stderr,
-+ "%s resolved to mutiple addresses: ",
-+ argv[optind]);
-+ }
-+ if (!quiet)
-+ fprintf(stderr, "checking %s\n", inet_ntoa(a));
-+ } else {
-+ if (!inet_aton(argv[optind], &a))
-+ fail++;
-+ }
-+
-+ if (fail) {
- fprintf( stderr, "%s: invalid IP address\n", progname );
- usage();
- return -1;
-@@ -383,7 +405,7 @@
-
for( ptr = rblsites; ptr != NULL; ptr = ptr->next )
{
+- if( sscanf( addr, "%d.%d.%d.%d", &a, &b, &c, &d ) != 4
+- || a < 0 || a > 255 || b < 0 || b > 255 || c < 0 || c > 255
+- || d < 0 || d > 255 )
+- {
++ fail = 0;
++ if ((ent = gethostbyname(addr)) != NULL) {
++ memcpy(&a, ent->h_addr_list[0], sizeof(a));
++ if (ent->h_addr_list[1]) {
++ if (!quiet && rblchecking == 0)
++ fprintf(stderr,
++ "%s resolved to mutiple addresses: ",
++ addr);
++ }
++ if (!quiet && rblchecking++ == 0)
++ fprintf(stderr, "checking %s\n", inet_ntoa(a));
++ } else {
++ if (!inet_aton(addr, &a))
++ fail++;
++ }
++
++ if (fail) {
+ fprintf( stderr, "%s: warning: invalid address `%s'\n",
+ progname, addr );
+ return 0;
+ }
- response = rblcheck( a, b, c, d, ptr->site, txt );
+ response = rblcheck( a, ptr->site, txt );
- printf( "%s%s%s%s%s%s", !quiet && !response ? "not " : "",
- !quiet ? "RBL filtered by " : "", !quiet ? ptr->site : "",
- txt && response && strlen( response ) && !quiet ? ": " : "",
+ if( !quiet || response )
+ printf( "%s %s%s%s%s%s%s", addr,
+ ( !quiet && !response ? "not " : "" ),