diff options
author | Sebastian Nadler <sebastian.nadler@tum.de> | 2023-11-30 19:38:58 +0100 |
---|---|---|
committer | Sebastian Nadler <sebastian.nadler@tum.de> | 2023-11-30 19:38:58 +0100 |
commit | 0d77fac87aba598ba53cf4d0606a1a26786e2186 (patch) | |
tree | 923e76d03682c95680bff52885aca9fbb8c382d3 | |
parent | fe90b359885e02363f1d4442bb4c2d41fd75c680 (diff) | |
download | gnunet-0d77fac87aba598ba53cf4d0606a1a26786e2186.tar.gz gnunet-0d77fac87aba598ba53cf4d0606a1a26786e2186.zip |
fix: BOX at @ not working
-rw-r--r-- | src/service/gns/gnunet-service-gns_resolver.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/src/service/gns/gnunet-service-gns_resolver.c b/src/service/gns/gnunet-service-gns_resolver.c index 3f21a3b8c..d9cdbd60e 100644 --- a/src/service/gns/gnunet-service-gns_resolver.c +++ b/src/service/gns/gnunet-service-gns_resolver.c | |||
@@ -581,14 +581,16 @@ timeout_resolution (void *cls) | |||
581 | 581 | ||
582 | /** | 582 | /** |
583 | * Function called to receive the protocol number for a service. | 583 | * Function called to receive the protocol number for a service. |
584 | * | 584 | * |
585 | * @param name name of the protocol | 585 | * @param name name of the protocol |
586 | */ | 586 | */ |
587 | static struct protoent * | 587 | static struct protoent * |
588 | resolver_getprotobyname(const char *name) { | 588 | resolver_getprotobyname (const char *name) |
589 | struct protoent *pe = getprotobyname(name); | 589 | { |
590 | if (pe == NULL && strcmp(name, "trust") == 0) { | 590 | struct protoent *pe = getprotobyname (name); |
591 | pe = GNUNET_new(struct protoent); | 591 | if (pe == NULL && strcmp (name, "trust") == 0) |
592 | { | ||
593 | pe = GNUNET_new (struct protoent); | ||
592 | pe->p_name = "trust"; | 594 | pe->p_name = "trust"; |
593 | pe->p_proto = 242; | 595 | pe->p_proto = 242; |
594 | } | 596 | } |
@@ -598,21 +600,27 @@ resolver_getprotobyname(const char *name) { | |||
598 | 600 | ||
599 | /** | 601 | /** |
600 | * Function called to receive the port number for a service. | 602 | * Function called to receive the port number for a service. |
601 | * | 603 | * |
602 | * @param name name of the service | 604 | * @param name name of the service |
603 | * @param proto name of the protocol | 605 | * @param proto name of the protocol |
604 | */ | 606 | */ |
605 | static struct servent *resolver_getservbyname(const char *name, const char *proto){ | 607 | static struct servent * |
606 | struct servent *se = getservbyname(name, proto); | 608 | resolver_getservbyname (const char *name, const char *proto) |
607 | if (se == NULL && strcmp(proto, "trust") == 0) { | 609 | { |
608 | if (strcmp(name, "trustlist") == 0) { | 610 | struct servent *se = getservbyname (name, proto); |
609 | se = GNUNET_new(struct servent); | 611 | if (se == NULL && strcmp (proto, "trust") == 0) |
612 | { | ||
613 | if (strcmp (name, "trustlist") == 0) | ||
614 | { | ||
615 | se = GNUNET_new (struct servent); | ||
610 | se->s_name = "trustlist"; | 616 | se->s_name = "trustlist"; |
611 | se->s_port = htons(1002); | 617 | se->s_port = htons (1002); |
612 | } else if (strcmp(name, "scheme") == 0) { | 618 | } |
613 | se = GNUNET_new(struct servent); | 619 | else if (strcmp (name, "scheme") == 0) |
620 | { | ||
621 | se = GNUNET_new (struct servent); | ||
614 | se->s_name = "scheme"; | 622 | se->s_name = "scheme"; |
615 | se->s_port = htons(1003); | 623 | se->s_port = htons (1003); |
616 | } | 624 | } |
617 | } | 625 | } |
618 | return se; | 626 | return se; |
@@ -713,7 +721,7 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh) | |||
713 | return ret; | 721 | return ret; |
714 | } | 722 | } |
715 | se = resolver_getservbyname (srv_name, | 723 | se = resolver_getservbyname (srv_name, |
716 | proto_name); | 724 | proto_name); |
717 | if (NULL == se) | 725 | if (NULL == se) |
718 | { | 726 | { |
719 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 727 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -1125,7 +1133,7 @@ dns_result_parser (void *cls, | |||
1125 | rd[i - skip].data_size = buf_off - buf_start; | 1133 | rd[i - skip].data_size = buf_off - buf_start; |
1126 | rd[i - skip].data = &buf[buf_start]; | 1134 | rd[i - skip].data = &buf[buf_start]; |
1127 | break; | 1135 | break; |
1128 | 1136 | ||
1129 | case GNUNET_DNSPARSER_TYPE_URI: | 1137 | case GNUNET_DNSPARSER_TYPE_URI: |
1130 | buf_start = buf_off; | 1138 | buf_start = buf_off; |
1131 | if (GNUNET_OK != | 1139 | if (GNUNET_OK != |
@@ -2046,7 +2054,10 @@ handle_gns_resolution_result (void *cls, | |||
2046 | if ((0 != rh->protocol) && | 2054 | if ((0 != rh->protocol) && |
2047 | (0 != rh->service) && | 2055 | (0 != rh->service) && |
2048 | (GNUNET_GNSRECORD_TYPE_BOX != rd[i].record_type)) | 2056 | (GNUNET_GNSRECORD_TYPE_BOX != rd[i].record_type)) |
2049 | continue; /* we _only_ care about boxed records */ | 2057 | if (GNUNET_GNSRECORD_TYPE_PKEY != rd[i].record_type && |
2058 | GNUNET_GNSRECORD_TYPE_EDKEY != rd[i].record_type) | ||
2059 | continue; | ||
2060 | /* we _only_ care about boxed records */ | ||
2050 | 2061 | ||
2051 | GNUNET_assert (rd_off < rd_count); | 2062 | GNUNET_assert (rd_off < rd_count); |
2052 | rd_new[rd_off] = rd[i]; | 2063 | rd_new[rd_off] = rd[i]; |
@@ -2238,7 +2249,7 @@ handle_gns_resolution_result (void *cls, | |||
2238 | (off != rd[i].data_size)) | 2249 | (off != rd[i].data_size)) |
2239 | { | 2250 | { |
2240 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2251 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2241 | _ ("Failed to deserialize URI record with target\n")); | 2252 | _ ("Failed to deserialize URI record with target\n")); |
2242 | GNUNET_break_op (0); /* record not well-formed */ | 2253 | GNUNET_break_op (0); /* record not well-formed */ |
2243 | } | 2254 | } |
2244 | else | 2255 | else |