diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-25 10:22:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-25 10:22:42 +0000 |
commit | 1880e2676f635910f5dbf4b20763f13b5cabd15c (patch) | |
tree | c1cd7d45f5518ec434ea7c383cba00e82011082d /src/dns/gnunet-dns-redirector.c | |
parent | 293604a96c409dbb4f03a02d8c1fb2a3818ae636 (diff) | |
download | gnunet-1880e2676f635910f5dbf4b20763f13b5cabd15c.tar.gz gnunet-1880e2676f635910f5dbf4b20763f13b5cabd15c.zip |
-check cmd line argument
Diffstat (limited to 'src/dns/gnunet-dns-redirector.c')
-rw-r--r-- | src/dns/gnunet-dns-redirector.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/dns/gnunet-dns-redirector.c b/src/dns/gnunet-dns-redirector.c index 41667ee9f..cea8f5be9 100644 --- a/src/dns/gnunet-dns-redirector.c +++ b/src/dns/gnunet-dns-redirector.c | |||
@@ -77,7 +77,7 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record) | |||
77 | "Changing A record from `%s' to `%s'\n", | 77 | "Changing A record from `%s' to `%s'\n", |
78 | inet_ntop (AF_INET, record->data.raw.data, buf, sizeof (buf)), | 78 | inet_ntop (AF_INET, record->data.raw.data, buf, sizeof (buf)), |
79 | n4); | 79 | n4); |
80 | inet_pton (AF_INET, n4, record->data.raw.data); | 80 | GNUNET_assert (1 == inet_pton (AF_INET, n4, record->data.raw.data)); |
81 | } | 81 | } |
82 | break; | 82 | break; |
83 | case GNUNET_DNSPARSER_TYPE_AAAA: | 83 | case GNUNET_DNSPARSER_TYPE_AAAA: |
@@ -90,7 +90,7 @@ modify_record (const struct GNUNET_DNSPARSER_Record *record) | |||
90 | "Changing AAAA record from `%s' to `%s'\n", | 90 | "Changing AAAA record from `%s' to `%s'\n", |
91 | inet_ntop (AF_INET6, record->data.raw.data, buf, sizeof (buf)), | 91 | inet_ntop (AF_INET6, record->data.raw.data, buf, sizeof (buf)), |
92 | n6); | 92 | n6); |
93 | inet_pton (AF_INET6, n6, record->data.raw.data); | 93 | GNUNET_assert (1 == inet_pton (AF_INET6, n6, record->data.raw.data)); |
94 | } | 94 | } |
95 | break; | 95 | break; |
96 | case GNUNET_DNSPARSER_TYPE_NS: | 96 | case GNUNET_DNSPARSER_TYPE_NS: |
@@ -199,6 +199,25 @@ static void | |||
199 | run (void *cls, char *const *args, const char *cfgfile, | 199 | run (void *cls, char *const *args, const char *cfgfile, |
200 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 200 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
201 | { | 201 | { |
202 | struct in_addr i4; | ||
203 | struct in6_addr i6; | ||
204 | if ( (n4 != NULL) && | ||
205 | (1 != inet_pton (AF_INET, n4, &i4)) ) | ||
206 | { | ||
207 | fprintf (stderr, | ||
208 | "`%s' is nto a valid IPv4 address!\n", | ||
209 | n4); | ||
210 | return; | ||
211 | } | ||
212 | if ( (n6 != NULL) && | ||
213 | (1 != inet_pton (AF_INET6, n6, &i6)) ) | ||
214 | { | ||
215 | fprintf (stderr, | ||
216 | "`%s' is nto a valid IPv6 address!\n", | ||
217 | n6); | ||
218 | return; | ||
219 | } | ||
220 | |||
202 | handle = | 221 | handle = |
203 | GNUNET_DNS_connect (cfg, | 222 | GNUNET_DNS_connect (cfg, |
204 | GNUNET_DNS_FLAG_POST_RESOLUTION, | 223 | GNUNET_DNS_FLAG_POST_RESOLUTION, |