diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-26 15:55:55 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-26 15:55:55 +0000 |
commit | 44d10fe5cea875a05a31059bf2b2da25ee0cd5c0 (patch) | |
tree | 9b0f29826c35f80e7c98a528e7129e2f79f53ea2 /src/namestore | |
parent | dfb93f8cbf257d1744cd59abd4d05ab06c9138c2 (diff) | |
download | gnunet-44d10fe5cea875a05a31059bf2b2da25ee0cd5c0.tar.gz gnunet-44d10fe5cea875a05a31059bf2b2da25ee0cd5c0.zip |
-added vpn gns test, fixes
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/namestore_common.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/namestore/namestore_common.c b/src/namestore/namestore_common.c index af7eee04c..5698236c5 100644 --- a/src/namestore/namestore_common.c +++ b/src/namestore/namestore_common.c | |||
@@ -387,7 +387,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
387 | vpn = (struct vpn_data*)data; | 387 | vpn = (struct vpn_data*)data; |
388 | 388 | ||
389 | GNUNET_CRYPTO_hash_to_enc (&vpn->peer, &s_peer); | 389 | GNUNET_CRYPTO_hash_to_enc (&vpn->peer, &s_peer); |
390 | if (GNUNET_OK != GNUNET_asprintf (&vpn_str, "%d:%s:%s", | 390 | if (GNUNET_OK != GNUNET_asprintf (&vpn_str, "%hu %s %s", |
391 | vpn->proto, | 391 | vpn->proto, |
392 | (char*)&s_peer, | 392 | (char*)&s_peer, |
393 | (char*)&vpn[1])) | 393 | (char*)&vpn[1])) |
@@ -396,7 +396,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
396 | case GNUNET_DNSPARSER_TYPE_SRV: | 396 | case GNUNET_DNSPARSER_TYPE_SRV: |
397 | srv = (struct srv_data*)data; | 397 | srv = (struct srv_data*)data; |
398 | 398 | ||
399 | if (GNUNET_OK != GNUNET_asprintf (&srv_str, "%d:%d:%d:%s", | 399 | if (GNUNET_OK != GNUNET_asprintf (&srv_str, "%d %d %d %s", |
400 | ntohs (srv->prio), | 400 | ntohs (srv->prio), |
401 | ntohs (srv->weight), | 401 | ntohs (srv->weight), |
402 | ntohs (srv->port), | 402 | ntohs (srv->port), |
@@ -441,10 +441,11 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
441 | uint32_t soa_retry; | 441 | uint32_t soa_retry; |
442 | uint32_t soa_expire; | 442 | uint32_t soa_expire; |
443 | uint32_t soa_min; | 443 | uint32_t soa_min; |
444 | struct GNUNET_CRYPTO_HashAsciiEncoded s_peer; | 444 | char s_peer[104]; |
445 | char s_serv[253]; | 445 | char s_serv[253]; |
446 | struct vpn_data* vpn; | 446 | struct vpn_data* vpn; |
447 | uint16_t proto; | 447 | uint16_t proto; |
448 | int ret; | ||
448 | 449 | ||
449 | switch (type) | 450 | switch (type) |
450 | { | 451 | { |
@@ -527,10 +528,12 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
527 | return GNUNET_OK; | 528 | return GNUNET_OK; |
528 | case GNUNET_NAMESTORE_TYPE_VPN: | 529 | case GNUNET_NAMESTORE_TYPE_VPN: |
529 | 530 | ||
530 | 531 | ret = SSCANF (s,"%hu %s %s", | |
531 | if (4 != SSCANF (s,"%hu:%s:%s", | 532 | &proto, s_peer, s_serv); |
532 | &proto, (char*)&s_peer, s_serv)) | 533 | if (3 != ret) |
533 | { | 534 | { |
535 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
536 | "Unable to parse VPN record string %s %d\n", s, ret); | ||
534 | return GNUNET_SYSERR; | 537 | return GNUNET_SYSERR; |
535 | } | 538 | } |
536 | *data_size = sizeof (struct vpn_data) + strlen (s_serv) + 1; | 539 | *data_size = sizeof (struct vpn_data) + strlen (s_serv) + 1; |