aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-07-15 22:04:35 +0000
committerChristian Grothoff <christian@grothoff.org>2013-07-15 22:04:35 +0000
commit860eeebfb1fd949474e74a23259d222b7563ba70 (patch)
treed140028eb1750f04813352d689961b727c935351 /src
parent40de04e450a22baca40ce7c02b935d0bd9863f8d (diff)
downloadgnunet-860eeebfb1fd949474e74a23259d222b7563ba70.tar.gz
gnunet-860eeebfb1fd949474e74a23259d222b7563ba70.zip
-fix: set default includes service name, not identity name
Diffstat (limited to 'src')
-rw-r--r--src/identity/gnunet-service-identity.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index 050628e59..95fb79c38 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -210,10 +210,12 @@ create_update_message (struct Ego *ego)
210 * Create a set default message with information about the current state of an ego. 210 * Create a set default message with information about the current state of an ego.
211 * 211 *
212 * @param ego ego to create message for 212 * @param ego ego to create message for
213 * @param servicename name of the service to provide in the message
213 * @return corresponding set default message 214 * @return corresponding set default message
214 */ 215 */
215static struct GNUNET_IDENTITY_SetDefaultMessage * 216static struct GNUNET_IDENTITY_SetDefaultMessage *
216create_set_default_message (struct Ego *ego) 217create_set_default_message (struct Ego *ego,
218 const char *servicename)
217{ 219{
218 struct GNUNET_IDENTITY_SetDefaultMessage *sdm; 220 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
219 char *str; 221 char *str;
@@ -221,7 +223,7 @@ create_set_default_message (struct Ego *ego)
221 size_t name_len; 223 size_t name_len;
222 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc; 224 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
223 225
224 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1); 226 name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1);
225 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk); 227 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk);
226 pk_len = ntohs (enc->size); 228 pk_len = ntohs (enc->size);
227 sdm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + pk_len + name_len); 229 sdm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + pk_len + name_len);
@@ -231,7 +233,7 @@ create_set_default_message (struct Ego *ego)
231 sdm->pk_len = htons (pk_len); 233 sdm->pk_len = htons (pk_len);
232 str = (char *) &sdm[1]; 234 str = (char *) &sdm[1];
233 memcpy (str, enc, pk_len); 235 memcpy (str, enc, pk_len);
234 memcpy (&str[pk_len], ego->identifier, name_len); 236 memcpy (&str[pk_len], servicename, name_len);
235 GNUNET_free (enc); 237 GNUNET_free (enc);
236 return sdm; 238 return sdm;
237} 239}
@@ -323,7 +325,8 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
323 if (0 == strcmp (ego->identifier, 325 if (0 == strcmp (ego->identifier,
324 identifier)) 326 identifier))
325 { 327 {
326 sdm = create_set_default_message (ego); 328 sdm = create_set_default_message (ego,
329 name);
327 GNUNET_SERVER_notification_context_broadcast (nc, &sdm->header, GNUNET_YES); 330 GNUNET_SERVER_notification_context_broadcast (nc, &sdm->header, GNUNET_YES);
328 GNUNET_free (sdm); 331 GNUNET_free (sdm);
329 GNUNET_SERVER_receive_done (client, GNUNET_OK); 332 GNUNET_SERVER_receive_done (client, GNUNET_OK);