aboutsummaryrefslogtreecommitdiff
path: root/src/gns
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-07-08 17:26:09 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-07-08 17:26:09 +0000
commit72eed3944fef05e40888ae87781cf5f172b57159 (patch)
treed12129150f86b4b4d75ef86c6fa4f91b2e38bd12 /src/gns
parentae3e39b54b8fe4afea1879d888d19f591b6b126e (diff)
downloadgnunet-72eed3944fef05e40888ae87781cf5f172b57159.tar.gz
gnunet-72eed3944fef05e40888ae87781cf5f172b57159.zip
-cleanup
Diffstat (limited to 'src/gns')
-rw-r--r--src/gns/gnunet-service-gns_resolver.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 8f3f98f4e..f90b9ed95 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -178,10 +178,10 @@ is_srv (char* name)
178 * a = canonical 178 * a = canonical
179 * 179 *
180 * @param name the name to test 180 * @param name the name to test
181 * @return 1 if canonical 181 * @return GNUNET_YES if canonical
182 */ 182 */
183static int 183static int
184is_canonical(char* name) 184is_canonical (char* name)
185{ 185{
186 char* ndup; 186 char* ndup;
187 char* tok; 187 char* tok;
@@ -197,10 +197,10 @@ is_canonical(char* name)
197 if (*tok == '_') 197 if (*tok == '_')
198 continue; 198 continue;
199 GNUNET_free (ndup); 199 GNUNET_free (ndup);
200 return 0; 200 return GNUNET_NO;
201 } 201 }
202 GNUNET_free (ndup); 202 GNUNET_free (ndup);
203 return 1; 203 return GNUNET_YES;
204} 204}
205 205
206 206
@@ -1883,7 +1883,8 @@ resolve_record_dns (struct ResolverHandle *rh,
1883 rh->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1883 rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1884 } 1884 }
1885 /* Start shortening */ 1885 /* Start shortening */
1886 if ((rh->priv_key != NULL) && is_canonical (rh->name)) 1886 if ((rh->priv_key != NULL) &&
1887 (is_canonical (rh->name) == GNUNET_YES))
1887 { 1888 {
1888 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1889 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1889 "GNS_PHASE_REC_DNS-%llu: Trying to shorten authority chain\n", 1890 "GNS_PHASE_REC_DNS-%llu: Trying to shorten authority chain\n",
@@ -2002,7 +2003,8 @@ resolve_record_vpn (struct ResolverHandle *rh,
2002 rh->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2003 rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2003 } 2004 }
2004 /* Start shortening */ 2005 /* Start shortening */
2005 if ((rh->priv_key != NULL) && is_canonical (rh->name)) 2006 if ((rh->priv_key != NULL) &&
2007 (is_canonical (rh->name) == GNUNET_YES))
2006 { 2008 {
2007 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2009 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2008 "GNS_PHASE_REC_VPN-%llu: Trying to shorten authority chain\n", 2010 "GNS_PHASE_REC_VPN-%llu: Trying to shorten authority chain\n",
@@ -2088,7 +2090,8 @@ resolve_record_ns(struct ResolverHandle *rh)
2088 rh->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2090 rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2089 } 2091 }
2090 /* Start shortening */ 2092 /* Start shortening */
2091 if ((rh->priv_key != NULL) && is_canonical (rh->name)) 2093 if ((rh->priv_key != NULL) &&
2094 (is_canonical (rh->name) == GNUNET_YES))
2092 { 2095 {
2093 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2096 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2094 "GNS_PHASE_REC-%llu: Trying to shorten authority chain\n", 2097 "GNS_PHASE_REC-%llu: Trying to shorten authority chain\n",
@@ -2522,7 +2525,8 @@ process_delegation_result_dht(void* cls,
2522 if (strcmp(rh->name, "") == 0) 2525 if (strcmp(rh->name, "") == 0)
2523 { 2526 {
2524 /* Start shortening */ 2527 /* Start shortening */
2525 if ((rh->priv_key != NULL) && is_canonical (rh->name)) 2528 if ((rh->priv_key != NULL) &&
2529 (is_canonical (rh->name) == GNUNET_YES))
2526 { 2530 {
2527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2531 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2528 "GNS_PHASE_DELEGATE_DHT-%llu: Trying to shorten authority chain\n", 2532 "GNS_PHASE_DELEGATE_DHT-%llu: Trying to shorten authority chain\n",
@@ -2850,7 +2854,7 @@ pop_tld(char* name, char* dest)
2850{ 2854{
2851 uint32_t len; 2855 uint32_t len;
2852 2856
2853 if (is_canonical (name)) 2857 if (is_canonical (name) == GNUNET_YES)
2854 { 2858 {
2855 strcpy(dest, name); 2859 strcpy(dest, name);
2856 strcpy(name, ""); 2860 strcpy(name, "");
@@ -2939,7 +2943,7 @@ handle_delegation_dht(void* cls, struct ResolverHandle *rh,
2939 /** 2943 /**
2940 * we still have some left 2944 * we still have some left
2941 **/ 2945 **/
2942 if (is_canonical(rh->name)) 2946 if (is_canonical (rh->name) == GNUNET_YES)
2943 { 2947 {
2944 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 2948 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2945 "GNS_PHASE_DELEGATE_DHT-%llu: Resolving canonical record %s in ns\n", 2949 "GNS_PHASE_DELEGATE_DHT-%llu: Resolving canonical record %s in ns\n",
@@ -3218,7 +3222,7 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh,
3218 3222
3219 if (check_dht == GNUNET_NO) 3223 if (check_dht == GNUNET_NO)
3220 { 3224 {
3221 if (is_canonical(rh->name)) 3225 if (is_canonical (rh->name) == GNUNET_YES)
3222 { 3226 {
3223 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 3227 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
3224 "GNS_PHASE_DELEGATE_NS-%llu: Resolving canonical record %s\n", 3228 "GNS_PHASE_DELEGATE_NS-%llu: Resolving canonical record %s\n",
@@ -3476,7 +3480,8 @@ process_delegation_result_ns (void* cls,
3476 if (strcmp (rh->name, "") == 0) 3480 if (strcmp (rh->name, "") == 0)
3477 { 3481 {
3478 /* Start shortening */ 3482 /* Start shortening */
3479 if ((rh->priv_key != NULL) && is_canonical (rh->name)) 3483 if ((rh->priv_key != NULL) &&
3484 (is_canonical (rh->name) == GNUNET_YES))
3480 { 3485 {
3481 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3486 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3482 "GNS_PHASE_DELEGATE_NS-%llu: Trying to shorten authority chain\n", 3487 "GNS_PHASE_DELEGATE_NS-%llu: Trying to shorten authority chain\n",
@@ -3559,7 +3564,8 @@ gns_resolver_lookup_record (struct GNUNET_CRYPTO_ShortHashCode zone,
3559 name, record_type); 3564 name, record_type);
3560 3565
3561 3566
3562 if (is_canonical((char*)name) && (strcmp(GNUNET_GNS_TLD, name) != 0)) 3567 if ((is_canonical ((char*)name) == GNUNET_YES) &&
3568 (strcmp(GNUNET_GNS_TLD, name) != 0))
3563 { 3569 {
3564 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3570 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3565 "%s is canonical and not gnunet -> cannot resolve!\n", name); 3571 "%s is canonical and not gnunet -> cannot resolve!\n", name);
@@ -4292,7 +4298,7 @@ gns_resolver_shorten_name (struct GNUNET_CRYPTO_ShortHashCode *zone,
4292 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4298 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4293 "Starting shorten for %s!\n", name); 4299 "Starting shorten for %s!\n", name);
4294 4300
4295 if (is_canonical ((char*)name)) 4301 if (is_canonical ((char*)name) == GNUNET_YES)
4296 { 4302 {
4297 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4298 "%s is canonical. Returning verbatim\n", name); 4304 "%s is canonical. Returning verbatim\n", name);
@@ -4450,7 +4456,7 @@ handle_delegation_result_ns_get_auth(void* cls,
4450 4456
4451 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 4457 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
4452 "Building response!\n"); 4458 "Building response!\n");
4453 if (is_canonical(rh->name)) 4459 if (is_canonical (rh->name) == GNUNET_YES)
4454 { 4460 {
4455 /** 4461 /**
4456 * We successfully resolved the authority in the ns 4462 * We successfully resolved the authority in the ns