aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-namestore-gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/gnunet-namestore-gtk.c')
-rw-r--r--src/namestore/gnunet-namestore-gtk.c72
1 files changed, 15 insertions, 57 deletions
diff --git a/src/namestore/gnunet-namestore-gtk.c b/src/namestore/gnunet-namestore-gtk.c
index ceff0812..c01e95b4 100644
--- a/src/namestore/gnunet-namestore-gtk.c
+++ b/src/namestore/gnunet-namestore-gtk.c
@@ -182,25 +182,6 @@ enum LIST_COLUMNS
182 182
183 183
184/** 184/**
185 * Columns in the zone list store.
186 */
187enum ZONE_COLUMNS
188{
189
190 /**
191 * A gchararray
192 */
193 ZONE_LS_NAME = 0,
194
195
196 /**
197 * A `struct GNUNET_IDENTITY_Ego`
198 */
199 ZONE_LS_EGO = 1
200};
201
202
203/**
204 * Closure for 'operation_done_cont'. 185 * Closure for 'operation_done_cont'.
205 */ 186 */
206struct OperationContext 187struct OperationContext
@@ -253,7 +234,7 @@ struct MoveOperationContext
253 /** 234 /**
254 * Private key of target zone. 235 * Private key of target zone.
255 */ 236 */
256 struct GNUNET_CRYPTO_EccPrivateKey *pk; 237 struct GNUNET_CRYPTO_EccPrivateKey pk;
257 238
258 /** 239 /**
259 * Data to free. 240 * Data to free.
@@ -832,7 +813,6 @@ merge_with_existing_records (void *cls,
832 { 813 {
833 show_error_message (_("Record combination not permitted"), 814 show_error_message (_("Record combination not permitted"),
834 _("Given the existing records, adding a new record of this type is not allowed.")); 815 _("Given the existing records, adding a new record of this type is not allowed."));
835 GNUNET_free (moc->pk);
836 GNUNET_free (moc->data); 816 GNUNET_free (moc->data);
837 GNUNET_free (moc); 817 GNUNET_free (moc);
838 free_edit_dialog_context (edc); 818 free_edit_dialog_context (edc);
@@ -845,12 +825,11 @@ merge_with_existing_records (void *cls,
845 oc = GNUNET_new (struct OperationContext); 825 oc = GNUNET_new (struct OperationContext);
846 GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc); 826 GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
847 oc->qe = GNUNET_NAMESTORE_records_store (namestore, 827 oc->qe = GNUNET_NAMESTORE_records_store (namestore,
848 moc->pk, 828 &moc->pk,
849 edc->name, 829 edc->name,
850 rd_count + 1, 830 rd_count + 1,
851 rd_new, 831 rd_new,
852 &operation_done_cont, oc); 832 &operation_done_cont, oc);
853 GNUNET_free (moc->pk);
854 GNUNET_free (moc->data); 833 GNUNET_free (moc->data);
855 GNUNET_free (moc); 834 GNUNET_free (moc);
856 free_edit_dialog_context (edc); 835 free_edit_dialog_context (edc);
@@ -871,8 +850,13 @@ decrypt_block_for_merge (void *cls,
871 struct MoveOperationContext *moc = cls; 850 struct MoveOperationContext *moc = cls;
872 struct GNUNET_CRYPTO_EccPublicSignKey pubkey; 851 struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
873 852
874 GNUNET_CRYPTO_ecc_key_get_public_for_signature (moc->pk, 853 if (NULL == block)
875 &pubkey); 854 {
855 merge_with_existing_records (moc, 0, NULL);
856 return;
857 }
858 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&moc->pk,
859 &pubkey);
876 if (GNUNET_OK != 860 if (GNUNET_OK !=
877 GNUNET_NAMESTORE_block_decrypt (block, 861 GNUNET_NAMESTORE_block_decrypt (block,
878 &pubkey, 862 &pubkey,
@@ -882,7 +866,6 @@ decrypt_block_for_merge (void *cls,
882 { 866 {
883 show_error_message (_("Failed to decode existing record in target zone"), 867 show_error_message (_("Failed to decode existing record in target zone"),
884 _("Failed to add new record.")); 868 _("Failed to add new record."));
885 GNUNET_free (moc->pk);
886 GNUNET_free (moc->data); 869 GNUNET_free (moc->data);
887 free_edit_dialog_context (moc->edc); 870 free_edit_dialog_context (moc->edc);
888 GNUNET_free (moc); 871 GNUNET_free (moc);
@@ -1008,37 +991,14 @@ edit_dialog_continuation (struct EditDialogContext *edc,
1008 } 991 }
1009 else 992 else
1010 { 993 {
1011 char *keyfile; 994 const struct GNUNET_CRYPTO_EccPrivateKey *pk;
1012 struct GNUNET_CRYPTO_EccPrivateKey *pk;
1013 struct MoveOperationContext *moc; 995 struct MoveOperationContext *moc;
1014 struct GNUNET_HashCode query; 996 struct GNUNET_HashCode query;
1015 997
1016 /* determine target zone */ 998 /* determine target zone */
1017 if ( (GNUNET_OK != 999 GNUNET_assert (NULL != edc->ego);
1018 GNUNET_CONFIGURATION_get_value_filename (cfg, 1000 pk = GNUNET_IDENTITY_ego_get_private_key (edc->ego);
1019 "gns", 1001 GNUNET_assert (NULL != pk);
1020 edc->new_zone_option,
1021 &keyfile)) ||
1022 (NULL == keyfile) )
1023 {
1024 char *emsg;
1025
1026 GNUNET_asprintf (&emsg,
1027 _("Option `%s' missing in section `%s'\n"),
1028 edc->new_zone_option, "gns");
1029 show_error_message (_("Failed to access key for target zone"),
1030 emsg);
1031 GNUNET_free (emsg);
1032 break;
1033 }
1034 pk = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
1035 GNUNET_free (keyfile);
1036 if (NULL == pk)
1037 {
1038 show_error_message (_("Failed to load private key for target zone"),
1039 NULL);
1040 break;
1041 }
1042 GNUNET_NAMESTORE_query_from_private_key (pk, 1002 GNUNET_NAMESTORE_query_from_private_key (pk,
1043 edc->name, 1003 edc->name,
1044 &query); 1004 &query);
@@ -1046,9 +1006,8 @@ edit_dialog_continuation (struct EditDialogContext *edc,
1046 moc->data = data; 1006 moc->data = data;
1047 moc->rd = rd; 1007 moc->rd = rd;
1048 moc->edc = edc; 1008 moc->edc = edc;
1049 moc->pk = pk; 1009 moc->pk = *pk;
1050 GNUNET_CONTAINER_DLL_insert (moc_head, moc_tail, moc); 1010 GNUNET_CONTAINER_DLL_insert (moc_head, moc_tail, moc);
1051
1052 moc->qe = GNUNET_NAMESTORE_lookup_block (namestore, 1011 moc->qe = GNUNET_NAMESTORE_lookup_block (namestore,
1053 &query, 1012 &query,
1054 &decrypt_block_for_merge, 1013 &decrypt_block_for_merge,
@@ -1437,7 +1396,7 @@ create_popup_menu ()
1437 "Selected row is not a record row\n"); 1396 "Selected row is not a record row\n");
1438 return FALSE; 1397 return FALSE;
1439 } 1398 }
1440 popup = GTK_MENU (get_object ("gnunet_namestore_edit_popup_menu")); 1399 popup = GTK_MENU (get_object ("gnunet_namestore_gtk_edit_popup_menu"));
1441 gtk_widget_show_all (GTK_WIDGET (popup)); 1400 gtk_widget_show_all (GTK_WIDGET (popup));
1442 gtk_menu_popup (popup, NULL, NULL, NULL, NULL, 0, 0); 1401 gtk_menu_popup (popup, NULL, NULL, NULL, NULL, 0, 0);
1443 return TRUE; 1402 return TRUE;
@@ -2098,7 +2057,6 @@ cleanup_task (void *cls,
2098 _("A pending namestore operation was not transmitted to the namestore.\n")); 2057 _("A pending namestore operation was not transmitted to the namestore.\n"));
2099 GNUNET_CONTAINER_DLL_remove (moc_head, moc_tail, moc); 2058 GNUNET_CONTAINER_DLL_remove (moc_head, moc_tail, moc);
2100 GNUNET_NAMESTORE_cancel (moc->qe); 2059 GNUNET_NAMESTORE_cancel (moc->qe);
2101 GNUNET_free (moc->pk);
2102 free_edit_dialog_context (moc->edc); 2060 free_edit_dialog_context (moc->edc);
2103 GNUNET_free (moc->data); 2061 GNUNET_free (moc->data);
2104 GNUNET_free (moc); 2062 GNUNET_free (moc);