off = 0;
ns = GNUNET_DNSPARSER_parse_name (data, data_size, &off);
+ if (NULL == ns)
+ {
+ GNUNET_break_op (0);
+ GNUNET_free_non_null (ns);
+ return NULL;
+ }
+#ifndef LSD001 //DNS server IP/name must be UTF-8
+ ip = GNUNET_strdup((char*) &data[off]);
+#else
+ // Must be IP or DNS name
ip = GNUNET_DNSPARSER_parse_name (data, data_size, &off);
- if ((NULL == ns) || (NULL == ip) || (off != data_size))
+ if ((NULL == ip) || (off != data_size))
{
GNUNET_break_op (0);
GNUNET_free_non_null (ns);
GNUNET_free_non_null (ip);
return NULL;
}
+#endif
GNUNET_asprintf (&nstr, "%s@%s", ns, ip);
GNUNET_free_non_null (ns);
GNUNET_free_non_null (ip);
at++;
off = 0;
- if ((GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf,
+ if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (nsbuf,
sizeof(nsbuf),
&off,
- cpy)) ||
- (GNUNET_OK !=
- GNUNET_DNSPARSER_builder_add_name (nsbuf, sizeof(nsbuf), &off, at)))
+ cpy))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _ (
+ "Failed to serialize GNS2DNS record with value `%s': Not a DNS name.\n"),
+ s);
+ GNUNET_free (cpy);
+ return GNUNET_SYSERR;
+ }
+#ifndef LSD001 //The DNS server location/name is in UTF-8
+ GNUNET_memcpy (&nsbuf[off], at, strlen (at) + 1);
+ off += strlen (at) + 1;
+#else
+ if (GNUNET_OK !=
+ GNUNET_DNSPARSER_builder_add_name (nsbuf, sizeof(nsbuf), &off, at))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to serialize GNS2DNS record with value `%s'\n"),
+ _ (
+ "Failed to serialize GNS2DNS record with value `%s': Not a DNS name\n"),
s);
GNUNET_free (cpy);
return GNUNET_SYSERR;
}
+#endif
GNUNET_free (cpy);
*data_size = off;
*data = GNUNET_malloc (off);