X-Git-Url: https://git.exim.org/users/heiko/exim.git/blobdiff_plain/14b3c5bc64a16df07583fe4b5ef2e0129d063893..fd8184e3bed43669b09f463ae610eff772e9ab65:/test/src/fakens.c?ds=sidebyside diff --git a/test/src/fakens.c b/test/src/fakens.c index 7e93979ec..00f1f7d46 100644 --- a/test/src/fakens.c +++ b/test/src/fakens.c @@ -75,9 +75,11 @@ a number of seconds (followed by one space). #include #include #include +#include #include #include #include +#include #define FALSE 0 #define TRUE 1 @@ -500,35 +502,13 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL) break; case ns_t_a: - for (i = 0; i < 4; i++) - { - value = 0; - while (isdigit(*p)) value = value*10 + *p++ - '0'; - *pk++ = value; - p++; - } + inet_pton(AF_INET, p, pk); /* FIXME: error checking */ + pk += 4; break; - /* The only occurrence of a double colon is for ::1 */ case ns_t_aaaa: - if (Ustrcmp(p, "::1") == 0) - { - memset(pk, 0, 15); - pk += 15; - *pk++ = 1; - } - else for (i = 0; i < 8; i++) - { - value = 0; - while (isxdigit(*p)) - { - value = value * 16 + toupper(*p) - (isdigit(*p)? '0' : '7'); - p++; - } - *pk++ = (value >> 8) & 255; - *pk++ = value & 255; - p++; - } + inet_pton(AF_INET6, p, pk); /* FIXME: error checking */ + pk += 16; break; case ns_t_mx: