diff options
-rw-r--r-- | src/gns/gnunet-service-gns_shorten.c | 2 | ||||
-rw-r--r-- | src/gns/plugin_gnsrecord_gns.c | 6 | ||||
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 4 | ||||
-rw-r--r-- | src/namestore/gnunet-namestore.c | 37 |
4 files changed, 42 insertions, 7 deletions
diff --git a/src/gns/gnunet-service-gns_shorten.c b/src/gns/gnunet-service-gns_shorten.c index 543b4042f..9c27da16f 100644 --- a/src/gns/gnunet-service-gns_shorten.c +++ b/src/gns/gnunet-service-gns_shorten.c | |||
@@ -380,7 +380,7 @@ process_auth_records (void *cls, | |||
380 | 380 | ||
381 | for (i=0; i < rd_count; i++) | 381 | for (i=0; i < rd_count; i++) |
382 | { | 382 | { |
383 | if (GNUNET_GNSRECORD_TYPE_PSEU == rd[i].record_type) | 383 | if (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) |
384 | { | 384 | { |
385 | char pseu[rd[i].data_size + 1]; | 385 | char pseu[rd[i].data_size + 1]; |
386 | 386 | ||
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c index 96ad0aa8d..14b015c0c 100644 --- a/src/gns/plugin_gnsrecord_gns.c +++ b/src/gns/plugin_gnsrecord_gns.c | |||
@@ -57,7 +57,7 @@ gns_value_to_string (void *cls, | |||
57 | if (data_size != sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) | 57 | if (data_size != sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) |
58 | return NULL; | 58 | return NULL; |
59 | return GNUNET_CRYPTO_ecdsa_public_key_to_string (data); | 59 | return GNUNET_CRYPTO_ecdsa_public_key_to_string (data); |
60 | case GNUNET_GNSRECORD_TYPE_PSEU: | 60 | case GNUNET_GNSRECORD_TYPE_NICK: |
61 | return GNUNET_strndup (data, data_size); | 61 | return GNUNET_strndup (data, data_size); |
62 | case GNUNET_GNSRECORD_TYPE_LEHO: | 62 | case GNUNET_GNSRECORD_TYPE_LEHO: |
63 | return GNUNET_strndup (data, data_size); | 63 | return GNUNET_strndup (data, data_size); |
@@ -157,7 +157,7 @@ gns_string_to_value (void *cls, | |||
157 | *data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); | 157 | *data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); |
158 | return GNUNET_OK; | 158 | return GNUNET_OK; |
159 | 159 | ||
160 | case GNUNET_GNSRECORD_TYPE_PSEU: | 160 | case GNUNET_GNSRECORD_TYPE_NICK: |
161 | *data = GNUNET_strdup (s); | 161 | *data = GNUNET_strdup (s); |
162 | *data_size = strlen (s); | 162 | *data_size = strlen (s); |
163 | return GNUNET_OK; | 163 | return GNUNET_OK; |
@@ -246,7 +246,7 @@ static struct { | |||
246 | uint32_t number; | 246 | uint32_t number; |
247 | } name_map[] = { | 247 | } name_map[] = { |
248 | { "PKEY", GNUNET_GNSRECORD_TYPE_PKEY }, | 248 | { "PKEY", GNUNET_GNSRECORD_TYPE_PKEY }, |
249 | { "PSEU", GNUNET_GNSRECORD_TYPE_PSEU }, | 249 | { "NICK", GNUNET_GNSRECORD_TYPE_NICK }, |
250 | { "LEHO", GNUNET_GNSRECORD_TYPE_LEHO }, | 250 | { "LEHO", GNUNET_GNSRECORD_TYPE_LEHO }, |
251 | { "VPN", GNUNET_GNSRECORD_TYPE_VPN }, | 251 | { "VPN", GNUNET_GNSRECORD_TYPE_VPN }, |
252 | { "GNS2DNS", GNUNET_GNSRECORD_TYPE_GNS2DNS }, | 252 | { "GNS2DNS", GNUNET_GNSRECORD_TYPE_GNS2DNS }, |
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 96e7e3aee..04a772c10 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -51,9 +51,9 @@ extern "C" | |||
51 | #define GNUNET_GNSRECORD_TYPE_PKEY 65536 | 51 | #define GNUNET_GNSRECORD_TYPE_PKEY 65536 |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Record type for GNS zone transfer ("PSEU"). | 54 | * Record type for GNS nick names ("NICK"). |
55 | */ | 55 | */ |
56 | #define GNUNET_GNSRECORD_TYPE_PSEU 65537 | 56 | #define GNUNET_GNSRECORD_TYPE_NICK 65537 |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Record type for GNS legacy hostnames ("LEHO"). | 59 | * Record type for GNS legacy hostnames ("LEHO"). |
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 5becf0e6c..f8ad83259 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -135,6 +135,11 @@ static char *typestring; | |||
135 | static char *expirationstring; | 135 | static char *expirationstring; |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Desired nick name. | ||
139 | */ | ||
140 | static char *nickstring; | ||
141 | |||
142 | /** | ||
138 | * Global return value | 143 | * Global return value |
139 | */ | 144 | */ |
140 | static int ret; | 145 | static int ret; |
@@ -521,7 +526,7 @@ testservice_task (void *cls, | |||
521 | "namestore"); | 526 | "namestore"); |
522 | return; | 527 | return; |
523 | } | 528 | } |
524 | if (! (add|del|list|(NULL != uri)|(NULL != reverse_pkey)) ) | 529 | if (! (add|del|list|(NULL != nickstring)|(NULL != uri)|(NULL != reverse_pkey)) ) |
525 | { | 530 | { |
526 | /* nothing more to be done */ | 531 | /* nothing more to be done */ |
527 | fprintf (stderr, | 532 | fprintf (stderr, |
@@ -705,6 +710,7 @@ testservice_task (void *cls, | |||
705 | rd.expiration_time = etime_abs.abs_value_us; | 710 | rd.expiration_time = etime_abs.abs_value_us; |
706 | else | 711 | else |
707 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | 712 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
713 | |||
708 | if (1 != shadow) | 714 | if (1 != shadow) |
709 | rd.flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD; | 715 | rd.flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD; |
710 | add_qe_uri = GNUNET_NAMESTORE_records_store (ns, | 716 | add_qe_uri = GNUNET_NAMESTORE_records_store (ns, |
@@ -715,6 +721,31 @@ testservice_task (void *cls, | |||
715 | &add_continuation, | 721 | &add_continuation, |
716 | &add_qe_uri); | 722 | &add_qe_uri); |
717 | } | 723 | } |
724 | if (NULL != nickstring) | ||
725 | { | ||
726 | if (0 == strlen(nickstring)) | ||
727 | { | ||
728 | fprintf (stderr, | ||
729 | _("Invalid nick `%s'\n"), | ||
730 | nickstring); | ||
731 | GNUNET_SCHEDULER_shutdown (); | ||
732 | ret = 1; | ||
733 | return; | ||
734 | } | ||
735 | memset (&rd, 0, sizeof (rd)); | ||
736 | rd.data = nickstring; | ||
737 | rd.data_size = strlen(nickstring); | ||
738 | rd.record_type = GNUNET_GNSRECORD_TYPE_NICK; | ||
739 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | ||
740 | rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE; | ||
741 | add_qe_uri = GNUNET_NAMESTORE_records_store (ns, | ||
742 | &zone_pkey, | ||
743 | "+", | ||
744 | 1, | ||
745 | &rd, | ||
746 | &add_continuation, | ||
747 | &add_qe_uri); | ||
748 | } | ||
718 | if (monitor) | 749 | if (monitor) |
719 | { | 750 | { |
720 | zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, | 751 | zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, |
@@ -777,6 +808,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
777 | _("You must specify which zone should be accessed\n")); | 808 | _("You must specify which zone should be accessed\n")); |
778 | return; | 809 | return; |
779 | } | 810 | } |
811 | |||
780 | if ( (NULL != args[0]) && (NULL == uri) ) | 812 | if ( (NULL != args[0]) && (NULL == uri) ) |
781 | uri = GNUNET_strdup (args[0]); | 813 | uri = GNUNET_strdup (args[0]); |
782 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 814 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
@@ -814,6 +846,9 @@ main (int argc, char *const *argv) | |||
814 | {'e', "expiration", "TIME", | 846 | {'e', "expiration", "TIME", |
815 | gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1, | 847 | gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1, |
816 | &GNUNET_GETOPT_set_string, &expirationstring}, | 848 | &GNUNET_GETOPT_set_string, &expirationstring}, |
849 | {'i', "nick", "NICKNAME", | ||
850 | gettext_noop ("set the desired nick name for the zone"), 1, | ||
851 | &GNUNET_GETOPT_set_string, &nickstring}, | ||
817 | {'m', "monitor", NULL, | 852 | {'m', "monitor", NULL, |
818 | gettext_noop ("monitor changes in the namestore"), 0, | 853 | gettext_noop ("monitor changes in the namestore"), 0, |
819 | &GNUNET_GETOPT_set_one, &monitor}, | 854 | &GNUNET_GETOPT_set_one, &monitor}, |