aboutsummaryrefslogtreecommitdiff
path: root/src/setup/gnunet-setup-gns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/setup/gnunet-setup-gns.c')
-rw-r--r--src/setup/gnunet-setup-gns.c53
1 files changed, 15 insertions, 38 deletions
diff --git a/src/setup/gnunet-setup-gns.c b/src/setup/gnunet-setup-gns.c
index 777de99d..65b36aed 100644
--- a/src/setup/gnunet-setup-gns.c
+++ b/src/setup/gnunet-setup-gns.c
@@ -194,10 +194,6 @@ struct ZoneIteration_Context
194 */ 194 */
195 struct GNUNET_CRYPTO_RsaKeyGenerationContext *rkgc; 195 struct GNUNET_CRYPTO_RsaKeyGenerationContext *rkgc;
196 196
197 /**
198 * Name of the zone (pseudonym). FIXME: rename...
199 */
200 char *label;
201}; 197};
202 198
203 199
@@ -387,12 +383,6 @@ static struct GNUNET_CRYPTO_ShortHashCode zone;
387static char *current_pseudonym; 383static char *current_pseudonym;
388 384
389/** 385/**
390 * Pointer to 'short', 'private' or empty string (for master zone),
391 * depending on which zone we are editing right now.
392 */
393static const char *current_zone_name;
394
395/**
396 * Pointer to name of the configuration option that gives the 386 * Pointer to name of the configuration option that gives the
397 * zone key for the zone we are editing right now. 387 * zone key for the zone we are editing right now.
398 */ 388 */
@@ -608,11 +598,9 @@ GNUNET_setup_gns_qr_saveas_button_clicked_cb (GtkButton *button,
608 * @param zonename name of the option in the configuration file 598 * @param zonename name of the option in the configuration file
609 * with the name of the file with the private key of the 599 * with the name of the file with the private key of the
610 * zone to load 600 * zone to load
611 * @param default_pseu default pseudonym to use
612 */ 601 */
613static void 602static void
614load_zone (const char *zonename, 603load_zone (const char *zonename);
615 const char *default_pseu);
616 604
617 605
618/** 606/**
@@ -625,8 +613,7 @@ load_zone (const char *zonename,
625static void 613static void
626resync_db () 614resync_db ()
627{ 615{
628 load_zone (current_zone_option, 616 load_zone (current_zone_option);
629 current_zone_name);
630} 617}
631 618
632 619
@@ -830,7 +817,7 @@ check_name_validity_and_commit (GtkTreeIter *it,
830 return; 817 return;
831 } 818 }
832 if ( (0 == strcmp (name, ROOT_STR)) && 819 if ( (0 == strcmp (name, ROOT_STR)) &&
833 (0 == strcmp (current_zone_name, "")) ) 820 (0 == strcmp (current_zone_option, "ZONEKEY")) )
834 { 821 {
835 /* We have to append PSEU RECORD, this is the 'master' zone */ 822 /* We have to append PSEU RECORD, this is the 'master' zone */
836 append_pseu = GNUNET_YES; 823 append_pseu = GNUNET_YES;
@@ -1742,7 +1729,7 @@ GNUNET_setup_gns_pseu_entry_changed_cb (GtkEditable *editable,
1742 pseu); 1729 pseu);
1743 gdk_beep (); 1730 gdk_beep ();
1744 gtk_entry_set_text (GTK_ENTRY (editable), 1731 gtk_entry_set_text (GTK_ENTRY (editable),
1745 current_pseudonym); 1732 pseu);
1746 return; 1733 return;
1747 } 1734 }
1748 if ( (pseu != NULL) && 1735 if ( (pseu != NULL) &&
@@ -1849,17 +1836,13 @@ zone_iteration_proc (void *cls,
1849 GNUNET_assert (NULL != zc_ctx); 1836 GNUNET_assert (NULL != zc_ctx);
1850 if ((NULL == zone_key) && (NULL == name)) 1837 if ((NULL == zone_key) && (NULL == name))
1851 { 1838 {
1852 GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc); 1839 GNUNET_CRYPTO_short_hash_to_enc (&zc_ctx->zone, &shenc);
1853 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1840 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1854 "Zone `%s 'iteration done\n", 1841 "Zone `%s 'iteration done\n",
1855 &shenc); 1842 &shenc);
1856 pseu_entry = GTK_ENTRY((GNUNET_SETUP_get_object ("GNUNET_setup_gns_pseu_entry"))); 1843 pseu_entry = GTK_ENTRY((GNUNET_SETUP_get_object ("GNUNET_setup_gns_pseu_entry")));
1857 if (NULL == zc_ctx->label) 1844 if (0 == strcmp (current_zone_option, "ZONEKEY"))
1858 zc_ctx->label = GNUNET_strdup (gettext ("")); 1845 gtk_widget_show (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_pseu_hbox")));
1859 gtk_entry_set_text (pseu_entry, zc_ctx->label);
1860 gtk_widget_show (GTK_WIDGET (pseu_entry));
1861 GNUNET_free_non_null (current_pseudonym);
1862 current_pseudonym = zc_ctx->label;
1863 GNUNET_setup_gns_pseu_entry_changed_cb (GTK_EDITABLE (pseu_entry), 1846 GNUNET_setup_gns_pseu_entry_changed_cb (GTK_EDITABLE (pseu_entry),
1864 NULL); 1847 NULL);
1865 GNUNET_CONTAINER_DLL_remove (zc_head, 1848 GNUNET_CONTAINER_DLL_remove (zc_head,
@@ -1945,8 +1928,8 @@ zone_iteration_proc (void *cls,
1945 if ( (0 == strcmp (name, ROOT_STR)) && 1928 if ( (0 == strcmp (name, ROOT_STR)) &&
1946 (GNUNET_NAMESTORE_TYPE_PSEU == rd[c].record_type) ) 1929 (GNUNET_NAMESTORE_TYPE_PSEU == rd[c].record_type) )
1947 { 1930 {
1948 GNUNET_free_non_null (zc_ctx->label); 1931 pseu_entry = GTK_ENTRY((GNUNET_SETUP_get_object ("GNUNET_setup_gns_pseu_entry")));
1949 zc_ctx->label = strdup (val); 1932 gtk_entry_set_text (pseu_entry, val);
1950 } 1933 }
1951 else 1934 else
1952 { 1935 {
@@ -1997,7 +1980,6 @@ zone_key_loaded_callback (void *cls,
1997 GNUNET_CONTAINER_DLL_remove (zc_head, 1980 GNUNET_CONTAINER_DLL_remove (zc_head,
1998 zc_tail, 1981 zc_tail,
1999 zc_ctx); 1982 zc_ctx);
2000 GNUNET_free_non_null (zc_ctx->label);
2001 GNUNET_free (zc_ctx); 1983 GNUNET_free (zc_ctx);
2002 show_error_message (_("Failed to load zone"), 1984 show_error_message (_("Failed to load zone"),
2003 gettext(emsg)); 1985 gettext(emsg));
@@ -2047,7 +2029,6 @@ abort_zone_iteration (struct ZoneIteration_Context *zc_ctx)
2047 GNUNET_CRYPTO_rsa_key_create_stop (zc_ctx->rkgc); 2029 GNUNET_CRYPTO_rsa_key_create_stop (zc_ctx->rkgc);
2048 if (NULL != zc_ctx->it) 2030 if (NULL != zc_ctx->it)
2049 GNUNET_NAMESTORE_zone_iteration_stop (zc_ctx->it); 2031 GNUNET_NAMESTORE_zone_iteration_stop (zc_ctx->it);
2050 GNUNET_free_non_null (zc_ctx->label);
2051 GNUNET_CONTAINER_DLL_remove (zc_head, 2032 GNUNET_CONTAINER_DLL_remove (zc_head,
2052 zc_tail, 2033 zc_tail,
2053 zc_ctx); 2034 zc_ctx);
@@ -2061,11 +2042,9 @@ abort_zone_iteration (struct ZoneIteration_Context *zc_ctx)
2061 * @param zonename name of the option in the configuration file 2042 * @param zonename name of the option in the configuration file
2062 * with the name of the file with the private key of the 2043 * with the name of the file with the private key of the
2063 * zone to load 2044 * zone to load
2064 * @param default_pseu default pseudonym to use
2065 */ 2045 */
2066static void 2046static void
2067load_zone (const char *zonename, 2047load_zone (const char *zonename)
2068 const char *default_pseu)
2069{ 2048{
2070 char *keyfile; 2049 char *keyfile;
2071 struct ZoneIteration_Context *zc_ctx; 2050 struct ZoneIteration_Context *zc_ctx;
@@ -2073,14 +2052,13 @@ load_zone (const char *zonename,
2073 2052
2074 /* clear previous zone */ 2053 /* clear previous zone */
2075 current_zone_option = zonename; 2054 current_zone_option = zonename;
2076 current_zone_name = default_pseu;
2077 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_zone_selection_hbuttonbox"))); 2055 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_zone_selection_hbuttonbox")));
2078 gtk_widget_show (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_status_label"))); 2056 gtk_widget_show (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_status_label")));
2079 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_main_scrolledwindow"))); 2057 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_main_scrolledwindow")));
2080 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_qr_image"))); 2058 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_qr_image")));
2081 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_qr_saveas_button"))); 2059 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_qr_saveas_button")));
2082 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_qr_vseparator"))); 2060 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_qr_vseparator")));
2083 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_pseu_entry"))); 2061 gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_gns_pseu_hbox")));
2084 gtk_tree_store_clear (ts); 2062 gtk_tree_store_clear (ts);
2085 2063
2086 /* setup crypto keys */ 2064 /* setup crypto keys */
@@ -2105,7 +2083,6 @@ load_zone (const char *zonename,
2105 GNUNET_CONTAINER_DLL_insert (zc_head, 2083 GNUNET_CONTAINER_DLL_insert (zc_head,
2106 zc_tail, 2084 zc_tail,
2107 zc_ctx); 2085 zc_ctx);
2108 zc_ctx->label = GNUNET_strdup (default_pseu);
2109 zc_ctx->rkgc = GNUNET_CRYPTO_rsa_key_create_start (keyfile, 2086 zc_ctx->rkgc = GNUNET_CRYPTO_rsa_key_create_start (keyfile,
2110 &zone_key_loaded_callback, 2087 &zone_key_loaded_callback,
2111 zc_ctx); 2088 zc_ctx);
@@ -2125,7 +2102,7 @@ GNUNET_setup_gns_shorten_zone_selection_radiobutton_toggled_cb (GtkToggleButton
2125 gpointer user_data) 2102 gpointer user_data)
2126{ 2103{
2127 if (gtk_toggle_button_get_active (togglebutton)) 2104 if (gtk_toggle_button_get_active (togglebutton))
2128 load_zone ("SHORTEN_ZONEKEY", _("short")); 2105 load_zone ("SHORTEN_ZONEKEY");
2129} 2106}
2130 2107
2131 2108
@@ -2141,7 +2118,7 @@ GNUNET_setup_gns_private_zone_selection_radiobutton_toggled_cb (GtkToggleButton
2141 gpointer user_data) 2118 gpointer user_data)
2142{ 2119{
2143 if (gtk_toggle_button_get_active (togglebutton)) 2120 if (gtk_toggle_button_get_active (togglebutton))
2144 load_zone ("PRIVATE_ZONEKEY", _("private")); 2121 load_zone ("PRIVATE_ZONEKEY");
2145} 2122}
2146 2123
2147 2124
@@ -2157,7 +2134,7 @@ GNUNET_setup_gns_master_zone_selection_radiobutton_toggled_cb (GtkToggleButton *
2157 gpointer user_data) 2134 gpointer user_data)
2158{ 2135{
2159 if (gtk_toggle_button_get_active (togglebutton)) 2136 if (gtk_toggle_button_get_active (togglebutton))
2160 load_zone ("ZONEKEY", ""); 2137 load_zone ("ZONEKEY");
2161} 2138}
2162 2139
2163 2140
@@ -2183,7 +2160,7 @@ GNUNET_SETUP_gns_init ()
2183 ts = GTK_TREE_STORE (GNUNET_SETUP_get_object ("GNUNET_setup_gns_treestore")); 2160 ts = GTK_TREE_STORE (GNUNET_SETUP_get_object ("GNUNET_setup_gns_treestore"));
2184 tv = GTK_TREE_VIEW (GNUNET_SETUP_get_object ("GNUNET_setup_gns_main_treeview")); 2161 tv = GTK_TREE_VIEW (GNUNET_SETUP_get_object ("GNUNET_setup_gns_main_treeview"));
2185 tm = GTK_TREE_MODEL(ts); 2162 tm = GTK_TREE_MODEL(ts);
2186 load_zone ("ZONEKEY", ""); 2163 load_zone ("ZONEKEY");
2187} 2164}
2188 2165
2189 2166