[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37758 - gnunet/src/namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37758 - gnunet/src/namestore |
Date: |
Mon, 22 Aug 2016 17:07:05 +0200 |
Author: grothoff
Date: 2016-08-22 17:07:05 +0200 (Mon, 22 Aug 2016)
New Revision: 37758
Modified:
gnunet/src/namestore/gnunet-namestore.c
gnunet/src/namestore/gnunet-service-namestore.c
gnunet/src/namestore/namestore_api.c
Log:
fix #4620
Modified: gnunet/src/namestore/gnunet-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-namestore.c 2016-08-22 14:50:04 UTC (rev
37757)
+++ gnunet/src/namestore/gnunet-namestore.c 2016-08-22 15:07:05 UTC (rev
37758)
@@ -704,7 +704,8 @@
del_qe = GNUNET_NAMESTORE_records_store (ns,
&zone_pkey,
name,
- 0, NULL,
+ 0,
+ NULL,
&del_continuation,
NULL);
return;
@@ -740,7 +741,8 @@
del_qe = GNUNET_NAMESTORE_records_store (ns,
&zone_pkey,
name,
- rd_left, rdx,
+ rd_left,
+ rdx,
&del_continuation,
NULL);
}
@@ -809,7 +811,9 @@
type = GNUNET_GNSRECORD_typename_to_number (typestring);
if (UINT32_MAX == type)
{
- fprintf (stderr, _("Unsupported type `%s'\n"), typestring);
+ fprintf (stderr,
+ _("Unsupported type `%s'\n"),
+ typestring);
GNUNET_SCHEDULER_shutdown ();
ret = 1;
return;
@@ -829,7 +833,8 @@
&data,
&data_size))
{
- fprintf (stderr, _("Value `%s' invalid for record type `%s'\n"),
+ fprintf (stderr,
+ _("Value `%s' invalid for record type `%s'\n"),
value,
typestring);
GNUNET_SCHEDULER_shutdown ();
@@ -845,7 +850,8 @@
ret = 1;
return;
}
- if (0 == strcmp (expirationstring, "never"))
+ if (0 == strcmp (expirationstring,
+ "never"))
{
etime_abs = GNUNET_TIME_UNIT_FOREVER_ABS;
etime_is_rel = GNUNET_NO;
Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c 2016-08-22 14:50:04 UTC
(rev 37757)
+++ gnunet/src/namestore/gnunet-service-namestore.c 2016-08-22 15:07:05 UTC
(rev 37758)
@@ -830,6 +830,7 @@
struct RecordLookupContext rlc;
const char *name_tmp;
char *res_name;
+ char *conv_name;
uint32_t name_len;
size_t src_size;
size_t res_size;
@@ -857,32 +858,47 @@
if ('\0' != name_tmp[name_len -1])
{
GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_OK);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' message for name `%s'\n",
- "NAMESTORE_RECORD_LOOKUP", name_tmp);
+ "Received NAMESTORE_RECORD_LOOKUP message for name `%s'\n",
+ name_tmp);
if (NULL == (client_lookup (client)))
{
GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
- rlc.label = name_tmp;
+ conv_name = GNUNET_GNSRECORD_string_to_lowercase (name_tmp);
+ if (NULL == conv_name)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Error converting name `%s'\n",
+ name_tmp);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
+ return;
+ }
+ rlc.label = conv_name;
rlc.found = GNUNET_NO;
rlc.res_rd_count = 0;
rlc.res_rd = NULL;
rlc.rd_ser_len = 0;
rlc.nick = get_nick_record (&ll_msg->zone);
-
res = GSN_database->lookup_records (GSN_database->cls,
- &ll_msg->zone, name_tmp, &lookup_it, &rlc);
-
+ &ll_msg->zone,
+ conv_name,
+ &lookup_it,
+ &rlc);
+ GNUNET_free (conv_name);
res_size = sizeof (struct LabelLookupResponseMessage) + name_len +
rlc.rd_ser_len;
llr_msg = GNUNET_malloc (res_size);
llr_msg->gns_header.header.size = htons (res_size);
@@ -897,12 +913,17 @@
llr_msg->found = ntohs (GNUNET_YES);
else
llr_msg->found = ntohs (GNUNET_NO);
- GNUNET_memcpy (&llr_msg[1], name_tmp, name_len);
- GNUNET_memcpy (&res_name[name_len], rlc.res_rd, rlc.rd_ser_len);
+ GNUNET_memcpy (&llr_msg[1],
+ name_tmp,
+ name_len);
+ GNUNET_memcpy (&res_name[name_len],
+ rlc.res_rd,
+ rlc.rd_ser_len);
+ GNUNET_SERVER_notification_context_unicast (snc,
+ client,
+ &llr_msg->gns_header.header,
+ GNUNET_NO);
- GNUNET_SERVER_notification_context_unicast (snc, client,
&llr_msg->gns_header.header,
- GNUNET_NO);
-
GNUNET_free_non_null (rlc.res_rd);
GNUNET_free (llr_msg);
}
@@ -935,8 +956,7 @@
struct ZoneMonitor *zm;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' message\n",
- "NAMESTORE_RECORD_STORE");
+ "Received NAMESTORE_RECORD_STORE message\n");
if (ntohs (message->size) < sizeof (struct RecordStoreMessage))
{
GNUNET_break (0);
@@ -954,13 +974,15 @@
if (msg_size != msg_size_exp)
{
GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
if ((0 == name_len) || (name_len > MAX_NAME_LEN))
{
GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
name_tmp = (const char *) &rp_msg[1];
@@ -968,7 +990,8 @@
if ('\0' != name_tmp[name_len -1])
{
GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
(void) client_lookup (client);
@@ -976,21 +999,26 @@
struct GNUNET_GNSRECORD_Data rd[rd_count];
if (GNUNET_OK !=
- GNUNET_GNSRECORD_records_deserialize (rd_ser_len, rd_ser, rd_count, rd))
+ GNUNET_GNSRECORD_records_deserialize (rd_ser_len,
+ rd_ser,
+ rd_count,
+ rd))
{
GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
/* Extracting and converting private key */
GNUNET_CRYPTO_ecdsa_key_get_public (&rp_msg->private_key,
- &pubkey);
+ &pubkey);
conv_name = GNUNET_GNSRECORD_string_to_lowercase (name_tmp);
if (NULL == conv_name)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error converting name `%s'\n", name_tmp);
+ "Error converting name `%s'\n",
+ name_tmp);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
@@ -1003,7 +1031,10 @@
if ( (0 == rd_count) &&
(GNUNET_NO ==
GSN_database->iterate_records (GSN_database->cls,
- &rp_msg->private_key, 0, NULL, 0)) )
+ &rp_msg->private_key,
+ 0,
+ NULL,
+ 0)) )
{
/* This name does not exist, so cannot be removed */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1030,7 +1061,8 @@
res = GSN_database->store_records (GSN_database->cls,
&rp_msg->private_key,
conv_name,
- rd_clean_off, rd_clean);
+ rd_clean_off,
+ rd_clean);
if (GNUNET_OK == res)
{
for (zm = monitor_head; NULL != zm; zm = zm->next)
@@ -1072,14 +1104,18 @@
&rp_msg->private_key,
conv_name,
rd_count, rd);
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_OK);
GNUNET_free (conv_name);
return;
}
GNUNET_free (conv_name);
}
- send_store_response (client, res, rid);
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ send_store_response (client,
+ res,
+ rid);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_OK);
}
@@ -1671,12 +1707,18 @@
namecache = GNUNET_NAMECACHE_connect (cfg);
/* Loading database plugin */
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg, "namestore", "database",
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "namestore",
+ "database",
&database))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No database backend configured\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "No database backend configured\n");
- GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_namestore_%s", database);
- GSN_database = GNUNET_PLUGIN_load (db_lib_name, (void *) GSN_cfg);
+ GNUNET_asprintf (&db_lib_name,
+ "libgnunet_plugin_namestore_%s",
+ database);
+ GSN_database = GNUNET_PLUGIN_load (db_lib_name,
+ (void *) GSN_cfg);
GNUNET_free (database);
if (NULL == GSN_database)
{
Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c 2016-08-22 14:50:04 UTC (rev
37757)
+++ gnunet/src/namestore/namestore_api.c 2016-08-22 15:07:05 UTC (rev
37758)
@@ -1026,8 +1026,8 @@
name_tmp = (char *) &msg[1];
GNUNET_memcpy (name_tmp,
- label,
- name_len);
+ label,
+ name_len);
rd_ser = &name_tmp[name_len];
GNUNET_assert (rd_ser_len ==
GNUNET_GNSRECORD_records_serialize (rd_count,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37758 - gnunet/src/namestore,
gnunet <=