1
diff -ur maradns-1.2.12.02.orig/dns/Compress.c maradns-1.2.12.02/dns/Compress.c
2
--- maradns-1.2.12.02.orig/dns/Compress.c 2005-10-06 15:58:58.000000000 -0500
3
+++ maradns-1.2.12.02/dns/Compress.c 2006-08-09 09:38:02.000000000 -0500
5
-/* Copyright (c) 2002 Sam Trenholme
6
+/* Copyright (c) 2002-2006 Sam Trenholme
11
new->uncompressed = uncompressed;
13
/* Initialize the values which allocate memory */
14
- if((new->compressed = js_create(MAX_COMPRESSED_LEN + 3,1)) == 0) {
15
+ if((new->compressed = js_create(MAX_COMPRESSED_LEN + 4,1)) == 0) {
22
state->uncompressed_offset += 2;
23
- if(state->uncompressed_offset >= state->uncompressed->unit_count) {
24
+ if(state->uncompressed_offset > state->uncompressed->unit_count) {
25
state->valid_state = 0;
31
int compress_get_question(compress_state *state) {
34
if(state->valid_state != 1) {
40
+ if(state->number_answers == -2) { /* No questions nor answers */
44
/* The domain name question */
45
if(compress_dlabel(state) != JS_SUCCESS) {
46
state->valid_state = 0;
47
diff -ur maradns-1.2.12.02.orig/dns/Queries.c maradns-1.2.12.02/dns/Queries.c
48
--- maradns-1.2.12.02.orig/dns/Queries.c 2006-07-26 10:58:44.000000000 -0500
49
+++ maradns-1.2.12.02/dns/Queries.c 2006-08-09 09:38:02.000000000 -0500
53
if(hdr.tc == 1 || (ns == 0 && ar == 0)) {
55
+ hdr.qdcount = hdr.ancount = hdr.nscount = hdr.arcount = 0;
56
make_hdr(&hdr,packet);
59
@@ -1008,11 +1010,13 @@
61
offset = 12; /* Beginning of first question */
62
/* Jump past all of the questions */
66
len = dlabel_length(packet,offset);
69
+ hdr.qdcount = hdr.ancount = hdr.nscount =
71
make_hdr(&hdr,packet);
76
if(offset >= packet->unit_count) {
78
+ hdr.qdcount = hdr.ancount = hdr.nscount =
80
make_hdr(&hdr,packet);
83
@@ -1027,11 +1033,13 @@
86
/* Jump past all of the answers except for the last one */
90
len = dlabel_length(packet,offset);
93
+ hdr.qdcount = hdr.ancount = hdr.nscount =
95
make_hdr(&hdr,packet);
100
if(offset + 2 >= packet->unit_count) {
102
+ hdr.qdcount = hdr.ancount = hdr.nscount =
104
make_hdr(&hdr,packet);
107
@@ -1049,6 +1059,8 @@
109
if(offset >= packet->unit_count) {
111
+ hdr.qdcount = hdr.ancount = hdr.nscount =
113
make_hdr(&hdr,packet);
116
@@ -1065,6 +1077,7 @@
120
+ hdr.qdcount = hdr.ancount = hdr.nscount = hdr.arcount = 0;
121
make_hdr(&hdr,packet);
124
@@ -1075,8 +1088,4 @@
133
diff -ur maradns-1.2.12.02.orig/server/MaraDNS.c maradns-1.2.12.02/server/MaraDNS.c
134
--- maradns-1.2.12.02.orig/server/MaraDNS.c 2006-08-09 09:37:33.000000000 -0500
135
+++ maradns-1.2.12.02/server/MaraDNS.c 2006-08-09 09:39:51.000000000 -0500
137
int seen_ptr_record = 0;
140
+ int compress_error_happened = 0;
144
@@ -926,40 +927,19 @@
148
- /* Compress "most" and place the compressed data in "ar" */
149
+ compress_error_happened = 0;
150
if(compress_data(most,ar) == JS_ERROR) {
151
- /* This is a bit of a kludge to work around the news.com.com
152
- problem for the 1.0.00 release */
153
- if(log_level > 2) {
156
- printf("%s",L_COMPRESS_ERROR);
157
- /* Compress error */
158
- show_esc_stdout(most);
162
- if(js_copy(most,ar) == JS_ERROR) {
165
- udperror(sock,most,client,0,SERVER_FAIL,"Compress failure",2,
168
- udperror(sock,most,0,0,SERVER_FAIL,"Compress failure",2,
175
+ compress_error_happened = 1;
178
/* Check to make sure the data fits in under 512 bytes (4096 bytes
179
* if it's a long_packet_ipv4 address) truncate if not */
180
- if(ar->unit_count > 512) {
181
+ if(ar->unit_count > 512 || compress_error_happened == 1) {
185
- if(ect->type == 4) { /* If this is an ipv4 connection */
186
+ /* If this is an ipv4 connection and we didn't get a compress error */
187
+ if(ect->type == 4 && compress_error_happened == 0) {
188
struct sockaddr_in *dq;
190
dq = (struct sockaddr_in *)(ect->d);
191
@@ -975,16 +955,26 @@
194
for(x = 0; x < 20; x++) {
195
+ compress_error_happened = 0;
196
/* OK, try to squeeze the packet in by removing records */
197
if(squeeze_to_fit(most) == 0) {
200
- if(compress_data(most,ar) == JS_ERROR) {
201
+ if(most->unit_count > 12) {
202
+ if(compress_data(most,ar) == JS_ERROR) {
203
+ compress_error_happened = 1;
205
+ if(ar->unit_count <= 512 &&
206
+ compress_error_happened == 0) {
209
+ } else if(most->unit_count == 12) {
210
+ if(js_copy(most,ar) == JS_ERROR) {
216
- if(ar->unit_count <= 512) {
226
+ if(compress_error_happened == 1) {
230
/* Success! Put out the good data */
232
sendto(sock,ar->string,ar->unit_count,0,
233
diff -ur maradns-1.2.12.02.orig/tools/askmara.c maradns-1.2.12.02/tools/askmara.c
234
--- maradns-1.2.12.02.orig/tools/askmara.c 2006-06-11 02:16:32.000000000 -0500
235
+++ maradns-1.2.12.02/tools/askmara.c 2006-08-09 09:38:02.000000000 -0500
237
if(read_hdr(uindata,&header) == JS_ERROR)
238
harderror(L_INHEADER_CONV); /* Problem converting inheader */
240
+ if(header.tc == 1) {
241
+ printf("# Remote server said: TRUNCATED\n");
244
/* If not 0, show them the rcode from the remote server */
245
switch(header.rcode) {