From f3408e33502e95c711b8ca15d8b4d175114387d2 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 3 Apr 2025 15:31:04 +0600 Subject: [PATCH 1/4] Fixed hash checking --- source/ubl-settings-update.c | 55 ++++-------------------------------- 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index 2d617ac..0e4d78f 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -1207,6 +1207,11 @@ void on_web_publish_accept(GtkWidget *, dictionary *dict){ yon_ubl_status_highlight_incorrect(window->UserPasswordEntry); return; } + if (encryption&&!yon_char_is_empty(encryption)&&(strlen(user_password)!=128&&strlen(user_password)!=64)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_RESTRICTED_SYMBOL_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->UserPasswordEntry); + return; + } if (username_check&&yon_char_is_empty(username)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->UsernameEntry); @@ -1395,7 +1400,7 @@ void on_password_accept(GtkWidget *,dictionary *dict){ yon_ubl_status_highlight_incorrect(window->PasswordHashEntry); return; } - if (check_is_password_hash(hash)){ + if (strlen((hash))==512){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),INCORRECT_HASH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->PasswordHashEntry); return; @@ -1428,54 +1433,6 @@ void on_password_accept(GtkWidget *,dictionary *dict){ } } gtk_widget_destroy(window->Window); - - // if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){ - // char *encryption = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo)); - // char *hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry)); - // if (yon_char_is_empty(hash)){ - // yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - // yon_ubl_status_highlight_incorrect(window->PasswordHashEntry); - // return; - // } - // char *temp = yon_char_unite(encryption,"|",hash,NULL); - // gtk_entry_set_text(GTK_ENTRY(target),temp); - // free(temp); - // } else { - // char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); - // char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry)); - // if (strpbrk(password,"!@#%^&*\'")){ - // yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_RESTRICTED_SYMBOL_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - // yon_ubl_status_highlight_incorrect(window->PasswordEntry); - // return; - // } - // if (strcmp(password,password_check)){ - // yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - // yon_ubl_status_highlight_incorrect(window->PasswordEntry); - // yon_ubl_status_highlight_incorrect(window->RepeatPasswordEntry); - // return; - // } - // char *encryption = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo)); - // if (yon_char_is_empty(encryption)){ - // gtk_entry_set_text(GTK_ENTRY(target),password); - - // } else { - // if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){ - // char *temp = yon_char_unite(encryption,"|",password,NULL); - // gtk_entry_set_text(GTK_ENTRY(target),temp); - // free(temp); - // } else { - // int size; - // config_str hash = yon_config_load(yon_debug_output("%s\n",!strcmp(encryption,"sha512")?sha512_encrypt_command(password):sha256_encrypt_command(password)),&size); - // yon_char_remove_last_symbol(hash[0],'\n'); - // char *temp = yon_char_unite(encryption,"|",hash[0],NULL); - // gtk_entry_set_text(GTK_ENTRY(target),temp); - // yon_char_parsed_free(hash,size); - // free(temp); - // } - // } - - // } - } void on_mirror_path_removed(GtkWidget *self, mirror_add_window *window){ -- 2.35.1 From 85cf294057be2eb2a6d962af9d4bba0c42ef1cf8 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 3 Apr 2025 18:06:35 +0600 Subject: [PATCH 2/4] Localisation edit; Hash check fix --- source/ubl-settings-update.c | 2 +- ubl-settings-update-password.glade | 4 ++-- ubl-settings-update_ru.po | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index 0e4d78f..70cc6f2 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -1400,7 +1400,7 @@ void on_password_accept(GtkWidget *,dictionary *dict){ yon_ubl_status_highlight_incorrect(window->PasswordHashEntry); return; } - if (strlen((hash))==512){ + if (strlen((hash))!=128||strlen(hash)!=64){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),INCORRECT_HASH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->PasswordHashEntry); return; diff --git a/ubl-settings-update-password.glade b/ubl-settings-update-password.glade index aceb9ba..3005633 100644 --- a/ubl-settings-update-password.glade +++ b/ubl-settings-update-password.glade @@ -174,8 +174,8 @@ 0 Default (None) - SHA-512 - SHA-256 + SHA-512 + SHA-256 diff --git a/ubl-settings-update_ru.po b/ubl-settings-update_ru.po index d79e412..6a4ca75 100644 --- a/ubl-settings-update_ru.po +++ b/ubl-settings-update_ru.po @@ -619,7 +619,7 @@ msgstr "Не шифровать пароль" #: source/ubl-strings.h:161 msgid "Password hash:" -msgstr "Пароль/Хэш пароля" +msgstr "Хэш пароля:" #: source/ubl-strings.h:162 msgid "Default (None)" -- 2.35.1 From 52aab76f659147fda397586e2911fbba8aa88945 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 4 Apr 2025 18:03:07 +0600 Subject: [PATCH 3/4] Fixed web publication deletion --- source/ubl-settings-update.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index 70cc6f2..01b5466 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -786,7 +786,7 @@ void on_web_publish_remove_accept(GtkWidget *, main_window *widgets){ } char *full_name = NULL; gtk_tree_model_get(model,&iter,8,&full_name,-1); - yon_config_remove_by_key(REPOPUBLIC_WEB_full(full_name)); + yon_config_remove_by_key(full_name); yon_interface_update(widgets); } -- 2.35.1 From 269e51676bfd7a267401fd312b65e19e184cb98d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 4 Apr 2025 18:06:43 +0600 Subject: [PATCH 4/4] Fixed restricted symbols --- source/ubl-settings-update.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index 01b5466..34aad3d 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -1692,7 +1692,7 @@ web_publication_add_window *yon_web_publication_add_window_new(){ window->SelectionCellRenderer = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"SelectionCellRenderer")); yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(window->UserPasswordEntry)); - yon_gtk_entry_block_restricted_symbols(GTK_ENTRY(window->UsernameEntry)); + yon_gtk_entry_block_symbols(GTK_ENTRY(window->UsernameEntry),"$"); window->name=NULL; g_signal_connect(G_OBJECT(window->SelectionCellRenderer),"toggled",G_CALLBACK(on_cell_renderer_toggle_toggled),window->RepositoriesTree); g_signal_connect(G_OBJECT(window->PathButton),"clicked",G_CALLBACK(on_file_chooser_open),window->PathEntry); @@ -1780,7 +1780,7 @@ mirror_add_window *yon_mirror_add_window_new(){ window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel"); window->PathBox = yon_gtk_builder_get_widget(builder,"PathBox"); - yon_gtk_entry_block_restricted_symbols(GTK_ENTRY(window->NameEntry)); + yon_gtk_entry_block_symbols(GTK_ENTRY(window->NameEntry),"$"); yon_on_entry_set_allowed_symbols(GTK_ENTRY(window->TypeEntry),"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/1234567890!$.#-_()~$&;{}[]|<>^:?+\\,'*`%"); window->sections = NULL; -- 2.35.1