- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "SHORTEN");
-
- size_t msg_size = 0;
- struct ClientShortenHandle *csh;
- char name[MAX_DNS_NAME_LENGTH];
- char* nameptr = name;
-
- if (ntohs (message->size) < sizeof (struct GNUNET_GNS_ClientShortenMessage))
- {
- GNUNET_break_op (0);
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
- return;
- }
-
-
- struct GNUNET_GNS_ClientShortenMessage *sh_msg =
- (struct GNUNET_GNS_ClientShortenMessage *) message;
-
- msg_size = ntohs(message->size);
-
- if (msg_size > GNUNET_SERVER_MAX_MESSAGE_SIZE)
- {
- GNUNET_break_op (0);
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
- return;
- }
-
- csh = GNUNET_malloc(sizeof (struct ClientShortenHandle));
- csh->client = client;
- csh->unique_id = sh_msg->id;
-
- GNUNET_CONTAINER_DLL_insert (csh_head, csh_tail, csh);
-
- GNUNET_STRINGS_utf8_tolower((char*)&sh_msg[1], &nameptr);
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "SHORTEN: Converted %s to %s\n", (char*)&sh_msg[1], nameptr);
- GNUNET_SERVER_notification_context_add (nc, client);
-
- if (strlen (name) < strlen(GNUNET_GNS_TLD)) {
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "SHORTEN: %s is too short\n", name);
- GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh);
- send_shorten_response(csh, name);
- return;
- }
-
- if (strlen (name) > MAX_DNS_NAME_LENGTH) {
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "SHORTEN: %s is too long\n", name);
- GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh);
- send_shorten_response(csh, name);
- return;
- }
-
- if (!is_gnunet_tld(name) && !is_zkey_tld(name))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%s is not our domain. Returning\n", name);
- GNUNET_CONTAINER_DLL_remove (csh_head, csh_tail, csh);
- send_shorten_response(csh, name);
- return;
- }
-
- csh->shorten_zone = sh_msg->shorten_zone;
- csh->private_zone = sh_msg->private_zone;
-
- strcpy (csh->name, name);
-
-
- if (1 == ntohl(sh_msg->use_default_zone))
- csh->root_zone = zone_hash; //Default zone
- else
- csh->root_zone = sh_msg->zone;
-
- start_shorten_name (csh);