Browse code

mode debugging output introduced

Jiri Kuthan authored on 19/08/2002 08:58:42
Showing 1 changed files
... ...
@@ -177,7 +177,10 @@ struct rdata* get_record(char* name, int type)
177 177
 	head=rd=0;
178 178
 	crt=&head;
179 179
 	size=res_search(name, C_IN, type, buff.buff, sizeof(buff));
180
-	if (size<0) goto error;
180
+	if (size<0) {
181
+		LOG(L_ERR, "ERROR: get_record: size<0\n");
182
+		goto error;
183
+	}
181 184
 	else if (size > sizeof(buff)) size=sizeof(buff);
182 185
 	
183 186
 	p=buff.buff+DNS_HDR_SIZE;
... ...
@@ -187,20 +190,29 @@ struct rdata* get_record(char* name, int type)
187 187
 
188 188
 	for (r=0; r<qno; r++){
189 189
 		/* skip the name of the question */
190
-		if ((p=dns_skipname(p, end))==0) goto error;
190
+		if ((p=dns_skipname(p, end))==0) {
191
+			LOG(L_ERR, "ERROR: get_record: skipname==0\n");
192
+			goto error;
193
+		}
191 194
 		p+=2+2; /* skip QCODE & QCLASS */
192 195
 	#if 0
193 196
 		for (;(p<end && (*p)); p++);
194 197
 		p+=1+2+2; /* skip the ending  '\0, QCODE and QCLASS */
195 198
 	#endif
196
-		if (p>end) goto error;
199
+		if (p>end) {
200
+			LOG(L_ERR, "ERROR: get_record: p>end\n");
201
+			goto error;
202
+		}
197 203
 	};
198 204
 	answers_no=ntohs((unsigned short)buff.hdr.ancount);
199 205
 	ans_len=ANS_SIZE;
200 206
 	t=answer;
201 207
 	for (r=0; (r<answers_no) && (p<end); r++){
202 208
 		/*  ignore it the default domain name */
203
-		if ((p=dns_skipname(p, end))==0) goto error;
209
+		if ((p=dns_skipname(p, end))==0) {
210
+			LOG(L_ERR, "ERROR: get_record: skip_name=0 (#2)\n");
211
+			goto error;
212
+		}
204 213
 		/*
205 214
 		skip=dn_expand(buff.buff, end, p, t, ans_len);
206 215
 		p+=skip;