#3 fixed last test, added A char

This commit is contained in:
Erik Ekman 2007-02-08 21:10:46 +00:00
parent 79f9940b83
commit 71e9359ed0

View file

@ -113,11 +113,9 @@ START_TEST(test_encode_query)
{ {
char buf[512]; char buf[512];
char resolv[512]; char resolv[512];
char *host = "kryo.se";
struct query q; struct query q;
char *d; char *d;
int len; int len;
int pos;
int ret; int ret;
len = sizeof(buf); len = sizeof(buf);
@ -128,13 +126,13 @@ START_TEST(test_encode_query)
q.id = 1337; q.id = 1337;
d = resolv; d = resolv;
*d++ = 'A';
encode_data(queryData, strlen(queryData), 100, d); encode_data(queryData, strlen(queryData), 100, d);
pos = strlen(resolv); d = resolv + strlen(resolv);
d += pos;
if (*d != '.') { if (*d != '.') {
*d++ = '.'; *d++ = '.';
} }
strncpy(d, host, strlen(host)+1); strcpy(d, topdomain);
ret = dns_encode(buf, len, &q, QR_QUERY, resolv, strlen(resolv)); ret = dns_encode(buf, len, &q, QR_QUERY, resolv, strlen(resolv));
len = sizeof(queryPacket) - 1; // Skip extra null character len = sizeof(queryPacket) - 1; // Skip extra null character