fix for strange dns settings
This commit is contained in:
parent
37c3424cd5
commit
34b0cbd170
@ -2,8 +2,10 @@ include_HEADERS=containers_public.h queue.h smtp.h cfg.h count.h safe_write.h su
|
|||||||
lib_LTLIBRARIES = libsmmapdfw.la
|
lib_LTLIBRARIES = libsmmapdfw.la
|
||||||
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c stats.c htcache.c htbuffer.c
|
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c stats.c htcache.c htbuffer.c
|
||||||
libsmmapdfw_la_LIBADD = @BDB_LIBS@
|
libsmmapdfw_la_LIBADD = @BDB_LIBS@
|
||||||
bin_PROGRAMS = htcachetest htbuffertest
|
bin_PROGRAMS = htcachetest htbuffertest htdnstest
|
||||||
htcachetest_SOURCES = htcachetest.c
|
htcachetest_SOURCES = htcachetest.c
|
||||||
htcachetest_LDADD = libsmmapdfw.la
|
htcachetest_LDADD = libsmmapdfw.la
|
||||||
htbuffertest_SOURCES = htbuffertest.c
|
htbuffertest_SOURCES = htbuffertest.c
|
||||||
htbuffertest_LDADD = libsmmapdfw.la
|
htbuffertest_LDADD = libsmmapdfw.la
|
||||||
|
htdnstest_SOURCES = htdnstest.c
|
||||||
|
htdnstest_LDADD = libsmmapdfw.la
|
||||||
|
@ -91,11 +91,13 @@ include_HEADERS = containers_public.h queue.h smtp.h cfg.h count.h safe_write.h
|
|||||||
lib_LTLIBRARIES = libsmmapdfw.la
|
lib_LTLIBRARIES = libsmmapdfw.la
|
||||||
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c stats.c htcache.c htbuffer.c
|
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c stats.c htcache.c htbuffer.c
|
||||||
libsmmapdfw_la_LIBADD = @BDB_LIBS@
|
libsmmapdfw_la_LIBADD = @BDB_LIBS@
|
||||||
bin_PROGRAMS = htcachetest htbuffertest
|
bin_PROGRAMS = htcachetest htbuffertest htdnstest
|
||||||
htcachetest_SOURCES = htcachetest.c
|
htcachetest_SOURCES = htcachetest.c
|
||||||
htcachetest_LDADD = libsmmapdfw.la
|
htcachetest_LDADD = libsmmapdfw.la
|
||||||
htbuffertest_SOURCES = htbuffertest.c
|
htbuffertest_SOURCES = htbuffertest.c
|
||||||
htbuffertest_LDADD = libsmmapdfw.la
|
htbuffertest_LDADD = libsmmapdfw.la
|
||||||
|
htdnstest_SOURCES = htdnstest.c
|
||||||
|
htdnstest_LDADD = libsmmapdfw.la
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
CONFIG_HEADER = ../config.h
|
CONFIG_HEADER = ../config.h
|
||||||
CONFIG_CLEAN_FILES =
|
CONFIG_CLEAN_FILES =
|
||||||
@ -111,7 +113,8 @@ libsmmapdfw_la_DEPENDENCIES =
|
|||||||
libsmmapdfw_la_OBJECTS = cfg.lo queue.lo count.lo safe_write.lo \
|
libsmmapdfw_la_OBJECTS = cfg.lo queue.lo count.lo safe_write.lo \
|
||||||
config_public.lo htdns.lo smtp.lo htmalloc.lo stats.lo htcache.lo \
|
config_public.lo htdns.lo smtp.lo htmalloc.lo stats.lo htcache.lo \
|
||||||
htbuffer.lo
|
htbuffer.lo
|
||||||
bin_PROGRAMS = htcachetest$(EXEEXT) htbuffertest$(EXEEXT)
|
bin_PROGRAMS = htcachetest$(EXEEXT) htbuffertest$(EXEEXT) \
|
||||||
|
htdnstest$(EXEEXT)
|
||||||
PROGRAMS = $(bin_PROGRAMS)
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
|
|
||||||
htcachetest_OBJECTS = htcachetest.$(OBJEXT)
|
htcachetest_OBJECTS = htcachetest.$(OBJEXT)
|
||||||
@ -120,6 +123,9 @@ htcachetest_LDFLAGS =
|
|||||||
htbuffertest_OBJECTS = htbuffertest.$(OBJEXT)
|
htbuffertest_OBJECTS = htbuffertest.$(OBJEXT)
|
||||||
htbuffertest_DEPENDENCIES = libsmmapdfw.la
|
htbuffertest_DEPENDENCIES = libsmmapdfw.la
|
||||||
htbuffertest_LDFLAGS =
|
htbuffertest_LDFLAGS =
|
||||||
|
htdnstest_OBJECTS = htdnstest.$(OBJEXT)
|
||||||
|
htdnstest_DEPENDENCIES = libsmmapdfw.la
|
||||||
|
htdnstest_LDFLAGS =
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
@ -136,10 +142,10 @@ TAR = tar
|
|||||||
GZIP_ENV = --best
|
GZIP_ENV = --best
|
||||||
DEP_FILES = .deps/cfg.P .deps/config_public.P .deps/count.P \
|
DEP_FILES = .deps/cfg.P .deps/config_public.P .deps/count.P \
|
||||||
.deps/htbuffer.P .deps/htbuffertest.P .deps/htcache.P \
|
.deps/htbuffer.P .deps/htbuffertest.P .deps/htcache.P \
|
||||||
.deps/htcachetest.P .deps/htdns.P .deps/htmalloc.P .deps/queue.P \
|
.deps/htcachetest.P .deps/htdns.P .deps/htdnstest.P .deps/htmalloc.P \
|
||||||
.deps/safe_write.P .deps/smtp.P .deps/stats.P
|
.deps/queue.P .deps/safe_write.P .deps/smtp.P .deps/stats.P
|
||||||
SOURCES = $(libsmmapdfw_la_SOURCES) $(htcachetest_SOURCES) $(htbuffertest_SOURCES)
|
SOURCES = $(libsmmapdfw_la_SOURCES) $(htcachetest_SOURCES) $(htbuffertest_SOURCES) $(htdnstest_SOURCES)
|
||||||
OBJECTS = $(libsmmapdfw_la_OBJECTS) $(htcachetest_OBJECTS) $(htbuffertest_OBJECTS)
|
OBJECTS = $(libsmmapdfw_la_OBJECTS) $(htcachetest_OBJECTS) $(htbuffertest_OBJECTS) $(htdnstest_OBJECTS)
|
||||||
|
|
||||||
all: all-redirect
|
all: all-redirect
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@ -251,6 +257,10 @@ htbuffertest$(EXEEXT): $(htbuffertest_OBJECTS) $(htbuffertest_DEPENDENCIES)
|
|||||||
@rm -f htbuffertest$(EXEEXT)
|
@rm -f htbuffertest$(EXEEXT)
|
||||||
$(LINK) $(htbuffertest_LDFLAGS) $(htbuffertest_OBJECTS) $(htbuffertest_LDADD) $(LIBS)
|
$(LINK) $(htbuffertest_LDFLAGS) $(htbuffertest_OBJECTS) $(htbuffertest_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
htdnstest$(EXEEXT): $(htdnstest_OBJECTS) $(htdnstest_DEPENDENCIES)
|
||||||
|
@rm -f htdnstest$(EXEEXT)
|
||||||
|
$(LINK) $(htdnstest_LDFLAGS) $(htdnstest_OBJECTS) $(htdnstest_LDADD) $(LIBS)
|
||||||
|
|
||||||
install-includeHEADERS: $(include_HEADERS)
|
install-includeHEADERS: $(include_HEADERS)
|
||||||
@$(NORMAL_INSTALL)
|
@$(NORMAL_INSTALL)
|
||||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||||
|
@ -72,7 +72,6 @@ static int get_domain_name(answer_t *answer, int offset, char **name) {
|
|||||||
name_buf = NULL;
|
name_buf = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (0 != (len = answer->buf[offset++])) {
|
while (0 != (len = answer->buf[offset++])) {
|
||||||
if (0xC0 == (len & 0xC0)) {
|
if (0xC0 == (len & 0xC0)) {
|
||||||
if (NULL != name) { /* if we don't need the result, we don't need to recurse, since a ... */
|
if (NULL != name) { /* if we don't need the result, we don't need to recurse, since a ... */
|
||||||
@ -103,7 +102,8 @@ static int get_domain_name(answer_t *answer, int offset, char **name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NULL != name) {
|
if (NULL != name) {
|
||||||
name_buf[strlen(name_buf)-1] = '\0'; /* remove the final dot */
|
if (name_buf != NULL) /* we can do this of course only if there is something */
|
||||||
|
name_buf[strlen(name_buf)-1] = '\0'; /* remove the final dot */
|
||||||
*name = name_buf;
|
*name = name_buf;
|
||||||
}
|
}
|
||||||
return offset;
|
return offset;
|
||||||
@ -112,6 +112,7 @@ static int get_domain_name(answer_t *answer, int offset, char **name) {
|
|||||||
static int get_mx_rdata(answer_t *answer, int offset, int len, mx_rdata_t **resp) {
|
static int get_mx_rdata(answer_t *answer, int offset, int len, mx_rdata_t **resp) {
|
||||||
*resp = (mx_rdata_t*) htmalloc(sizeof(mx_rdata_t));
|
*resp = (mx_rdata_t*) htmalloc(sizeof(mx_rdata_t));
|
||||||
(*resp)->preference = get16(answer->buf, offset);
|
(*resp)->preference = get16(answer->buf, offset);
|
||||||
|
(*resp)->exchange = NULL;
|
||||||
get_domain_name(answer, offset+2, &(*resp)->exchange);
|
get_domain_name(answer, offset+2, &(*resp)->exchange);
|
||||||
(*resp)->type = T_MX;
|
(*resp)->type = T_MX;
|
||||||
|
|
||||||
@ -135,6 +136,7 @@ static int get_a_rdata(answer_t *answer, int offset, int len, a_rdata_t **resp)
|
|||||||
|
|
||||||
static int get_cname_rdata(answer_t *answer, int offset, int len, cname_rdata_t **resp) {
|
static int get_cname_rdata(answer_t *answer, int offset, int len, cname_rdata_t **resp) {
|
||||||
*resp = (cname_rdata_t*) htmalloc(sizeof(cname_rdata_t));
|
*resp = (cname_rdata_t*) htmalloc(sizeof(cname_rdata_t));
|
||||||
|
(*resp)->cname = NULL;
|
||||||
get_domain_name(answer, offset, &(*resp)->cname);
|
get_domain_name(answer, offset, &(*resp)->cname);
|
||||||
(*resp)->type = T_CNAME;
|
(*resp)->type = T_CNAME;
|
||||||
|
|
||||||
|
60
smmapdfw/libsmmapdfw/htdnstest.c
Normal file
60
smmapdfw/libsmmapdfw/htdnstest.c
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2004,2005 Wolfgang Hottgenroth
|
||||||
|
|
||||||
|
This file is part of smmapdfw.
|
||||||
|
|
||||||
|
smmapdfw is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
smmapdfw is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with smmapdfw. If not, write to the Free Software Foundation, 59
|
||||||
|
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
|
||||||
|
#include "htdns.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **args) {
|
||||||
|
if (argc != 2) {
|
||||||
|
printf("give domain to test on commandline\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *domain = args[1];
|
||||||
|
|
||||||
|
mx_rdata_t **mx_rdata = get_best_mx_rrs(domain);
|
||||||
|
if (mx_rdata == NULL) {
|
||||||
|
printf("no mx-rr found\n");
|
||||||
|
} else {
|
||||||
|
mx_rdata_t **mx_rdata2;
|
||||||
|
for (mx_rdata2 = mx_rdata; *mx_rdata2 != NULL; mx_rdata2++) {
|
||||||
|
printf("--> %d, %s\n", (*mx_rdata2)->preference, (*mx_rdata2)->exchange);
|
||||||
|
}
|
||||||
|
|
||||||
|
free_rrs((void**)mx_rdata);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user