gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r20901 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r20901 - gnunet/src/gns
Date: Thu, 5 Apr 2012 12:16:53 +0200

Author: schanzen
Date: 2012-04-05 12:16:53 +0200 (Thu, 05 Apr 2012)
New Revision: 20901

Modified:
   gnunet/src/gns/gnunet-service-gns.c
Log:
- max name len


Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2012-04-05 10:02:59 UTC (rev 20900)
+++ gnunet/src/gns/gnunet-service-gns.c 2012-04-05 10:16:53 UTC (rev 20901)
@@ -466,7 +466,6 @@
     return;
   }
 
-  GNUNET_SERVER_notification_context_add (nc, client);
 
   struct GNUNET_GNS_ClientShortenMessage *sh_msg =
     (struct GNUNET_GNS_ClientShortenMessage *) message;
@@ -487,10 +486,20 @@
   GNUNET_STRINGS_utf8_tolower((char*)&sh_msg[1], &nameptr);
 
   if (strlen (name) < strlen(GNUNET_GNS_TLD)) {
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+               "SHORTEN: %s is too short", name);
     csh->name = NULL;
     send_shorten_response(csh, name);
     return;
   }
+
+  if (strlen (name) > MAX_DNS_NAME_LENGTH) {
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+               "SHORTEN: %s is too long", name);
+    csh->name = NULL;
+    send_shorten_response(csh, name);
+    return;
+  }
   
   if (!is_gnunet_tld(name) && !is_zkey_tld(name))
   {
@@ -501,6 +510,8 @@
     return;
   }
   
+  GNUNET_SERVER_notification_context_add (nc, client);
+  
   /* Start shortening */
   if (GNUNET_YES == auto_import_pkey)
     gns_resolver_shorten_name(zone_hash, name, zone_key,
@@ -607,17 +618,25 @@
   if (strlen(name) < strlen(GNUNET_GNS_TLD))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "%s is too short. Returning\n", name);
+                "GET_AUTH: %s is too short. Returning\n", name);
     cah->name = NULL;
     send_get_auth_response(cah, name);
     return;
   }
-
+  
+  if (strlen (name) > MAX_DNS_NAME_LENGTH) {
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+               "GET_AUTH: %s is too long", name);
+    cah->name = NULL;
+    send_get_auth_response(cah, name);
+    return;
+  }
+  
   if (strcmp(name+strlen(name)-strlen(GNUNET_GNS_TLD),
              GNUNET_GNS_TLD) != 0)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "%s is not our domain. Returning\n", name);
+                "GET_AUTH: %s is not our domain. Returning\n", name);
     cah->name = NULL;
     send_get_auth_response(cah, name);
     return;
@@ -626,7 +645,7 @@
   if (strcmp(name, GNUNET_GNS_TLD) == 0)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "%s is us. Returning\n", name);
+                "GET_AUTH: %s is us. Returning\n", name);
     cah->name = NULL;
     send_get_auth_response(cah, name);
     return;
@@ -736,6 +755,14 @@
   clh->unique_id = sh_msg->id;
   clh->type = ntohl(sh_msg->type);
   
+  if (strlen (name) > MAX_DNS_NAME_LENGTH) {
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+               "LOOKUP: %s is too long", name);
+    clh->name = NULL;
+    send_lookup_response(clh, 0, NULL);
+    return;
+  }
+  
   if (GNUNET_YES == auto_import_pkey)
   {
     gns_resolver_lookup_record(zone_hash, clh->type, name,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]