From 72dd7f1eed1786cd04eef7f99279200eee71bd29 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 9 Jan 2025 12:41:33 +0600 Subject: [PATCH 01/72] Test added dynamic fixed width for some tree view columns --- source/ubl-settings-usergroups.c | 14 +++++++------- ubl-settings-usergroups.glade | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 167591a..3322e20 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -3213,24 +3213,24 @@ main_window *yon_main_window_complete(main_window *widgets){ gtk_widget_realize(GTK_WIDGET(widgets->GroupsTree)); GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->UsersTree)); - gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(g_list_nth_data(list,1)),50); - gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(g_list_nth_data(list,2)),175); - gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(g_list_nth_data(list,3)),175); for (guint i=0;iGroupsTree)); - gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(g_list_nth_data(list,0)),50); - gtk_tree_view_column_set_min_width(GTK_TREE_VIEW_COLUMN(g_list_nth_data(list,1)),175); for (guint i=0;iUsersTree),1,2,3,-1); + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->GroupsTree),1,2,-1); + + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemTree),1,2,3,-1); + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemGroupsTree),1,2,-1); + yon_save_window_set_postsave_function(on_save_done,widgets); yon_save_window_set_postsave_failure_function(on_save_failed,widgets); return widgets; diff --git a/ubl-settings-usergroups.glade b/ubl-settings-usergroups.glade index c5eabe9..3943708 100644 --- a/ubl-settings-usergroups.glade +++ b/ubl-settings-usergroups.glade @@ -374,7 +374,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. True fixed - 50 + 10 10 UID 1 From 946c0842a79f2ec682c922b110556abf1b723ac5 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 10 Jan 2025 09:17:42 +0600 Subject: [PATCH 02/72] Crash fix --- source/ubl-settings-usergroups.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 3322e20..6e8c3ef 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1778,8 +1778,10 @@ void yon_system_load(main_window *window){ int parsed_size; if (main_config.groups[i][strlen(main_config.groups[i])-1]=='\n') main_config.groups[i][strlen(main_config.groups[i])-1]='\0'; config_str parsed = yon_char_parse(main_config.groups[i],&parsed_size,":"); + if (parsed_size){ gtk_list_store_append(window->liststore2,&iter); gtk_list_store_set(window->liststore2,&iter,0,atol(parsed[2]),1,parsed[0],2,parsed[3],-1); + } } for (int i=0;iUsersTree),1,2,3,-1); yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->GroupsTree),1,2,-1); @@ -3248,7 +3251,6 @@ int main(int argc, char *argv[]){ gtk_init(&argc,&argv); template_main_window *widgets = yon_ubl_window_setup(); yon_main_window_complete((main_window*)widgets); - yon_window_config_load(config_path); main_config.launch_arguments=yon_char_parsed_copy(argv,argc); main_config.launch_size=argc; gtk_main(); From 1649f617236d3645545d4d34cec654501d404241 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 10 Jan 2025 18:16:19 +0600 Subject: [PATCH 03/72] WIP Deleting system users and groups --- gresource.xml | 1 + source/CMakeLists.txt | 3 + source/ubl-settings-usergroups-system.c | 132 ++++ source/ubl-settings-usergroups-user.c | 595 ++++++++++++++++ source/ubl-settings-usergroups.c | 673 +----------------- source/ubl-settings-usergroups.h | 33 +- source/ubl-strings.h | 2 +- ...rgroups-system-deletion-confirmation.glade | 226 ++++++ 8 files changed, 1024 insertions(+), 641 deletions(-) create mode 100644 source/ubl-settings-usergroups-system.c create mode 100644 source/ubl-settings-usergroups-user.c create mode 100644 ubl-settings-usergroups-system-deletion-confirmation.glade diff --git a/gresource.xml b/gresource.xml index c29a06f..4a731e5 100644 --- a/gresource.xml +++ b/gresource.xml @@ -10,6 +10,7 @@ ubl-settings-usergroups-system.glade ubl-settings-usergroups-savesettings.glade ubl-settings-usergroups-confirmation.glade + ubl-settings-usergroups-system-deletion-confirmation.glade ubl-settings-usergroups.css diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b33f93b..94c2d57 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -38,6 +38,7 @@ set(DEPENDFILES ../ubl-settings-usergroups-group.glade ../ubl-settings-usergroups-savesettings.glade ../ubl-settings-usergroups-confirmation.glade + ../ubl-settings-usergroups-system-deletion-confirmation.glade ../gresource.xml ../ubl-settings-usergroups-banner.png ../ubl-settings-usergroups.css @@ -79,6 +80,8 @@ endif() set(SOURCE_FILES ubl-settings-usergroups.c + ubl-settings-usergroups-user.c + ubl-settings-usergroups-system.c ubl-settings-usergroups.h ubl-strings.h ) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c new file mode 100644 index 0000000..54471e0 --- /dev/null +++ b/source/ubl-settings-usergroups-system.c @@ -0,0 +1,132 @@ +#include "ubl-settings-usergroups.h" + +void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog){ + GtkTreeModel *model = GTK_TREE_MODEL(dialog->list); + GtkTreeIter iter; + char *command=NULL; + for_iter(model,&iter){ + int status,delete_home_status; + char *target; + gtk_tree_model_get(model,&iter,0,&status,1,&target,3,&delete_home_status,-1); + if (command) command=yon_char_unite(command,"; ",delete_home_status?remove_user_and_homedir_from_system_command(target):remove_user_from_system_command(target),NULL); + else command = delete_home_status?remove_user_and_homedir_from_system_command(target):remove_user_from_system_command(target); + } + if (!yon_char_is_empty(command)){ + yon_launch(command); + } +} + +void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog){ + GtkTreeModel *model = GTK_TREE_MODEL(dialog->list); + GtkTreeIter iter; + char *command=NULL; + for_iter(model,&iter){ + int status,delete_home_status; + char *target; + gtk_tree_model_get(model,&iter,0,&status,1,&target,3,&delete_home_status,-1); + if (command) command=yon_char_unite(command,"; ",remove_group_from_system_command(target),NULL); + else command = remove_group_from_system_command(target); + } + if (!yon_char_is_empty(command)){ + yon_launch(command); + } +} + +void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window *); + system_remove_confirmation_window *window = yon_dictionary_get_data(dict->first->next,system_remove_confirmation_window *); + if (self == window->ConfigAcceptButton){ + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==2){ + GtkTreeIter iter, itar; + GtkTreeModel *model; + char *target; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ + gtk_tree_model_get(model,&iter,2,&target,-1); + } + for_iter(GTK_TREE_MODEL(widgets->UsersList),&itar){ + char *cur; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->UsersList),&itar,2,&cur,-1); + if (!strcmp(target,cur)){ + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&itar); + break; + } + } + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->MainNotebook),0); + yon_delete_confirmation_open(widgets); + } else { + GtkTreeIter iter, itar; + GtkTreeModel *model; + char *target; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ + gtk_tree_model_get(model,&iter,1,&target,-1); + } + for_iter(GTK_TREE_MODEL(widgets->GroupsList),&itar){ + char *cur; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&itar,1,&cur,-1); + if (!strcmp(target,cur)){ + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GroupsTree)),&itar); + break; + } + } + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->MainNotebook),1); + yon_group_delete_confirmation_open(widgets); + } + } else { + yon_confirmation_window *dialog = yon_delete_confirmation_new(); + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); + gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==2){ + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(widgets->SystemTree)); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ + char *name,*username,*homedir=NULL; + gtk_tree_model_get(model,&iter,2,&name,3,&username,6,&homedir,-1); + gtk_list_store_append(dialog->list,&iter); + gtk_list_store_set(dialog->list,&iter,0,1,1,name,2,homedir,4,!yon_char_is_empty(homedir),5,username,-1); + gtk_widget_show(dialog->Window); + } + + } else { + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(widgets->SystemGroupsTree)); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ + yon_confirmation_window *dialog = yon_delete_confirmation_new(); + gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); + gtk_widget_show(window->AcceptButton); + gtk_widget_hide(window->ConfigAcceptButton); + gtk_widget_hide(window->SystemAcceptButton); + char *name; + gtk_label_set_text(GTK_LABEL(window->TitleLabel),DELETE_GROUP_CONFIRMATION_CONFIRM_LABEL); + gtk_tree_view_column_set_title(dialog->UserCell,GROUP_LABEL); + gtk_label_set_text(GTK_LABEL(dialog->HatLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(dialog->DeletionTree),2),0); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(dialog->DeletionTree),3),0); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(dialog->DeletionTree),4),0); + + gtk_tree_model_get(model,&iter,1,&name,-1); + gtk_list_store_append(dialog->list,&iter); + gtk_list_store_set(dialog->list,&iter,0,1,1,name,-1); + gtk_widget_show(dialog->Window); + } + } + } + on_subwindow_close(self); +} + +system_remove_confirmation_window *yon_system_remove_confirmation_window_new(){ + system_remove_confirmation_window *window = malloc(sizeof(system_remove_confirmation_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_system_deletion_confirmation); + + window->Window = yon_gtk_builder_get_widget(builder,"Window"); + window->HeaderLabel = yon_gtk_builder_get_widget(builder,"HeaderLabel"); + window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); + window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel"); + window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); + window->ConfigAcceptButton = yon_gtk_builder_get_widget(builder,"ConfigAcceptButton"); + window->SystemAcceptButton = yon_gtk_builder_get_widget(builder,"SystemAcceptButton"); + + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + + return window; +} \ No newline at end of file diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c new file mode 100644 index 0000000..43e77aa --- /dev/null +++ b/source/ubl-settings-usergroups-user.c @@ -0,0 +1,595 @@ +#include "ubl-settings-usergroups.h" + + +ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ + ubl_settings_usergroups_user_window *window = malloc(sizeof(ubl_settings_usergroups_user_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_user); + window->CreateUserWindow=yon_gtk_builder_get_widget(builder,"CreateUserWindow"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->userUIDAutoCheck=yon_gtk_builder_get_widget(builder,"userUIDAutoCheck"); + window->userUIDEntry=yon_gtk_builder_get_widget(builder,"userUIDEntry"); + window->userLoginEntry=yon_gtk_builder_get_widget(builder,"userLoginEntry"); + window->userPasswordCombo=yon_gtk_builder_get_widget(builder,"userPasswordCombo"); + window->userPasswordEntry=yon_gtk_builder_get_widget(builder,"userPasswordEntry"); + window->userPasswordButton=yon_gtk_builder_get_widget(builder,"userPasswordButton"); + window->userUserNameEntry=yon_gtk_builder_get_widget(builder,"userUserNameEntry"); + window->userGroupsCheck=yon_gtk_builder_get_widget(builder,"userGroupsCheck"); + window->userGroupsEntry=yon_gtk_builder_get_widget(builder,"userGroupsEntry"); + window->UserGroupsButton=yon_gtk_builder_get_widget(builder,"UserGroupsButton"); + window->userAdditionalGroupsEntry=yon_gtk_builder_get_widget(builder,"userAdditionalGroupsEntry"); + window->userAdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"userAdditionalGroupsButton"); + window->userPasswordChangedEntry=yon_gtk_builder_get_widget(builder,"userPasswordChangedEntry"); + window->userPasswordExpirationEntry=yon_gtk_builder_get_widget(builder,"userPasswordExpirationEntry"); + window->userPasswordExpirationButton=yon_gtk_builder_get_widget(builder,"userPasswordExpirationButton"); + window->userPasswordChangeDelayMinimumSpin=yon_gtk_builder_get_widget(builder,"userPasswordChangeDelayMinimumSpin"); + window->userPasswordChangeDelayMaximumSpin=yon_gtk_builder_get_widget(builder,"userPasswordChangeDelayMaximumSpin"); + window->userWarningSpin=yon_gtk_builder_get_widget(builder,"userWarningSpin"); + window->userActivitySpin=yon_gtk_builder_get_widget(builder,"userActivitySpin"); + window->userForceChangeCheck=yon_gtk_builder_get_widget(builder,"userForceChangeCheck"); + window->userShellCombo=yon_gtk_builder_get_widget(builder,"userShellCombo"); + window->userShellEntry=yon_gtk_builder_get_widget(builder,"userShellEntry"); + window->userHomeCombo=yon_gtk_builder_get_widget(builder,"userHomeCombo"); + window->userHomeEntry=yon_gtk_builder_get_widget(builder,"userHomeEntry"); + window->userHomeButton=yon_gtk_builder_get_widget(builder,"userHomeButton"); + window->userCreateSystemCheck=yon_gtk_builder_get_widget(builder,"userCreateSystemCheck"); + window->userCreateUnuniqueCheck=yon_gtk_builder_get_widget(builder,"userCreateUnuniqueCheck"); + window->userDontCheckCheck=yon_gtk_builder_get_widget(builder,"userDontCheckCheck"); + window->userSyncSAMBACheck=yon_gtk_builder_get_widget(builder,"userSyncSAMBACheck"); + window->userSyncSAMBAPasswordCheck=yon_gtk_builder_get_widget(builder,"userSyncSAMBAPasswordCheck"); + window->userDeactivatedCheck=yon_gtk_builder_get_widget(builder,"userDeactivatedCheck"); + window->userExtraOptionsEntry=yon_gtk_builder_get_widget(builder,"userExtraOptionsEntry"); + window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton"); + window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton"); + window->CalendarPopup=yon_gtk_builder_get_widget(builder,"CalendarPopover"); + window->UseraddBootCheck=yon_gtk_builder_get_widget(builder,"UseraddBootCheck"); + window->ExpirationCalendar=yon_gtk_builder_get_widget(builder,"ExpirationCalendar"); + window->UseraddShutdownCheck=yon_gtk_builder_get_widget(builder,"UseraddShutdownCheck"); + window->UsershadowBootCheck=yon_gtk_builder_get_widget(builder,"UsershadowBootCheck"); + window->UsershadowShutdownCheck=yon_gtk_builder_get_widget(builder,"UsershadowShutdownCheck"); + window->userTitleNameLabel=yon_gtk_builder_get_widget(builder,"userTitleNameLabel"); + window->expiration_unix=NULL; + window->last_uid=NULL; + + time_t t = time(NULL); + struct tm tm = *localtime(&t); + gtk_calendar_select_day(GTK_CALENDAR(window->ExpirationCalendar),tm.tm_mday); + gtk_calendar_select_month(GTK_CALENDAR(window->ExpirationCalendar),tm.tm_mon,1900+tm.tm_year); + + on_UID_update(NULL,window); + int shell_size=0; + config_str shells = yon_file_open(shell_list_path,&shell_size); + for (int i=1;iuserShellCombo),parsed[0],parsed[0]); + yon_char_parsed_free(parsed,parsed_size); + } + } + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->userShellCombo),"Set",SET_LABEL); + yon_char_parsed_free(shells,shell_size); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->userShellCombo),0); + window->old_password=NULL; + window->old_username=NULL; + dictionary *entry_dict = NULL; + yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateUserWindow),"UserWindow"); + yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"combo",window->userPasswordCombo); + yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"entry",window->userPasswordEntry); + // char *password = yon_config_get_by_key(USERADD((char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)))); + g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); + g_signal_connect(G_OBJECT(window->userHomeButton),"clicked",G_CALLBACK(on_filechooser_open),window->userHomeEntry); + g_signal_connect(G_OBJECT(window->UserGroupsButton),"clicked",G_CALLBACK(on_groups_clicked),window->userGroupsEntry); + g_signal_connect(G_OBJECT(window->userPasswordButton),"clicked",G_CALLBACK(on_password_change),entry_dict); + g_signal_connect(G_OBJECT(window->userAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userAdditionalGroupsEntry); + g_signal_connect(G_OBJECT(window->userPasswordExpirationButton),"clicked",G_CALLBACK(on_expiration_clicked),window); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); + g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userHomeEntry); + g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userHomeButton); + g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userPasswordButton); + g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userGroupsEntry); + g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UserGroupsButton); + g_signal_connect(G_OBJECT(window->userShellCombo),"changed",G_CALLBACK(on_user_shell_changed),window); + g_signal_connect(G_OBJECT(window->ExpirationCalendar),"day-selected",G_CALLBACK(on_date_selected),window); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(on_UID_update),window); + g_signal_connect(G_OBJECT(window->userCreateSystemCheck),"toggled",G_CALLBACK(on_UID_update),window); + g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(on_user_login_update),window); + g_signal_connect(G_OBJECT(window->userLoginEntry),"changed",G_CALLBACK(on_user_login_update),window); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->userCreateSystemCheck); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_toggle_button_set_inactive_from_toggle_button),window->userCreateSystemCheck); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userCreateUnuniqueCheck); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_toggle_button_set_inactive_from_toggle_button_inversed),window->userCreateUnuniqueCheck); + g_signal_connect(G_OBJECT(window->userSyncSAMBACheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userSyncSAMBAPasswordCheck); + g_signal_connect(G_OBJECT(window->userSyncSAMBAPasswordCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userSyncSAMBACheck); + g_signal_connect(G_OBJECT(window->userSyncSAMBACheck),"toggled",G_CALLBACK(on_toggle_button_set_active_from_toggle_button_inversed),window); + g_signal_connect(G_OBJECT(window->userSyncSAMBAPasswordCheck),"toggled",G_CALLBACK(on_toggle_button_set_active_from_toggle_button_inversed),window); + g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_toggle_button_set_active_from_combo_box),window); + g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_toggle_button_set_active_from_combo_box),window); + g_signal_connect(G_OBJECT(window->userPasswordEntry),"changed",G_CALLBACK(on_password_user_changed),window); + g_signal_connect(G_OBJECT(window->userHomeEntry),"changed",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userShellCombo),"changed",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userShellEntry),"changed",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userCreateSystemCheck),"toggled",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userCreateUnuniqueCheck),"toggled",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userDontCheckCheck),"toggled",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userGroupsEntry),"changed",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userPasswordExpirationEntry),"icon-press",G_CALLBACK(on_remove_expired),window->userPasswordExpirationEntry); + g_signal_connect(G_OBJECT(window->userUIDEntry),"insert-text",G_CALLBACK(yon_on_text_insert_only_digits),NULL); +return window; +} + +void on_UID_update(GtkWidget *, ubl_settings_usergroups_user_window *window){ + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){ + if (window->last_uid){ + gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),window->last_uid); + } else { + int config_size=0; + int final_size=0; + config_str config_users = yon_config_get_all_by_key(USERADD_SEARCH_macro,&config_size); + yon_char_parsed_prepend_strings(config_users,config_size,":"); + config_str final = yon_char_parsed_merge(main_config.users,main_config.users_size,config_users,config_size,&final_size); + long prev_busy=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck))?0:main_config.MINGID; + for (int i=0;iuserCreateUnuniqueCheck))?0:main_config.MINGID; + int maximum = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck))?68000:main_config.MAXGID; + for (int i=0;iprev_busy){ + prev_busy=atol(parsed[2]); + } + } + } + yon_char_parsed_free(parsed, parsed_size); + } + gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),yon_char_from_long(prev_busy+1)); + } + } else { + gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),""); + } +} + +void on_user_shell_changed(GtkWidget *, ubl_settings_usergroups_user_window *window){ + const char *current = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)); + if (!yon_char_is_empty(current)&&!strcmp(current,SET_LABEL)){ + if(gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo))>1){ + gtk_widget_set_sensitive(window->userShellEntry,1); + } else { + gtk_widget_set_sensitive(window->userShellEntry,0); + } + } else { + gtk_widget_set_sensitive(window->userShellEntry,0); + } +} + +void on_user_login_update(GtkWidget *, ubl_settings_usergroups_user_window *window){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck))){ + gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry))); + } else { + gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),""); + } +} + +void on_user_save(GtkWidget *self, dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + ubl_settings_usergroups_user_window *window = yon_dictionary_get_data(dict->first->next,ubl_settings_usergroups_user_window*); + char *final_user=""; + char *uid_string = NULL; + char *password = NULL; + char *login = NULL; + char *username = NULL; + char *main_group = NULL; + char *additional_groups = NULL; + char *password_changed_date = NULL; + char *password_expiration_date = NULL; + char *password_change_interval_minimum = NULL; + char *password_change_interval_maximum = NULL; + char *warning_days = NULL; + char *no_activity_days = NULL; + // char *force_at_next_login = NULL; + char *user_shell = NULL; + char *user_home = NULL; + char *create_system_user = NULL; + char *create_ununique = NULL; + char *do_not_check = NULL; + int samba_sync = 0; + int samba_password_sync = 0; + int deactivate = 0; + char *extra_options = NULL; + char *useradd_boot = ""; + char *useradd_shutdown = ""; + char *usershadow_boot = ""; + char *usershadow_shutdown = ""; + + + int uid_auto_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck)); + if (uid_auto_active){ + uid_string=""; + } else { + int config_size=0; + int final_size=0; + config_str config_users = yon_config_get_all_by_key(USERADD_SEARCH_macro,&config_size); + yon_char_parsed_prepend_strings(config_users,config_size,":"); + config_str final = yon_char_parsed_merge(main_config.users,main_config.users_size,config_users,config_size,&final_size); + + uid_string = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry)); + if (strcmp(uid_string,window->last_uid)){ + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck))){ + int found=0; + for (int i=0;i2&&!strcmp(parsed[2],uid_string)){ + if (yon_char_is_empty(window->last_uid)||(!yon_char_is_empty(window->last_uid)&&strcmp(parsed[2],window->last_uid))){ + found = yon_char_parsed_check_exist(config_users,config_size,final[i])>-1?1:2; + break; + } + } + + if (parsed_size) yon_char_parsed_free(parsed,parsed_size); + } + if (found){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),found==1?UID_ALREADY_EXIST_CONFIG_LABEL:UID_ALREADY_EXIST_SYSTEM_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userUIDEntry); + return; + } + } + } + + if (yon_char_is_empty(uid_string)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userUIDEntry); + return; + } + } + + int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck)); + if (do_not_check_actve) + do_not_check = "--badnames"; + + login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)); + if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),USER_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userLoginEntry); + return; + } + if (yon_char_is_empty(login)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userLoginEntry); + return; + } + + int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo)); + if (password_active > 1){ + password = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); + if (yon_char_is_empty(password)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userPasswordEntry); + return; + } + } else if (password_active==1){ + password = "!*"; + } else { + password=""; + } + + char *old_password = NULL; + if (window->old_password){ + old_password = window->old_password; + yon_check_password_blocked(old_password); + } + if (!old_password||(old_password&&strcmp(old_password,password))){ + time_t t = time(NULL); + struct tm tm = *localtime(&t); + char *month = yon_char_from_int(tm.tm_mon+1); + if (strlen(month)==1){ + month=yon_char_append("0",month); + } + char *day = yon_char_from_int(tm.tm_mday); + if (strlen(day)<2){ + day=yon_char_append("0",day); + } + password_changed_date = yon_char_unite(yon_char_from_int(1900+tm.tm_year),"-",month,"-",day,NULL); + } else { + password_changed_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordChangedEntry)); + } + + deactivate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck)); + if (deactivate){ + if (strlen(password)>1&&password[0]=='%'&&password[1]=='%'){ + char *temp = yon_char_replace(password,"%%","!!"); + password = yon_char_replace(temp,"!!","%%!"); + } else { + password = yon_char_append("!",password); + } + } + + username = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUserNameEntry)); + if (yon_char_is_empty(username)){ + username=""; + } + + int main_group_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck)); + if (!main_group_active){ + main_group = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry)); + } else { + main_group = ""; + } + + additional_groups = (char*)gtk_entry_get_text(GTK_ENTRY(window->userAdditionalGroupsEntry)); + char *default_groups = yon_config_get_by_key(USERGROUPS_parameter); + if (!yon_char_is_empty(default_groups)&&!strcmp(default_groups,additional_groups)){ + additional_groups=""; + } + long password_change_interval_minimum_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMinimumSpin)); + if (password_change_interval_minimum_active>0){ + password_change_interval_minimum = yon_char_from_long(password_change_interval_minimum_active); + } else password_change_interval_minimum = 0; + + long password_change_interval_maximum_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin)); + if (password_change_interval_minimum_active>0){ + password_change_interval_maximum = yon_char_from_long(password_change_interval_maximum_active); + } else password_change_interval_maximum = 0; + + password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry)); + if (yon_char_is_empty(password_expiration_date)){ + password_expiration_date="-1"; + } + + long warning_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin)); + if (warning_days_active>0) + warning_days = yon_char_from_long(warning_days_active); + + int no_activity_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userActivitySpin)); + if (no_activity_days_active>0){ + no_activity_days = yon_char_from_long(no_activity_days_active); + } + + int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo)); + if (user_shell_active>0){ + char *shell_string = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)); + if (strcmp(shell_string,SET_LABEL)){ + user_shell = yon_char_unite("--shell ",shell_string," ",NULL); + } else { + user_shell = yon_char_unite("--shell ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userShellEntry)),NULL); + } + } else user_shell=""; + + int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo)); + if (user_home_active==2){ + user_home=yon_char_unite("--home-dir ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry)),NULL); + } else if (user_home_active==1){ + user_home="--no-create-home"; + } else user_home = ""; + + int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck)); + if (system_user_active) + create_system_user = "--system"; + + int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck)); + if (create_ununique_active) + create_ununique = "--non-unique"; + + samba_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck)); + samba_password_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck)); + if (samba_sync){ + if (yon_samba_sync_get(login)==2) + yon_samba_sync_remove(login); + yon_samba_sync_add(login,NULL); + } else if (samba_password_sync){ + if (yon_samba_sync_get(login)==1) + yon_samba_sync_remove(login); + yon_samba_sync_add(login,password); + } else { + yon_samba_sync_remove(login); + } + + extra_options=(char*)gtk_entry_get_text(GTK_ENTRY(window->userExtraOptionsEntry)); + + int force_at_next_login_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userForceChangeCheck)); + if (force_at_next_login_active){ + password_changed_date = "0"; + } + + int useradd_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck)); + if (useradd_boot_active){ + useradd_boot = "boot"; + } + + int useradd_shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck)); + if (useradd_shutdown_active){ + useradd_shutdown = "shutdown"; + } + + int usershadow_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsershadowBootCheck)); + if (usershadow_boot_active){ + usershadow_boot = "boot"; + } + + int usershadow_shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck)); + if (usershadow_shutdown_active){ + usershadow_shutdown = "shutdown"; + } + + + char *useradd_sync_string = NULL; + useradd_sync_string = yon_char_unite(useradd_boot,!yon_char_is_empty(useradd_boot)?",":"",useradd_shutdown,NULL); + char *usershadow_sync_string = NULL; + usershadow_sync_string = yon_char_unite(usershadow_boot,!yon_char_is_empty(usershadow_boot)?",":"",usershadow_shutdown,NULL); + char *shadow_string = NULL; + shadow_string = yon_char_unite(yon_char_return_if_exist(password_changed_date,""), + ":",yon_char_return_if_exist(password_change_interval_minimum,""), + ":",yon_char_return_if_exist(password_change_interval_maximum,""), + ":",yon_char_return_if_exist(warning_days,""), + ":",yon_char_return_if_exist(no_activity_days,""), + ":",yon_char_return_if_exist(password_expiration_date,""), + NULL); + + final_user = yon_char_unite(yon_char_return_if_exist(username,"x"), + ":",yon_char_return_if_exist(uid_string,"x"), + ":",yon_char_return_if_exist(main_group,"x"), + ":",yon_char_return_if_exist(additional_groups,"x"), + ":",yon_char_return_if_exist(extra_options,""), + ":",yon_char_return_if_exist(password,""), + NULL); + + char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD(login)); + yon_config_register(USERADD(login),final_command,final_user); + if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ + yon_config_remove_by_key(USERADD(window->old_username)); + } + final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW(login)); + yon_config_register(USERSHADOW(login),final_command,shadow_string); + if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ + yon_config_remove_by_key(USERSHADOW(window->old_username)); + } + int home_delete = yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,login); + if (home_delete>-1){ + yon_char_parsed_rip(main_config.remove_homes,&main_config.homes_size,home_delete); + } + + if (!yon_char_is_empty(useradd_sync_string)){ + final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD_SYNC(login)); + yon_config_register(USERADD_SYNC(login),final_command,useradd_sync_string); + if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ + yon_config_remove_by_key(USERADD_SYNC(window->old_username)); + } + } else { + yon_config_remove_by_key(USERADD_SYNC(window->old_username)); + } + + if (!yon_char_is_empty(usershadow_sync_string)){ + final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW_SYNC(login)); + yon_config_register(USERSHADOW_SYNC(login),final_command,usershadow_sync_string); + if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ + yon_config_remove_by_key(USERSHADOW_SYNC(window->old_username)); + } + } else { + yon_config_remove_by_key(USERSHADOW_SYNC(window->old_username)); + } + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->UsersList); + char *password_status=NULL; + if (password_active==0) password_status = DEFAULT_USER_LABEL; + else if (password_active==1) password_status = NO_PASSWORD_LABEL; + else if (password[0]=='%'&&password[1]=='%') password_status = UNENCRYPTED_LABEL; + else password_status = ENCRYPTED_LABEL; + if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter)) + gtk_list_store_append(widgets->UsersList,&iter); + gtk_list_store_set(widgets->UsersList,&iter, + 0,deactivate, + 1,yon_char_return_if_exist(uid_string,""), + 2,yon_char_return_if_exist(login,""), + 3,yon_char_return_if_exist(username,""), + 4,yon_char_return_if_exist(main_group,login), + 5,yon_char_return_if_exist(additional_groups,yon_config_get_by_key(USERGROUPS_parameter)), + 6,yon_char_unite(yon_char_return_if_exist(user_home,""),yon_char_return_if_exist(user_shell,""),yon_char_return_if_exist(create_system_user,""),yon_char_return_if_exist(create_ununique,""),yon_char_return_if_exist(do_not_check,""),NULL), + 7,password_status, + -1); + on_subwindow_close(self); +} + +void on_user_sync_with_config(GtkWidget *,main_window *widgets){ + int active = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook)); + switch (active){ + case 2:{ + GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore1); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ + char *target; + gtk_tree_model_get(model,&iter,2,&target,-1); + dialog_confirmation_data data; + if (config(USERADD(target))){ + data.action_text = SYSTEM_USER_SYNC_CONFIRMATION_LABEL(target); + data.data=NULL; + data.function=NULL; + } else { + data.action_text = SYSTEM_USER_ADD_CONFIRMATION_LABEL(target); + data.data=NULL; + data.function=NULL; + } + if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ + return; + } + + char *user = yon_char_parsed_check_exist_begins_with(main_config.groups,main_config.groups_size,target); + char *shadow = yon_char_parsed_check_exist_begins_with(main_config.group_shadow,main_config.group_shadow_size,target); + yon_char_remove_last_symbol(user,'\n'); + yon_char_remove_last_symbol(shadow,'\n'); + int user_size=0; + int shadow_size=0; + config_str parsed = yon_char_parse(user,&user_size,":"); + config_str parsed_shadow = yon_char_parse(shadow,&shadow_size,":"); + + char *optionals = yon_char_unite(user_size>5? parsed[5]:"",user_size>5?" ":"",user_size>6?parsed[6]:"",NULL); + char *config_user = yon_char_unite(parsed[0],":", + user_size>4?parsed[4]:"",":", + user_size>2?parsed[2]:"",":", + user_size>3?parsed[3]:"",":", + !yon_char_is_empty(optionals)?optionals:"",":", + user_size>1&&strcmp(parsed[1],"x")?yon_char_return_if_exist(parsed[1],""):yon_char_return_if_exist(parsed_shadow[1],""),NULL); + char *config_shadow = yon_char_unite(yon_char_return_if_exist(parsed[2],""),":", + user_size>3?parsed[3]:"",":", + user_size>4?parsed[4]:"",":", + user_size>5?parsed[5]:"",":", + user_size>6?parsed[6]:"",":", + user_size>7?parsed[7]:"",":",NULL); + + if (!yon_char_is_empty(config_user)){ + char *user_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD(target)); + yon_config_register(USERADD(target),user_command,config_user); + } + if (!yon_char_is_empty(config_shadow)){ + char *shadow_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW(target)); + yon_config_register(USERSHADOW(target),shadow_command,config_shadow); + } + yon_interface_update(widgets); + } + yon_interface_update((main_window*)widgets); + }break; + case 3:{ + GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore1); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ + + char *target; + gtk_tree_model_get(model,&iter,1,&target,-1); + dialog_confirmation_data data; + if (config(GROUPADD(target))){ + data.action_text = SYSTEM_GROUP_ADD_CONFIRMATION_LABEL(target); + data.data=NULL; + data.function=NULL; + } else { + data.action_text = SYSTEM_GROUP_SYNC_CONFIRMATION_LABEL(target); + data.data=NULL; + data.function=NULL; + } + if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ + return; + } + char *group = yon_char_parsed_check_exist_begins_with(main_config.groups,main_config.groups_size,target); + char *group_shadow = yon_char_parsed_check_exist_begins_with(main_config.group_shadow,main_config.group_shadow_size,target); + yon_char_remove_last_symbol(group,'\n'); + yon_char_remove_last_symbol(group_shadow,'\n'); + int group_size=0; + int group_shadow_size=0; + config_str parsed = yon_char_parse(group,&group_size,":"); + config_str parsed_shadow = yon_char_parse(group_shadow,&group_shadow_size,":"); + char *config_group = yon_char_unite(parsed[0],":",parsed[3],":",parsed[2],"::",parsed_shadow[2],":",strcmp(parsed[1],"x")?parsed[1]:parsed_shadow[1],NULL); + + if (!yon_char_is_empty(config_group)){ + char *group_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD(target)); + yon_config_register(GROUPADD(target),group_command,config_group); + yon_interface_update(widgets); + } + } + }break; + } +} \ No newline at end of file diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 6e8c3ef..09b175e 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1880,415 +1880,12 @@ void on_system_update(GtkWidget *, main_window *window){ yon_system_load(window); } -ubl_settings_usergroups_system_window *yon_ubl_settings_usergroups_system_new(){ - ubl_settings_usergroups_system_window *window = malloc(sizeof(ubl_settings_usergroups_system_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_system); - window->liststore1=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); - window->liststore2=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore2")); - window->MonitorWindow=yon_gtk_builder_get_widget(builder,"MonitorWindow"); - window->ToggleAllButton=yon_gtk_builder_get_widget(builder,"ToggleAllButton"); - window->UpdateButton=yon_gtk_builder_get_widget(builder,"UpdateButton"); - window->SystemTree = yon_gtk_builder_get_widget(builder,"SystemTree"); - window->show_all=0; - yon_window_config_custom_window_setup(GTK_WINDOW(window->MonitorWindow),"InspectorWindow"); - yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(window->SystemTree)); - GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(window->SystemTree)); - for (guint i=0;iMonitorWindow),INSPECTOR_TITLE_LABEL); - - // g_signal_connect(G_OBJECT(window->ToggleAllButton),"clicked",G_CALLBACK(on_mode_changed),window); - g_signal_connect(G_OBJECT(window->UpdateButton),"clicked",G_CALLBACK(on_system_update),window); -return window; -} - -void on_settings_usergroups_system_open(GtkWidget *, main_window *){ - ubl_settings_usergroups_system_window *window = yon_ubl_settings_usergroups_system_new(); - gtk_widget_show(window->MonitorWindow); -} - - - -void on_user_shell_changed(GtkWidget *, ubl_settings_usergroups_user_window *window){ - const char *current = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)); - if (!yon_char_is_empty(current)&&!strcmp(current,SET_LABEL)){ - if(gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo))>1){ - gtk_widget_set_sensitive(window->userShellEntry,1); - } else { - gtk_widget_set_sensitive(window->userShellEntry,0); - } - } else { - gtk_widget_set_sensitive(window->userShellEntry,0); - } -} - -void on_UID_update(GtkWidget *, ubl_settings_usergroups_user_window *window){ - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){ - if (window->last_uid){ - gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),window->last_uid); - } else { - int config_size=0; - int final_size=0; - config_str config_users = yon_config_get_all_by_key(USERADD_SEARCH_macro,&config_size); - yon_char_parsed_prepend_strings(config_users,config_size,":"); - config_str final = yon_char_parsed_merge(main_config.users,main_config.users_size,config_users,config_size,&final_size); - long prev_busy=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck))?0:main_config.MINGID; - for (int i=0;iuserCreateUnuniqueCheck))?0:main_config.MINGID; - int maximum = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck))?68000:main_config.MAXGID; - for (int i=0;iprev_busy){ - prev_busy=atol(parsed[2]); - } - } - } - yon_char_parsed_free(parsed, parsed_size); - } - gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),yon_char_from_long(prev_busy+1)); - } - } else { - gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),""); - } -} - -void on_user_login_update(GtkWidget *, ubl_settings_usergroups_user_window *window){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck))){ - gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry))); - } else { - gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),""); - } -} - -void on_user_save(GtkWidget *self, dictionary *dict){ - main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); - ubl_settings_usergroups_user_window *window = yon_dictionary_get_data(dict->first->next,ubl_settings_usergroups_user_window*); - char *final_user=""; - char *uid_string = NULL; - char *password = NULL; - char *login = NULL; - char *username = NULL; - char *main_group = NULL; - char *additional_groups = NULL; - char *password_changed_date = NULL; - char *password_expiration_date = NULL; - char *password_change_interval_minimum = NULL; - char *password_change_interval_maximum = NULL; - char *warning_days = NULL; - char *no_activity_days = NULL; - // char *force_at_next_login = NULL; - char *user_shell = NULL; - char *user_home = NULL; - char *create_system_user = NULL; - char *create_ununique = NULL; - char *do_not_check = NULL; - int samba_sync = 0; - int samba_password_sync = 0; - int deactivate = 0; - char *extra_options = NULL; - char *useradd_boot = ""; - char *useradd_shutdown = ""; - char *usershadow_boot = ""; - char *usershadow_shutdown = ""; - - int uid_auto_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck)); - if (uid_auto_active){ - uid_string=""; - } else { - int config_size=0; - int final_size=0; - config_str config_users = yon_config_get_all_by_key(USERADD_SEARCH_macro,&config_size); - yon_char_parsed_prepend_strings(config_users,config_size,":"); - config_str final = yon_char_parsed_merge(main_config.users,main_config.users_size,config_users,config_size,&final_size); - - uid_string = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry)); - if (strcmp(uid_string,window->last_uid)){ - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck))){ - int found=0; - for (int i=0;i2&&!strcmp(parsed[2],uid_string)){ - if (yon_char_is_empty(window->last_uid)||(!yon_char_is_empty(window->last_uid)&&strcmp(parsed[2],window->last_uid))){ - found = yon_char_parsed_check_exist(config_users,config_size,final[i])>-1?1:2; - break; - } - } - if (parsed_size) yon_char_parsed_free(parsed,parsed_size); - } - if (found){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),found==1?UID_ALREADY_EXIST_CONFIG_LABEL:UID_ALREADY_EXIST_SYSTEM_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->userUIDEntry); - return; - } - } - } - - if (yon_char_is_empty(uid_string)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->userUIDEntry); - return; - } - } - - int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck)); - if (do_not_check_actve) - do_not_check = "--badnames"; - - login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)); - if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),USER_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->userLoginEntry); - return; - } - if (yon_char_is_empty(login)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->userLoginEntry); - return; - } - - int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo)); - if (password_active > 1){ - password = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); - if (yon_char_is_empty(password)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->userPasswordEntry); - return; - } - } else if (password_active==1){ - password = "!*"; - } else { - password=""; - } - - char *old_password = NULL; - if (window->old_password){ - old_password = window->old_password; - yon_check_password_blocked(old_password); - } - if (!old_password||(old_password&&strcmp(old_password,password))){ - time_t t = time(NULL); - struct tm tm = *localtime(&t); - char *month = yon_char_from_int(tm.tm_mon+1); - if (strlen(month)==1){ - month=yon_char_append("0",month); - } - char *day = yon_char_from_int(tm.tm_mday); - if (strlen(day)<2){ - day=yon_char_append("0",day); - } - password_changed_date = yon_char_unite(yon_char_from_int(1900+tm.tm_year),"-",month,"-",day,NULL); - } else { - password_changed_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordChangedEntry)); - } - - deactivate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck)); - if (deactivate){ - if (strlen(password)>1&&password[0]=='%'&&password[1]=='%'){ - char *temp = yon_char_replace(password,"%%","!!"); - password = yon_char_replace(temp,"!!","%%!"); - } else { - password = yon_char_append("!",password); - } - } - - username = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUserNameEntry)); - if (yon_char_is_empty(username)){ - username=""; - } - - int main_group_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck)); - if (!main_group_active){ - main_group = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry)); - } else { - main_group = ""; - } - - additional_groups = (char*)gtk_entry_get_text(GTK_ENTRY(window->userAdditionalGroupsEntry)); - char *default_groups = yon_config_get_by_key(USERGROUPS_parameter); - if (!yon_char_is_empty(default_groups)&&!strcmp(default_groups,additional_groups)){ - additional_groups=""; - } - long password_change_interval_minimum_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMinimumSpin)); - if (password_change_interval_minimum_active>0){ - password_change_interval_minimum = yon_char_from_long(password_change_interval_minimum_active); - } else password_change_interval_minimum = 0; - - long password_change_interval_maximum_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin)); - if (password_change_interval_minimum_active>0){ - password_change_interval_maximum = yon_char_from_long(password_change_interval_maximum_active); - } else password_change_interval_maximum = 0; - - password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry)); - if (yon_char_is_empty(password_expiration_date)){ - password_expiration_date="-1"; - } - - long warning_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin)); - if (warning_days_active>0) - warning_days = yon_char_from_long(warning_days_active); - - int no_activity_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userActivitySpin)); - if (no_activity_days_active>0){ - no_activity_days = yon_char_from_long(no_activity_days_active); - } - - int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo)); - if (user_shell_active>0){ - char *shell_string = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)); - if (strcmp(shell_string,SET_LABEL)){ - user_shell = yon_char_unite("--shell ",shell_string," ",NULL); - } else { - user_shell = yon_char_unite("--shell ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userShellEntry)),NULL); - } - } else user_shell=""; - - int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo)); - if (user_home_active==2){ - user_home=yon_char_unite("--home-dir ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry)),NULL); - } else if (user_home_active==1){ - user_home="--no-create-home"; - } else user_home = ""; - - int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck)); - if (system_user_active) - create_system_user = "--system"; - - int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck)); - if (create_ununique_active) - create_ununique = "--non-unique"; - - samba_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck)); - samba_password_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck)); - if (samba_sync){ - if (yon_samba_sync_get(login)==2) - yon_samba_sync_remove(login); - yon_samba_sync_add(login,NULL); - } else if (samba_password_sync){ - if (yon_samba_sync_get(login)==1) - yon_samba_sync_remove(login); - yon_samba_sync_add(login,password); - } else { - yon_samba_sync_remove(login); - } - - extra_options=(char*)gtk_entry_get_text(GTK_ENTRY(window->userExtraOptionsEntry)); - - int force_at_next_login_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userForceChangeCheck)); - if (force_at_next_login_active){ - password_changed_date = "0"; - } - - int useradd_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck)); - if (useradd_boot_active){ - useradd_boot = "boot"; - } - - int useradd_shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck)); - if (useradd_shutdown_active){ - useradd_shutdown = "shutdown"; - } - - int usershadow_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsershadowBootCheck)); - if (usershadow_boot_active){ - usershadow_boot = "boot"; - } - - int usershadow_shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck)); - if (usershadow_shutdown_active){ - usershadow_shutdown = "shutdown"; - } - - - char *useradd_sync_string = NULL; - useradd_sync_string = yon_char_unite(useradd_boot,!yon_char_is_empty(useradd_boot)?",":"",useradd_shutdown,NULL); - char *usershadow_sync_string = NULL; - usershadow_sync_string = yon_char_unite(usershadow_boot,!yon_char_is_empty(usershadow_boot)?",":"",usershadow_shutdown,NULL); - char *shadow_string = NULL; - shadow_string = yon_char_unite(yon_char_return_if_exist(password_changed_date,""), - ":",yon_char_return_if_exist(password_change_interval_minimum,""), - ":",yon_char_return_if_exist(password_change_interval_maximum,""), - ":",yon_char_return_if_exist(warning_days,""), - ":",yon_char_return_if_exist(no_activity_days,""), - ":",yon_char_return_if_exist(password_expiration_date,""), - NULL); - - final_user = yon_char_unite(yon_char_return_if_exist(username,"x"), - ":",yon_char_return_if_exist(uid_string,"x"), - ":",yon_char_return_if_exist(main_group,"x"), - ":",yon_char_return_if_exist(additional_groups,"x"), - ":",yon_char_return_if_exist(extra_options,""), - ":",yon_char_return_if_exist(password,""), - NULL); - - char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD(login)); - yon_config_register(USERADD(login),final_command,final_user); - if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ - yon_config_remove_by_key(USERADD(window->old_username)); - } - final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW(login)); - yon_config_register(USERSHADOW(login),final_command,shadow_string); - if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ - yon_config_remove_by_key(USERSHADOW(window->old_username)); - } - int home_delete = yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,login); - if (home_delete>-1){ - yon_char_parsed_rip(main_config.remove_homes,&main_config.homes_size,home_delete); - } - - if (!yon_char_is_empty(useradd_sync_string)){ - final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD_SYNC(login)); - yon_config_register(USERADD_SYNC(login),final_command,useradd_sync_string); - if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ - yon_config_remove_by_key(USERADD_SYNC(window->old_username)); - } - } else { - yon_config_remove_by_key(USERADD_SYNC(window->old_username)); - } - - if (!yon_char_is_empty(usershadow_sync_string)){ - final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW_SYNC(login)); - yon_config_register(USERSHADOW_SYNC(login),final_command,usershadow_sync_string); - if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ - yon_config_remove_by_key(USERSHADOW_SYNC(window->old_username)); - } - } else { - yon_config_remove_by_key(USERSHADOW_SYNC(window->old_username)); - } - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->UsersList); - char *password_status=NULL; - if (password_active==0) password_status = DEFAULT_USER_LABEL; - else if (password_active==1) password_status = NO_PASSWORD_LABEL; - else if (password[0]=='%'&&password[1]=='%') password_status = UNENCRYPTED_LABEL; - else password_status = ENCRYPTED_LABEL; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter)) - gtk_list_store_append(widgets->UsersList,&iter); - gtk_list_store_set(widgets->UsersList,&iter, - 0,deactivate, - 1,yon_char_return_if_exist(uid_string,""), - 2,yon_char_return_if_exist(login,""), - 3,yon_char_return_if_exist(username,""), - 4,yon_char_return_if_exist(main_group,login), - 5,yon_char_return_if_exist(additional_groups,yon_config_get_by_key(USERGROUPS_parameter)), - 6,yon_char_unite(yon_char_return_if_exist(user_home,""),yon_char_return_if_exist(user_shell,""),yon_char_return_if_exist(create_system_user,""),yon_char_return_if_exist(create_ununique,""),yon_char_return_if_exist(do_not_check,""),NULL), - 7,password_status, - -1); - on_subwindow_close(self); -} void on_toggle_button_set_active_from_combo_box(GtkComboBox *self,ubl_settings_usergroups_user_window *window){ char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); @@ -2447,125 +2044,6 @@ void on_remove_expired(GtkWidget *, GtkEntryIconPosition icon_pos, GdkEvent *, G } } -ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ - ubl_settings_usergroups_user_window *window = malloc(sizeof(ubl_settings_usergroups_user_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_user); - window->CreateUserWindow=yon_gtk_builder_get_widget(builder,"CreateUserWindow"); - window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); - window->userUIDAutoCheck=yon_gtk_builder_get_widget(builder,"userUIDAutoCheck"); - window->userUIDEntry=yon_gtk_builder_get_widget(builder,"userUIDEntry"); - window->userLoginEntry=yon_gtk_builder_get_widget(builder,"userLoginEntry"); - window->userPasswordCombo=yon_gtk_builder_get_widget(builder,"userPasswordCombo"); - window->userPasswordEntry=yon_gtk_builder_get_widget(builder,"userPasswordEntry"); - window->userPasswordButton=yon_gtk_builder_get_widget(builder,"userPasswordButton"); - window->userUserNameEntry=yon_gtk_builder_get_widget(builder,"userUserNameEntry"); - window->userGroupsCheck=yon_gtk_builder_get_widget(builder,"userGroupsCheck"); - window->userGroupsEntry=yon_gtk_builder_get_widget(builder,"userGroupsEntry"); - window->UserGroupsButton=yon_gtk_builder_get_widget(builder,"UserGroupsButton"); - window->userAdditionalGroupsEntry=yon_gtk_builder_get_widget(builder,"userAdditionalGroupsEntry"); - window->userAdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"userAdditionalGroupsButton"); - window->userPasswordChangedEntry=yon_gtk_builder_get_widget(builder,"userPasswordChangedEntry"); - window->userPasswordExpirationEntry=yon_gtk_builder_get_widget(builder,"userPasswordExpirationEntry"); - window->userPasswordExpirationButton=yon_gtk_builder_get_widget(builder,"userPasswordExpirationButton"); - window->userPasswordChangeDelayMinimumSpin=yon_gtk_builder_get_widget(builder,"userPasswordChangeDelayMinimumSpin"); - window->userPasswordChangeDelayMaximumSpin=yon_gtk_builder_get_widget(builder,"userPasswordChangeDelayMaximumSpin"); - window->userWarningSpin=yon_gtk_builder_get_widget(builder,"userWarningSpin"); - window->userActivitySpin=yon_gtk_builder_get_widget(builder,"userActivitySpin"); - window->userForceChangeCheck=yon_gtk_builder_get_widget(builder,"userForceChangeCheck"); - window->userShellCombo=yon_gtk_builder_get_widget(builder,"userShellCombo"); - window->userShellEntry=yon_gtk_builder_get_widget(builder,"userShellEntry"); - window->userHomeCombo=yon_gtk_builder_get_widget(builder,"userHomeCombo"); - window->userHomeEntry=yon_gtk_builder_get_widget(builder,"userHomeEntry"); - window->userHomeButton=yon_gtk_builder_get_widget(builder,"userHomeButton"); - window->userCreateSystemCheck=yon_gtk_builder_get_widget(builder,"userCreateSystemCheck"); - window->userCreateUnuniqueCheck=yon_gtk_builder_get_widget(builder,"userCreateUnuniqueCheck"); - window->userDontCheckCheck=yon_gtk_builder_get_widget(builder,"userDontCheckCheck"); - window->userSyncSAMBACheck=yon_gtk_builder_get_widget(builder,"userSyncSAMBACheck"); - window->userSyncSAMBAPasswordCheck=yon_gtk_builder_get_widget(builder,"userSyncSAMBAPasswordCheck"); - window->userDeactivatedCheck=yon_gtk_builder_get_widget(builder,"userDeactivatedCheck"); - window->userExtraOptionsEntry=yon_gtk_builder_get_widget(builder,"userExtraOptionsEntry"); - window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton"); - window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton"); - window->CalendarPopup=yon_gtk_builder_get_widget(builder,"CalendarPopover"); - window->UseraddBootCheck=yon_gtk_builder_get_widget(builder,"UseraddBootCheck"); - window->ExpirationCalendar=yon_gtk_builder_get_widget(builder,"ExpirationCalendar"); - window->UseraddShutdownCheck=yon_gtk_builder_get_widget(builder,"UseraddShutdownCheck"); - window->UsershadowBootCheck=yon_gtk_builder_get_widget(builder,"UsershadowBootCheck"); - window->UsershadowShutdownCheck=yon_gtk_builder_get_widget(builder,"UsershadowShutdownCheck"); - window->userTitleNameLabel=yon_gtk_builder_get_widget(builder,"userTitleNameLabel"); - window->expiration_unix=NULL; - window->last_uid=NULL; - - time_t t = time(NULL); - struct tm tm = *localtime(&t); - gtk_calendar_select_day(GTK_CALENDAR(window->ExpirationCalendar),tm.tm_mday); - gtk_calendar_select_month(GTK_CALENDAR(window->ExpirationCalendar),tm.tm_mon,1900+tm.tm_year); - - on_UID_update(NULL,window); - int shell_size=0; - config_str shells = yon_file_open(shell_list_path,&shell_size); - for (int i=1;iuserShellCombo),parsed[0],parsed[0]); - yon_char_parsed_free(parsed,parsed_size); - } - } - gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->userShellCombo),"Set",SET_LABEL); - yon_char_parsed_free(shells,shell_size); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->userShellCombo),0); - window->old_password=NULL; - window->old_username=NULL; - dictionary *entry_dict = NULL; - yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateUserWindow),"UserWindow"); - yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"combo",window->userPasswordCombo); - yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"entry",window->userPasswordEntry); - // char *password = yon_config_get_by_key(USERADD((char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)))); - g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); - g_signal_connect(G_OBJECT(window->userHomeButton),"clicked",G_CALLBACK(on_filechooser_open),window->userHomeEntry); - g_signal_connect(G_OBJECT(window->UserGroupsButton),"clicked",G_CALLBACK(on_groups_clicked),window->userGroupsEntry); - g_signal_connect(G_OBJECT(window->userPasswordButton),"clicked",G_CALLBACK(on_password_change),entry_dict); - g_signal_connect(G_OBJECT(window->userAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userAdditionalGroupsEntry); - g_signal_connect(G_OBJECT(window->userPasswordExpirationButton),"clicked",G_CALLBACK(on_expiration_clicked),window); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); - g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userHomeEntry); - g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userHomeButton); - g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userPasswordButton); - g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userGroupsEntry); - g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UserGroupsButton); - g_signal_connect(G_OBJECT(window->userShellCombo),"changed",G_CALLBACK(on_user_shell_changed),window); - g_signal_connect(G_OBJECT(window->ExpirationCalendar),"day-selected",G_CALLBACK(on_date_selected),window); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(on_UID_update),window); - g_signal_connect(G_OBJECT(window->userCreateSystemCheck),"toggled",G_CALLBACK(on_UID_update),window); - g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(on_user_login_update),window); - g_signal_connect(G_OBJECT(window->userLoginEntry),"changed",G_CALLBACK(on_user_login_update),window); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->userCreateSystemCheck); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_toggle_button_set_inactive_from_toggle_button),window->userCreateSystemCheck); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userCreateUnuniqueCheck); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_toggle_button_set_inactive_from_toggle_button_inversed),window->userCreateUnuniqueCheck); - g_signal_connect(G_OBJECT(window->userSyncSAMBACheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userSyncSAMBAPasswordCheck); - g_signal_connect(G_OBJECT(window->userSyncSAMBAPasswordCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userSyncSAMBACheck); - g_signal_connect(G_OBJECT(window->userSyncSAMBACheck),"toggled",G_CALLBACK(on_toggle_button_set_active_from_toggle_button_inversed),window); - g_signal_connect(G_OBJECT(window->userSyncSAMBAPasswordCheck),"toggled",G_CALLBACK(on_toggle_button_set_active_from_toggle_button_inversed),window); - g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_toggle_button_set_active_from_combo_box),window); - g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_toggle_button_set_active_from_combo_box),window); - g_signal_connect(G_OBJECT(window->userPasswordEntry),"changed",G_CALLBACK(on_password_user_changed),window); - g_signal_connect(G_OBJECT(window->userHomeEntry),"changed",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userShellCombo),"changed",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userShellEntry),"changed",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userCreateSystemCheck),"toggled",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userCreateUnuniqueCheck),"toggled",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userDontCheckCheck),"toggled",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userGroupsEntry),"changed",G_CALLBACK(on_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userPasswordExpirationEntry),"icon-press",G_CALLBACK(on_remove_expired),window->userPasswordExpirationEntry); - g_signal_connect(G_OBJECT(window->userUIDEntry),"insert-text",G_CALLBACK(yon_on_text_insert_only_digits),NULL); -return window; -} void on_main_add(GtkWidget *, main_window *widgets){ if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){ @@ -2851,30 +2329,55 @@ void on_main_delete(GtkWidget *, main_window *widgets){ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ char *target; gtk_tree_model_get(model,&iter,2,&target,-1); - dialog_confirmation_data data; - int found = !!config(USERADD(target)); - if (found){ - data.action_text = SYSTEM_USER_CONFIG_REMOVE_CONFIRMATION_LABEL(target); - data.function=NULL; - data.data=NULL; + if (config(USERADD(target))){ + system_remove_confirmation_window *window = yon_system_remove_confirmation_window_new(); + gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target)); + dictionary *dict = NULL; + yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); + g_signal_connect(G_OBJECT(window->ConfigAcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); + g_signal_connect(G_OBJECT(window->SystemAcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); + gtk_widget_show(window->Window); } else { + dialog_confirmation_data data; data.action_text = SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target); data.function=NULL; data.data=NULL; - } - if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ - return; - } - if (found){ - yon_delete_confirmation_open(widgets); - } else { + if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ + return; + } yon_system_delete_confirmation_open(widgets); } } }break; case 3:{ - + GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore2); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ + char *target; + gtk_tree_model_get(model,&iter,1,&target,-1); + if (config(USERADD(target))){ + system_remove_confirmation_window *window = yon_system_remove_confirmation_window_new(); + gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target)); + dictionary *dict = NULL; + yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); + g_signal_connect(G_OBJECT(window->ConfigAcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); + g_signal_connect(G_OBJECT(window->SystemAcceptButton),"clicked",G_CALLBACK(yon_remove_confirmation_window_accept_clicked),dict); + gtk_widget_show(window->Window); + } else { + dialog_confirmation_data data; + data.action_text = SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target); + data.function=NULL; + data.data=NULL; + + if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ + return; + } + yon_system_delete_confirmation_open(widgets); + } + } }break; } } @@ -2889,103 +2392,6 @@ void on_config_update(GtkWidget *, main_window *widgets){ } -void on_user_sync_with_config(GtkWidget *,main_window *widgets){ - int active = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook)); - switch (active){ - case 2:{ - GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore1); - GtkTreeIter iter; - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ - char *target; - gtk_tree_model_get(model,&iter,2,&target,-1); - dialog_confirmation_data data; - if (config(USERADD(target))){ - data.action_text = SYSTEM_USER_SYNC_CONFIRMATION_LABEL(target); - data.data=NULL; - data.function=NULL; - } else { - data.action_text = SYSTEM_USER_ADD_CONFIRMATION_LABEL(target); - data.data=NULL; - data.function=NULL; - } - if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ - return; - } - - char *user = yon_char_parsed_check_exist_begins_with(main_config.groups,main_config.groups_size,target); - char *shadow = yon_char_parsed_check_exist_begins_with(main_config.group_shadow,main_config.group_shadow_size,target); - yon_char_remove_last_symbol(user,'\n'); - yon_char_remove_last_symbol(shadow,'\n'); - int user_size=0; - int shadow_size=0; - config_str parsed = yon_char_parse(user,&user_size,":"); - config_str parsed_shadow = yon_char_parse(shadow,&shadow_size,":"); - - char *optionals = yon_char_unite(user_size>5? parsed[5]:"",user_size>5?" ":"",user_size>6?parsed[6]:"",NULL); - char *config_user = yon_char_unite(parsed[0],":", - user_size>4?parsed[4]:"",":", - user_size>2?parsed[2]:"",":", - user_size>3?parsed[3]:"",":", - !yon_char_is_empty(optionals)?optionals:"",":", - user_size>1&&strcmp(parsed[1],"x")?yon_char_return_if_exist(parsed[1],""):yon_char_return_if_exist(parsed_shadow[1],""),NULL); - char *config_shadow = yon_char_unite(yon_char_return_if_exist(parsed[2],""),":", - user_size>3?parsed[3]:"",":", - user_size>4?parsed[4]:"",":", - user_size>5?parsed[5]:"",":", - user_size>6?parsed[6]:"",":", - user_size>7?parsed[7]:"",":",NULL); - - if (!yon_char_is_empty(config_user)){ - char *user_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD(target)); - yon_config_register(USERADD(target),user_command,config_user); - } - if (!yon_char_is_empty(config_shadow)){ - char *shadow_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW(target)); - yon_config_register(USERSHADOW(target),shadow_command,config_shadow); - } - yon_interface_update(widgets); - } - yon_interface_update((main_window*)widgets); - }break; - case 3:{ - GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore1); - GtkTreeIter iter; - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ - - char *target; - gtk_tree_model_get(model,&iter,1,&target,-1); - dialog_confirmation_data data; - if (config(GROUPADD(target))){ - data.action_text = SYSTEM_GROUP_ADD_CONFIRMATION_LABEL(target); - data.data=NULL; - data.function=NULL; - } else { - data.action_text = SYSTEM_GROUP_SYNC_CONFIRMATION_LABEL(target); - data.data=NULL; - data.function=NULL; - } - if (yon_confirmation_dialog_call(widgets->Window,&data)!=GTK_RESPONSE_ACCEPT){ - return; - } - char *group = yon_char_parsed_check_exist_begins_with(main_config.groups,main_config.groups_size,target); - char *group_shadow = yon_char_parsed_check_exist_begins_with(main_config.group_shadow,main_config.group_shadow_size,target); - yon_char_remove_last_symbol(group,'\n'); - yon_char_remove_last_symbol(group_shadow,'\n'); - int group_size=0; - int group_shadow_size=0; - config_str parsed = yon_char_parse(group,&group_size,":"); - config_str parsed_shadow = yon_char_parse(group_shadow,&group_shadow_size,":"); - char *config_group = yon_char_unite(parsed[0],":",parsed[3],":",parsed[2],"::",parsed_shadow[2],":",strcmp(parsed[1],"x")?parsed[1]:parsed_shadow[1],NULL); - - if (!yon_char_is_empty(config_group)){ - char *group_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD(target)); - yon_config_register(GROUPADD(target),group_command,config_group); - yon_interface_update(widgets); - } - } - }break; - } -} int yon_element_chosen(GtkWidget *){ return (int)1; @@ -3240,7 +2646,6 @@ return widgets; } int main(int argc, char *argv[]){ - local=setlocale(LC_ALL, ""); textdomain (LocaleName); config_init(); yon_ubl_connect_config((_template_config*)&main_config); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index f38b727..09982e0 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -1,3 +1,5 @@ +#ifndef USERGROUPS_H +#define USERGROUPS_H #include #include #include @@ -30,6 +32,7 @@ #define glade_path_ubl_settings_usergroups_user "/com/ublinux/ui/ubl-settings-usergroups-user.glade" #define glade_path_ubl_settings_usergroups_savesettings "/com/ublinux/ui/ubl-settings-usergroups-savesettings.glade" #define glade_path_ubl_settings_usergroups_confirmation "/com/ublinux/ui/ubl-settings-usergroups-confirmation.glade" +#define glade_path_ubl_settings_usergroups_system_deletion_confirmation "/com/ublinux/ui/ubl-settings-usergroups-system-deletion-confirmation.glade" #define banner_path "/com/ublinux/images/ubl-settings-usergroups-banner.png" #define CssPath "/com/ublinux/css/ubl-settings-usergroups.css" @@ -52,8 +55,8 @@ #define get_system_group_command(target) yon_char_unite("/usr/lib/ublinux/functions get_conf_groupadd_from_system ",target,NULL) #define remove_user_from_system_command(target) yon_char_append("userdel ",target) -#define remove_user_and_homedir_from_system_command yon_char_append("userdel -r ",target) -#define remove_group_from_system_command yon_char_append("groupdel ",target) +#define remove_user_and_homedir_from_system_command(target) yon_char_append("userdel -r ",target) +#define remove_group_from_system_command(target) yon_char_append("groupdel ",target) #define groups_path "/etc/group" #define users_path "/etc/passwd" @@ -142,10 +145,10 @@ #define GROUPADD_parameter_command yon_char_unite("GROUPADD[",target,"]",NULL) typedef char* string; + +__attribute__((unused)) static \ string version_application; - -char *local; - + typedef struct { template_config_fields @@ -179,6 +182,7 @@ typedef struct { int launch_size; config_str launch_arguments; } config; +extern config main_config; typedef struct { template_window_fields @@ -368,6 +372,18 @@ typedef struct{ GtkTreeViewColumn *UserCell; } yon_confirmation_window; + typedef struct { + GtkWidget *Window; + GtkWidget *HeaderLabel; + GtkWidget *CancelButton; + GtkWidget *StatusBox; + GtkWidget *TitleLabel; + GtkWidget *AcceptButton; + GtkWidget *ConfigAcceptButton; + GtkWidget *SystemAcceptButton; + + } system_remove_confirmation_window; + ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(); void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *self, main_window *widgets); @@ -476,4 +492,9 @@ void config_init(); void on_selection_changed(GtkWidget *self, main_window *widgets); void on_notebook_page_changed(GtkWidget *self, GtkWidget *page, int num, main_window *widgets); gboolean on_menu_open(GtkWidget *self,GdkEventButton *event, rmb_menu_window *window); -main_window *yon_main_window_complete(main_window *widgets); \ No newline at end of file +main_window *yon_main_window_complete(main_window *widgets); +void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *dict); +system_remove_confirmation_window *yon_system_remove_confirmation_window_new(); +void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog); +void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog); +#endif \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index e2f969f..72e9d82 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -56,7 +56,7 @@ #define SYSTEM_GROUP_SYNC_CONFIRMATION_LABEL(target) yon_char_unite(_("This group doesn't exist in configuration. Are you sure want to add group")," ",target," ", _("to configuration?"),NULL) #define SYSTEM_GROUP_ADD_CONFIRMATION_LABEL(target) yon_char_unite(_("This group exists in configuration. Are you sure want to update group")," ",target," ", _("data at configuration?"),NULL) -#define SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This user doesn't exist in configuration and will be removed from the system. Are you sure want to remove user")," ",target," ", _("from the system??"),NULL) +#define SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This user doesn't exist in configuration and will be removed from the system. Are you sure want to remove user")," ",target," ", _("from the system?"),NULL) #define SYSTEM_USER_CONFIG_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This user exists in configuration. Are you sure want to remove user")," ",target," ", _("?"),NULL) #define SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This group doesn't exist in configuration and will be removed from the system. Are you sure want to remove group")," ",target," ", _("from the system?"),NULL) #define SYSTEM_GROUP_CONFIG_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This group exists in configuration. Are you sure want to remove group")," ",target,"", _("?"),NULL) diff --git a/ubl-settings-usergroups-system-deletion-confirmation.glade b/ubl-settings-usergroups-system-deletion-confirmation.glade new file mode 100644 index 0000000..b3b12d3 --- /dev/null +++ b/ubl-settings-usergroups-system-deletion-confirmation.glade @@ -0,0 +1,226 @@ + + + + + + + True + False + com.ublinux.ubl-settings-usergroups.accept-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.accept-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.cancel-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.accept-symbolic + + + 650 + 200 + False + True + 450 + com.ublinux.ubl-settings-usergroups + + + True + False + vertical + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + 20 + 20 + 10 + 10 + 50 + dialog-information-symbolic + 6 + + + False + True + 0 + + + + + True + False + True + True + 0 + + + True + True + 1 + + + + + True + True + 0 + + + + + True + False + end + 5 + 5 + 5 + 5 + + + Remove from configuration + True + True + True + image1 + + + + False + True + 0 + + + + + Remove from system + True + True + True + image5 + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + True + 1 + + + + + + + True + False + + + True + False + User deletion + + + + + + + + Cancel + True + True + True + image4 + + + + + + Accept + True + True + image2 + + + + end + 1 + + + + + + + + + + + + + + + + + + + + + + From 15a55ab5026e06104456370292c76d6a9379370a Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 13 Jan 2025 10:36:55 +0600 Subject: [PATCH 04/72] System groups and users deletion --- source/ubl-settings-usergroups-system.c | 1 + source/ubl-settings-usergroups.c | 55 +++-- source/ubl-settings-usergroups.h | 1 + source/ubl-strings.h | 8 +- ubl-settings-usergroups.pot | 276 ++++++++++++----------- ubl-settings-usergroups_ru.po | 283 +++++++++++++----------- 6 files changed, 357 insertions(+), 267 deletions(-) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index 54471e0..bad75fa 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -92,6 +92,7 @@ void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *d if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ yon_confirmation_window *dialog = yon_delete_confirmation_new(); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_group),dialog); gtk_widget_show(window->AcceptButton); gtk_widget_hide(window->ConfigAcceptButton); gtk_widget_hide(window->SystemAcceptButton); diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 09b175e..375ac06 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -716,17 +716,43 @@ yon_confirmation_window *yon_delete_confirmation_new(){ } void yon_system_delete_confirmation_open(main_window *widgets){ - yon_confirmation_window *window = yon_delete_confirmation_new(); - gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); - GtkTreeIter iter; - dictionary *dict = NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_delete_confirmation_save),dict); - GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore1); - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ - // gtk_tree_model_get(model,&iter,1,,2,,) - } + yon_confirmation_window *dialog = yon_delete_confirmation_new(); + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); + gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==2){ + gtk_label_set_text(GTK_LABEL(dialog->TitleLabel),DELETE_CONFIRMATION_CONFIRM_LABEL); + gtk_label_set_text(GTK_LABEL(dialog->HatLabel),DELETE_CONFIRMATION_TITLE_LABEL); + yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window),DELETE_CONFIRMATION_TITLE_LABEL,icon_path,"system-user-deletion-window"); + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(widgets->SystemTree)); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ + char *name,*username,*homedir=NULL; + gtk_tree_model_get(model,&iter,2,&name,3,&username,6,&homedir,-1); + gtk_list_store_append(dialog->list,&iter); + gtk_list_store_set(dialog->list,&iter,0,1,1,name,2,homedir,4,!yon_char_is_empty(homedir),5,username,-1); + gtk_widget_show(dialog->Window); + } + + } else { + gtk_label_set_text(GTK_LABEL(dialog->TitleLabel),DELETE_GROUP_CONFIRMATION_CONFIRM_LABEL); + gtk_label_set_text(GTK_LABEL(dialog->HatLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL); + yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window),DELETE_GROUP_CONFIRMATION_TITLE_LABEL,icon_path,"system-group-deletion-window"); + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(widgets->SystemGroupsTree)); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_group),dialog); + char *name; + gtk_tree_view_column_set_title(dialog->UserCell,GROUP_LABEL); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(dialog->DeletionTree),2),0); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(dialog->DeletionTree),3),0); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(dialog->DeletionTree),4),0); + + gtk_tree_model_get(model,&iter,1,&name,-1); + gtk_list_store_append(dialog->list,&iter); + gtk_list_store_set(dialog->list,&iter,0,1,1,name,-1); + gtk_widget_show(dialog->Window); + } + } } void yon_delete_confirmation_open(main_window *widgets){ @@ -2331,7 +2357,8 @@ void on_main_delete(GtkWidget *, main_window *widgets){ gtk_tree_model_get(model,&iter,2,&target,-1); if (config(USERADD(target))){ system_remove_confirmation_window *window = yon_system_remove_confirmation_window_new(); - gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target)); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DELETE_CONFIRMATION_TITLE_LABEL,icon_path,"user-deletion-window"); + gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_USER_CONFIG_REMOVE_CONFIRMATION_LABEL(target)); dictionary *dict = NULL; yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); @@ -2357,8 +2384,9 @@ void on_main_delete(GtkWidget *, main_window *widgets){ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ char *target; gtk_tree_model_get(model,&iter,1,&target,-1); - if (config(USERADD(target))){ + if (config(GROUPADD(target))){ system_remove_confirmation_window *window = yon_system_remove_confirmation_window_new(); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DELETE_CONFIRMATION_TITLE_LABEL,icon_path,"group-deletion-window"); gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target)); dictionary *dict = NULL; yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); @@ -2646,6 +2674,7 @@ return widgets; } int main(int argc, char *argv[]){ + if (setlocale(LC_ALL,"")){}; textdomain (LocaleName); config_init(); yon_ubl_connect_config((_template_config*)&main_config); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 09982e0..da9b081 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -37,6 +37,7 @@ #define banner_path "/com/ublinux/images/ubl-settings-usergroups-banner.png" #define CssPath "/com/ublinux/css/ubl-settings-usergroups.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) +#define icon_path "com.ublinux.ubl-settings-usergroups" #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-usergroups" diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 72e9d82..26636c7 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -56,10 +56,10 @@ #define SYSTEM_GROUP_SYNC_CONFIRMATION_LABEL(target) yon_char_unite(_("This group doesn't exist in configuration. Are you sure want to add group")," ",target," ", _("to configuration?"),NULL) #define SYSTEM_GROUP_ADD_CONFIRMATION_LABEL(target) yon_char_unite(_("This group exists in configuration. Are you sure want to update group")," ",target," ", _("data at configuration?"),NULL) -#define SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This user doesn't exist in configuration and will be removed from the system. Are you sure want to remove user")," ",target," ", _("from the system?"),NULL) -#define SYSTEM_USER_CONFIG_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This user exists in configuration. Are you sure want to remove user")," ",target," ", _("?"),NULL) -#define SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This group doesn't exist in configuration and will be removed from the system. Are you sure want to remove group")," ",target," ", _("from the system?"),NULL) -#define SYSTEM_GROUP_CONFIG_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This group exists in configuration. Are you sure want to remove group")," ",target,"", _("?"),NULL) +#define SYSTEM_USER_SYSTEM_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This user doesn't exist in configuration. Are you sure want to remove user")," ",target," ", _("from the system?"),NULL) +#define SYSTEM_USER_CONFIG_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This user exists in configuration and system. Are you sure want to remove user")," ",target,"", "?",NULL) +#define SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This group doesn't exist in configuration. Are you sure want to remove group")," ",target," ", _("from the system?"),NULL) +#define SYSTEM_GROUP_CONFIG_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This group exists in configuration and system. Are you sure want to remove group")," ",target,"", "?",NULL) //ubl-settings-usergroups-additional-settings.glade diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index cd450ad..a018a60 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -53,7 +53,7 @@ msgstr "" msgid "UID" msgstr "" -#: source/ubl-strings.h:14 source/ubl-strings.h:107 +#: source/ubl-strings.h:14 source/ubl-strings.h:112 msgid "Login" msgstr "" @@ -175,7 +175,7 @@ msgstr "" msgid "Inspect users and groups in system" msgstr "" -#: source/ubl-strings.h:46 source/ubl-strings.h:61 +#: source/ubl-strings.h:46 source/ubl-strings.h:66 msgid "Additional settings" msgstr "" @@ -228,529 +228,555 @@ msgstr "" msgid "This group exists in configuration. Are you sure want to update group" msgstr "" +#: source/ubl-strings.h:59 +msgid "" +"This user doesn't exist in configuration. Are you sure want to remove user" +msgstr "" + +#: source/ubl-strings.h:59 source/ubl-strings.h:61 +msgid "from the system?" +msgstr "" + +#: source/ubl-strings.h:60 +msgid "" +"This user exists in configuration and system. Are you sure want to remove " +"user" +msgstr "" + +#: source/ubl-strings.h:61 +msgid "" +"This group doesn't exist in configuration. Are you sure want to remove group" +msgstr "" + #: source/ubl-strings.h:62 +msgid "" +"This group exists in configuration and system. Are you sure want to remove " +"group" +msgstr "" + +#: source/ubl-strings.h:67 msgid "No password required" msgstr "" -#: source/ubl-strings.h:63 +#: source/ubl-strings.h:68 msgid "Set a password" msgstr "" -#: source/ubl-strings.h:64 source/ubl-strings.h:110 +#: source/ubl-strings.h:69 source/ubl-strings.h:115 msgid "Encrypted" msgstr "" -#: source/ubl-strings.h:65 +#: source/ubl-strings.h:70 msgid "Unencrypted" msgstr "" -#: source/ubl-strings.h:78 +#: source/ubl-strings.h:83 msgid "Accept" msgstr "" -#: source/ubl-strings.h:79 +#: source/ubl-strings.h:84 msgid "" "Are you sure want to encrypt all passwords?\n" "This action can't be undone." msgstr "" -#: source/ubl-strings.h:80 +#: source/ubl-strings.h:85 msgid "Encrypt all unencrypted passwords at global configuration" msgstr "" -#: source/ubl-strings.h:81 +#: source/ubl-strings.h:86 msgid "DES (Algorithm for Symmetric Encryption)" msgstr "" -#: source/ubl-strings.h:82 +#: source/ubl-strings.h:87 msgid "MD5 (128-bit hashing algorithm)" msgstr "" -#: source/ubl-strings.h:83 +#: source/ubl-strings.h:88 msgid "yescrypt (Cryptographic hash function)" msgstr "" -#: source/ubl-strings.h:84 +#: source/ubl-strings.h:89 msgid "GOST-YESCRYPT (Design according to GOST R 34.11─2012)" msgstr "" -#: source/ubl-strings.h:85 +#: source/ubl-strings.h:90 msgid "scrypt (Adaptive cryptographic key generation function)" msgstr "" -#: source/ubl-strings.h:86 +#: source/ubl-strings.h:91 msgid "Blowfish (Symmetric Block Cipher Algorithm)" msgstr "" -#: source/ubl-strings.h:87 +#: source/ubl-strings.h:92 msgid "bcrypt (Adaptive hash function from the Blowfish family of algorithms)" msgstr "" -#: source/ubl-strings.h:88 +#: source/ubl-strings.h:93 msgid "" "bcrypt-a (Adaptive hash function from the Blowfish family of algorithms)" msgstr "" -#: source/ubl-strings.h:89 +#: source/ubl-strings.h:94 msgid "SHA512 (Hash function from the SHA-2 family of algorithms)" msgstr "" -#: source/ubl-strings.h:90 +#: source/ubl-strings.h:95 msgid "SHA256 (Hash function from the SHA-2 family of algorithms)" msgstr "" -#: source/ubl-strings.h:91 +#: source/ubl-strings.h:96 msgid "Sun MD5 (Hash algorithm from Sun Microsystems)" msgstr "" -#: source/ubl-strings.h:92 +#: source/ubl-strings.h:97 msgid "MD5 Unix (Hash algorithm calls standard MD5 thousand times)" msgstr "" -#: source/ubl-strings.h:93 +#: source/ubl-strings.h:98 msgid "" "Extended DES Crypt (Hash function from the BSDi family of DES algorithms)" msgstr "" -#: source/ubl-strings.h:94 +#: source/ubl-strings.h:99 msgid "descrypt (Hash function from the DES family of algorithms)" msgstr "" -#: source/ubl-strings.h:95 +#: source/ubl-strings.h:100 msgid "NTHash (Hash function from the NT Windows family of algorithms)" msgstr "" -#: source/ubl-strings.h:97 +#: source/ubl-strings.h:102 msgid "" "While booting the operating system, apply the settings of all users from the " "configuration" msgstr "" -#: source/ubl-strings.h:98 +#: source/ubl-strings.h:103 msgid "" "While shutdown, save the settings of all users with UID>=1000 to the " "configuration" msgstr "" -#: source/ubl-strings.h:101 +#: source/ubl-strings.h:106 msgid "Configure group" msgstr "" -#: source/ubl-strings.h:102 +#: source/ubl-strings.h:107 msgid "Add group" msgstr "" -#: source/ubl-strings.h:103 +#: source/ubl-strings.h:108 msgid "Group id:" msgstr "" -#: source/ubl-strings.h:104 +#: source/ubl-strings.h:109 msgid "Group name:" msgstr "" -#: source/ubl-strings.h:105 +#: source/ubl-strings.h:110 msgid "Group users:" msgstr "" -#: source/ubl-strings.h:106 +#: source/ubl-strings.h:111 msgid "Automatically" msgstr "" -#: source/ubl-strings.h:108 +#: source/ubl-strings.h:113 msgid "Create group with ununique GID" msgstr "" -#: source/ubl-strings.h:109 +#: source/ubl-strings.h:114 msgid "Create system group" msgstr "" -#: source/ubl-strings.h:111 +#: source/ubl-strings.h:116 msgid "Additional configuration" msgstr "" -#: source/ubl-strings.h:112 +#: source/ubl-strings.h:117 msgid "Group configuration synchronization" msgstr "" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:118 msgid "When shutting down the system, save the group into the configuration" msgstr "" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:119 msgid "Group administrators:" msgstr "" -#: source/ubl-strings.h:115 +#: source/ubl-strings.h:120 msgid "Group name must not start with digit" msgstr "" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:123 msgid "Default groups" msgstr "" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:124 msgid "Main group" msgstr "" -#: source/ubl-strings.h:120 +#: source/ubl-strings.h:125 msgid "Additional groups" msgstr "" -#: source/ubl-strings.h:121 +#: source/ubl-strings.h:126 msgid "Choose groups" msgstr "" -#: source/ubl-strings.h:122 +#: source/ubl-strings.h:127 msgid "Choose users" msgstr "" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:130 msgid "System users and groups" msgstr "" -#: source/ubl-strings.h:126 +#: source/ubl-strings.h:131 msgid "Locked" msgstr "" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:132 msgid "Username" msgstr "" -#: source/ubl-strings.h:128 +#: source/ubl-strings.h:133 msgid "" "Primary\n" "group" msgstr "" -#: source/ubl-strings.h:129 +#: source/ubl-strings.h:134 msgid "" "Home\n" "directory" msgstr "" -#: source/ubl-strings.h:130 source/ubl-strings.h:136 +#: source/ubl-strings.h:135 source/ubl-strings.h:141 msgid "Group" msgstr "" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:136 msgid "Update the system users and groups list" msgstr "" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:137 msgid "Toggle system groups and users" msgstr "" -#: source/ubl-strings.h:134 +#: source/ubl-strings.h:139 msgid "Password mismatch" msgstr "" -#: source/ubl-strings.h:135 +#: source/ubl-strings.h:140 msgid "Password must be at least" msgstr "" -#: source/ubl-strings.h:135 +#: source/ubl-strings.h:140 msgid "characters" msgstr "" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:142 msgid "" "Days until\n" "warning" msgstr "" -#: source/ubl-strings.h:138 +#: source/ubl-strings.h:143 msgid "" "Days\n" "without activity" msgstr "" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:144 msgid "" "Shell\n" "path" msgstr "" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:145 msgid "" "Password has\n" "been changed" msgstr "" -#: source/ubl-strings.h:141 +#: source/ubl-strings.h:146 msgid "" "Expiration\n" "date" msgstr "" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:147 msgid "" "Password change\n" "interval (min)" msgstr "" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:148 msgid "" "Password change\n" "interval (max)" msgstr "" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:151 msgid "Add user" msgstr "" -#: source/ubl-strings.h:147 +#: source/ubl-strings.h:152 msgid "Configure user" msgstr "" -#: source/ubl-strings.h:148 +#: source/ubl-strings.h:153 msgid "Set" msgstr "" -#: source/ubl-strings.h:149 +#: source/ubl-strings.h:154 msgid "Empty important field" msgstr "" -#: source/ubl-strings.h:150 +#: source/ubl-strings.h:155 msgid "Login must not start with digit" msgstr "" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:156 msgid "Loading has failed" msgstr "" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:157 msgid "Login name" msgstr "" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:158 msgid "Additional groups:" msgstr "" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:159 msgid "Password configuration" msgstr "" -#: source/ubl-strings.h:155 +#: source/ubl-strings.h:160 msgid "Password has been changed:" msgstr "" -#: source/ubl-strings.h:156 +#: source/ubl-strings.h:161 msgid "expiration date:" msgstr "" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:162 msgid "Password change interval: minimum" msgstr "" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:163 msgid "days, maximum" msgstr "" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:164 msgid "days" msgstr "" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:165 msgid "Days until warning:" msgstr "" -#: source/ubl-strings.h:161 +#: source/ubl-strings.h:166 msgid "Days without activity:" msgstr "" -#: source/ubl-strings.h:162 +#: source/ubl-strings.h:167 msgid "Force change at next login" msgstr "" -#: source/ubl-strings.h:163 +#: source/ubl-strings.h:168 msgid "User shell:" msgstr "" -#: source/ubl-strings.h:164 +#: source/ubl-strings.h:169 msgid "Home directory:" msgstr "" -#: source/ubl-strings.h:165 +#: source/ubl-strings.h:170 msgid "Don't set" msgstr "" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:171 msgid "Create system user" msgstr "" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:172 msgid "Create user with ununique (repeating) UID" msgstr "" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:173 msgid "Do not check login for compliance with character rules" msgstr "" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:174 msgid "Temporary deactivation" msgstr "" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:175 msgid "Save" msgstr "" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:176 msgid "login_name" msgstr "" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:177 msgid "group_name" msgstr "" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:178 msgid "User name" msgstr "" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:179 msgid "Sync user" msgstr "" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:180 msgid "Sync user with password" msgstr "" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:181 msgid "Encrypt all passwords" msgstr "" -#: source/ubl-strings.h:178 +#: source/ubl-strings.h:183 msgid "User configuration" msgstr "" -#: source/ubl-strings.h:179 +#: source/ubl-strings.h:184 msgid "User configuration synchronization" msgstr "" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:185 msgid "During system startup, load the user from the configuration" msgstr "" -#: source/ubl-strings.h:181 +#: source/ubl-strings.h:186 msgid "When shutting down the system, save the user into the configuration" msgstr "" -#: source/ubl-strings.h:182 +#: source/ubl-strings.h:187 msgid "User password configuration syncronization" msgstr "" -#: source/ubl-strings.h:183 +#: source/ubl-strings.h:188 msgid "" "During system startup, load the user's parameters from the configuration" msgstr "" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:189 msgid "" "When shutting down the system, save the user's parameters into the " "configuration" msgstr "" -#: source/ubl-strings.h:186 +#: source/ubl-strings.h:191 msgid "Basic" msgstr "" -#: source/ubl-strings.h:187 +#: source/ubl-strings.h:192 msgid "Additional" msgstr "" -#: source/ubl-strings.h:188 +#: source/ubl-strings.h:193 msgid "Syncronization" msgstr "" -#: source/ubl-strings.h:190 +#: source/ubl-strings.h:195 msgid "Not specified" msgstr "" -#: source/ubl-strings.h:192 +#: source/ubl-strings.h:197 msgid "UID already exists in configuration" msgstr "" -#: source/ubl-strings.h:193 +#: source/ubl-strings.h:198 msgid "UID already exists in system" msgstr "" -#: source/ubl-strings.h:194 +#: source/ubl-strings.h:199 msgid "GID already exists in configuration" msgstr "" -#: source/ubl-strings.h:195 +#: source/ubl-strings.h:200 msgid "GID already exists in system" msgstr "" -#: source/ubl-strings.h:198 +#: source/ubl-strings.h:203 msgid "Repeat password:" msgstr "" -#: source/ubl-strings.h:199 +#: source/ubl-strings.h:204 msgid "Password hash:" msgstr "" -#: source/ubl-strings.h:200 +#: source/ubl-strings.h:205 msgid "Do not encrypt password" msgstr "" -#: source/ubl-strings.h:203 +#: source/ubl-strings.h:208 msgid "Additional configuration of service parameter saving" msgstr "" -#: source/ubl-strings.h:204 +#: source/ubl-strings.h:209 msgid "" "At every system shutdown save changes of (root)/var/lib/samba\n" "into (hd)/ublinux-data/rootcopy" msgstr "" -#: source/ubl-strings.h:205 +#: source/ubl-strings.h:210 msgid "For system save mode \"Sandbox\"" msgstr "" -#: source/ubl-strings.h:208 +#: source/ubl-strings.h:213 msgid "Group deletion" msgstr "" -#: source/ubl-strings.h:209 +#: source/ubl-strings.h:214 msgid "Confirm group(-s) deletion:" msgstr "" -#: source/ubl-strings.h:211 +#: source/ubl-strings.h:216 msgid "User deletion" msgstr "" -#: source/ubl-strings.h:212 +#: source/ubl-strings.h:217 msgid "Confirm user(-s) deletion:" msgstr "" -#: source/ubl-strings.h:213 +#: source/ubl-strings.h:218 msgid "Chosen" msgstr "" -#: source/ubl-strings.h:214 +#: source/ubl-strings.h:219 msgid "User" msgstr "" -#: source/ubl-strings.h:215 +#: source/ubl-strings.h:220 msgid "Home directory" msgstr "" -#: source/ubl-strings.h:216 +#: source/ubl-strings.h:221 msgid "Delete home directory" msgstr "" -#: source/ubl-strings.h:218 +#: source/ubl-strings.h:223 msgid "Configuration users" msgstr "" -#: source/ubl-strings.h:219 +#: source/ubl-strings.h:224 msgid "Configuration groups" msgstr "" -#: source/ubl-strings.h:220 +#: source/ubl-strings.h:225 msgid "System users" msgstr "" -#: source/ubl-strings.h:221 +#: source/ubl-strings.h:226 msgid "System groups" msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 8c73536..264c9b8 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -53,7 +53,7 @@ msgstr "Алгоритм хэширования пароля:" msgid "UID" msgstr "UID" -#: source/ubl-strings.h:14 source/ubl-strings.h:107 +#: source/ubl-strings.h:14 source/ubl-strings.h:112 msgid "Login" msgstr "Логин" @@ -189,7 +189,7 @@ msgstr "Обзор файлов" msgid "Inspect users and groups in system" msgstr "Просмотр пользователей и групп в системе" -#: source/ubl-strings.h:46 source/ubl-strings.h:61 +#: source/ubl-strings.h:46 source/ubl-strings.h:66 msgid "Additional settings" msgstr "Дополнительные настройки" @@ -248,27 +248,60 @@ msgstr "" msgid "This group exists in configuration. Are you sure want to update group" msgstr "Группа уже присутствует в конфигурации. Хотите обновить данные группы" +#: source/ubl-strings.h:59 +msgid "" +"This user doesn't exist in configuration. Are you sure want to remove user" +msgstr "" +"Пользователь в конфигурации отсутствует. Вы " +"действительно хотите удалить пользователя" + +#: source/ubl-strings.h:59 source/ubl-strings.h:61 +msgid "from the system?" +msgstr "из системы" + +#: source/ubl-strings.h:60 +msgid "" +"This user exists in configuration and system. Are you sure want to remove " +"user" +msgstr "" +"Пользователь уже присутствует в конфигурации и системе. Вы действительно хотите " +"удалить пользователя" + +#: source/ubl-strings.h:61 +msgid "" +"This group doesn't exist in configuration. Are you sure want to remove group" +msgstr "" +"Группа в конфигурации отсутствует и удаление будет выполнено из системы. Вы " +"действительно хотите удалить группу" + #: source/ubl-strings.h:62 +msgid "" +"This group exists in configuration and system. Are you sure want to remove " +"group" +msgstr "Группа уже присутствует в конфигурации и системе. Вы действительно хотите " +"удалить группу" + +#: source/ubl-strings.h:67 msgid "No password required" msgstr "Пароль не требуется" -#: source/ubl-strings.h:63 +#: source/ubl-strings.h:68 msgid "Set a password" msgstr "Задать пароль" -#: source/ubl-strings.h:64 source/ubl-strings.h:110 +#: source/ubl-strings.h:69 source/ubl-strings.h:115 msgid "Encrypted" msgstr "Зашифрован" -#: source/ubl-strings.h:65 +#: source/ubl-strings.h:70 msgid "Unencrypted" msgstr "Не зашифрован" -#: source/ubl-strings.h:78 +#: source/ubl-strings.h:83 msgid "Accept" msgstr "Принять" -#: source/ubl-strings.h:79 +#: source/ubl-strings.h:84 msgid "" "Are you sure want to encrypt all passwords?\n" "This action can't be undone." @@ -276,73 +309,73 @@ msgstr "" "Вы уверены что хотите зашифровать все пароли?\n" "Это действие нельзя отменить." -#: source/ubl-strings.h:80 +#: source/ubl-strings.h:85 msgid "Encrypt all unencrypted passwords at global configuration" msgstr "Зашифровать все незашифрованные пароли в глобальной конфигурации" -#: source/ubl-strings.h:81 +#: source/ubl-strings.h:86 msgid "DES (Algorithm for Symmetric Encryption)" msgstr "DES (Алгоритм для симметричного шифрования)" -#: source/ubl-strings.h:82 +#: source/ubl-strings.h:87 msgid "MD5 (128-bit hashing algorithm)" msgstr "MD5 (128-битный алгоритм хеширования)" -#: source/ubl-strings.h:83 +#: source/ubl-strings.h:88 msgid "yescrypt (Cryptographic hash function)" msgstr "yescrypt (Криптографическая хэш-функция)" -#: source/ubl-strings.h:84 +#: source/ubl-strings.h:89 msgid "GOST-YESCRYPT (Design according to GOST R 34.11─2012)" msgstr "GOST-YESCRYPT (Конструкция согласно ГОСТ Р 34.11─2012)" -#: source/ubl-strings.h:85 +#: source/ubl-strings.h:90 msgid "scrypt (Adaptive cryptographic key generation function)" msgstr "scrypt (Адаптивная криптографическая функция формирования ключа)" -#: source/ubl-strings.h:86 +#: source/ubl-strings.h:91 msgid "Blowfish (Symmetric Block Cipher Algorithm)" msgstr "Blowfish (Алгоритм блочного симметричного шифрования)" -#: source/ubl-strings.h:87 +#: source/ubl-strings.h:92 msgid "bcrypt (Adaptive hash function from the Blowfish family of algorithms)" msgstr "bcrypt (Адаптивная хеш-функция из семейства алгоритмов Blowfish)" -#: source/ubl-strings.h:88 +#: source/ubl-strings.h:93 msgid "" "bcrypt-a (Adaptive hash function from the Blowfish family of algorithms)" msgstr "bcrypt-a (Адаптивная хеш-функция из семейства алгоритмов Blowfish)" -#: source/ubl-strings.h:89 +#: source/ubl-strings.h:94 msgid "SHA512 (Hash function from the SHA-2 family of algorithms)" msgstr "SHA512 (Хеш-функция из семейства алгоритмов SHA-2)" -#: source/ubl-strings.h:90 +#: source/ubl-strings.h:95 msgid "SHA256 (Hash function from the SHA-2 family of algorithms)" msgstr "SHA256 (Хеш-функция из семейства алгоритмов SHA-2)" -#: source/ubl-strings.h:91 +#: source/ubl-strings.h:96 msgid "Sun MD5 (Hash algorithm from Sun Microsystems)" msgstr "Sun MD5 (Хеш-алгоритм от Sun Microsystems)" -#: source/ubl-strings.h:92 +#: source/ubl-strings.h:97 msgid "MD5 Unix (Hash algorithm calls standard MD5 thousand times)" msgstr "MD5 Unix (Хэш-алгоритм вызывает тысячу раз стандартный MD5)" -#: source/ubl-strings.h:93 +#: source/ubl-strings.h:98 msgid "" "Extended DES Crypt (Hash function from the BSDi family of DES algorithms)" msgstr "Extended DES Crypt (Хеш-функция из семейства алгоритмов DES от BSDi)" -#: source/ubl-strings.h:94 +#: source/ubl-strings.h:99 msgid "descrypt (Hash function from the DES family of algorithms)" msgstr "descrypt (Хеш-функция из семейства алгоритмов DES)" -#: source/ubl-strings.h:95 +#: source/ubl-strings.h:100 msgid "NTHash (Hash function from the NT Windows family of algorithms)" msgstr "NTHash (Хеш-функция из семейства алгоритмов NT Windows)" -#: source/ubl-strings.h:97 +#: source/ubl-strings.h:102 msgid "" "While booting the operating system, apply the settings of all users from the " "configuration" @@ -350,7 +383,7 @@ msgstr "" "При запуске операционной системы применять настройки всех пользователей из " "конфигурации" -#: source/ubl-strings.h:98 +#: source/ubl-strings.h:103 msgid "" "While shutdown, save the settings of all users with UID>=1000 to the " "configuration" @@ -358,91 +391,91 @@ msgstr "" "При завершении работы сохранить настройки пользователей с UID>=1000 в " "конфигурацию" -#: source/ubl-strings.h:101 +#: source/ubl-strings.h:106 msgid "Configure group" msgstr "Редактировать группу" -#: source/ubl-strings.h:102 +#: source/ubl-strings.h:107 msgid "Add group" msgstr "Добавить группу" -#: source/ubl-strings.h:103 +#: source/ubl-strings.h:108 msgid "Group id:" msgstr "Идентификатор группы (GID):" -#: source/ubl-strings.h:104 +#: source/ubl-strings.h:109 msgid "Group name:" msgstr "Имя группы:" -#: source/ubl-strings.h:105 +#: source/ubl-strings.h:110 msgid "Group users:" msgstr "Пользователи группы:" -#: source/ubl-strings.h:106 +#: source/ubl-strings.h:111 msgid "Automatically" msgstr "Автоматически" -#: source/ubl-strings.h:108 +#: source/ubl-strings.h:113 msgid "Create group with ununique GID" msgstr "Создать группу с повторяющимися (не уникальными) GID" -#: source/ubl-strings.h:109 +#: source/ubl-strings.h:114 msgid "Create system group" msgstr "Создать системную группу" -#: source/ubl-strings.h:111 +#: source/ubl-strings.h:116 msgid "Additional configuration" msgstr "Дополнительные настройки" -#: source/ubl-strings.h:112 +#: source/ubl-strings.h:117 msgid "Group configuration synchronization" msgstr "Синхронизация настроек группы" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:118 msgid "When shutting down the system, save the group into the configuration" msgstr "При завершении работы системы сохранить группу в конфигурацию" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:119 msgid "Group administrators:" msgstr "Администраторы группы:" -#: source/ubl-strings.h:115 +#: source/ubl-strings.h:120 msgid "Group name must not start with digit" msgstr "Имя группы не должно начинаться с цифры" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:123 msgid "Default groups" msgstr "Группы пользователей по умолчанию" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:124 msgid "Main group" msgstr "Основная группа" -#: source/ubl-strings.h:120 +#: source/ubl-strings.h:125 msgid "Additional groups" msgstr "Дополнительные группы" -#: source/ubl-strings.h:121 +#: source/ubl-strings.h:126 msgid "Choose groups" msgstr "Выбрать группы" -#: source/ubl-strings.h:122 +#: source/ubl-strings.h:127 msgid "Choose users" msgstr "Выбрать пользователей" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:130 msgid "System users and groups" msgstr "Пользователи и группы в системе" -#: source/ubl-strings.h:126 +#: source/ubl-strings.h:131 msgid "Locked" msgstr "Отключен" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:132 msgid "Username" msgstr "Имя пользователя" -#: source/ubl-strings.h:128 +#: source/ubl-strings.h:133 msgid "" "Primary\n" "group" @@ -450,7 +483,7 @@ msgstr "" "Основная\n" "группа" -#: source/ubl-strings.h:129 +#: source/ubl-strings.h:134 msgid "" "Home\n" "directory" @@ -458,31 +491,31 @@ msgstr "" "Домашний\n" "каталог" -#: source/ubl-strings.h:130 source/ubl-strings.h:136 +#: source/ubl-strings.h:135 source/ubl-strings.h:141 msgid "Group" msgstr "Группа" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:136 msgid "Update the system users and groups list" msgstr "Обновить список пользователей и групп системы" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:137 msgid "Toggle system groups and users" msgstr "Переключить видимость системных пользователей и групп" -#: source/ubl-strings.h:134 +#: source/ubl-strings.h:139 msgid "Password mismatch" msgstr "Несовпадение паролей" -#: source/ubl-strings.h:135 +#: source/ubl-strings.h:140 msgid "Password must be at least" msgstr "Пароль должен состоять из как минимум" -#: source/ubl-strings.h:135 +#: source/ubl-strings.h:140 msgid "characters" msgstr "символов" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:142 msgid "" "Days until\n" "warning" @@ -490,7 +523,7 @@ msgstr "" "Дней до\n" "предупреждения" -#: source/ubl-strings.h:138 +#: source/ubl-strings.h:143 msgid "" "Days\n" "without activity" @@ -498,7 +531,7 @@ msgstr "" "Дней без\n" "активности" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:144 msgid "" "Shell\n" "path" @@ -506,7 +539,7 @@ msgstr "" "Путь до\n" "оболочки" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:145 msgid "" "Password has\n" "been changed" @@ -514,7 +547,7 @@ msgstr "" "Пароль\n" "изменён" -#: source/ubl-strings.h:141 +#: source/ubl-strings.h:146 msgid "" "Expiration\n" "date" @@ -522,7 +555,7 @@ msgstr "" "Дата\n" "устаревания" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:147 msgid "" "Password change\n" "interval (min)" @@ -530,7 +563,7 @@ msgstr "" "Интервал смены\n" "пароля (мин.)" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:148 msgid "" "Password change\n" "interval (max)" @@ -538,215 +571,215 @@ msgstr "" "Интервал смены\n" "пароля (макс.)" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:151 msgid "Add user" msgstr "Добавить пользователя" -#: source/ubl-strings.h:147 +#: source/ubl-strings.h:152 msgid "Configure user" msgstr "Редактировать пользователя" -#: source/ubl-strings.h:148 +#: source/ubl-strings.h:153 msgid "Set" msgstr "Задать" -#: source/ubl-strings.h:149 +#: source/ubl-strings.h:154 msgid "Empty important field" msgstr "Пустое важное поле" -#: source/ubl-strings.h:150 +#: source/ubl-strings.h:155 msgid "Login must not start with digit" msgstr "Логин не должен начинаться с цифры" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:156 msgid "Loading has failed" msgstr "Ошибка загрузки" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:157 msgid "Login name" msgstr "Имя логина" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:158 msgid "Additional groups:" msgstr "Дополнительные группы:" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:159 msgid "Password configuration" msgstr "Конфигурация пароля" -#: source/ubl-strings.h:155 +#: source/ubl-strings.h:160 msgid "Password has been changed:" msgstr "Пароль изменён:" -#: source/ubl-strings.h:156 +#: source/ubl-strings.h:161 msgid "expiration date:" msgstr "Дата устаревания:" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:162 msgid "Password change interval: minimum" msgstr "Интервал смены пароля: минимум" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:163 msgid "days, maximum" msgstr "дней, максимум" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:164 msgid "days" msgstr "дней" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:165 msgid "Days until warning:" msgstr "Дней до предупреждения:" -#: source/ubl-strings.h:161 +#: source/ubl-strings.h:166 msgid "Days without activity:" msgstr "Дней без активности:" -#: source/ubl-strings.h:162 +#: source/ubl-strings.h:167 msgid "Force change at next login" msgstr "Принудительно сменить при следующем входе в систему" -#: source/ubl-strings.h:163 +#: source/ubl-strings.h:168 msgid "User shell:" msgstr "Оболочка пользователя:" -#: source/ubl-strings.h:164 +#: source/ubl-strings.h:169 msgid "Home directory:" msgstr "Домашний каталог:" -#: source/ubl-strings.h:165 +#: source/ubl-strings.h:170 msgid "Don't set" msgstr "Не создавать" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:171 msgid "Create system user" msgstr "Создать системного пользователя" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:172 msgid "Create user with ununique (repeating) UID" msgstr "Создать пользователя с повторяющимися (не уникальными) UID" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:173 msgid "Do not check login for compliance with character rules" msgstr "Не проверять логин на несоответствие правилам использования символов" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:174 msgid "Temporary deactivation" msgstr "Временное отключение учётной записи" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:175 msgid "Save" msgstr "Сохранить" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:176 msgid "login_name" msgstr "Имя_логина" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:177 msgid "group_name" msgstr "Имя_группы" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:178 msgid "User name" msgstr "Имя пользователя" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:179 msgid "Sync user" msgstr "Синхронизировать пользователя" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:180 msgid "Sync user with password" msgstr "Синхронизировать пользователя с паролем" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:181 msgid "Encrypt all passwords" msgstr "Зашифровать все пароли" -#: source/ubl-strings.h:178 +#: source/ubl-strings.h:183 msgid "User configuration" msgstr "Настройка пользователя" -#: source/ubl-strings.h:179 +#: source/ubl-strings.h:184 msgid "User configuration synchronization" msgstr "Синхронизация настроек пользователя" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:185 msgid "During system startup, load the user from the configuration" msgstr "" "При запуске операционной системы применять настройки пользователя из " "конфигурации" -#: source/ubl-strings.h:181 +#: source/ubl-strings.h:186 msgid "When shutting down the system, save the user into the configuration" msgstr "" "При завершении работы операционной системы сохранить настройки пользователя " "в конфигурацию" -#: source/ubl-strings.h:182 +#: source/ubl-strings.h:187 msgid "User password configuration syncronization" msgstr "Синхронизация настроек пароля пользователя" -#: source/ubl-strings.h:183 +#: source/ubl-strings.h:188 msgid "" "During system startup, load the user's parameters from the configuration" msgstr "При загрузке системы загрузить параметры пользователя из конфигурации" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:189 msgid "" "When shutting down the system, save the user's parameters into the " "configuration" msgstr "" "При завершении работы системы сохранить параметры пользователя в конфигурацию" -#: source/ubl-strings.h:186 +#: source/ubl-strings.h:191 msgid "Basic" msgstr "Основные" -#: source/ubl-strings.h:187 +#: source/ubl-strings.h:192 msgid "Additional" msgstr "Дополнительные" -#: source/ubl-strings.h:188 +#: source/ubl-strings.h:193 msgid "Syncronization" msgstr "Синхронизация" -#: source/ubl-strings.h:190 +#: source/ubl-strings.h:195 msgid "Not specified" msgstr "Не задан" -#: source/ubl-strings.h:192 +#: source/ubl-strings.h:197 msgid "UID already exists in configuration" msgstr "UID уже существует в конфигурации" -#: source/ubl-strings.h:193 +#: source/ubl-strings.h:198 msgid "UID already exists in system" msgstr "UID уже существует в системе" -#: source/ubl-strings.h:194 +#: source/ubl-strings.h:199 msgid "GID already exists in configuration" msgstr "GID уже существует в конфигурации" -#: source/ubl-strings.h:195 +#: source/ubl-strings.h:200 msgid "GID already exists in system" msgstr "GID уже существует в системе" -#: source/ubl-strings.h:198 +#: source/ubl-strings.h:203 msgid "Repeat password:" msgstr "Подтверждение пароля:" -#: source/ubl-strings.h:199 +#: source/ubl-strings.h:204 msgid "Password hash:" msgstr "Хэш пароля:" -#: source/ubl-strings.h:200 +#: source/ubl-strings.h:205 msgid "Do not encrypt password" msgstr "Не шифровать пароль" -#: source/ubl-strings.h:203 +#: source/ubl-strings.h:208 msgid "Additional configuration of service parameter saving" msgstr "Дополнительные настройки сохранения параметров сервисов" -#: source/ubl-strings.h:204 +#: source/ubl-strings.h:209 msgid "" "At every system shutdown save changes of (root)/var/lib/samba\n" "into (hd)/ublinux-data/rootcopy" @@ -754,54 +787,54 @@ msgstr "" "При каждом завершении работы ОС сохранять изменения (root)/var/lib/samba\n" "в (hd)/ublinux-data/rootcopy/" -#: source/ubl-strings.h:205 +#: source/ubl-strings.h:210 msgid "For system save mode \"Sandbox\"" msgstr "Для режима сохранения системы \"Песочница\"" -#: source/ubl-strings.h:208 +#: source/ubl-strings.h:213 msgid "Group deletion" msgstr "Удаление групп(-ы)" -#: source/ubl-strings.h:209 +#: source/ubl-strings.h:214 msgid "Confirm group(-s) deletion:" msgstr "Подтвердите удаление групп(-ы):" -#: source/ubl-strings.h:211 +#: source/ubl-strings.h:216 msgid "User deletion" msgstr "Удаление пользователя(-ей)" -#: source/ubl-strings.h:212 +#: source/ubl-strings.h:217 msgid "Confirm user(-s) deletion:" msgstr "Подтвердите удаление пользователя (-ей):" -#: source/ubl-strings.h:213 +#: source/ubl-strings.h:218 msgid "Chosen" msgstr "Выбран" -#: source/ubl-strings.h:214 +#: source/ubl-strings.h:219 msgid "User" msgstr "Пользователь" -#: source/ubl-strings.h:215 +#: source/ubl-strings.h:220 msgid "Home directory" msgstr "Домашний каталог" -#: source/ubl-strings.h:216 +#: source/ubl-strings.h:221 msgid "Delete home directory" msgstr "Удалить домашний каталог" -#: source/ubl-strings.h:218 +#: source/ubl-strings.h:223 msgid "Configuration users" msgstr "Пользователи конфигурации" -#: source/ubl-strings.h:219 +#: source/ubl-strings.h:224 msgid "Configuration groups" msgstr "Группы конфигурации" -#: source/ubl-strings.h:220 +#: source/ubl-strings.h:225 msgid "System users" msgstr "Пользователи системы" -#: source/ubl-strings.h:221 +#: source/ubl-strings.h:226 msgid "System groups" msgstr "Группы системы" From 1066a80afa0cad7b7b1234e7e4baf971b2018a6d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 13 Jan 2025 11:07:13 +0600 Subject: [PATCH 05/72] Fixed custom config loading cancelling --- source/ubl-settings-usergroups.c | 7 ++++++- source/ubl-settings-usergroups.h | 1 + ubl-settings-usergroups-group.glade | 18 ++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 375ac06..47b7abd 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -5,7 +5,9 @@ config main_config; //functions int yon_load_proceed(YON_CONFIG_TYPE type){ - yon_config_clean(); + if (type!=YON_CONFIG_CUSTOM){ + yon_config_clean(); + } yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL); if (type==YON_CONFIG_GLOBAL){ yon_debug_output("%s\n",yon_char_unite(config_get_command("global"),NULL)); @@ -68,6 +70,7 @@ int yon_load_proceed(YON_CONFIG_TYPE type){ gtk_widget_destroy(dialog); return 0; } + yon_config_clean(); yon_config_load_config(type,config_get_command(path),NULL); } return 1; @@ -1606,11 +1609,13 @@ ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(int window->HeaderLabel=yon_gtk_builder_get_widget(builder,"HeaderLabel"); window->StatusCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"StatusCell")); window->GroupColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"GroupColumn")); + window->DefaultCheck=yon_gtk_builder_get_widget(builder,"DefaultCheck"); window->list = gtk_list_store_new(3,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_INT); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(window->list),2,GTK_SORT_ASCENDING); yon_window_config_custom_window_setup(GTK_WINDOW(window->GroupsWindow),"GroupWindow"); gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),GROUPS_TITLE_LABEL); + g_signal_connect(G_OBJECT(window->DefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->GroupsTree); g_signal_connect(G_OBJECT(window->StatusCell),"toggled",G_CALLBACK(on_group_clicked),window); GtkTreeIter iter; config_str current; diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index da9b081..227d4d0 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -272,6 +272,7 @@ typedef struct{ GtkWidget *GroupsCancelButton; GtkWidget *GroupsOkButton; GtkWidget *HeaderLabel; + GtkWidget *DefaultCheck; GtkCellRenderer *StatusCell; GtkTreeViewColumn *GroupColumn; } ubl_settings_usergroups_group_window; diff --git a/ubl-settings-usergroups-group.glade b/ubl-settings-usergroups-group.glade index 06819cc..c150d07 100644 --- a/ubl-settings-usergroups-group.glade +++ b/ubl-settings-usergroups-group.glade @@ -31,6 +31,20 @@ 5 vertical 5 + + + Default + True + True + False + True + + + False + True + 0 + + True @@ -90,7 +104,7 @@ True True - 0 + 1 @@ -126,7 +140,7 @@ False True - 1 + 2 From c9d00ee05f84f7ff9dc5411090e912b0b425fb94 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 13 Jan 2025 11:47:45 +0600 Subject: [PATCH 06/72] Fixed empty additional group entry at user editing window if user has only default groups --- source/ubl-settings-usergroups.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 47b7abd..cdfff31 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -963,6 +963,7 @@ void on_groups_clicked(GtkWidget *, GtkEntry *output_target){ void on_groups_multiple_save(GtkWidget *self, dictionary *dict){ ubl_settings_usergroups_group_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_group_window*); GtkEntry *output = yon_dictionary_get_data(dict->first->next,GtkEntry*); + if (!gtk_widget_get_visible(window->DefaultCheck)||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ GtkTreeIter iter; int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter); char *full_groups=""; @@ -978,6 +979,9 @@ void on_groups_multiple_save(GtkWidget *self, dictionary *dict){ } } gtk_entry_set_text(output,full_groups); + } else { + gtk_entry_set_text(output,config(USERGROUPS_parameter)); + } on_subwindow_close(self); } @@ -1644,6 +1648,7 @@ return window; } void on_standard_groups_accept(GtkWidget *self, ubl_settings_usergroups_group_window *window){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(window->list); int valid = gtk_tree_model_get_iter_first(model,&iter); @@ -1660,11 +1665,17 @@ void on_standard_groups_accept(GtkWidget *self, ubl_settings_usergroups_group_wi } } yon_config_register(USERGROUPS_parameter,USERGROUPS_get_command,standard_groups); + } else { + yon_config_remove_by_key(USERGROUPS_parameter); + } on_subwindow_close(self); } void on_standard_groups_open(GtkWidget *, main_window *widgets){ ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(0); + if (yon_config_check_ignore(USERGROUPS_parameter)){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultCheck),1); + } gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),DEFAULT_GROUPS_TITLE_LABEL); gtk_label_set_text(GTK_LABEL(window->HeaderLabel),DEFAULT_GROUPS_TITLE_LABEL); gtk_tree_view_column_set_title(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),1),GID_LABEL); @@ -2151,13 +2162,16 @@ void on_main_edit(GtkWidget *, main_window *widgets){ } } if (parsed_size>3){ - if (strcmp(parameters[3],"x")){ + if (!yon_char_is_empty(parameters[3])&&strcmp(parameters[3],"x")){ gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), parameters[3]); } else { char *default_groups = yon_config_get_by_key(USERGROUPS_parameter); gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), default_groups); } + } else { + char *default_groups = yon_config_get_by_key(USERGROUPS_parameter); + gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), default_groups); } if (parsed_size>4&&!yon_char_is_empty(parameters[4])&&strcmp(parameters[4],"")&&strcmp(parameters[4],"x")){ int params_size; From bf931861d38fc1d28ed53a213f3ea372beb8c939 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 13 Jan 2025 12:01:17 +0600 Subject: [PATCH 07/72] Fixed removing of user sync parameter with user deletion --- source/ubl-settings-usergroups.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index cdfff31..879ddf0 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -600,6 +600,7 @@ void yon_delete_confirmation_save(GtkWidget *self, dictionary *dict){ gtk_list_store_remove(widgets->UsersList,&iter); yon_config_remove_by_key(USERADD(name)); yon_config_remove_by_key(USERSHADOW(name)); + yon_config_remove_by_key(USERADD_SYNC(name)); gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->UsersList),&iter); if (status){ if (yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,name)==-1){ From 3d61aa4f327cd9b68c29ed6a41d0d6dbc57d5e3d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 13 Jan 2025 17:05:29 +0600 Subject: [PATCH 08/72] Groups list window update; Fixes --- source/ubl-settings-usergroups.c | 23 +++- source/ubl-settings-usergroups.h | 4 + source/ubl-strings.h | 1 + ubl-settings-usergroups-group.glade | 180 ++++++++++++++++------------ ubl-settings-usergroups.pot | 4 + ubl-settings-usergroups_ru.po | 4 + 6 files changed, 135 insertions(+), 81 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 879ddf0..49a0a15 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -271,14 +271,13 @@ void yon_hide_passwords(template_saving_window *window){ if(!yon_char_is_empty(old_value)){ config_str parsed = NULL; parsed = yon_char_parse(old_value,&size,":"); - if (size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")&&parsed[5][0]!='%'&&parsed[5][1]!='%'){ + if (size>5&&!yon_char_is_empty(parsed[5])&&!check_is_password_hash(parsed[5])){ free(old_value); free(parsed[5]); parsed[5]=yon_char_new("*******"); old_value = yon_char_parsed_to_string(parsed,size,":"); } else if (size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")) { free(old_value); - free(yon_char_divide(parsed[5],1)); old_value = yon_char_parsed_to_string(parsed,size,":"); } if (parsed){ @@ -979,6 +978,18 @@ void on_groups_multiple_save(GtkWidget *self, dictionary *dict){ full_groups=extend_groups; } } + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->AddNewCheck))){ + char *custom_groups = (char*)gtk_entry_get_text(GTK_ENTRY(window->AddNewEntry)); + if (!yon_char_is_empty(custom_groups)){ + char *temp = yon_char_unite(full_groups,",",custom_groups,NULL); + if (!yon_char_is_empty(full_groups)) free(full_groups); + full_groups=temp; + } else { + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->AddNewEntry); + return; + } + } gtk_entry_set_text(output,full_groups); } else { gtk_entry_set_text(output,config(USERGROUPS_parameter)); @@ -988,6 +999,7 @@ void on_groups_multiple_save(GtkWidget *self, dictionary *dict){ void on_groups_multiple_clicked(GtkWidget *, GtkEntry *output_target){ ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(0); + gtk_widget_show(window->AddNewBox); gtk_tree_view_column_set_title(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),1),GID_LABEL); gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),ADDITIONAL_GROUPS_TITLE_LABEL); gtk_label_set_text(GTK_LABEL(window->HeaderLabel),ADDITIONAL_GROUPS_TITLE_LABEL); @@ -1313,6 +1325,7 @@ void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *, main_windo void on_user_choose(GtkWidget *, GtkEntry *target){ ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(1); + gtk_widget_hide(window->DefaultCheck); gtk_label_set_text(GTK_LABEL(window->HeaderLabel),GROUP_USERS_TITLE_LABEL); gtk_label_set_text(GTK_LABEL(window->HeaderLabel),GROUP_USERS_TITLE_LABEL); gtk_tree_view_column_set_title(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),1),UID_LABEL); @@ -1615,11 +1628,17 @@ ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(int window->StatusCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"StatusCell")); window->GroupColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"GroupColumn")); window->DefaultCheck=yon_gtk_builder_get_widget(builder,"DefaultCheck"); + window->AddNewCheck=yon_gtk_builder_get_widget(builder,"AddNewCheck"); + window->AddNewEntry=yon_gtk_builder_get_widget(builder,"AddNewEntry"); + window->AddNewBox=yon_gtk_builder_get_widget(builder,"AddNewBox"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); window->list = gtk_list_store_new(3,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_INT); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(window->list),2,GTK_SORT_ASCENDING); + yon_gtk_entry_block_symbols(GTK_ENTRY(window->AddNewEntry),";.'\"*%$#!-=+\\|/_@^&()№:?<>"); yon_window_config_custom_window_setup(GTK_WINDOW(window->GroupsWindow),"GroupWindow"); gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),GROUPS_TITLE_LABEL); + g_signal_connect(G_OBJECT(window->AddNewCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->AddNewEntry); g_signal_connect(G_OBJECT(window->DefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->GroupsTree); g_signal_connect(G_OBJECT(window->StatusCell),"toggled",G_CALLBACK(on_group_clicked),window); GtkTreeIter iter; diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 227d4d0..c1448a9 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -267,12 +267,16 @@ typedef struct{ typedef struct{ GtkWidget *GroupsWindow; + GtkWidget *StatusBox; GtkWidget *GroupsTree; GtkListStore *list; GtkWidget *GroupsCancelButton; GtkWidget *GroupsOkButton; GtkWidget *HeaderLabel; GtkWidget *DefaultCheck; + GtkWidget *AddNewCheck; + GtkWidget *AddNewEntry; + GtkWidget *AddNewBox; GtkCellRenderer *StatusCell; GtkTreeViewColumn *GroupColumn; } ubl_settings_usergroups_group_window; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 26636c7..19234f5 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -125,6 +125,7 @@ #define ADDITIONAL_GROUPS_TITLE_LABEL _("Additional groups") #define GROUPS_TITLE_LABEL _("Choose groups") #define GROUP_USERS_TITLE_LABEL _("Choose users") +#define ADD_TO_NEW _("Add to new:") //ubl-settings-usergroups-system.glade #define INSPECTOR_TITLE_LABEL _("System users and groups") diff --git a/ubl-settings-usergroups-group.glade b/ubl-settings-usergroups-group.glade index c150d07..47cc29a 100644 --- a/ubl-settings-usergroups-group.glade +++ b/ubl-settings-usergroups-group.glade @@ -23,21 +23,14 @@ True False - 5 - 5 - 5 - 5 - 5 - 5 vertical - 5 - - Default + True - True - False - True + False + + + False @@ -46,101 +39,130 @@ - + True - True - in + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 - + + Default True True - 2 - vertical - - - none - - + False + True + + + False + True + 0 + + + + + True + True + in - - Chosen + + True + True + 2 + vertical - - - 0 - + + Chosen + + + + 0 + + + - - - - - ID - True - 2 - - - 2 - + + ID + True + 2 + + + + 2 + + + - - - - - Group - descending - 1 - - - 1 - + + Group + descending + 1 + + + + 1 + + + - - - - True - True - 1 - - - - - False - 5 - - - Add to new: - True - True - False - True - - False + True True - 0 + 1 - - True - True + + False + 5 + + + Add to new: + True + True + False + True + + + False + True + 0 + + + + + True + False + True + + + True + True + 1 + + False True - 1 + 2 - False + True True - 2 + 1 diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index a018a60..c5df777 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -430,6 +430,10 @@ msgstr "" msgid "Choose users" msgstr "" +#: source/ubl-strings.h:127 +msgid "Add to new:" +msgstr "" + #: source/ubl-strings.h:130 msgid "System users and groups" msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 264c9b8..2bc75fb 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -463,6 +463,10 @@ msgstr "Выбрать группы" msgid "Choose users" msgstr "Выбрать пользователей" +#: source/ubl-strings.h:127 +msgid "Add to new:" +msgstr "Добавить в новую:" + #: source/ubl-strings.h:130 msgid "System users and groups" msgstr "Пользователи и группы в системе" From 6397d401c5ee4b4165edb175a00bd7795743c9a8 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 09:38:38 +0600 Subject: [PATCH 09/72] Fixed USERADD_SYNC[] parameter for user --- source/ubl-settings-usergroups.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 49a0a15..937967a 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -2154,6 +2154,14 @@ void on_main_edit(GtkWidget *, main_window *widgets){ char *name; gtk_tree_model_get(GTK_TREE_MODEL(widgets->UsersList),&iter,2,&name,-1); char *parameter_string = yon_config_get_by_key(USERADD(name)); + char *sync = config(USERADD_SYNC(name)); + if (!yon_char_is_empty(sync)){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck),!!strstr(sync,"boot")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck),!!strstr(sync,"shutdown")); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck),0); + } int parsed_size=0; if (parameter_string){ if (parameter_string[0]=='\"') yon_char_divide(parameter_string,0); From 8ea5b23d32df72db841f280fbdfc7eb772aba1d8 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 10:06:49 +0600 Subject: [PATCH 10/72] Added usershadow_sync deletion with user --- source/ubl-settings-usergroups.c | 2 ++ source/ubl-settings-usergroups.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 937967a..4fa59c0 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -599,7 +599,9 @@ void yon_delete_confirmation_save(GtkWidget *self, dictionary *dict){ gtk_list_store_remove(widgets->UsersList,&iter); yon_config_remove_by_key(USERADD(name)); yon_config_remove_by_key(USERSHADOW(name)); + yon_config_register(USERADD_SYNC(name),USERADD_SYNC_command(name),""); yon_config_remove_by_key(USERADD_SYNC(name)); + yon_config_remove_by_key(USERSHADOW_SYNC(name)); gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->UsersList),&iter); if (status){ if (yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,name)==-1){ diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index c1448a9..b626528 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -78,6 +78,8 @@ #define GROUPADD(group) yon_char_unite("GROUPADD[",group,"]",NULL) #define USERSHADOW(user) yon_char_unite("USERSHADOW[",user,"]",NULL) #define USERADD_SYNC(user) yon_char_unite("USERADD_SYNC[",user,"]",NULL) + +#define USERADD_SYNC_command(target) yon_char_unite("ubconfig --source system get users USERADD_SYNC[",target,"]",NULL) #define USERSHADOW_SYNC(user) yon_char_unite("USERSHADOW_SYNC[",user,"]",NULL) #define GROUPADD_SYNC(user) yon_char_unite("GROUPADD_SYNC[",user,"]",NULL) @@ -87,7 +89,7 @@ #define password_hash_get_command(passwd) yon_char_append("mkpasswd2 ",passwd) -#define config_get_command(source) yon_char_unite("ubconfig --source ",source," get users DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERADD_SYNC USERADD_SYNC[*] USERSHADOW[*] GROUPADD[*]",NULL),yon_char_unite("ubconfig --source ",source," get [system] SYSTEMBOOT_STATEMODE",NULL),yon_char_unite("ubconfig --source ",source," get [save] SAVE_ROOTCOPY_CHANGES",NULL) +#define config_get_command(source) yon_char_unite("ubconfig --source ",source," get users DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERADD_SYNC USERADD_SYNC[*] USERSHADOW[*] USERSHADOW_SYNC[*] GROUPADD[*]",NULL),yon_char_unite("ubconfig --source ",source," get [system] SYSTEMBOOT_STATEMODE",NULL),yon_char_unite("ubconfig --source ",source," get [save] SAVE_ROOTCOPY_CHANGES",NULL) #define config_get_default_command "ubconfig --source default get users DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM" #define config_get_global_only_parameters "ubconfig --source global get users DEFAULTPASSWD DEFAULTROOTPASSWD" From 43775a720be6cef28ac949ce729b6712b1e98a5b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 10:27:42 +0600 Subject: [PATCH 11/72] Fixed loading of system users and groups --- source/ubl-settings-usergroups.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 4fa59c0..7ca1c49 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -173,14 +173,8 @@ void yon_interface_update(main_window *widgets){ } } - if (main_config.groups_size>0){ - yon_char_parsed_free(main_config.groups,main_config.groups_size); - main_config.groups = yon_file_open(groups_path,&main_config.groups_size); - } - if (main_config.users_size>0){ - yon_char_parsed_free(main_config.users,main_config.users_size); - main_config.users = yon_file_open(users_path,&main_config.users_size); - } + + yon_system_load(widgets); } void on_config_local_load(GtkWidget *, main_window *widgets){ @@ -1837,6 +1831,16 @@ return window; void yon_system_load(main_window *window){ gtk_list_store_clear(window->liststore1); gtk_list_store_clear(window->liststore2); + + if (main_config.groups_size>0){ + yon_char_parsed_free(main_config.groups,main_config.groups_size); + main_config.groups = yon_file_open(groups_path,&main_config.groups_size); + } + if (main_config.users_size>0){ + yon_char_parsed_free(main_config.users,main_config.users_size); + main_config.users = yon_file_open(users_path,&main_config.users_size); + } + GtkTreeIter iter; for (int i=0;i Date: Tue, 14 Jan 2025 10:38:10 +0600 Subject: [PATCH 12/72] Page changing for user and group creation window to the page, where error occured --- source/ubl-settings-usergroups-user.c | 5 +++++ source/ubl-settings-usergroups.c | 6 ++++++ source/ubl-settings-usergroups.h | 2 ++ ubl-settings-usergroups-group-creation.glade | 4 ++-- ubl-settings-usergroups-user.glade | 4 ++-- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index 43e77aa..8b8f2e0 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -47,6 +47,7 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ window->UsershadowBootCheck=yon_gtk_builder_get_widget(builder,"UsershadowBootCheck"); window->UsershadowShutdownCheck=yon_gtk_builder_get_widget(builder,"UsershadowShutdownCheck"); window->userTitleNameLabel=yon_gtk_builder_get_widget(builder,"userTitleNameLabel"); + window->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook"); window->expiration_unix=NULL; window->last_uid=NULL; @@ -238,6 +239,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ if (found){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),found==1?UID_ALREADY_EXIST_CONFIG_LABEL:UID_ALREADY_EXIST_SYSTEM_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->userUIDEntry); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); return; } } @@ -246,6 +248,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ if (yon_char_is_empty(uid_string)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->userUIDEntry); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); return; } } @@ -263,6 +266,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ if (yon_char_is_empty(login)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->userLoginEntry); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); return; } @@ -272,6 +276,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ if (yon_char_is_empty(password)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->userPasswordEntry); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); return; } } else if (password_active==1){ diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 7ca1c49..308958e 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1418,6 +1418,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){ gid = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry)); if (yon_char_is_empty(gid)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); yon_ubl_status_highlight_incorrect(window->userUIDEntry); return; } @@ -1445,6 +1446,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){ if (found){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),found==1?GID_ALREADY_EXIST_CONFIG_LABEL:GID_ALREADY_EXIST_SYSTEM_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->userUIDEntry); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); return; } } @@ -1459,6 +1461,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){ } if (yon_char_is_empty(group_name)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); yon_ubl_status_highlight_incorrect(window->userLoginEntry); return; } @@ -1466,6 +1469,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){ group_users = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry)); if (yon_char_is_empty(group_users)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); yon_ubl_status_highlight_incorrect(window->userGroupsEntry); return; } @@ -1495,6 +1499,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){ password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); if (yon_char_is_empty(password)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); yon_ubl_status_highlight_incorrect(window->PasswordEntry); return; } @@ -1578,6 +1583,7 @@ ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group window->AdminGroupsButton=yon_gtk_builder_get_widget(builder,"AdminGroupsButton"); window->GroupaddShutdownCheck=yon_gtk_builder_get_widget(builder,"GroupaddShutdownCheck"); window->groupExtraOptionsEntry=yon_gtk_builder_get_widget(builder,"groupExtraOptionsEntry"); + window->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook"); window->last_gid=NULL; gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),GROUPS_TITLE_LABEL); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index b626528..b3c8478 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -263,6 +263,7 @@ typedef struct{ GtkWidget *AdminGroupsButton; GtkWidget *GroupaddShutdownCheck; GtkWidget *groupExtraOptionsEntry; + GtkWidget *MainNotebook; char *last_gid; } ubl_settings_usergroups_group_creation_window; @@ -350,6 +351,7 @@ typedef struct{ GtkWidget *UsershadowShutdownCheck; GtkWidget *userTitleNameLabel; GtkWidget *userSyncSAMBAPasswordCheck; + GtkWidget *MainNotebook; char *expiration_unix; diff --git a/ubl-settings-usergroups-group-creation.glade b/ubl-settings-usergroups-group-creation.glade index 78c8766..49b403b 100644 --- a/ubl-settings-usergroups-group-creation.glade +++ b/ubl-settings-usergroups-group-creation.glade @@ -1,5 +1,5 @@ - + @@ -56,7 +56,7 @@ - + True True 5 diff --git a/ubl-settings-usergroups-user.glade b/ubl-settings-usergroups-user.glade index 8e0cda4..8ecc1cc 100644 --- a/ubl-settings-usergroups-user.glade +++ b/ubl-settings-usergroups-user.glade @@ -1,5 +1,5 @@ - + @@ -86,7 +86,7 @@ - + True True From bb32edd4cf8cadb6eb398b73fbfb7feb8a82334b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 10:50:46 +0600 Subject: [PATCH 13/72] Test fix for crash --- source/ubl-settings-usergroups.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 308958e..ed9825c 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -223,13 +223,17 @@ if (main_config.sync_users){ } void yon_accept_changes(){ - char *remove_homes = ""; - for (int i=0;i Date: Tue, 14 Jan 2025 12:00:43 +0600 Subject: [PATCH 14/72] Fixed confirmation window closing --- source/ubl-settings-usergroups-system.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index bad75fa..0047481 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -14,6 +14,7 @@ void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog){ if (!yon_char_is_empty(command)){ yon_launch(command); } + on_subwindow_close(dialog->Window); } void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog){ @@ -30,6 +31,7 @@ void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog){ if (!yon_char_is_empty(command)){ yon_launch(command); } + on_subwindow_close(dialog->Window); } void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *dict){ From 9bb702a584034acf9dd8564e7e21caadf51fbb81 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 16:30:17 +0600 Subject: [PATCH 15/72] Test fixes --- source/ubl-settings-usergroups.c | 70 ++++++++------------------------ 1 file changed, 18 insertions(+), 52 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index ed9825c..e4a0b73 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -419,57 +419,6 @@ void on_config_save(GtkWidget *, main_window *){ main_config.save_config=2; template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_command("global"),NULL); if (window){ - if (main_config.load_mode==0){ - GtkTreeIter iter; - int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter); - for(;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){ - char *parameter,*old_value, *new_value; - gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,¶meter,2,&old_value,3,&new_value,-1); - int old_size, new_size; - config_str old_parsed = yon_char_parse(old_value,&old_size,":"); - config_str new_parsed = yon_char_parse(new_value,&new_size,":"); - if (old_parsed&&new_parsed){ - char *parameter_type = yon_char_divide_search(parameter,"[",-1); - if (!strcmp(parameter_type,USERADD_parameter)){ - if (old_size>5){ - old_parsed = yon_char_parsed_rip(old_parsed,&old_size,5); - - } - if (new_size>5){ - new_parsed = yon_char_parsed_rip(new_parsed,&new_size,5); - } - char *old_final = yon_char_parsed_to_string(old_parsed,old_size,":"); - char *new_final = yon_char_parsed_to_string(new_parsed,new_size,":"); - if (old_final&&new_final&&!strcmp(old_final,new_final)){ - gtk_list_store_set(window->list,&iter,5,0,-1); - } - free(old_final); - free(new_final); - yon_char_parsed_free(old_parsed,old_size); - yon_char_parsed_free(new_parsed,new_size); - - } else if (!strcmp(parameter_type,GROUPADD_parameter)){ - if (old_size>3){ - old_parsed = yon_char_parsed_rip(old_parsed,&old_size,3); - - } - if (new_size>3){ - new_parsed = yon_char_parsed_rip(new_parsed,&new_size,3); - } - char *old_final = yon_char_parsed_to_string(old_parsed,old_size,":"); - char *new_final = yon_char_parsed_to_string(new_parsed,new_size,":"); - if (!strcmp(old_final,new_final)){ - gtk_list_store_set(window->list,&iter,5,0,-1); - } - free(old_final); - free(new_final); - yon_char_parsed_free(old_parsed,old_size); - yon_char_parsed_free(new_parsed,new_size); - - } - } - } - } yon_hide_passwords(window); } } @@ -496,7 +445,22 @@ void on_config_local_save(GtkWidget *, main_window *){ if (parsed_size>5&&!yon_char_is_empty(parsed[5])){ yon_char_parsed_add_or_create_if_exists(passwords,&passw_size,yon_char_new(parsed[5])); parsed = yon_char_parsed_rip(parsed,&parsed_size,5); - char *final_string = yon_char_parsed_to_string(parsed,parsed_size,":"); + char *final_string = NULL; + { + + if (parsed && parsed_size>0){ + char *final = NULL; + char *temp; + for (int i=0;iuserLoginEntry)); if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),USER_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); yon_ubl_status_highlight_incorrect(window->userLoginEntry); return; } if (yon_char_is_empty(login)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); yon_ubl_status_highlight_incorrect(window->userLoginEntry); return; } From 6d27414c1dba7fbc0b72cd1e64d54aeb0a8ff3b8 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 16:40:08 +0600 Subject: [PATCH 16/72] Fixed ability to delete homes for undeleted users --- source/ubl-settings-usergroups.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index e4a0b73..a1b2739 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -538,9 +538,10 @@ void on_delete_confirmation_delete_home_check(GtkCellRenderer *, char *path, yon void on_delete_confirmation_delete_check(GtkCellRenderer *, char *path, yon_confirmation_window *window){ GtkTreeIter iter; gboolean status; + char *homedir; gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),&iter,path); - gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&status,-1); - gtk_list_store_set(window->list,&iter,0,!status,-1); + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&status,2,&homedir,-1); + gtk_list_store_set(window->list,&iter,0,!status,4,!status&&!yon_char_is_empty(homedir),-1); } From b1d4b3c28cdc56597fddb13174b1906c55bf8ccb Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 16:42:38 +0600 Subject: [PATCH 17/72] Fixed ability to delete homes for undeleted users --- source/ubl-settings-usergroups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index a1b2739..1ebcfb6 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -757,7 +757,7 @@ void yon_delete_confirmation_open(main_window *widgets){ int status=0; if (homedir) status=1; gtk_list_store_append(window->list,&itar); - gtk_list_store_set(window->list,&itar,0,yon_char_parsed_check_exist(chosen,chosen_size,name)>-1?1:0,1,name,2,homedir,3,0,4,status,5,username,-1); + gtk_list_store_set(window->list,&itar,0,yon_char_parsed_check_exist(chosen,chosen_size,name)>-1?1:0,1,name,2,homedir,3,0,4,yon_char_parsed_check_exist(chosen,chosen_size,name)>-1&&status?1:0,5,username,-1); free(name); free(username); free(parameters); From f3fe5ab0b77266faa53be6f73aac0d32ef511af1 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 17:19:30 +0600 Subject: [PATCH 18/72] Added debut output for system deletion commands --- source/ubl-settings-usergroups-system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index 0047481..d4e0c8f 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -12,7 +12,7 @@ void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog){ else command = delete_home_status?remove_user_and_homedir_from_system_command(target):remove_user_from_system_command(target); } if (!yon_char_is_empty(command)){ - yon_launch(command); + yon_launch(yon_debug_output("%s\n",command)); } on_subwindow_close(dialog->Window); } @@ -29,7 +29,7 @@ void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog){ else command = remove_group_from_system_command(target); } if (!yon_char_is_empty(command)){ - yon_launch(command); + yon_launch(yon_debug_output("%s\n",command)); } on_subwindow_close(dialog->Window); } From 03fb1bc06b58b6835e2b84890eda131c4ed64fcf Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 17:28:20 +0600 Subject: [PATCH 19/72] Fixed group deletion --- source/ubl-settings-usergroups-system.c | 2 +- source/ubl-settings-usergroups.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index d4e0c8f..03e97e2 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -75,9 +75,9 @@ void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *d } } else { yon_confirmation_window *dialog = yon_delete_confirmation_new(); - g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==2){ + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(widgets->SystemTree)); GtkTreeIter iter; if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 1ebcfb6..de83a05 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -685,7 +685,7 @@ yon_confirmation_window *yon_delete_confirmation_new(){ void yon_system_delete_confirmation_open(main_window *widgets){ yon_confirmation_window *dialog = yon_delete_confirmation_new(); - g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); + // g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==2){ gtk_label_set_text(GTK_LABEL(dialog->TitleLabel),DELETE_CONFIRMATION_CONFIRM_LABEL); From 39827e0e42090347b724f788100caad7a028a8f8 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 17:37:53 +0600 Subject: [PATCH 20/72] Fixed update adter deleting user or group from system --- source/ubl-settings-usergroups-system.c | 17 +++++++++++++---- source/ubl-settings-usergroups.h | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index 03e97e2..9bbe361 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -1,6 +1,8 @@ #include "ubl-settings-usergroups.h" -void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog){ +void on_delete_system_user(GtkWidget *, dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + yon_confirmation_window *dialog = yon_dictionary_get_data(dict->first->next,yon_confirmation_window*); GtkTreeModel *model = GTK_TREE_MODEL(dialog->list); GtkTreeIter iter; char *command=NULL; @@ -15,9 +17,12 @@ void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog){ yon_launch(yon_debug_output("%s\n",command)); } on_subwindow_close(dialog->Window); + yon_system_load(widgets); } -void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog){ +void on_delete_system_group(GtkWidget *, dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + yon_confirmation_window *dialog = yon_dictionary_get_data(dict->first->next,yon_confirmation_window*); GtkTreeModel *model = GTK_TREE_MODEL(dialog->list); GtkTreeIter iter; char *command=NULL; @@ -32,6 +37,7 @@ void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog){ yon_launch(yon_debug_output("%s\n",command)); } on_subwindow_close(dialog->Window); + yon_system_load(widgets); } void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *dict){ @@ -75,9 +81,12 @@ void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *d } } else { yon_confirmation_window *dialog = yon_delete_confirmation_new(); + dictionary *dact = NULL; + yon_dictionary_add_or_create_if_exists_with_data(dact,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dact,"dialog",dialog); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==2){ - g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dact); GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(widgets->SystemTree)); GtkTreeIter iter; if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemTree)),&model,&iter)){ @@ -94,7 +103,7 @@ void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *d if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemGroupsTree)),&model,&iter)){ yon_confirmation_window *dialog = yon_delete_confirmation_new(); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); - g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_group),dialog); + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_group),dact); gtk_widget_show(window->AcceptButton); gtk_widget_hide(window->ConfigAcceptButton); gtk_widget_hide(window->SystemAcceptButton); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index b3c8478..8a45c00 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -505,6 +505,6 @@ gboolean on_menu_open(GtkWidget *self,GdkEventButton *event, rmb_menu_window *wi main_window *yon_main_window_complete(main_window *widgets); void yon_remove_confirmation_window_accept_clicked(GtkWidget *self,dictionary *dict); system_remove_confirmation_window *yon_system_remove_confirmation_window_new(); -void on_delete_system_user(GtkWidget *, yon_confirmation_window *dialog); -void on_delete_system_group(GtkWidget *, yon_confirmation_window *dialog); +void on_delete_system_user(GtkWidget *, dictionary *dict); +void on_delete_system_group(GtkWidget *, dictionary *dict); #endif \ No newline at end of file From 2511a7780007fbfbdba45354cac598d5c41b4368 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 18:00:41 +0600 Subject: [PATCH 21/72] Test fix for crash --- source/ubl-settings-usergroups.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index de83a05..e1e1c2e 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -685,9 +685,12 @@ yon_confirmation_window *yon_delete_confirmation_new(){ void yon_system_delete_confirmation_open(main_window *widgets){ yon_confirmation_window *dialog = yon_delete_confirmation_new(); - // g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dialog); + dictionary *dact = NULL; + yon_dictionary_add_or_create_if_exists_with_data(dact,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dact,"dialog",dialog); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window)); if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==2){ + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_user),dact); gtk_label_set_text(GTK_LABEL(dialog->TitleLabel),DELETE_CONFIRMATION_CONFIRM_LABEL); gtk_label_set_text(GTK_LABEL(dialog->HatLabel),DELETE_CONFIRMATION_TITLE_LABEL); yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window),DELETE_CONFIRMATION_TITLE_LABEL,icon_path,"system-user-deletion-window"); @@ -702,6 +705,7 @@ void yon_system_delete_confirmation_open(main_window *widgets){ } } else { + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_group_user),dact); gtk_label_set_text(GTK_LABEL(dialog->TitleLabel),DELETE_GROUP_CONFIRMATION_CONFIRM_LABEL); gtk_label_set_text(GTK_LABEL(dialog->HatLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL); yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window),DELETE_GROUP_CONFIRMATION_TITLE_LABEL,icon_path,"system-group-deletion-window"); From 4822be0f696a132c0f501de753d81b89ba2027db Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 14 Jan 2025 18:01:34 +0600 Subject: [PATCH 22/72] Test fix for crash --- source/ubl-settings-usergroups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index e1e1c2e..8645663 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -705,7 +705,7 @@ void yon_system_delete_confirmation_open(main_window *widgets){ } } else { - g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_group_user),dact); + g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_delete_system_group),dact); gtk_label_set_text(GTK_LABEL(dialog->TitleLabel),DELETE_GROUP_CONFIRMATION_CONFIRM_LABEL); gtk_label_set_text(GTK_LABEL(dialog->HatLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL); yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(widgets->Window),DELETE_GROUP_CONFIRMATION_TITLE_LABEL,icon_path,"system-group-deletion-window"); From 24a32c99ffb3e107d8a5c4c429a66543f6da5a9c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 10:20:19 +0600 Subject: [PATCH 23/72] Fixed saving of unedited values at additional settings window --- source/CMakeLists.txt | 1 + source/ubl-settings-usergroups-settings.c | 233 ++++++++++++++++++++++ source/ubl-settings-usergroups.c | 188 ----------------- source/ubl-settings-usergroups.h | 11 + 4 files changed, 245 insertions(+), 188 deletions(-) create mode 100644 source/ubl-settings-usergroups-settings.c diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 94c2d57..125f652 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -80,6 +80,7 @@ endif() set(SOURCE_FILES ubl-settings-usergroups.c + ubl-settings-usergroups-settings.c ubl-settings-usergroups-user.c ubl-settings-usergroups-system.c ubl-settings-usergroups.h diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c new file mode 100644 index 0000000..a090bfe --- /dev/null +++ b/source/ubl-settings-usergroups-settings.c @@ -0,0 +1,233 @@ +#include "ubl-settings-usergroups.h" + +void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){ + if (self == window->DefaultUserNameEntry){ + window->default_user_name = gtk_entry_get_text(GTK_ENTRY(window->DefaultUserNameEntry)); + + } else if (self == window->DefaultPasswordEntry){ + window->default_password = gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry)); + + } else if (self == window->RootPasswordEntry){ + window->default_root_password = gtk_entry_get_text(GTK_ENTRY(window->RootPasswordEntry)); + + } else if (self == window->PasswordHashCombo){ + window->password_hash = ""; + + } else if (self == window->DefaultUserAdministratorCheck){ + window->user_1000_admin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck)); + + } else if (self == window->UsersBootCheck){ + window->user_boot = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck)); + + } else if (self == window->UsersShutdownCheck){ + window->user_shutdown = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck)); + } +} + + void on_additional_settings_save(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ + const char *default_user = (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultUserNameEntry)); + if (!yon_char_is_empty(default_user)){ + if (window->default_user_name) + yon_config_register(DEFAULTUSER_parameter,DEFAULTUSER_parameter_command,yon_char_new((char*)default_user)); + } else { + if (window->default_user_name) + yon_config_remove_by_key(DEFAULTUSER_parameter); + } + char *default_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->DefaultPasswordCombo))>1? (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry)):NULL; + if (!yon_char_is_empty(default_password)){ + if (window->default_password) + yon_config_register(DEFAULTPASSWD_parameter,DEFAULTPASSWD_parameter_command,default_password); + } else { + if (window->default_password) + yon_config_remove_by_key(DEFAULTPASSWD_parameter); + } + char *root_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RootPasswordCombo)) > 1 ? (char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordEntry)) : NULL; + if (!yon_char_is_empty(root_password)){ + if (window->default_root_password) + yon_config_register(DEFAULTROOTPASSWD_parameter,DEFAULTROOTPASSWD_parameter_command,root_password); + } else { + if (window->default_root_password) + yon_config_remove_by_key(DEFAULTROOTPASSWD_parameter); + } + int user_k_admin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck)); + if (user_k_admin){ + if (window->user_1000_admin) + yon_config_register(ADDADM_parameter,ADDADM_parameter_command,"yes"); + } else { + if (window->user_1000_admin) + yon_config_register(ADDADM_parameter,ADDADM_parameter_command,"no"); + } + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordHashCombo))!=0){ + char *hash = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->PasswordHashCombo)); + if (!yon_char_is_empty(hash)){ + if (window->password_hash) + yon_config_register(HASHPASSWD_parameter,HASHPASSWD_parameter_command,hash); + } + }else { + if (window->password_hash) + yon_config_remove_by_key(HASHPASSWD_parameter); + } + char *sync = ""; + int boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck)); + int shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck)); + if (!boot_active&&!shutdown_active){ + if (window->user_boot>-1||window->user_boot>-1) + yon_config_remove_by_key(USERADD_SYNC_parameter); + } else { + if (boot_active){ + if (window->user_boot>-1) + sync = "boot"; + } + if (shutdown_active){ + if (window->user_shutdown>-1) + sync = yon_char_unite(sync,yon_char_is_empty(sync)?"":",","shutdown",NULL); + } + if (window->user_boot>-1||window->user_boot>-1) + yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_parameter_command,sync); + } + } + +ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ + ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings); + window->Window=yon_gtk_builder_get_widget(builder,"Window"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->DefaultUserNameEntry=yon_gtk_builder_get_widget(builder,"DefaultUserNameEntry"); + window->DefaultUserAdministratorCheck=yon_gtk_builder_get_widget(builder,"DefaultUserAdministratorCheck"); + window->DefaultPasswordCombo=yon_gtk_builder_get_widget(builder,"DefaultPasswordCombo"); + window->DefaultPasswordEntry=yon_gtk_builder_get_widget(builder,"DefaultPasswordEntry"); + window->DefaultPasswordButton=yon_gtk_builder_get_widget(builder,"DefaultPasswordButton"); + window->RootPasswordCombo=yon_gtk_builder_get_widget(builder,"RootPasswordCombo"); + window->RootPasswordEntry=yon_gtk_builder_get_widget(builder,"RootPasswordEntry"); + window->RootPasswordButton=yon_gtk_builder_get_widget(builder,"RootPasswordButton"); + window->PasswordHashCombo=yon_gtk_builder_get_widget(builder,"PasswordHashCombo"); + window->EncryptAllPasswordsButton=yon_gtk_builder_get_widget(builder,"EncryptAllPasswordsButton"); + window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); + window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton"); + window->UsersBootCheck=yon_gtk_builder_get_widget(builder,"UsersBootCheck"); + window->UsersShutdownCheck=yon_gtk_builder_get_widget(builder,"UsersShutdownCheck"); + + window->default_password=NULL; + window->default_root_password=NULL; + window->default_user_name=NULL; + window->user_1000_admin=-1; + window->user_shutdown=-1; + window->user_boot=-1; + window->password_hash=NULL; + + yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow"); + gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL); + char *sync_parameters = yon_config_get_by_key(USERADD_SYNC_parameter); + if (sync_parameters){ + if (strstr(sync_parameters,"boot")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1); + } + if (strstr(sync_parameters,"shutdown")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck),1); + } + } + + int hash_size=0; + config_str hash_algos = yon_file_open(hash_list_path,&hash_size); + if (main_config.hash_default_id==-1){ + int size; + config_str ret = yon_config_load(get_default_hash_command,&size); + if (size>0){ + char *hash = ret[0]; + if (hash[strlen(hash)-1]=='\n') hash[strlen(hash)-1]='\0'; + for (int i=0;iPasswordHashCombo),yon_char_unite(DEFAULT_USER_LABEL," (",def,")",NULL)); + } + } + } + } + } + for (int i=1;iPasswordHashCombo),parsed[0],_(parsed[1])); + gtk_widget_set_tooltip_text(window->PasswordHashCombo,parsed[1]); + yon_char_parsed_free(parsed,parsed_size); + } + } + yon_char_parsed_free(hash_algos,hash_size); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordHashCombo),0); + char *default_user = yon_config_get_by_key(DEFAULTUSER_parameter); + if (!yon_char_is_empty(default_user)) + gtk_entry_set_text(GTK_ENTRY(window->DefaultUserNameEntry),default_user); + + + g_signal_connect(G_OBJECT(window->RootPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->RootPasswordButton); + g_signal_connect(G_OBJECT(window->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton); + char *default_password = yon_config_get_by_key(DEFAULTPASSWD_parameter); + if (!yon_char_is_empty(default_password)){ + gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),default_password); + if(!yon_config_check_ignore(DEFAULTPASSWD_parameter)) + gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),2); + } + char *root_password = yon_config_get_by_key(DEFAULTROOTPASSWD_parameter); + if (!yon_char_is_empty(root_password)){ + gtk_entry_set_text(GTK_ENTRY(window->RootPasswordEntry),root_password); + if(!yon_config_check_ignore(DEFAULTROOTPASSWD_parameter)) + gtk_combo_box_set_active(GTK_COMBO_BOX(window->RootPasswordCombo),2); + } + char *is_k_admin = yon_config_get_by_key(ADDADM_parameter); + if (!yon_char_is_empty(is_k_admin)) + if (!strcmp(is_k_admin,"yes")) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck),1); + char *hash = yon_config_get_by_key(HASHPASSWD_parameter); + if (!yon_char_is_empty(hash)){ + gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->PasswordHashCombo),hash); + } + + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_additional_settings_save),window); + dictionary *default_dict=NULL; + yon_dictionary_add_or_create_if_exists_with_data(default_dict,"combo",window->DefaultPasswordCombo); + yon_dictionary_add_or_create_if_exists_with_data(default_dict,"entry",window->DefaultPasswordEntry); + + dictionary *root_dict=NULL; + yon_dictionary_add_or_create_if_exists_with_data(root_dict,"combo",window->RootPasswordCombo); + yon_dictionary_add_or_create_if_exists_with_data(root_dict,"entry",window->RootPasswordEntry); + g_signal_connect(G_OBJECT(window->DefaultPasswordButton),"clicked",G_CALLBACK(on_password_change),default_dict); + g_signal_connect(G_OBJECT(window->RootPasswordButton),"clicked",G_CALLBACK(on_password_change),root_dict); + dialog_confirmation_data *data=malloc(sizeof(dialog_confirmation_data)); + data->function=on_passwords_encrypt; + data->action_text = ENCRYPT_SURE_LABEL; + data->data=NULL; + + g_signal_connect(G_OBJECT(window->EncryptAllPasswordsButton),"clicked",G_CALLBACK(yon_confirmation_dialog_call),data); + g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window); + + g_signal_connect(G_OBJECT(window->DefaultUserNameEntry),"changed",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->DefaultPasswordEntry),"changed",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->RootPasswordEntry),"changed",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->DefaultUserAdministratorCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); + + // g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_users_boot_toggled),NULL); + // g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_users_shutdown_toggled),NULL); + +return window; +} + +void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *, main_window *widgets){ + ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new(); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + + gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); + gtk_widget_show(window->Window); + +} \ No newline at end of file diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 8645663..886e013 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1063,66 +1063,6 @@ void on_expiration_clicked(GtkWidget *, ubl_settings_usergroups_user_window *win // standard functions - void on_additional_settings_save(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ - const char *default_user = (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultUserNameEntry)); - if (!yon_char_is_empty(default_user)){ - yon_config_register(DEFAULTUSER_parameter,DEFAULTUSER_parameter_command,yon_char_new((char*)default_user)); - } else { - yon_config_remove_by_key(DEFAULTUSER_parameter); - } - char *default_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->DefaultPasswordCombo))>1? (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry)):NULL; - if (!yon_char_is_empty(default_password)){ - yon_config_register(DEFAULTPASSWD_parameter,DEFAULTPASSWD_parameter_command,default_password); - } else { - yon_config_remove_by_key(DEFAULTPASSWD_parameter); - } - char *root_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RootPasswordCombo)) > 1 ? (char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordEntry)) : NULL; - if (!yon_char_is_empty(root_password)){ - yon_config_register(DEFAULTROOTPASSWD_parameter,DEFAULTROOTPASSWD_parameter_command,root_password); - } else { - yon_config_remove_by_key(DEFAULTROOTPASSWD_parameter); - } - int user_k_admin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck)); - if (!yon_config_check_ignore(ADDADM_parameter)){ - if (user_k_admin){ - yon_config_register(ADDADM_parameter,ADDADM_parameter_command,"yes"); - } else { - yon_config_register(ADDADM_parameter,ADDADM_parameter_command,"no"); - } - } else { - char *user_k = config(ADDADM_parameter); - if (strcmp(user_k,user_k_admin?"yes":"no")){ - if (user_k_admin){ - yon_config_register(ADDADM_parameter,ADDADM_parameter_command,"yes"); - } else { - yon_config_register(ADDADM_parameter,ADDADM_parameter_command,"no"); - } - } - } - if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordHashCombo))!=0){ - char *hash = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->PasswordHashCombo)); - if (!yon_char_is_empty(hash)){ - yon_config_register(HASHPASSWD_parameter,HASHPASSWD_parameter_command,hash); - } - }else { - yon_config_remove_by_key(HASHPASSWD_parameter); - } - char *sync = ""; - int boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck)); - int shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck)); - if (!boot_active&&!shutdown_active){ - yon_config_remove_by_key(USERADD_SYNC_parameter); - } else { - if (boot_active){ - sync = "boot"; - } - if (shutdown_active){ - sync = yon_char_unite(sync,yon_char_is_empty(sync)?"":",","shutdown",NULL); - } - yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_parameter_command,sync); - } - } - void on_hash_changed(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ int hash_size=0; @@ -1163,134 +1103,6 @@ void on_expiration_clicked(GtkWidget *, ubl_settings_usergroups_user_window *win // } // } -ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ - ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings); - window->Window=yon_gtk_builder_get_widget(builder,"Window"); - window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); - window->DefaultUserNameEntry=yon_gtk_builder_get_widget(builder,"DefaultUserNameEntry"); - window->DefaultUserAdministratorCheck=yon_gtk_builder_get_widget(builder,"DefaultUserAdministratorCheck"); - window->DefaultPasswordCombo=yon_gtk_builder_get_widget(builder,"DefaultPasswordCombo"); - window->DefaultPasswordEntry=yon_gtk_builder_get_widget(builder,"DefaultPasswordEntry"); - window->DefaultPasswordButton=yon_gtk_builder_get_widget(builder,"DefaultPasswordButton"); - window->RootPasswordCombo=yon_gtk_builder_get_widget(builder,"RootPasswordCombo"); - window->RootPasswordEntry=yon_gtk_builder_get_widget(builder,"RootPasswordEntry"); - window->RootPasswordButton=yon_gtk_builder_get_widget(builder,"RootPasswordButton"); - window->PasswordHashCombo=yon_gtk_builder_get_widget(builder,"PasswordHashCombo"); - window->EncryptAllPasswordsButton=yon_gtk_builder_get_widget(builder,"EncryptAllPasswordsButton"); - window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); - window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton"); - window->UsersBootCheck=yon_gtk_builder_get_widget(builder,"UsersBootCheck"); - window->UsersShutdownCheck=yon_gtk_builder_get_widget(builder,"UsersShutdownCheck"); - - yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow"); - gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL); - char *sync_parameters = yon_config_get_by_key(USERADD_SYNC_parameter); - if (sync_parameters){ - if (strstr(sync_parameters,"boot")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1); - } - if (strstr(sync_parameters,"shutdown")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck),1); - } - } - - int hash_size=0; - config_str hash_algos = yon_file_open(hash_list_path,&hash_size); - if (main_config.hash_default_id==-1){ - int size; - config_str ret = yon_config_load(get_default_hash_command,&size); - if (size>0){ - char *hash = ret[0]; - if (hash[strlen(hash)-1]=='\n') hash[strlen(hash)-1]='\0'; - for (int i=0;iPasswordHashCombo),yon_char_unite(DEFAULT_USER_LABEL," (",def,")",NULL)); - } - } - } - } - } - for (int i=1;iPasswordHashCombo),parsed[0],_(parsed[1])); - gtk_widget_set_tooltip_text(window->PasswordHashCombo,parsed[1]); - yon_char_parsed_free(parsed,parsed_size); - } - } - yon_char_parsed_free(hash_algos,hash_size); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordHashCombo),0); - char *default_user = yon_config_get_by_key(DEFAULTUSER_parameter); - if (!yon_char_is_empty(default_user)) - gtk_entry_set_text(GTK_ENTRY(window->DefaultUserNameEntry),default_user); - - - g_signal_connect(G_OBJECT(window->RootPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->RootPasswordButton); - g_signal_connect(G_OBJECT(window->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton); - char *default_password = yon_config_get_by_key(DEFAULTPASSWD_parameter); - if (!yon_char_is_empty(default_password)){ - gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),default_password); - if(!yon_config_check_ignore(DEFAULTPASSWD_parameter)) - gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),2); - } - char *root_password = yon_config_get_by_key(DEFAULTROOTPASSWD_parameter); - if (!yon_char_is_empty(root_password)){ - gtk_entry_set_text(GTK_ENTRY(window->RootPasswordEntry),root_password); - if(!yon_config_check_ignore(DEFAULTROOTPASSWD_parameter)) - gtk_combo_box_set_active(GTK_COMBO_BOX(window->RootPasswordCombo),2); - } - char *is_k_admin = yon_config_get_by_key(ADDADM_parameter); - if (!yon_char_is_empty(is_k_admin)) - if (!strcmp(is_k_admin,"yes")) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck),1); - char *hash = yon_config_get_by_key(HASHPASSWD_parameter); - if (!yon_char_is_empty(hash)){ - gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->PasswordHashCombo),hash); - } - - g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_additional_settings_save),window); - dictionary *default_dict=NULL; - yon_dictionary_add_or_create_if_exists_with_data(default_dict,"combo",window->DefaultPasswordCombo); - yon_dictionary_add_or_create_if_exists_with_data(default_dict,"entry",window->DefaultPasswordEntry); - - dictionary *root_dict=NULL; - yon_dictionary_add_or_create_if_exists_with_data(root_dict,"combo",window->RootPasswordCombo); - yon_dictionary_add_or_create_if_exists_with_data(root_dict,"entry",window->RootPasswordEntry); - g_signal_connect(G_OBJECT(window->DefaultPasswordButton),"clicked",G_CALLBACK(on_password_change),default_dict); - g_signal_connect(G_OBJECT(window->RootPasswordButton),"clicked",G_CALLBACK(on_password_change),root_dict); - dialog_confirmation_data *data=malloc(sizeof(dialog_confirmation_data)); - data->function=on_passwords_encrypt; - data->action_text = ENCRYPT_SURE_LABEL; - data->data=NULL; - g_signal_connect(G_OBJECT(window->EncryptAllPasswordsButton),"clicked",G_CALLBACK(yon_confirmation_dialog_call),data); - - g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window); - - // g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_users_boot_toggled),NULL); - // g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_users_shutdown_toggled),NULL); - -return window; -} - -void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *, main_window *widgets){ - ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new(); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - - gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); - gtk_widget_show(window->Window); - -} void on_user_choose(GtkWidget *, GtkEntry *target){ ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(1); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 8a45c00..e352f78 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -240,6 +240,15 @@ typedef struct{ GtkWidget *EncryptAllPasswordsButton; GtkWidget *UsersBootCheck; GtkWidget *UsersShutdownCheck; + + const char *default_user_name; + const char *default_password; + const char *default_root_password; + const char *password_hash; + int user_1000_admin; + int user_boot; + int user_shutdown; + } ubl_settings_usergroups_additional_settings_window; typedef struct{ @@ -461,6 +470,8 @@ void on_passwords_encrypt(); void on_password_change(GtkWidget *self, dictionary *entry_dict); void on_additional_settings_clicked(GtkWidget *self, GtkEntry *output_target); void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window *window); + +void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window); void on_additional_settings_save(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window); void on_hash_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window); ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(); From 45b9c51267bded150ce46b03462ba74893edc027 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 10:48:09 +0600 Subject: [PATCH 24/72] Custom configuration file window fixes --- source/ubl-settings-usergroups.c | 9 +- source/ubl-strings.h | 3 + ubl-settings-usergroups.pot | 282 ++++++++++++++--------------- ubl-settings-usergroups_ru.po | 293 ++++++++++++++++--------------- 4 files changed, 306 insertions(+), 281 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 886e013..53b7b04 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -53,9 +53,14 @@ int yon_load_proceed(YON_CONFIG_TYPE type){ return 1; } else if (type==YON_CONFIG_CUSTOM){ - char *path=NULL;; - GtkWidget *dialog = gtk_file_chooser_dialog_new(template_app_information.app_title,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); + char *path=NULL; + textdomain(template_ui_LocaleName); + char *open_string = OPEN_LABEL; + textdomain(LocaleName); + GtkWidget *dialog = gtk_file_chooser_dialog_new(template_app_information.app_title,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,open_string,GTK_RESPONSE_ACCEPT,NULL); + yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,CHOOSE_CUSTOM_CONFIG_LABEL,icon_path,"config-open-window"); GtkFileFilter *filter = gtk_file_filter_new(); + gtk_file_filter_set_name(filter,FILTER_NAME_CONFIG_LABEL); gtk_file_filter_add_pattern(filter,"*.ini"); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); gtk_widget_show(dialog); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 19234f5..6a8cf7c 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -51,6 +51,9 @@ #define UPDATE_LABEL _("Update users and groups") #define SAVING_CONFIGURATION_LABEL _("Additional saving configuration") +#define FILTER_NAME_CONFIG_LABEL yon_char_append(_("Configuration file")," *.ini") +#define CHOOSE_CUSTOM_CONFIG_LABEL _("Choose custom configuration file") + #define SYSTEM_USER_ADD_CONFIRMATION_LABEL(target) yon_char_unite(_("This user doesn't exist in configuration. Are you sure want to add user")," ",target," ", _("to configuration?"),NULL) #define SYSTEM_USER_SYNC_CONFIRMATION_LABEL(target) yon_char_unite(_("This user exists in configuration. Are you sure want to update user")," ",target," ", _("data at configuration?"),NULL) #define SYSTEM_GROUP_SYNC_CONFIRMATION_LABEL(target) yon_char_unite(_("This group doesn't exist in configuration. Are you sure want to add group")," ",target," ", _("to configuration?"),NULL) diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index c5df777..74b6c64 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -53,7 +53,7 @@ msgstr "" msgid "UID" msgstr "" -#: source/ubl-strings.h:14 source/ubl-strings.h:112 +#: source/ubl-strings.h:14 source/ubl-strings.h:115 msgid "Login" msgstr "" @@ -175,7 +175,7 @@ msgstr "" msgid "Inspect users and groups in system" msgstr "" -#: source/ubl-strings.h:46 source/ubl-strings.h:66 +#: source/ubl-strings.h:46 source/ubl-strings.h:69 msgid "Additional settings" msgstr "" @@ -204,583 +204,591 @@ msgid "Additional saving configuration" msgstr "" #: source/ubl-strings.h:54 +msgid "Configuration file" +msgstr "" + +#: source/ubl-strings.h:55 +msgid "Choose custom configuration file" +msgstr "" + +#: source/ubl-strings.h:57 msgid "This user doesn't exist in configuration. Are you sure want to add user" msgstr "" -#: source/ubl-strings.h:54 source/ubl-strings.h:56 +#: source/ubl-strings.h:57 source/ubl-strings.h:59 msgid "to configuration?" msgstr "" -#: source/ubl-strings.h:55 +#: source/ubl-strings.h:58 msgid "This user exists in configuration. Are you sure want to update user" msgstr "" -#: source/ubl-strings.h:55 source/ubl-strings.h:57 +#: source/ubl-strings.h:58 source/ubl-strings.h:60 msgid "data at configuration?" msgstr "" -#: source/ubl-strings.h:56 +#: source/ubl-strings.h:59 msgid "" "This group doesn't exist in configuration. Are you sure want to add group" msgstr "" -#: source/ubl-strings.h:57 +#: source/ubl-strings.h:60 msgid "This group exists in configuration. Are you sure want to update group" msgstr "" -#: source/ubl-strings.h:59 +#: source/ubl-strings.h:62 msgid "" "This user doesn't exist in configuration. Are you sure want to remove user" msgstr "" -#: source/ubl-strings.h:59 source/ubl-strings.h:61 +#: source/ubl-strings.h:62 source/ubl-strings.h:64 msgid "from the system?" msgstr "" -#: source/ubl-strings.h:60 +#: source/ubl-strings.h:63 msgid "" "This user exists in configuration and system. Are you sure want to remove " "user" msgstr "" -#: source/ubl-strings.h:61 +#: source/ubl-strings.h:64 msgid "" "This group doesn't exist in configuration. Are you sure want to remove group" msgstr "" -#: source/ubl-strings.h:62 +#: source/ubl-strings.h:65 msgid "" "This group exists in configuration and system. Are you sure want to remove " "group" msgstr "" -#: source/ubl-strings.h:67 +#: source/ubl-strings.h:70 msgid "No password required" msgstr "" -#: source/ubl-strings.h:68 +#: source/ubl-strings.h:71 msgid "Set a password" msgstr "" -#: source/ubl-strings.h:69 source/ubl-strings.h:115 +#: source/ubl-strings.h:72 source/ubl-strings.h:118 msgid "Encrypted" msgstr "" -#: source/ubl-strings.h:70 +#: source/ubl-strings.h:73 msgid "Unencrypted" msgstr "" -#: source/ubl-strings.h:83 +#: source/ubl-strings.h:86 msgid "Accept" msgstr "" -#: source/ubl-strings.h:84 +#: source/ubl-strings.h:87 msgid "" "Are you sure want to encrypt all passwords?\n" "This action can't be undone." msgstr "" -#: source/ubl-strings.h:85 +#: source/ubl-strings.h:88 msgid "Encrypt all unencrypted passwords at global configuration" msgstr "" -#: source/ubl-strings.h:86 +#: source/ubl-strings.h:89 msgid "DES (Algorithm for Symmetric Encryption)" msgstr "" -#: source/ubl-strings.h:87 +#: source/ubl-strings.h:90 msgid "MD5 (128-bit hashing algorithm)" msgstr "" -#: source/ubl-strings.h:88 +#: source/ubl-strings.h:91 msgid "yescrypt (Cryptographic hash function)" msgstr "" -#: source/ubl-strings.h:89 +#: source/ubl-strings.h:92 msgid "GOST-YESCRYPT (Design according to GOST R 34.11─2012)" msgstr "" -#: source/ubl-strings.h:90 +#: source/ubl-strings.h:93 msgid "scrypt (Adaptive cryptographic key generation function)" msgstr "" -#: source/ubl-strings.h:91 +#: source/ubl-strings.h:94 msgid "Blowfish (Symmetric Block Cipher Algorithm)" msgstr "" -#: source/ubl-strings.h:92 +#: source/ubl-strings.h:95 msgid "bcrypt (Adaptive hash function from the Blowfish family of algorithms)" msgstr "" -#: source/ubl-strings.h:93 +#: source/ubl-strings.h:96 msgid "" "bcrypt-a (Adaptive hash function from the Blowfish family of algorithms)" msgstr "" -#: source/ubl-strings.h:94 +#: source/ubl-strings.h:97 msgid "SHA512 (Hash function from the SHA-2 family of algorithms)" msgstr "" -#: source/ubl-strings.h:95 +#: source/ubl-strings.h:98 msgid "SHA256 (Hash function from the SHA-2 family of algorithms)" msgstr "" -#: source/ubl-strings.h:96 +#: source/ubl-strings.h:99 msgid "Sun MD5 (Hash algorithm from Sun Microsystems)" msgstr "" -#: source/ubl-strings.h:97 +#: source/ubl-strings.h:100 msgid "MD5 Unix (Hash algorithm calls standard MD5 thousand times)" msgstr "" -#: source/ubl-strings.h:98 +#: source/ubl-strings.h:101 msgid "" "Extended DES Crypt (Hash function from the BSDi family of DES algorithms)" msgstr "" -#: source/ubl-strings.h:99 +#: source/ubl-strings.h:102 msgid "descrypt (Hash function from the DES family of algorithms)" msgstr "" -#: source/ubl-strings.h:100 +#: source/ubl-strings.h:103 msgid "NTHash (Hash function from the NT Windows family of algorithms)" msgstr "" -#: source/ubl-strings.h:102 +#: source/ubl-strings.h:105 msgid "" "While booting the operating system, apply the settings of all users from the " "configuration" msgstr "" -#: source/ubl-strings.h:103 +#: source/ubl-strings.h:106 msgid "" "While shutdown, save the settings of all users with UID>=1000 to the " "configuration" msgstr "" -#: source/ubl-strings.h:106 +#: source/ubl-strings.h:109 msgid "Configure group" msgstr "" -#: source/ubl-strings.h:107 +#: source/ubl-strings.h:110 msgid "Add group" msgstr "" -#: source/ubl-strings.h:108 +#: source/ubl-strings.h:111 msgid "Group id:" msgstr "" -#: source/ubl-strings.h:109 +#: source/ubl-strings.h:112 msgid "Group name:" msgstr "" -#: source/ubl-strings.h:110 +#: source/ubl-strings.h:113 msgid "Group users:" msgstr "" -#: source/ubl-strings.h:111 +#: source/ubl-strings.h:114 msgid "Automatically" msgstr "" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:116 msgid "Create group with ununique GID" msgstr "" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:117 msgid "Create system group" msgstr "" -#: source/ubl-strings.h:116 +#: source/ubl-strings.h:119 msgid "Additional configuration" msgstr "" -#: source/ubl-strings.h:117 +#: source/ubl-strings.h:120 msgid "Group configuration synchronization" msgstr "" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:121 msgid "When shutting down the system, save the group into the configuration" msgstr "" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:122 msgid "Group administrators:" msgstr "" -#: source/ubl-strings.h:120 +#: source/ubl-strings.h:123 msgid "Group name must not start with digit" msgstr "" -#: source/ubl-strings.h:123 +#: source/ubl-strings.h:126 msgid "Default groups" msgstr "" -#: source/ubl-strings.h:124 +#: source/ubl-strings.h:127 msgid "Main group" msgstr "" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:128 msgid "Additional groups" msgstr "" -#: source/ubl-strings.h:126 +#: source/ubl-strings.h:129 msgid "Choose groups" msgstr "" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:130 msgid "Choose users" msgstr "" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:131 msgid "Add to new:" msgstr "" -#: source/ubl-strings.h:130 +#: source/ubl-strings.h:134 msgid "System users and groups" msgstr "" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:135 msgid "Locked" msgstr "" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:136 msgid "Username" msgstr "" -#: source/ubl-strings.h:133 +#: source/ubl-strings.h:137 msgid "" "Primary\n" "group" msgstr "" -#: source/ubl-strings.h:134 +#: source/ubl-strings.h:138 msgid "" "Home\n" "directory" msgstr "" -#: source/ubl-strings.h:135 source/ubl-strings.h:141 +#: source/ubl-strings.h:139 source/ubl-strings.h:145 msgid "Group" msgstr "" -#: source/ubl-strings.h:136 +#: source/ubl-strings.h:140 msgid "Update the system users and groups list" msgstr "" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:141 msgid "Toggle system groups and users" msgstr "" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:143 msgid "Password mismatch" msgstr "" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:144 msgid "Password must be at least" msgstr "" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:144 msgid "characters" msgstr "" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:146 msgid "" "Days until\n" "warning" msgstr "" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:147 msgid "" "Days\n" "without activity" msgstr "" -#: source/ubl-strings.h:144 +#: source/ubl-strings.h:148 msgid "" "Shell\n" "path" msgstr "" -#: source/ubl-strings.h:145 +#: source/ubl-strings.h:149 msgid "" "Password has\n" "been changed" msgstr "" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:150 msgid "" "Expiration\n" "date" msgstr "" -#: source/ubl-strings.h:147 +#: source/ubl-strings.h:151 msgid "" "Password change\n" "interval (min)" msgstr "" -#: source/ubl-strings.h:148 +#: source/ubl-strings.h:152 msgid "" "Password change\n" "interval (max)" msgstr "" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:155 msgid "Add user" msgstr "" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:156 msgid "Configure user" msgstr "" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:157 msgid "Set" msgstr "" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:158 msgid "Empty important field" msgstr "" -#: source/ubl-strings.h:155 +#: source/ubl-strings.h:159 msgid "Login must not start with digit" msgstr "" -#: source/ubl-strings.h:156 +#: source/ubl-strings.h:160 msgid "Loading has failed" msgstr "" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:161 msgid "Login name" msgstr "" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:162 msgid "Additional groups:" msgstr "" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:163 msgid "Password configuration" msgstr "" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:164 msgid "Password has been changed:" msgstr "" -#: source/ubl-strings.h:161 +#: source/ubl-strings.h:165 msgid "expiration date:" msgstr "" -#: source/ubl-strings.h:162 +#: source/ubl-strings.h:166 msgid "Password change interval: minimum" msgstr "" -#: source/ubl-strings.h:163 +#: source/ubl-strings.h:167 msgid "days, maximum" msgstr "" -#: source/ubl-strings.h:164 +#: source/ubl-strings.h:168 msgid "days" msgstr "" -#: source/ubl-strings.h:165 +#: source/ubl-strings.h:169 msgid "Days until warning:" msgstr "" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:170 msgid "Days without activity:" msgstr "" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:171 msgid "Force change at next login" msgstr "" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:172 msgid "User shell:" msgstr "" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:173 msgid "Home directory:" msgstr "" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:174 msgid "Don't set" msgstr "" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:175 msgid "Create system user" msgstr "" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:176 msgid "Create user with ununique (repeating) UID" msgstr "" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:177 msgid "Do not check login for compliance with character rules" msgstr "" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:178 msgid "Temporary deactivation" msgstr "" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:179 msgid "Save" msgstr "" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:180 msgid "login_name" msgstr "" -#: source/ubl-strings.h:177 +#: source/ubl-strings.h:181 msgid "group_name" msgstr "" -#: source/ubl-strings.h:178 +#: source/ubl-strings.h:182 msgid "User name" msgstr "" -#: source/ubl-strings.h:179 +#: source/ubl-strings.h:183 msgid "Sync user" msgstr "" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:184 msgid "Sync user with password" msgstr "" -#: source/ubl-strings.h:181 +#: source/ubl-strings.h:185 msgid "Encrypt all passwords" msgstr "" -#: source/ubl-strings.h:183 +#: source/ubl-strings.h:187 msgid "User configuration" msgstr "" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:188 msgid "User configuration synchronization" msgstr "" -#: source/ubl-strings.h:185 +#: source/ubl-strings.h:189 msgid "During system startup, load the user from the configuration" msgstr "" -#: source/ubl-strings.h:186 +#: source/ubl-strings.h:190 msgid "When shutting down the system, save the user into the configuration" msgstr "" -#: source/ubl-strings.h:187 +#: source/ubl-strings.h:191 msgid "User password configuration syncronization" msgstr "" -#: source/ubl-strings.h:188 +#: source/ubl-strings.h:192 msgid "" "During system startup, load the user's parameters from the configuration" msgstr "" -#: source/ubl-strings.h:189 +#: source/ubl-strings.h:193 msgid "" "When shutting down the system, save the user's parameters into the " "configuration" msgstr "" -#: source/ubl-strings.h:191 +#: source/ubl-strings.h:195 msgid "Basic" msgstr "" -#: source/ubl-strings.h:192 +#: source/ubl-strings.h:196 msgid "Additional" msgstr "" -#: source/ubl-strings.h:193 +#: source/ubl-strings.h:197 msgid "Syncronization" msgstr "" -#: source/ubl-strings.h:195 +#: source/ubl-strings.h:199 msgid "Not specified" msgstr "" -#: source/ubl-strings.h:197 +#: source/ubl-strings.h:201 msgid "UID already exists in configuration" msgstr "" -#: source/ubl-strings.h:198 +#: source/ubl-strings.h:202 msgid "UID already exists in system" msgstr "" -#: source/ubl-strings.h:199 +#: source/ubl-strings.h:203 msgid "GID already exists in configuration" msgstr "" -#: source/ubl-strings.h:200 +#: source/ubl-strings.h:204 msgid "GID already exists in system" msgstr "" -#: source/ubl-strings.h:203 +#: source/ubl-strings.h:207 msgid "Repeat password:" msgstr "" -#: source/ubl-strings.h:204 +#: source/ubl-strings.h:208 msgid "Password hash:" msgstr "" -#: source/ubl-strings.h:205 +#: source/ubl-strings.h:209 msgid "Do not encrypt password" msgstr "" -#: source/ubl-strings.h:208 +#: source/ubl-strings.h:212 msgid "Additional configuration of service parameter saving" msgstr "" -#: source/ubl-strings.h:209 +#: source/ubl-strings.h:213 msgid "" "At every system shutdown save changes of (root)/var/lib/samba\n" "into (hd)/ublinux-data/rootcopy" msgstr "" -#: source/ubl-strings.h:210 +#: source/ubl-strings.h:214 msgid "For system save mode \"Sandbox\"" msgstr "" -#: source/ubl-strings.h:213 +#: source/ubl-strings.h:217 msgid "Group deletion" msgstr "" -#: source/ubl-strings.h:214 +#: source/ubl-strings.h:218 msgid "Confirm group(-s) deletion:" msgstr "" -#: source/ubl-strings.h:216 +#: source/ubl-strings.h:220 msgid "User deletion" msgstr "" -#: source/ubl-strings.h:217 +#: source/ubl-strings.h:221 msgid "Confirm user(-s) deletion:" msgstr "" -#: source/ubl-strings.h:218 +#: source/ubl-strings.h:222 msgid "Chosen" msgstr "" -#: source/ubl-strings.h:219 +#: source/ubl-strings.h:223 msgid "User" msgstr "" -#: source/ubl-strings.h:220 +#: source/ubl-strings.h:224 msgid "Home directory" msgstr "" -#: source/ubl-strings.h:221 +#: source/ubl-strings.h:225 msgid "Delete home directory" msgstr "" -#: source/ubl-strings.h:223 +#: source/ubl-strings.h:227 msgid "Configuration users" msgstr "" -#: source/ubl-strings.h:224 +#: source/ubl-strings.h:228 msgid "Configuration groups" msgstr "" -#: source/ubl-strings.h:225 +#: source/ubl-strings.h:229 msgid "System users" msgstr "" -#: source/ubl-strings.h:226 +#: source/ubl-strings.h:230 msgid "System groups" msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 2bc75fb..1eb9a74 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -53,7 +53,7 @@ msgstr "Алгоритм хэширования пароля:" msgid "UID" msgstr "UID" -#: source/ubl-strings.h:14 source/ubl-strings.h:112 +#: source/ubl-strings.h:14 source/ubl-strings.h:115 msgid "Login" msgstr "Логин" @@ -189,7 +189,7 @@ msgstr "Обзор файлов" msgid "Inspect users and groups in system" msgstr "Просмотр пользователей и групп в системе" -#: source/ubl-strings.h:46 source/ubl-strings.h:66 +#: source/ubl-strings.h:46 source/ubl-strings.h:69 msgid "Additional settings" msgstr "Дополнительные настройки" @@ -218,90 +218,99 @@ msgid "Additional saving configuration" msgstr "Дополнительные настройки сохранения" #: source/ubl-strings.h:54 +msgid "Configuration file" +msgstr "Файл конфигурации" + +#: source/ubl-strings.h:55 +msgid "Choose custom configuration file" +msgstr "Выбор файла конфигурации" + +#: source/ubl-strings.h:57 msgid "This user doesn't exist in configuration. Are you sure want to add user" msgstr "" "Пользователь в конфигурации отсутствует, но его можно добавить. Вы " "действительно хотите добавить пользователя" -#: source/ubl-strings.h:54 source/ubl-strings.h:56 +#: source/ubl-strings.h:57 source/ubl-strings.h:59 msgid "to configuration?" msgstr "в конфигурацию?" -#: source/ubl-strings.h:55 +#: source/ubl-strings.h:58 msgid "This user exists in configuration. Are you sure want to update user" msgstr "" "Пользователь уже присутствует в конфигурации. Хотите обновить данные " "пользователя" -#: source/ubl-strings.h:55 source/ubl-strings.h:57 +#: source/ubl-strings.h:58 source/ubl-strings.h:60 msgid "data at configuration?" msgstr "в конфигурации?" -#: source/ubl-strings.h:56 +#: source/ubl-strings.h:59 msgid "" "This group doesn't exist in configuration. Are you sure want to add group" msgstr "" "Группа в конфигурации отсутствует, но её можно добавить. Вы действительно " "хотите добавить группу" -#: source/ubl-strings.h:57 +#: source/ubl-strings.h:60 msgid "This group exists in configuration. Are you sure want to update group" msgstr "Группа уже присутствует в конфигурации. Хотите обновить данные группы" -#: source/ubl-strings.h:59 +#: source/ubl-strings.h:62 msgid "" "This user doesn't exist in configuration. Are you sure want to remove user" msgstr "" -"Пользователь в конфигурации отсутствует. Вы " -"действительно хотите удалить пользователя" +"Пользователь в конфигурации отсутствует. Вы действительно хотите удалить " +"пользователя" -#: source/ubl-strings.h:59 source/ubl-strings.h:61 +#: source/ubl-strings.h:62 source/ubl-strings.h:64 msgid "from the system?" msgstr "из системы" -#: source/ubl-strings.h:60 +#: source/ubl-strings.h:63 msgid "" "This user exists in configuration and system. Are you sure want to remove " "user" msgstr "" -"Пользователь уже присутствует в конфигурации и системе. Вы действительно хотите " -"удалить пользователя" +"Пользователь уже присутствует в конфигурации и системе. Вы действительно " +"хотите удалить пользователя" -#: source/ubl-strings.h:61 +#: source/ubl-strings.h:64 msgid "" "This group doesn't exist in configuration. Are you sure want to remove group" msgstr "" "Группа в конфигурации отсутствует и удаление будет выполнено из системы. Вы " "действительно хотите удалить группу" -#: source/ubl-strings.h:62 +#: source/ubl-strings.h:65 msgid "" "This group exists in configuration and system. Are you sure want to remove " "group" -msgstr "Группа уже присутствует в конфигурации и системе. Вы действительно хотите " +msgstr "" +"Группа уже присутствует в конфигурации и системе. Вы действительно хотите " "удалить группу" -#: source/ubl-strings.h:67 +#: source/ubl-strings.h:70 msgid "No password required" msgstr "Пароль не требуется" -#: source/ubl-strings.h:68 +#: source/ubl-strings.h:71 msgid "Set a password" msgstr "Задать пароль" -#: source/ubl-strings.h:69 source/ubl-strings.h:115 +#: source/ubl-strings.h:72 source/ubl-strings.h:118 msgid "Encrypted" msgstr "Зашифрован" -#: source/ubl-strings.h:70 +#: source/ubl-strings.h:73 msgid "Unencrypted" msgstr "Не зашифрован" -#: source/ubl-strings.h:83 +#: source/ubl-strings.h:86 msgid "Accept" msgstr "Принять" -#: source/ubl-strings.h:84 +#: source/ubl-strings.h:87 msgid "" "Are you sure want to encrypt all passwords?\n" "This action can't be undone." @@ -309,73 +318,73 @@ msgstr "" "Вы уверены что хотите зашифровать все пароли?\n" "Это действие нельзя отменить." -#: source/ubl-strings.h:85 +#: source/ubl-strings.h:88 msgid "Encrypt all unencrypted passwords at global configuration" msgstr "Зашифровать все незашифрованные пароли в глобальной конфигурации" -#: source/ubl-strings.h:86 +#: source/ubl-strings.h:89 msgid "DES (Algorithm for Symmetric Encryption)" msgstr "DES (Алгоритм для симметричного шифрования)" -#: source/ubl-strings.h:87 +#: source/ubl-strings.h:90 msgid "MD5 (128-bit hashing algorithm)" msgstr "MD5 (128-битный алгоритм хеширования)" -#: source/ubl-strings.h:88 +#: source/ubl-strings.h:91 msgid "yescrypt (Cryptographic hash function)" msgstr "yescrypt (Криптографическая хэш-функция)" -#: source/ubl-strings.h:89 +#: source/ubl-strings.h:92 msgid "GOST-YESCRYPT (Design according to GOST R 34.11─2012)" msgstr "GOST-YESCRYPT (Конструкция согласно ГОСТ Р 34.11─2012)" -#: source/ubl-strings.h:90 +#: source/ubl-strings.h:93 msgid "scrypt (Adaptive cryptographic key generation function)" msgstr "scrypt (Адаптивная криптографическая функция формирования ключа)" -#: source/ubl-strings.h:91 +#: source/ubl-strings.h:94 msgid "Blowfish (Symmetric Block Cipher Algorithm)" msgstr "Blowfish (Алгоритм блочного симметричного шифрования)" -#: source/ubl-strings.h:92 +#: source/ubl-strings.h:95 msgid "bcrypt (Adaptive hash function from the Blowfish family of algorithms)" msgstr "bcrypt (Адаптивная хеш-функция из семейства алгоритмов Blowfish)" -#: source/ubl-strings.h:93 +#: source/ubl-strings.h:96 msgid "" "bcrypt-a (Adaptive hash function from the Blowfish family of algorithms)" msgstr "bcrypt-a (Адаптивная хеш-функция из семейства алгоритмов Blowfish)" -#: source/ubl-strings.h:94 +#: source/ubl-strings.h:97 msgid "SHA512 (Hash function from the SHA-2 family of algorithms)" msgstr "SHA512 (Хеш-функция из семейства алгоритмов SHA-2)" -#: source/ubl-strings.h:95 +#: source/ubl-strings.h:98 msgid "SHA256 (Hash function from the SHA-2 family of algorithms)" msgstr "SHA256 (Хеш-функция из семейства алгоритмов SHA-2)" -#: source/ubl-strings.h:96 +#: source/ubl-strings.h:99 msgid "Sun MD5 (Hash algorithm from Sun Microsystems)" msgstr "Sun MD5 (Хеш-алгоритм от Sun Microsystems)" -#: source/ubl-strings.h:97 +#: source/ubl-strings.h:100 msgid "MD5 Unix (Hash algorithm calls standard MD5 thousand times)" msgstr "MD5 Unix (Хэш-алгоритм вызывает тысячу раз стандартный MD5)" -#: source/ubl-strings.h:98 +#: source/ubl-strings.h:101 msgid "" "Extended DES Crypt (Hash function from the BSDi family of DES algorithms)" msgstr "Extended DES Crypt (Хеш-функция из семейства алгоритмов DES от BSDi)" -#: source/ubl-strings.h:99 +#: source/ubl-strings.h:102 msgid "descrypt (Hash function from the DES family of algorithms)" msgstr "descrypt (Хеш-функция из семейства алгоритмов DES)" -#: source/ubl-strings.h:100 +#: source/ubl-strings.h:103 msgid "NTHash (Hash function from the NT Windows family of algorithms)" msgstr "NTHash (Хеш-функция из семейства алгоритмов NT Windows)" -#: source/ubl-strings.h:102 +#: source/ubl-strings.h:105 msgid "" "While booting the operating system, apply the settings of all users from the " "configuration" @@ -383,7 +392,7 @@ msgstr "" "При запуске операционной системы применять настройки всех пользователей из " "конфигурации" -#: source/ubl-strings.h:103 +#: source/ubl-strings.h:106 msgid "" "While shutdown, save the settings of all users with UID>=1000 to the " "configuration" @@ -391,95 +400,95 @@ msgstr "" "При завершении работы сохранить настройки пользователей с UID>=1000 в " "конфигурацию" -#: source/ubl-strings.h:106 +#: source/ubl-strings.h:109 msgid "Configure group" msgstr "Редактировать группу" -#: source/ubl-strings.h:107 +#: source/ubl-strings.h:110 msgid "Add group" msgstr "Добавить группу" -#: source/ubl-strings.h:108 +#: source/ubl-strings.h:111 msgid "Group id:" msgstr "Идентификатор группы (GID):" -#: source/ubl-strings.h:109 +#: source/ubl-strings.h:112 msgid "Group name:" msgstr "Имя группы:" -#: source/ubl-strings.h:110 +#: source/ubl-strings.h:113 msgid "Group users:" msgstr "Пользователи группы:" -#: source/ubl-strings.h:111 +#: source/ubl-strings.h:114 msgid "Automatically" msgstr "Автоматически" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:116 msgid "Create group with ununique GID" msgstr "Создать группу с повторяющимися (не уникальными) GID" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:117 msgid "Create system group" msgstr "Создать системную группу" -#: source/ubl-strings.h:116 +#: source/ubl-strings.h:119 msgid "Additional configuration" msgstr "Дополнительные настройки" -#: source/ubl-strings.h:117 +#: source/ubl-strings.h:120 msgid "Group configuration synchronization" msgstr "Синхронизация настроек группы" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:121 msgid "When shutting down the system, save the group into the configuration" msgstr "При завершении работы системы сохранить группу в конфигурацию" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:122 msgid "Group administrators:" msgstr "Администраторы группы:" -#: source/ubl-strings.h:120 +#: source/ubl-strings.h:123 msgid "Group name must not start with digit" msgstr "Имя группы не должно начинаться с цифры" -#: source/ubl-strings.h:123 +#: source/ubl-strings.h:126 msgid "Default groups" msgstr "Группы пользователей по умолчанию" -#: source/ubl-strings.h:124 +#: source/ubl-strings.h:127 msgid "Main group" msgstr "Основная группа" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:128 msgid "Additional groups" msgstr "Дополнительные группы" -#: source/ubl-strings.h:126 +#: source/ubl-strings.h:129 msgid "Choose groups" msgstr "Выбрать группы" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:130 msgid "Choose users" msgstr "Выбрать пользователей" -#: source/ubl-strings.h:127 +#: source/ubl-strings.h:131 msgid "Add to new:" msgstr "Добавить в новую:" -#: source/ubl-strings.h:130 +#: source/ubl-strings.h:134 msgid "System users and groups" msgstr "Пользователи и группы в системе" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:135 msgid "Locked" msgstr "Отключен" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:136 msgid "Username" msgstr "Имя пользователя" -#: source/ubl-strings.h:133 +#: source/ubl-strings.h:137 msgid "" "Primary\n" "group" @@ -487,7 +496,7 @@ msgstr "" "Основная\n" "группа" -#: source/ubl-strings.h:134 +#: source/ubl-strings.h:138 msgid "" "Home\n" "directory" @@ -495,31 +504,31 @@ msgstr "" "Домашний\n" "каталог" -#: source/ubl-strings.h:135 source/ubl-strings.h:141 +#: source/ubl-strings.h:139 source/ubl-strings.h:145 msgid "Group" msgstr "Группа" -#: source/ubl-strings.h:136 +#: source/ubl-strings.h:140 msgid "Update the system users and groups list" msgstr "Обновить список пользователей и групп системы" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:141 msgid "Toggle system groups and users" msgstr "Переключить видимость системных пользователей и групп" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:143 msgid "Password mismatch" msgstr "Несовпадение паролей" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:144 msgid "Password must be at least" msgstr "Пароль должен состоять из как минимум" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:144 msgid "characters" msgstr "символов" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:146 msgid "" "Days until\n" "warning" @@ -527,7 +536,7 @@ msgstr "" "Дней до\n" "предупреждения" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:147 msgid "" "Days\n" "without activity" @@ -535,7 +544,7 @@ msgstr "" "Дней без\n" "активности" -#: source/ubl-strings.h:144 +#: source/ubl-strings.h:148 msgid "" "Shell\n" "path" @@ -543,7 +552,7 @@ msgstr "" "Путь до\n" "оболочки" -#: source/ubl-strings.h:145 +#: source/ubl-strings.h:149 msgid "" "Password has\n" "been changed" @@ -551,7 +560,7 @@ msgstr "" "Пароль\n" "изменён" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:150 msgid "" "Expiration\n" "date" @@ -559,7 +568,7 @@ msgstr "" "Дата\n" "устаревания" -#: source/ubl-strings.h:147 +#: source/ubl-strings.h:151 msgid "" "Password change\n" "interval (min)" @@ -567,7 +576,7 @@ msgstr "" "Интервал смены\n" "пароля (мин.)" -#: source/ubl-strings.h:148 +#: source/ubl-strings.h:152 msgid "" "Password change\n" "interval (max)" @@ -575,215 +584,215 @@ msgstr "" "Интервал смены\n" "пароля (макс.)" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:155 msgid "Add user" msgstr "Добавить пользователя" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:156 msgid "Configure user" msgstr "Редактировать пользователя" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:157 msgid "Set" msgstr "Задать" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:158 msgid "Empty important field" msgstr "Пустое важное поле" -#: source/ubl-strings.h:155 +#: source/ubl-strings.h:159 msgid "Login must not start with digit" msgstr "Логин не должен начинаться с цифры" -#: source/ubl-strings.h:156 +#: source/ubl-strings.h:160 msgid "Loading has failed" msgstr "Ошибка загрузки" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:161 msgid "Login name" msgstr "Имя логина" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:162 msgid "Additional groups:" msgstr "Дополнительные группы:" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:163 msgid "Password configuration" msgstr "Конфигурация пароля" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:164 msgid "Password has been changed:" msgstr "Пароль изменён:" -#: source/ubl-strings.h:161 +#: source/ubl-strings.h:165 msgid "expiration date:" msgstr "Дата устаревания:" -#: source/ubl-strings.h:162 +#: source/ubl-strings.h:166 msgid "Password change interval: minimum" msgstr "Интервал смены пароля: минимум" -#: source/ubl-strings.h:163 +#: source/ubl-strings.h:167 msgid "days, maximum" msgstr "дней, максимум" -#: source/ubl-strings.h:164 +#: source/ubl-strings.h:168 msgid "days" msgstr "дней" -#: source/ubl-strings.h:165 +#: source/ubl-strings.h:169 msgid "Days until warning:" msgstr "Дней до предупреждения:" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:170 msgid "Days without activity:" msgstr "Дней без активности:" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:171 msgid "Force change at next login" msgstr "Принудительно сменить при следующем входе в систему" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:172 msgid "User shell:" msgstr "Оболочка пользователя:" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:173 msgid "Home directory:" msgstr "Домашний каталог:" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:174 msgid "Don't set" msgstr "Не создавать" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:175 msgid "Create system user" msgstr "Создать системного пользователя" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:176 msgid "Create user with ununique (repeating) UID" msgstr "Создать пользователя с повторяющимися (не уникальными) UID" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:177 msgid "Do not check login for compliance with character rules" msgstr "Не проверять логин на несоответствие правилам использования символов" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:178 msgid "Temporary deactivation" msgstr "Временное отключение учётной записи" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:179 msgid "Save" msgstr "Сохранить" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:180 msgid "login_name" msgstr "Имя_логина" -#: source/ubl-strings.h:177 +#: source/ubl-strings.h:181 msgid "group_name" msgstr "Имя_группы" -#: source/ubl-strings.h:178 +#: source/ubl-strings.h:182 msgid "User name" msgstr "Имя пользователя" -#: source/ubl-strings.h:179 +#: source/ubl-strings.h:183 msgid "Sync user" msgstr "Синхронизировать пользователя" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:184 msgid "Sync user with password" msgstr "Синхронизировать пользователя с паролем" -#: source/ubl-strings.h:181 +#: source/ubl-strings.h:185 msgid "Encrypt all passwords" msgstr "Зашифровать все пароли" -#: source/ubl-strings.h:183 +#: source/ubl-strings.h:187 msgid "User configuration" msgstr "Настройка пользователя" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:188 msgid "User configuration synchronization" msgstr "Синхронизация настроек пользователя" -#: source/ubl-strings.h:185 +#: source/ubl-strings.h:189 msgid "During system startup, load the user from the configuration" msgstr "" "При запуске операционной системы применять настройки пользователя из " "конфигурации" -#: source/ubl-strings.h:186 +#: source/ubl-strings.h:190 msgid "When shutting down the system, save the user into the configuration" msgstr "" "При завершении работы операционной системы сохранить настройки пользователя " "в конфигурацию" -#: source/ubl-strings.h:187 +#: source/ubl-strings.h:191 msgid "User password configuration syncronization" msgstr "Синхронизация настроек пароля пользователя" -#: source/ubl-strings.h:188 +#: source/ubl-strings.h:192 msgid "" "During system startup, load the user's parameters from the configuration" msgstr "При загрузке системы загрузить параметры пользователя из конфигурации" -#: source/ubl-strings.h:189 +#: source/ubl-strings.h:193 msgid "" "When shutting down the system, save the user's parameters into the " "configuration" msgstr "" "При завершении работы системы сохранить параметры пользователя в конфигурацию" -#: source/ubl-strings.h:191 +#: source/ubl-strings.h:195 msgid "Basic" msgstr "Основные" -#: source/ubl-strings.h:192 +#: source/ubl-strings.h:196 msgid "Additional" msgstr "Дополнительные" -#: source/ubl-strings.h:193 +#: source/ubl-strings.h:197 msgid "Syncronization" msgstr "Синхронизация" -#: source/ubl-strings.h:195 +#: source/ubl-strings.h:199 msgid "Not specified" msgstr "Не задан" -#: source/ubl-strings.h:197 +#: source/ubl-strings.h:201 msgid "UID already exists in configuration" msgstr "UID уже существует в конфигурации" -#: source/ubl-strings.h:198 +#: source/ubl-strings.h:202 msgid "UID already exists in system" msgstr "UID уже существует в системе" -#: source/ubl-strings.h:199 +#: source/ubl-strings.h:203 msgid "GID already exists in configuration" msgstr "GID уже существует в конфигурации" -#: source/ubl-strings.h:200 +#: source/ubl-strings.h:204 msgid "GID already exists in system" msgstr "GID уже существует в системе" -#: source/ubl-strings.h:203 +#: source/ubl-strings.h:207 msgid "Repeat password:" msgstr "Подтверждение пароля:" -#: source/ubl-strings.h:204 +#: source/ubl-strings.h:208 msgid "Password hash:" msgstr "Хэш пароля:" -#: source/ubl-strings.h:205 +#: source/ubl-strings.h:209 msgid "Do not encrypt password" msgstr "Не шифровать пароль" -#: source/ubl-strings.h:208 +#: source/ubl-strings.h:212 msgid "Additional configuration of service parameter saving" msgstr "Дополнительные настройки сохранения параметров сервисов" -#: source/ubl-strings.h:209 +#: source/ubl-strings.h:213 msgid "" "At every system shutdown save changes of (root)/var/lib/samba\n" "into (hd)/ublinux-data/rootcopy" @@ -791,54 +800,54 @@ msgstr "" "При каждом завершении работы ОС сохранять изменения (root)/var/lib/samba\n" "в (hd)/ublinux-data/rootcopy/" -#: source/ubl-strings.h:210 +#: source/ubl-strings.h:214 msgid "For system save mode \"Sandbox\"" msgstr "Для режима сохранения системы \"Песочница\"" -#: source/ubl-strings.h:213 +#: source/ubl-strings.h:217 msgid "Group deletion" msgstr "Удаление групп(-ы)" -#: source/ubl-strings.h:214 +#: source/ubl-strings.h:218 msgid "Confirm group(-s) deletion:" msgstr "Подтвердите удаление групп(-ы):" -#: source/ubl-strings.h:216 +#: source/ubl-strings.h:220 msgid "User deletion" msgstr "Удаление пользователя(-ей)" -#: source/ubl-strings.h:217 +#: source/ubl-strings.h:221 msgid "Confirm user(-s) deletion:" msgstr "Подтвердите удаление пользователя (-ей):" -#: source/ubl-strings.h:218 +#: source/ubl-strings.h:222 msgid "Chosen" msgstr "Выбран" -#: source/ubl-strings.h:219 +#: source/ubl-strings.h:223 msgid "User" msgstr "Пользователь" -#: source/ubl-strings.h:220 +#: source/ubl-strings.h:224 msgid "Home directory" msgstr "Домашний каталог" -#: source/ubl-strings.h:221 +#: source/ubl-strings.h:225 msgid "Delete home directory" msgstr "Удалить домашний каталог" -#: source/ubl-strings.h:223 +#: source/ubl-strings.h:227 msgid "Configuration users" msgstr "Пользователи конфигурации" -#: source/ubl-strings.h:224 +#: source/ubl-strings.h:228 msgid "Configuration groups" msgstr "Группы конфигурации" -#: source/ubl-strings.h:225 +#: source/ubl-strings.h:229 msgid "System users" msgstr "Пользователи системы" -#: source/ubl-strings.h:226 +#: source/ubl-strings.h:230 msgid "System groups" msgstr "Группы системы" From f39c95fe9183c1a034517f9c885600b16dc24663 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 11:13:46 +0600 Subject: [PATCH 25/72] Fixed user saving --- source/ubl-settings-usergroups.c | 47 ++++++++++++++++---------------- source/ubl-settings-usergroups.h | 1 + 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 53b7b04..46c7559 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -241,6 +241,22 @@ void yon_accept_changes(){ main_config.homes_size=0; } +char *yon_char_parsed_to_string_include_empty(config_str parsed, int parsed_size, char *divider){ + if (parsed && parsed_size>0){ + char *final = NULL; + char *temp; + for (int i=0;ilist); GtkTreeIter iter; @@ -261,11 +277,11 @@ void yon_hide_passwords(template_saving_window *window){ free(new_value); free(parsed[5]); parsed[5]=yon_char_new("*******"); - new_value = yon_char_parsed_to_string(parsed,size,":"); + new_value = yon_char_parsed_to_string_include_empty(parsed,size,":"); } else if (size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")) { free(new_value); free(yon_char_divide(parsed[5],1)); - new_value = yon_char_parsed_to_string(parsed,size,":"); + new_value = yon_char_parsed_to_string_include_empty(parsed,size,":"); } if (parsed){ yon_char_parsed_free(parsed,size); @@ -278,10 +294,10 @@ void yon_hide_passwords(template_saving_window *window){ free(old_value); free(parsed[5]); parsed[5]=yon_char_new("*******"); - old_value = yon_char_parsed_to_string(parsed,size,":"); + old_value = yon_char_parsed_to_string_include_empty(parsed,size,":"); } else if (size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")) { free(old_value); - old_value = yon_char_parsed_to_string(parsed,size,":"); + old_value = yon_char_parsed_to_string_include_empty(parsed,size,":"); } if (parsed){ yon_char_parsed_free(parsed,size); @@ -306,7 +322,7 @@ void yon_hide_passwords(template_saving_window *window){ free(parsed[4]); parsed[4]=yon_char_new("*******"); } - new_value = yon_char_parsed_to_string(parsed,size,":"); + new_value = yon_char_parsed_to_string_include_empty(parsed,size,":"); } if(!yon_char_is_empty(old_value)){ config_str parsed = NULL; @@ -315,11 +331,11 @@ void yon_hide_passwords(template_saving_window *window){ free(old_value); free(parsed[4]); parsed[4]=yon_char_new("*******"); - old_value = yon_char_parsed_to_string(parsed,size,":"); + old_value = yon_char_parsed_to_string_include_empty(parsed,size,":"); } else if (size>4&&!yon_char_is_empty(parsed[4])&&strcmp(parsed[4],"x")) { free(old_value); free(yon_char_divide(parsed[4],1)); - old_value = yon_char_parsed_to_string(parsed,size,":"); + old_value = yon_char_parsed_to_string_include_empty(parsed,size,":"); } if (parsed){ yon_char_parsed_free(parsed,size); @@ -450,22 +466,7 @@ void on_config_local_save(GtkWidget *, main_window *){ if (parsed_size>5&&!yon_char_is_empty(parsed[5])){ yon_char_parsed_add_or_create_if_exists(passwords,&passw_size,yon_char_new(parsed[5])); parsed = yon_char_parsed_rip(parsed,&parsed_size,5); - char *final_string = NULL; - { - - if (parsed && parsed_size>0){ - char *final = NULL; - char *temp; - for (int i=0;i Date: Wed, 15 Jan 2025 11:27:38 +0600 Subject: [PATCH 26/72] Fixed standard group saving --- source/ubl-settings-usergroups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 46c7559..364f979 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1461,7 +1461,7 @@ return window; } void on_standard_groups_accept(GtkWidget *self, ubl_settings_usergroups_group_window *window){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(window->list); int valid = gtk_tree_model_get_iter_first(model,&iter); From 16601547673f5bd04c1b8a8f2179bb341734c493 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 11:30:58 +0600 Subject: [PATCH 27/72] USERADD_SYNC[] parameter unwanted coma fix --- source/ubl-settings-usergroups-user.c | 2 +- source/ubl-settings-usergroups.c | 27 --------------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index 8b8f2e0..b7a8641 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -425,7 +425,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ char *useradd_sync_string = NULL; - useradd_sync_string = yon_char_unite(useradd_boot,!yon_char_is_empty(useradd_boot)?",":"",useradd_shutdown,NULL); + useradd_sync_string = yon_char_unite(useradd_boot,!yon_char_is_empty(useradd_boot)&&!yon_char_is_empty(useradd_shutdown)?",":"",useradd_shutdown,NULL); char *usershadow_sync_string = NULL; usershadow_sync_string = yon_char_unite(usershadow_boot,!yon_char_is_empty(usershadow_boot)?",":"",usershadow_shutdown,NULL); char *shadow_string = NULL; diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 364f979..e8deee5 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1083,33 +1083,6 @@ void on_expiration_clicked(GtkWidget *, ubl_settings_usergroups_user_window *win yon_char_parsed_free(hash_algos,hash_size); } -// void on_users_boot_toggled(GtkToggleButton *self){ -// if (gtk_toggle_button_get_active(self)){ -// char *parameter = yon_config_get_by_key(USERADD_SYNC_parameter); -// if (!parameter){ -// yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_parameter_command,"boot"); -// } else { -// yon_config_append(USERADD_SYNC_parameter,"boot",","); -// } -// } else { -// yon_config_remove_element(USERADD_SYNC_parameter,"boot",","); -// } -// } - -// void on_users_shutdown_toggled(GtkToggleButton *self){ -// if (gtk_toggle_button_get_active(self)){ -// char *parameter = yon_config_get_by_key(USERADD_SYNC_parameter); -// if (!parameter){ -// yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_parameter_command,"shutdown"); -// } else { -// yon_config_append(USERADD_SYNC_parameter,"shutdown",","); -// } -// } else { -// yon_config_remove_element(USERADD_SYNC_parameter,"shutdown",","); -// } -// } - - void on_user_choose(GtkWidget *, GtkEntry *target){ ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(1); gtk_widget_hide(window->DefaultCheck); From 2895c733fde6cf699b508f4e8d893c4ddf22495c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 11:39:58 +0600 Subject: [PATCH 28/72] Localisation update --- source/ubl-strings.h | 4 +++- ubl-settings-usergroups.pot | 8 ++++++++ ubl-settings-usergroups_ru.po | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 6a8cf7c..b862035 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -227,4 +227,6 @@ #define CONFIG_USERS_TAB_LABEL _("Configuration users") #define CONFIG_GROUPS_TAB_LABEL _("Configuration groups") #define SYSTEM_USERS_TAB_LABEL _("System users") -#define SYSTEM_GROUPS_TAB_LABEL _("System groups") \ No newline at end of file +#define SYSTEM_GROUPS_TAB_LABEL _("System groups") +#define SYSTEM_REMOVE_FROM_CONFIG_LABEL _("Remove from system") +#define SYSTEM_REMOVE_FROM_SYSTEM_LABEL _("Remove from configuration") \ No newline at end of file diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index 74b6c64..df5a488 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -792,3 +792,11 @@ msgstr "" #: source/ubl-strings.h:230 msgid "System groups" msgstr "" + +#: source/ubl-strings.h:231 +msgid "Remove from system" +msgstr "" + +#: source/ubl-strings.h:232 +msgid "Remove from configuration" +msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 1eb9a74..3639c9a 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -851,3 +851,11 @@ msgstr "Пользователи системы" #: source/ubl-strings.h:230 msgid "System groups" msgstr "Группы системы" + +#: source/ubl-strings.h:231 +msgid "Remove from system" +msgstr "Удалить из системы" + +#: source/ubl-strings.h:232 +msgid "Remove from configuration" +msgstr "Удалить из конфигурации" From e0028cbe0cee6755acbbc4e35a9089ae884d1193 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 14:18:33 +0600 Subject: [PATCH 29/72] Localisation fixes --- source/ubl-settings-usergroups.c | 4 ++-- source/ubl-strings.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index e8deee5..43fdec0 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -2212,7 +2212,7 @@ void on_main_delete(GtkWidget *, main_window *widgets){ if (config(GROUPADD(target))){ system_remove_confirmation_window *window = yon_system_remove_confirmation_window_new(); yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DELETE_CONFIRMATION_TITLE_LABEL,icon_path,"group-deletion-window"); - gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target)); + gtk_label_set_markup(GTK_LABEL(window->TitleLabel),SYSTEM_GROUP_CONFIG_REMOVE_CONFIRMATION_LABEL(target)); dictionary *dict = NULL; yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); @@ -2485,13 +2485,13 @@ main_window *yon_main_window_complete(main_window *widgets){ yon_window_config_add_listener((GtkWidget*)g_list_nth_data(list,i),yon_char_append("GroupColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT); } g_list_free(list); - yon_window_config_load(config_path); yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->UsersTree),1,2,3,-1); yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->GroupsTree),1,2,-1); yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemTree),1,2,3,-1); yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemGroupsTree),1,2,-1); + yon_window_config_load(config_path); yon_save_window_set_postsave_function(on_save_done,widgets); yon_save_window_set_postsave_failure_function(on_save_failed,widgets); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index b862035..0bc7e12 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -229,4 +229,7 @@ #define SYSTEM_USERS_TAB_LABEL _("System users") #define SYSTEM_GROUPS_TAB_LABEL _("System groups") #define SYSTEM_REMOVE_FROM_CONFIG_LABEL _("Remove from system") -#define SYSTEM_REMOVE_FROM_SYSTEM_LABEL _("Remove from configuration") \ No newline at end of file +#define SYSTEM_REMOVE_FROM_SYSTEM_LABEL _("Remove from configuration") + +#define GROUP_REMOVE_ERROR _("Group deletion has failed") +#define USER_REMOVE_ERROR _("User deletion has failed") \ No newline at end of file From a35bd634772eedc6d6be990bd39802e4394bd735 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 14:25:08 +0600 Subject: [PATCH 30/72] Localisation update --- source/ubl-settings-usergroups-system.c | 18 ++++++++++++++++-- ubl-settings-usergroups.pot | 8 ++++++++ ubl-settings-usergroups_ru.po | 9 +++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index 9bbe361..d326e44 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -14,7 +14,14 @@ void on_delete_system_user(GtkWidget *, dictionary *dict){ else command = delete_home_status?remove_user_and_homedir_from_system_command(target):remove_user_from_system_command(target); } if (!yon_char_is_empty(command)){ - yon_launch(yon_debug_output("%s\n",command)); + if (system(yon_debug_output("%s\n",command))){ + yon_ubl_status_box_render(USER_REMOVE_ERROR,BACKGROUND_IMAGE_FAIL_TYPE); + } else { + + textdomain(template_ui_LocaleName); + yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + textdomain(LocalePath); + } } on_subwindow_close(dialog->Window); yon_system_load(widgets); @@ -34,7 +41,14 @@ void on_delete_system_group(GtkWidget *, dictionary *dict){ else command = remove_group_from_system_command(target); } if (!yon_char_is_empty(command)){ - yon_launch(yon_debug_output("%s\n",command)); + if (system(yon_debug_output("%s\n",command))){ + yon_ubl_status_box_render(USER_REMOVE_ERROR,BACKGROUND_IMAGE_FAIL_TYPE); + } else { + + textdomain(template_ui_LocaleName); + yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + textdomain(LocalePath); + } } on_subwindow_close(dialog->Window); yon_system_load(widgets); diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index df5a488..2d8f29d 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -800,3 +800,11 @@ msgstr "" #: source/ubl-strings.h:232 msgid "Remove from configuration" msgstr "" + +#: source/ubl-strings.h:234 +msgid "Group deletion has failed" +msgstr "" + +#: source/ubl-strings.h:235 +msgid "User deletion has failed" +msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 3639c9a..5930499 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -859,3 +859,12 @@ msgstr "Удалить из системы" #: source/ubl-strings.h:232 msgid "Remove from configuration" msgstr "Удалить из конфигурации" + +#: source/ubl-strings.h:234 +msgid "Group deletion has failed" +msgstr "Удаление группы завершено с ошибкой" + +#: source/ubl-strings.h:235 +#, fuzzy +msgid "User deletion has failed" +msgstr "Удаление пользователя завершено с ошибкой" From 469cd5a3965f564441dbed546402deef496bad9a Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 15:07:00 +0600 Subject: [PATCH 31/72] Fixed group syncing with config --- source/ubl-settings-usergroups-user.c | 2 +- ubl-settings-usergroups_ru.po | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index b7a8641..ce9bdf3 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -587,7 +587,7 @@ void on_user_sync_with_config(GtkWidget *,main_window *widgets){ int group_shadow_size=0; config_str parsed = yon_char_parse(group,&group_size,":"); config_str parsed_shadow = yon_char_parse(group_shadow,&group_shadow_size,":"); - char *config_group = yon_char_unite(parsed[0],":",parsed[3],":",parsed[2],"::",parsed_shadow[2],":",strcmp(parsed[1],"x")?parsed[1]:parsed_shadow[1],NULL); + char *config_group = yon_char_unite(parsed[3],":",parsed[2],"::",parsed_shadow[2],":",strcmp(parsed[1],"x")?parsed[1]:parsed_shadow[1],NULL); if (!yon_char_is_empty(config_group)){ char *group_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD(target)); diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 5930499..3515d58 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -865,6 +865,5 @@ msgid "Group deletion has failed" msgstr "Удаление группы завершено с ошибкой" #: source/ubl-strings.h:235 -#, fuzzy msgid "User deletion has failed" msgstr "Удаление пользователя завершено с ошибкой" From faeb42a8d1b78a608fb381f00e818f7eaf36c3e7 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 15 Jan 2025 15:09:30 +0600 Subject: [PATCH 32/72] Fixed succeeded operation status background color --- source/ubl-settings-usergroups-system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups-system.c b/source/ubl-settings-usergroups-system.c index d326e44..1360c1c 100644 --- a/source/ubl-settings-usergroups-system.c +++ b/source/ubl-settings-usergroups-system.c @@ -19,7 +19,7 @@ void on_delete_system_user(GtkWidget *, dictionary *dict){ } else { textdomain(template_ui_LocaleName); - yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); textdomain(LocalePath); } } @@ -46,7 +46,7 @@ void on_delete_system_group(GtkWidget *, dictionary *dict){ } else { textdomain(template_ui_LocaleName); - yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_render(SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); textdomain(LocalePath); } } From c7cca4571f16633ef0aa1914f171bd58c8edcff9 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Jan 2025 10:40:46 +0600 Subject: [PATCH 33/72] Fixed groups output at main window --- source/ubl-settings-usergroups-user.c | 6 +++++- source/ubl-settings-usergroups.c | 16 ++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index ce9bdf3..4cb25db 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -587,7 +587,11 @@ void on_user_sync_with_config(GtkWidget *,main_window *widgets){ int group_shadow_size=0; config_str parsed = yon_char_parse(group,&group_size,":"); config_str parsed_shadow = yon_char_parse(group_shadow,&group_shadow_size,":"); - char *config_group = yon_char_unite(parsed[3],":",parsed[2],"::",parsed_shadow[2],":",strcmp(parsed[1],"x")?parsed[1]:parsed_shadow[1],NULL); + char *config_group = yon_char_unite(yon_char_return_if_exist(parsed[3],""), + ":",yon_char_return_if_exist(parsed[2],""), + "::",yon_char_return_if_exist(parsed_shadow[2],""), + ":",strcmp(parsed[1],"x")?yon_char_return_if_exist(parsed[1],""):yon_char_return_if_exist(parsed_shadow[1],""), + NULL); if (!yon_char_is_empty(config_group)){ char *group_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD(target)); diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 43fdec0..e1112e7 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -158,6 +158,8 @@ void yon_interface_update(main_window *widgets){ if (parameters_size>4&&strcmp(parameters[4],"x")&&strcmp(parameters[4],"")){ if (!check_is_password_hash(parameters[4])&¶meters[4][0]!='%'&¶meters[4][1]!='%'){ pars = ENCRYPTED_LABEL; + } else if (!strcmp(parameters[4],"!*")){ + pars = NO_PASSWORD_LABEL; } else { pars = UNENCRYPTED_LABEL; @@ -168,8 +170,8 @@ void yon_interface_update(main_window *widgets){ } gtk_list_store_set(widgets->GroupsList,&iter, 1,login, - 0,parameters_size>2?parameters[2]:"", - 2,parameters_size>1?parameters[1]:"", + 0,parameters_size>2?parameters[1]:"", + 2,parameters_size>1?parameters[0]:"", 3,parameters_size>3?parameters[3]:"", 4,pars, -1); @@ -1188,7 +1190,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){ } - if (strcmp(gid,window->last_gid)){ + if (!yon_char_is_empty(window->last_gid)&&strcmp(gid,window->last_gid)){ int config_size=0; int final_size=0; config_str config_users = yon_config_get_all_by_key(GROUPADD_SEARCH_macro,&config_size); @@ -1231,12 +1233,6 @@ void on_group_save(GtkWidget *self, dictionary *dict){ } group_users = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry)); - if (yon_char_is_empty(group_users)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); - yon_ubl_status_highlight_incorrect(window->userGroupsEntry); - return; - } admins = (char*)gtk_entry_get_text(GTK_ENTRY(window->AdminGroupsEntry)); int non_unique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UnuniqueGIDCheck)); @@ -2135,7 +2131,7 @@ void on_main_edit(GtkWidget *, main_window *widgets){ } } if (size>4){ - if (strcmp(parsed[4],"")&&strcmp(parsed[4],"x")){ + if (!yon_char_is_empty(parsed[4])&&strcmp(parsed[4],"x")){ gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),parsed[4]); gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),2); } else { From f387a71d5fe5649cea92ff15caae29fd12aea45f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Jan 2025 10:53:43 +0600 Subject: [PATCH 34/72] Group password parsing fixes --- source/ubl-settings-usergroups.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index e1112e7..2b18554 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1255,7 +1255,9 @@ void on_group_save(GtkWidget *self, dictionary *dict){ int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordCombo)); - if (password_active > 1){ + if (password_active == 1) { + password = "!*"; + } else if (password_active == 2){ password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); if (yon_char_is_empty(password)){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); @@ -2131,12 +2133,17 @@ void on_main_edit(GtkWidget *, main_window *widgets){ } } if (size>4){ - if (!yon_char_is_empty(parsed[4])&&strcmp(parsed[4],"x")){ - gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),parsed[4]); - gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),2); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),0); + if (!yon_char_is_empty(parsed[4])){ + if (!strcmp(parsed[4],"!*")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),1); + gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),""); + } else if (strcmp(parsed[4],"x")){ + gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),parsed[4]); + gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),2); + } } + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),0); } char *sync = yon_config_get_by_key(GROUPADD_SYNC(name)); if (sync){ From 412de0caa14625fdc57192facf6288fbe1cc782f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Jan 2025 11:06:36 +0600 Subject: [PATCH 35/72] Fixed group syncing parsing for group edit window --- source/ubl-settings-usergroups.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 2b18554..9dc4d07 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -2096,6 +2096,7 @@ void on_main_edit(GtkWidget *, main_window *widgets){ char *name; gtk_tree_model_get(model,&iter,1,&name,-1); char *config_string = yon_config_get_by_key(GROUPADD(name)); + char *sync_string = config(GROUPADD_SYNC(name)); if (!yon_char_is_empty(config_string)){ if (config_string[0]=='\"') yon_char_divide(config_string,0); if (config_string[strlen(config_string)-1]=='\"') config_string[strlen(config_string)-1]='\0'; @@ -2152,7 +2153,11 @@ void on_main_edit(GtkWidget *, main_window *widgets){ } else { yon_ubl_status_box_render(LOADING_FAILED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); } - + if (!yon_char_is_empty(sync_string)){ + if (!strcmp(sync_string,"shutdown")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->GroupaddShutdownCheck),1); + } + } gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(widgets->Window)); gtk_widget_show(window->CreateGroupWindow); } From 4fbc53c8ee86c7fb64dd0b5f86f9564883d207f9 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Jan 2025 11:20:56 +0600 Subject: [PATCH 36/72] Localisation update --- ubl-settings-usergroups_ru.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 3515d58..2bb132e 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -265,7 +265,7 @@ msgstr "" #: source/ubl-strings.h:62 source/ubl-strings.h:64 msgid "from the system?" -msgstr "из системы" +msgstr "из системы?" #: source/ubl-strings.h:63 msgid "" From 9ad96556123d7c55f9f8adafba755b3338be8ea6 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Jan 2025 12:53:24 +0600 Subject: [PATCH 37/72] Fixes --- source/ubl-settings-usergroups.c | 4 ++-- ubl-settings-usergroups.css | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 9dc4d07..3d62acd 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1268,11 +1268,11 @@ void on_group_save(GtkWidget *self, dictionary *dict){ } else { password=""; } - final_string = yon_char_unite(yon_char_return_if_exist(group_users,"x"), + final_string = yon_char_unite(yon_char_return_if_exist(group_users,""), ":",yon_char_return_if_exist(gid,"x"), ":",yon_char_return_if_exist(non_unique,""), yon_char_return_if_exist(gsystem,""), - ":",yon_char_return_if_exist(admins,"x"), + ":",yon_char_return_if_exist(admins,""), ":",yon_char_return_if_exist(password,"x"), NULL); char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD_SYNC(group_name)); diff --git a/ubl-settings-usergroups.css b/ubl-settings-usergroups.css index a98861a..4c6fa9a 100644 --- a/ubl-settings-usergroups.css +++ b/ubl-settings-usergroups.css @@ -16,6 +16,14 @@ background:transparent; color: @theme_text_color; } +.bggrey{ + border-radius:5px; + border-color:@theme_text_color; + border-style:solid; + border-width:0.3px; + box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15); +} + .inherited>* { border:none; background:inherit; From 52d3e2cef6b2c223f1881d16cc8bdf053f2edaeb Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Jan 2025 15:05:04 +0600 Subject: [PATCH 38/72] Group deletion fix --- source/ubl-settings-usergroups.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 3d62acd..d826f6c 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -620,32 +620,15 @@ void yon_group_delete_confirmation_save(GtkWidget *self, dictionary *dict){ int delete; gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&delete,1,&name_check,-1); if (!strcmp(name,name_check)&&delete){ - gtk_list_store_remove(widgets->GroupsList,&iter); yon_config_remove_by_key(GROUPADD(name)); - gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter); + yon_config_remove_by_key(GROUPADD_SYNC(name)); + valid=0; + break; } } } - char *name; - if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter)){ - gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,1,&name,-1); - int valid2 = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar); - for (;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itar)){ - char *name_check; - int status,delete; - gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&delete,1,&name_check,3,&status,-1); - if (!strcmp(name,name_check)&&delete){ - gtk_list_store_remove(widgets->GroupsList,&iter); - yon_config_remove_by_key(GROUPADD(name)); - gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter); - if (status){ - if (yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,name)==-1){ - yon_char_parsed_add_or_create_if_exists(main_config.remove_homes,&main_config.homes_size,name); - } - } - } - } - } + yon_interface_update(widgets); + on_subwindow_close(self); } From 7f013f6ad0cea057b6c9eef12eac6cf7b8ad88ed Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Jan 2025 15:10:59 +0600 Subject: [PATCH 39/72] Fixed GROUPADD_SYNC deletion --- source/ubl-settings-usergroups.c | 2 +- source/ubl-settings-usergroups.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index d826f6c..2ac5912 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -135,7 +135,7 @@ void yon_interface_update(main_window *widgets){ } free(users); } - config_str groups = yon_config_get_all_by_key(GROUPADD_parameter,&size); + config_str groups = yon_config_get_all_by_key(GROUPADD_SEARCH_macro,&size); if (groups){ for (int i=0;iGroupsList,&iter); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 00d122a..e216f46 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -89,7 +89,7 @@ #define password_hash_get_command(passwd) yon_char_append("mkpasswd2 ",passwd) -#define config_get_command(source) yon_char_unite("ubconfig --source ",source," get users DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERADD_SYNC USERADD_SYNC[*] USERSHADOW[*] USERSHADOW_SYNC[*] GROUPADD[*]",NULL),yon_char_unite("ubconfig --source ",source," get [system] SYSTEMBOOT_STATEMODE",NULL),yon_char_unite("ubconfig --source ",source," get [save] SAVE_ROOTCOPY_CHANGES",NULL) +#define config_get_command(source) yon_char_unite("ubconfig --source ",source," get users DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERADD_SYNC USERADD_SYNC[*] USERSHADOW[*] USERSHADOW_SYNC[*] GROUPADD[*] GROUPADD_SYNC[*] GROUPADD_SYNC",NULL),yon_char_unite("ubconfig --source ",source," get [system] SYSTEMBOOT_STATEMODE",NULL),yon_char_unite("ubconfig --source ",source," get [save] SAVE_ROOTCOPY_CHANGES",NULL) #define config_get_default_command "ubconfig --source default get users DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM" #define config_get_global_only_parameters "ubconfig --source global get users DEFAULTPASSWD DEFAULTROOTPASSWD" From 8b55f1158327b0551546bde53110643f65111fca Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 16 Jan 2025 16:42:28 +0600 Subject: [PATCH 40/72] Menus has been added for system users and groups tables --- source/ubl-settings-usergroups.c | 2 + source/ubl-settings-usergroups.h | 1 + source/ubl-strings.h | 1 + ...tings-usergroups-additional-settings.glade | 220 ++++++++++++++- ubl-settings-usergroups.glade | 2 +- ubl-settings-usergroups.pot | 266 +++++++++--------- ubl-settings-usergroups_ru.po | 266 +++++++++--------- 7 files changed, 491 insertions(+), 267 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 2ac5912..847aa3e 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -2450,6 +2450,8 @@ main_window *yon_main_window_complete(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->LoadCustomMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets); widgets->UsersMenu = yon_rmb_menu_setup(widgets->UsersTree,(RmbCheck)yon_element_chosen,widgets->UsersTree,CREATE_NEW_LABEL,add_icon_name,G_CALLBACK(on_main_add),widgets,EDIT_LABEL,edit_icon_name,G_CALLBACK(on_main_edit),widgets, REMOVE_LABEL,delete_icon_name,G_CALLBACK(on_main_delete),widgets,NULL); widgets->GroupsMenu = yon_rmb_menu_setup(widgets->GroupsTree,(RmbCheck)yon_element_chosen,widgets->GroupsTree,CREATE_NEW_LABEL,add_icon_name,G_CALLBACK(on_main_add),widgets,EDIT_LABEL,edit_icon_name,G_CALLBACK(on_main_edit),widgets,REMOVE_LABEL,delete_icon_name,G_CALLBACK(on_main_delete),widgets,NULL); + widgets->GroupsMenu = yon_rmb_menu_setup(widgets->SystemTree,(RmbCheck)yon_element_chosen,widgets->GroupsTree,SYNC_TOOLTIP_LABEL,sync_icon_name,G_CALLBACK(on_user_sync_with_config),widgets,REMOVE_LABEL,delete_icon_name,G_CALLBACK(on_main_delete),widgets,NULL); + widgets->GroupsMenu = yon_rmb_menu_setup(widgets->SystemGroupsTree,(RmbCheck)yon_element_chosen,widgets->GroupsTree,SYNC_TOOLTIP_LABEL,sync_icon_name,G_CALLBACK(on_user_sync_with_config),widgets,REMOVE_LABEL,delete_icon_name,G_CALLBACK(on_main_delete),widgets,NULL); g_signal_connect(G_OBJECT(widgets->UsersTree),"button-press-event",G_CALLBACK(on_menu_open),widgets->UsersMenu); g_signal_connect(G_OBJECT(widgets->GroupsTree),"button-press-event",G_CALLBACK(on_menu_open),widgets->GroupsMenu); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index e216f46..cc74f21 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -86,6 +86,7 @@ #define add_icon_name "com.ublinux.ubl-settings-usergroups.increase-symbolic" #define edit_icon_name "com.ublinux.ubl-settings-usergroups.edit-symbolic" #define delete_icon_name "com.ublinux.ubl-settings-usergroups.trash-symbolic" +#define sync_icon_name "com.ublinux.ubl-settings-usergroups.user-add-symbolic" #define password_hash_get_command(passwd) yon_char_append("mkpasswd2 ",passwd) diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 0bc7e12..15f854a 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -64,6 +64,7 @@ #define SYSTEM_GROUP_SYSTEM_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This group doesn't exist in configuration. Are you sure want to remove group")," ",target," ", _("from the system?"),NULL) #define SYSTEM_GROUP_CONFIG_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("This group exists in configuration and system. Are you sure want to remove group")," ",target,"", "?",NULL) +#define SYNC_TOOLTIP_LABEL _("Syncronize with configuration") //ubl-settings-usergroups-additional-settings.glade #define ADDITIONAL_SETTINGS_TITLE_LABEL _("Additional settings") diff --git a/ubl-settings-usergroups-additional-settings.glade b/ubl-settings-usergroups-additional-settings.glade index 7618860..4f83b00 100644 --- a/ubl-settings-usergroups-additional-settings.glade +++ b/ubl-settings-usergroups-additional-settings.glade @@ -3,6 +3,17 @@ + + + + + + + + + + + True False @@ -394,8 +405,109 @@ - - While shutdown, save the settings of all users with UID>=1000 to the configuration + + True + False + 0 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + While shutdown, save the settings of all users with UID>=1000 to the configuration + + + False + True + 0 + + + + + True + True + + + False + True + end + 1 + + + + + False + True + 0 + + + + + True + False + slide-up + + + True + True + in + 150 + + + True + True + UsersShutdownList + both + + + + + + + False + True + 1 + + + + + + + + + + + + + True + True + 1 + + + + + While booting the operating system, apply the settings of all users from the configuration True True False @@ -404,7 +516,107 @@ False True - 1 + 2 + + + + + True + False + 0 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + 5 + + + True + False + + + True + False + While shutdown, save the settings of all users with UID>=1000 to the configuration + + + False + True + 0 + + + + + True + True + + + False + True + end + 1 + + + + + False + True + 0 + + + + + True + False + slide-up + + + True + True + in + 150 + + + True + True + GroupsShutdownList + both + + + + + + + False + True + 1 + + + + + + + + + + + + + True + True + 3 @@ -425,7 +637,7 @@ - False + True True 1 diff --git a/ubl-settings-usergroups.glade b/ubl-settings-usergroups.glade index 3943708..4ec95c8 100644 --- a/ubl-settings-usergroups.glade +++ b/ubl-settings-usergroups.glade @@ -209,7 +209,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. True True - Additional saving configuration + Syncronize with configuration image5 + + + False + True + 0 + + + + + True + True + True + image7 + + + + False + True + 1 + + + + False + True + 1 + @@ -500,14 +618,14 @@ - True + False True 1 - While booting the operating system, apply the settings of all users from the configuration + While booting the operating system, apply the settings of all groups from the configuration True True False @@ -547,7 +665,7 @@ True False - While shutdown, save the settings of all users with UID>=1000 to the configuration + While shutdown, save the settings of all groups with GID>=1000 to the configuration False @@ -556,7 +674,7 @@ - + True True @@ -580,18 +698,107 @@ False slide-up - + True - True - in - 150 + False + 5 - + True True - GroupsShutdownList - both + in + 150 + + + True + True + GroupsShutdownList + both + + + column + + + + + + + + column + + + + + + + + column + + + + + + + + column + + + + + + + + + + True + True + 0 + + + + + True + False + vertical + 5 + + + True + True + True + image8 + + + + False + True + 0 + + + + + True + True + True + image9 + + + + False + True + 1 + + + + False + True + 1 + @@ -614,7 +821,7 @@ - True + False True 3 From d425bfcdaf866bcd7c8c5d44ad4e6e937e157f26 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 20 Jan 2025 11:22:25 +0600 Subject: [PATCH 47/72] User syncing with every user changes saving --- source/ubl-settings-usergroups-user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index 158958d..f963df7 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -474,6 +474,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ if (!yon_char_is_empty(useradd_sync_string)){ final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD_SYNC(login)); yon_config_register(USERADD_SYNC(login),final_command,useradd_sync_string); + yon_config_compare_ignore_set(USERADD_SYNC(login),1); if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ yon_config_remove_by_key(USERADD_SYNC(window->old_username)); } From 0796e449f6cac4023f926265317f4dab81a433db Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 20 Jan 2025 11:46:38 +0600 Subject: [PATCH 48/72] Changed password window status messages --- source/ubl-settings-usergroups.c | 18 ++---------------- source/ubl-settings-usergroups.h | 1 - 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 99d1f0b..5f8b104 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1515,22 +1515,11 @@ void on_password_show_hide(GtkEntry *self, GtkEntryIconPosition icon_pos, GdkEv } } -void on_password_changed(GtkEntry *, ubl_settings_usergroups_password_window *window){ - char *self_text = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); - char *pair_text = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry)); - if ((!yon_char_is_empty(self_text)&&!yon_char_is_empty(pair_text))&&strcmp(self_text,pair_text)){ - yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_mismatch",PASSWORD_MISMATCH_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); - } else if (strlen(self_text)StatusBox),"password_short",PASSWORD_SHORT_LABEL(yon_char_from_int(main_config.password_min_length)),BACKGROUND_IMAGE_FAIL_TYPE); - } else { - yon_ubl_status_box_despawn_infinite(GTK_CONTAINER(window->StatusBox)); - } -} - void on_password_accept(GtkWidget *self, dictionary *dict){ ubl_settings_usergroups_password_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_password_window*); GtkEntry *entry = yon_dictionary_get_data(dict->first->next,GtkEntry*); char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); + char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry)); if (yon_char_is_empty(password)){ char *pasted_hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry)); if (!yon_char_is_empty(pasted_hash)){ @@ -1553,7 +1542,6 @@ void on_password_accept(GtkWidget *self, dictionary *dict){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_SHORT_LABEL(yon_char_from_int(main_config.password_min_length)),5,BACKGROUND_IMAGE_FAIL_TYPE); return; } - char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry)); if (!strcmp(password,password_check)){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){ char *pasw=yon_char_append("%%",password); @@ -1561,7 +1549,7 @@ void on_password_accept(GtkWidget *self, dictionary *dict){ } gtk_entry_set_text(GTK_ENTRY(entry),password); } else { - yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_mismatch",PASSWORD_MISMATCH_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); return; } } @@ -1588,8 +1576,6 @@ ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_ne g_signal_connect(G_OBJECT(window->PasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); g_signal_connect(G_OBJECT(window->PasswordHashEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); - g_signal_connect(G_OBJECT(window->PasswordEntry),"changed",G_CALLBACK(on_password_changed),window); - g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"changed",G_CALLBACK(on_password_changed),window); gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),PASSWORD_TITLE_LABEL); return window; diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index a8bf6f3..7f9098e 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -501,7 +501,6 @@ ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(int void on_standard_groups_accept(GtkWidget *self, ubl_settings_usergroups_group_window *window); void on_standard_groups_open(GtkWidget *self, main_window *widgets); void on_password_show_hide(GtkEntry *self, GtkEntryIconPosition icon_pos, GdkEvent* event); -void on_password_changed(GtkEntry *self, ubl_settings_usergroups_password_window *window); void on_password_accept(GtkWidget *self, dictionary *dict); ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(); void yon_system_load(main_window *window); From 686377d0ec5cc472df3871bd685b5813974b3415 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 20 Jan 2025 13:39:25 +0600 Subject: [PATCH 49/72] Group syncing with every group changes saving --- source/ubl-settings-usergroups.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 5f8b104..376fd5f 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1248,6 +1248,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){ if (shutdown_sync_active){ char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD_SYNC(group_name)); yon_config_register(GROUPADD_SYNC(group_name),final_command,"shutdown"); + yon_config_compare_ignore_set(GROUPADD_SYNC(group_name),1); } else { yon_config_remove_by_key(GROUPADD_SYNC(group_name)); } From f5d79b92653503c26d8197c43dd67cf7cdaf7318 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 20 Jan 2025 14:39:03 +0600 Subject: [PATCH 50/72] Added restricted symbols error for password --- source/ubl-settings-usergroups.c | 19 ++- source/ubl-strings.h | 1 + ubl-settings-usergroups.pot | 236 ++++++++++++++++-------------- ubl-settings-usergroups_ru.po | 240 +++++++++++++++++-------------- 4 files changed, 269 insertions(+), 227 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 376fd5f..b20d96d 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1531,12 +1531,17 @@ void on_password_accept(GtkWidget *self, dictionary *dict){ return; } } else { - + for (size_t i=0;iStatusBox),RESTRICTED_SYMBOLS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + } if (yon_char_is_empty(password)){ - yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_empty",EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); return; } else if (password[0]=='%'&&password[1]=='%'){ - yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_wrong",EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); return; } if (strlen(password)UsersTree),1,2,3,-1); - yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->GroupsTree),1,2,-1); + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->UsersTree),1,-1); + // yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->GroupsTree),1,2,-1); - yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemTree),1,2,3,-1); - yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemGroupsTree),1,2,-1); + // yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemTree),1,2,3,-1); + // yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemGroupsTree),1,2,-1); yon_window_config_load(config_path); yon_save_window_set_postsave_function(on_save_done,widgets); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 9b0fc92..9a22b17 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -212,6 +212,7 @@ #define PASSWORD_REPEAT_LABEL _("Repeat password:") #define PASSWORD_HASH_LABEL _("Password hash:") #define PASSWORD_NO_ENCRYPT_LABEL _("Do not encrypt password") +#define RESTRICTED_SYMBOLS_LABEL _("Password contain restricted symbols") //ubl-settings-usergroups-savesettings.glade #define SAVESETTINGS_TITLE_LABEL _("Additional configuration of service parameter saving") diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index ee76c27..dbd0619 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -53,7 +53,7 @@ msgstr "" msgid "UID" msgstr "" -#: source/ubl-strings.h:14 source/ubl-strings.h:116 +#: source/ubl-strings.h:14 source/ubl-strings.h:118 msgid "Login" msgstr "" @@ -274,7 +274,7 @@ msgstr "" msgid "Set a password" msgstr "" -#: source/ubl-strings.h:73 source/ubl-strings.h:120 +#: source/ubl-strings.h:73 source/ubl-strings.h:122 msgid "Encrypted" msgstr "" @@ -370,461 +370,477 @@ msgid "" "configuration" msgstr "" -#: source/ubl-strings.h:110 +#: source/ubl-strings.h:108 +msgid "" +"While booting the operating system, apply the settings of all groups from " +"the configuration" +msgstr "" + +#: source/ubl-strings.h:109 +msgid "" +"While shutdown, save the settings of all groups with GID>=1000 to the " +"configuration" +msgstr "" + +#: source/ubl-strings.h:112 msgid "Configure group" msgstr "" -#: source/ubl-strings.h:111 +#: source/ubl-strings.h:113 msgid "Add group" msgstr "" -#: source/ubl-strings.h:112 +#: source/ubl-strings.h:114 msgid "Group id:" msgstr "" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:115 msgid "Group name:" msgstr "" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:116 msgid "Group users:" msgstr "" -#: source/ubl-strings.h:115 +#: source/ubl-strings.h:117 msgid "Automatically" msgstr "" -#: source/ubl-strings.h:117 +#: source/ubl-strings.h:119 msgid "Group already exists in configuration" msgstr "" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:120 msgid "Create group with ununique GID" msgstr "" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:121 msgid "Create system group" msgstr "" -#: source/ubl-strings.h:121 +#: source/ubl-strings.h:123 msgid "Additional configuration" msgstr "" -#: source/ubl-strings.h:122 +#: source/ubl-strings.h:124 msgid "Group configuration synchronization" msgstr "" -#: source/ubl-strings.h:123 +#: source/ubl-strings.h:125 msgid "When shutting down the system, save the group into the configuration" msgstr "" -#: source/ubl-strings.h:124 +#: source/ubl-strings.h:126 msgid "Group administrators:" msgstr "" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:127 msgid "Group name must not start with digit" msgstr "" -#: source/ubl-strings.h:128 +#: source/ubl-strings.h:130 msgid "Default groups" msgstr "" -#: source/ubl-strings.h:129 +#: source/ubl-strings.h:131 msgid "Main group" msgstr "" -#: source/ubl-strings.h:130 +#: source/ubl-strings.h:132 msgid "Additional groups" msgstr "" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:133 msgid "Choose groups" msgstr "" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:134 msgid "Choose users" msgstr "" -#: source/ubl-strings.h:133 +#: source/ubl-strings.h:135 msgid "Add to new:" msgstr "" -#: source/ubl-strings.h:136 +#: source/ubl-strings.h:138 msgid "System users and groups" msgstr "" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:139 msgid "Locked" msgstr "" -#: source/ubl-strings.h:138 +#: source/ubl-strings.h:140 msgid "Username" msgstr "" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:141 msgid "" "Primary\n" "group" msgstr "" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:142 msgid "" "Home\n" "directory" msgstr "" -#: source/ubl-strings.h:141 source/ubl-strings.h:147 +#: source/ubl-strings.h:143 source/ubl-strings.h:149 msgid "Group" msgstr "" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:144 msgid "Update the system users and groups list" msgstr "" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:145 msgid "Toggle system groups and users" msgstr "" -#: source/ubl-strings.h:145 +#: source/ubl-strings.h:147 msgid "Password mismatch" msgstr "" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:148 msgid "Password must be at least" msgstr "" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:148 msgid "characters" msgstr "" -#: source/ubl-strings.h:148 +#: source/ubl-strings.h:150 msgid "" "Days until\n" "warning" msgstr "" -#: source/ubl-strings.h:149 +#: source/ubl-strings.h:151 msgid "" "Days\n" "without activity" msgstr "" -#: source/ubl-strings.h:150 +#: source/ubl-strings.h:152 msgid "" "Shell\n" "path" msgstr "" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:153 msgid "" "Password has\n" "been changed" msgstr "" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:154 msgid "" "Expiration\n" "date" msgstr "" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:155 msgid "" "Password change\n" "interval (min)" msgstr "" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:156 msgid "" "Password change\n" "interval (max)" msgstr "" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:159 msgid "Add user" msgstr "" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:160 msgid "Configure user" msgstr "" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:161 msgid "Set" msgstr "" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:162 msgid "Empty important field" msgstr "" -#: source/ubl-strings.h:161 +#: source/ubl-strings.h:163 msgid "Login must not start with digit" msgstr "" -#: source/ubl-strings.h:162 +#: source/ubl-strings.h:164 msgid "Loading has failed" msgstr "" -#: source/ubl-strings.h:163 +#: source/ubl-strings.h:165 msgid "Login name" msgstr "" -#: source/ubl-strings.h:164 +#: source/ubl-strings.h:166 msgid "Additional groups:" msgstr "" -#: source/ubl-strings.h:165 +#: source/ubl-strings.h:167 msgid "Password configuration" msgstr "" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:168 msgid "Password has been changed:" msgstr "" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:169 msgid "expiration date:" msgstr "" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:170 msgid "Password change interval: minimum" msgstr "" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:171 msgid "days, maximum" msgstr "" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:172 msgid "days" msgstr "" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:173 msgid "User already exists in configuration" msgstr "" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:174 msgid "Days until warning:" msgstr "" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:175 msgid "Days without activity:" msgstr "" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:176 msgid "Force change at next login" msgstr "" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:177 msgid "User shell:" msgstr "" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:178 msgid "Home directory:" msgstr "" -#: source/ubl-strings.h:177 +#: source/ubl-strings.h:179 msgid "Don't set" msgstr "" -#: source/ubl-strings.h:178 +#: source/ubl-strings.h:180 msgid "Create system user" msgstr "" -#: source/ubl-strings.h:179 +#: source/ubl-strings.h:181 msgid "Create user with ununique (repeating) UID" msgstr "" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:182 msgid "Do not check login for compliance with character rules" msgstr "" -#: source/ubl-strings.h:181 +#: source/ubl-strings.h:183 msgid "Temporary deactivation" msgstr "" -#: source/ubl-strings.h:182 +#: source/ubl-strings.h:184 msgid "Save" msgstr "" -#: source/ubl-strings.h:183 +#: source/ubl-strings.h:185 msgid "login_name" msgstr "" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:186 msgid "group_name" msgstr "" -#: source/ubl-strings.h:185 +#: source/ubl-strings.h:187 msgid "User name" msgstr "" -#: source/ubl-strings.h:186 +#: source/ubl-strings.h:188 msgid "Sync user" msgstr "" -#: source/ubl-strings.h:187 +#: source/ubl-strings.h:189 msgid "Sync user with password" msgstr "" -#: source/ubl-strings.h:188 +#: source/ubl-strings.h:190 msgid "Encrypt all passwords" msgstr "" -#: source/ubl-strings.h:190 +#: source/ubl-strings.h:192 msgid "User configuration" msgstr "" -#: source/ubl-strings.h:191 +#: source/ubl-strings.h:193 msgid "User configuration synchronization" msgstr "" -#: source/ubl-strings.h:192 +#: source/ubl-strings.h:194 msgid "During system startup, load the user from the configuration" msgstr "" -#: source/ubl-strings.h:193 +#: source/ubl-strings.h:195 msgid "When shutting down the system, save the user into the configuration" msgstr "" -#: source/ubl-strings.h:194 +#: source/ubl-strings.h:196 msgid "User password configuration syncronization" msgstr "" -#: source/ubl-strings.h:195 +#: source/ubl-strings.h:197 msgid "" "During system startup, load the user's parameters from the configuration" msgstr "" -#: source/ubl-strings.h:196 +#: source/ubl-strings.h:198 msgid "" "When shutting down the system, save the user's parameters into the " "configuration" msgstr "" -#: source/ubl-strings.h:198 +#: source/ubl-strings.h:200 msgid "Basic" msgstr "" -#: source/ubl-strings.h:199 +#: source/ubl-strings.h:201 msgid "Additional" msgstr "" -#: source/ubl-strings.h:200 +#: source/ubl-strings.h:202 msgid "Syncronization" msgstr "" -#: source/ubl-strings.h:202 +#: source/ubl-strings.h:204 msgid "Not specified" msgstr "" -#: source/ubl-strings.h:204 +#: source/ubl-strings.h:206 msgid "UID already exists in configuration" msgstr "" -#: source/ubl-strings.h:205 +#: source/ubl-strings.h:207 msgid "UID already exists in system" msgstr "" -#: source/ubl-strings.h:206 +#: source/ubl-strings.h:208 msgid "GID already exists in configuration" msgstr "" -#: source/ubl-strings.h:207 +#: source/ubl-strings.h:209 msgid "GID already exists in system" msgstr "" -#: source/ubl-strings.h:210 +#: source/ubl-strings.h:212 msgid "Repeat password:" msgstr "" -#: source/ubl-strings.h:211 +#: source/ubl-strings.h:213 msgid "Password hash:" msgstr "" -#: source/ubl-strings.h:212 +#: source/ubl-strings.h:214 msgid "Do not encrypt password" msgstr "" #: source/ubl-strings.h:215 +msgid "Password contain restricted symbols" +msgstr "" + +#: source/ubl-strings.h:218 msgid "Additional configuration of service parameter saving" msgstr "" -#: source/ubl-strings.h:216 +#: source/ubl-strings.h:219 msgid "" "At every system shutdown save changes of (root)/var/lib/samba\n" "into (hd)/ublinux-data/rootcopy" msgstr "" -#: source/ubl-strings.h:217 +#: source/ubl-strings.h:220 msgid "For system save mode \"Sandbox\"" msgstr "" -#: source/ubl-strings.h:220 +#: source/ubl-strings.h:223 msgid "Group deletion" msgstr "" -#: source/ubl-strings.h:221 +#: source/ubl-strings.h:224 msgid "Confirm group(-s) deletion:" msgstr "" -#: source/ubl-strings.h:223 +#: source/ubl-strings.h:226 msgid "User deletion" msgstr "" -#: source/ubl-strings.h:224 +#: source/ubl-strings.h:227 msgid "Confirm user(-s) deletion:" msgstr "" -#: source/ubl-strings.h:225 +#: source/ubl-strings.h:228 msgid "Chosen" msgstr "" -#: source/ubl-strings.h:226 +#: source/ubl-strings.h:229 msgid "User" msgstr "" -#: source/ubl-strings.h:227 +#: source/ubl-strings.h:230 msgid "Home directory" msgstr "" -#: source/ubl-strings.h:228 +#: source/ubl-strings.h:231 msgid "Delete home directory" msgstr "" -#: source/ubl-strings.h:230 +#: source/ubl-strings.h:233 msgid "Configuration users" msgstr "" -#: source/ubl-strings.h:231 +#: source/ubl-strings.h:234 msgid "Configuration groups" msgstr "" -#: source/ubl-strings.h:232 +#: source/ubl-strings.h:235 msgid "System users" msgstr "" -#: source/ubl-strings.h:233 +#: source/ubl-strings.h:236 msgid "System groups" msgstr "" -#: source/ubl-strings.h:234 source/ubl-strings.h:243 +#: source/ubl-strings.h:237 source/ubl-strings.h:246 msgid "Remove from system" msgstr "" -#: source/ubl-strings.h:235 source/ubl-strings.h:241 +#: source/ubl-strings.h:238 source/ubl-strings.h:244 msgid "Remove from configuration" msgstr "" -#: source/ubl-strings.h:237 +#: source/ubl-strings.h:240 msgid "Group deletion has failed" msgstr "" -#: source/ubl-strings.h:238 +#: source/ubl-strings.h:241 msgid "User deletion has failed" msgstr "" -#: source/ubl-strings.h:240 +#: source/ubl-strings.h:243 msgid "Add to configuration" msgstr "" -#: source/ubl-strings.h:242 +#: source/ubl-strings.h:245 msgid "Add to system" msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 40befd0..29ed13f 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -53,7 +53,7 @@ msgstr "Алгоритм хэширования пароля:" msgid "UID" msgstr "UID" -#: source/ubl-strings.h:14 source/ubl-strings.h:116 +#: source/ubl-strings.h:14 source/ubl-strings.h:118 msgid "Login" msgstr "Логин" @@ -302,7 +302,7 @@ msgstr "Пароль не требуется" msgid "Set a password" msgstr "Задать пароль" -#: source/ubl-strings.h:73 source/ubl-strings.h:120 +#: source/ubl-strings.h:73 source/ubl-strings.h:122 msgid "Encrypted" msgstr "Зашифрован" @@ -404,99 +404,115 @@ msgstr "" "При завершении работы сохранить настройки пользователей с UID>=1000 в " "конфигурацию" -#: source/ubl-strings.h:110 +#: source/ubl-strings.h:108 +msgid "" +"While booting the operating system, apply the settings of all groups from " +"the configuration" +msgstr "" +"При запуске операционной системы применять настройки всех групп из " +"конфигурации" + +#: source/ubl-strings.h:109 +msgid "" +"While shutdown, save the settings of all groups with GID>=1000 to the " +"configuration" +msgstr "" +"При завершении работы сохранить настройки групп с GID>=1000 в " +"конфигурацию" + +#: source/ubl-strings.h:112 msgid "Configure group" msgstr "Редактировать группу" -#: source/ubl-strings.h:111 +#: source/ubl-strings.h:113 msgid "Add group" msgstr "Добавить группу" -#: source/ubl-strings.h:112 +#: source/ubl-strings.h:114 msgid "Group id:" msgstr "Идентификатор группы (GID):" -#: source/ubl-strings.h:113 +#: source/ubl-strings.h:115 msgid "Group name:" msgstr "Имя группы:" -#: source/ubl-strings.h:114 +#: source/ubl-strings.h:116 msgid "Group users:" msgstr "Пользователи группы:" -#: source/ubl-strings.h:115 +#: source/ubl-strings.h:117 msgid "Automatically" msgstr "Автоматически" -#: source/ubl-strings.h:117 +#: source/ubl-strings.h:119 msgid "Group already exists in configuration" msgstr "Группа уже существует в конфигурации" -#: source/ubl-strings.h:118 +#: source/ubl-strings.h:120 msgid "Create group with ununique GID" msgstr "Создать группу с повторяющимися (не уникальными) GID" -#: source/ubl-strings.h:119 +#: source/ubl-strings.h:121 msgid "Create system group" msgstr "Создать системную группу" -#: source/ubl-strings.h:121 +#: source/ubl-strings.h:123 msgid "Additional configuration" msgstr "Дополнительные настройки" -#: source/ubl-strings.h:122 +#: source/ubl-strings.h:124 msgid "Group configuration synchronization" msgstr "Синхронизация настроек группы" -#: source/ubl-strings.h:123 +#: source/ubl-strings.h:125 msgid "When shutting down the system, save the group into the configuration" msgstr "При завершении работы системы сохранить группу в конфигурацию" -#: source/ubl-strings.h:124 +#: source/ubl-strings.h:126 msgid "Group administrators:" msgstr "Администраторы группы:" -#: source/ubl-strings.h:125 +#: source/ubl-strings.h:127 msgid "Group name must not start with digit" msgstr "Имя группы не должно начинаться с цифры" -#: source/ubl-strings.h:128 +#: source/ubl-strings.h:130 msgid "Default groups" msgstr "Группы пользователей по умолчанию" -#: source/ubl-strings.h:129 +#: source/ubl-strings.h:131 msgid "Main group" msgstr "Основная группа" -#: source/ubl-strings.h:130 +#: source/ubl-strings.h:132 msgid "Additional groups" msgstr "Дополнительные группы" -#: source/ubl-strings.h:131 +#: source/ubl-strings.h:133 msgid "Choose groups" msgstr "Выбрать группы" -#: source/ubl-strings.h:132 +#: source/ubl-strings.h:134 msgid "Choose users" msgstr "Выбрать пользователей" -#: source/ubl-strings.h:133 +#: source/ubl-strings.h:135 msgid "Add to new:" msgstr "Добавить в новую:" -#: source/ubl-strings.h:136 +#: source/ubl-strings.h:138 msgid "System users and groups" msgstr "Пользователи и группы в системе" -#: source/ubl-strings.h:137 +#: source/ubl-strings.h:139 msgid "Locked" msgstr "Отключен" -#: source/ubl-strings.h:138 +#: source/ubl-strings.h:140 msgid "Username" msgstr "Имя пользователя" -#: source/ubl-strings.h:139 +#: source/ubl-strings.h:141 msgid "" "Primary\n" "group" @@ -504,7 +520,7 @@ msgstr "" "Основная\n" "группа" -#: source/ubl-strings.h:140 +#: source/ubl-strings.h:142 msgid "" "Home\n" "directory" @@ -512,31 +528,31 @@ msgstr "" "Домашний\n" "каталог" -#: source/ubl-strings.h:141 source/ubl-strings.h:147 +#: source/ubl-strings.h:143 source/ubl-strings.h:149 msgid "Group" msgstr "Группа" -#: source/ubl-strings.h:142 +#: source/ubl-strings.h:144 msgid "Update the system users and groups list" msgstr "Обновить список пользователей и групп системы" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:145 msgid "Toggle system groups and users" msgstr "Переключить видимость системных пользователей и групп" -#: source/ubl-strings.h:145 +#: source/ubl-strings.h:147 msgid "Password mismatch" msgstr "Несовпадение паролей" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:148 msgid "Password must be at least" msgstr "Пароль должен состоять из как минимум" -#: source/ubl-strings.h:146 +#: source/ubl-strings.h:148 msgid "characters" msgstr "символов" -#: source/ubl-strings.h:148 +#: source/ubl-strings.h:150 msgid "" "Days until\n" "warning" @@ -544,7 +560,7 @@ msgstr "" "Дней до\n" "предупреждения" -#: source/ubl-strings.h:149 +#: source/ubl-strings.h:151 msgid "" "Days\n" "without activity" @@ -552,7 +568,7 @@ msgstr "" "Дней без\n" "активности" -#: source/ubl-strings.h:150 +#: source/ubl-strings.h:152 msgid "" "Shell\n" "path" @@ -560,7 +576,7 @@ msgstr "" "Путь до\n" "оболочки" -#: source/ubl-strings.h:151 +#: source/ubl-strings.h:153 msgid "" "Password has\n" "been changed" @@ -568,7 +584,7 @@ msgstr "" "Пароль\n" "изменён" -#: source/ubl-strings.h:152 +#: source/ubl-strings.h:154 msgid "" "Expiration\n" "date" @@ -576,7 +592,7 @@ msgstr "" "Дата\n" "устаревания" -#: source/ubl-strings.h:153 +#: source/ubl-strings.h:155 msgid "" "Password change\n" "interval (min)" @@ -584,7 +600,7 @@ msgstr "" "Интервал смены\n" "пароля (мин.)" -#: source/ubl-strings.h:154 +#: source/ubl-strings.h:156 msgid "" "Password change\n" "interval (max)" @@ -592,219 +608,223 @@ msgstr "" "Интервал смены\n" "пароля (макс.)" -#: source/ubl-strings.h:157 +#: source/ubl-strings.h:159 msgid "Add user" msgstr "Добавить пользователя" -#: source/ubl-strings.h:158 +#: source/ubl-strings.h:160 msgid "Configure user" msgstr "Редактировать пользователя" -#: source/ubl-strings.h:159 +#: source/ubl-strings.h:161 msgid "Set" msgstr "Задать" -#: source/ubl-strings.h:160 +#: source/ubl-strings.h:162 msgid "Empty important field" msgstr "Пустое важное поле" -#: source/ubl-strings.h:161 +#: source/ubl-strings.h:163 msgid "Login must not start with digit" msgstr "Логин не должен начинаться с цифры" -#: source/ubl-strings.h:162 +#: source/ubl-strings.h:164 msgid "Loading has failed" msgstr "Ошибка загрузки" -#: source/ubl-strings.h:163 +#: source/ubl-strings.h:165 msgid "Login name" msgstr "Имя логина" -#: source/ubl-strings.h:164 +#: source/ubl-strings.h:166 msgid "Additional groups:" msgstr "Дополнительные группы:" -#: source/ubl-strings.h:165 +#: source/ubl-strings.h:167 msgid "Password configuration" msgstr "Конфигурация пароля" -#: source/ubl-strings.h:166 +#: source/ubl-strings.h:168 msgid "Password has been changed:" msgstr "Пароль изменён:" -#: source/ubl-strings.h:167 +#: source/ubl-strings.h:169 msgid "expiration date:" msgstr "Дата устаревания:" -#: source/ubl-strings.h:168 +#: source/ubl-strings.h:170 msgid "Password change interval: minimum" msgstr "Интервал смены пароля: минимум" -#: source/ubl-strings.h:169 +#: source/ubl-strings.h:171 msgid "days, maximum" msgstr "дней, максимум" -#: source/ubl-strings.h:170 +#: source/ubl-strings.h:172 msgid "days" msgstr "дней" -#: source/ubl-strings.h:171 +#: source/ubl-strings.h:173 msgid "User already exists in configuration" msgstr "Пользователь уже существует в конфигурации" -#: source/ubl-strings.h:172 +#: source/ubl-strings.h:174 msgid "Days until warning:" msgstr "Дней до предупреждения:" -#: source/ubl-strings.h:173 +#: source/ubl-strings.h:175 msgid "Days without activity:" msgstr "Дней без активности:" -#: source/ubl-strings.h:174 +#: source/ubl-strings.h:176 msgid "Force change at next login" msgstr "Принудительно сменить при следующем входе в систему" -#: source/ubl-strings.h:175 +#: source/ubl-strings.h:177 msgid "User shell:" msgstr "Оболочка пользователя:" -#: source/ubl-strings.h:176 +#: source/ubl-strings.h:178 msgid "Home directory:" msgstr "Домашний каталог:" -#: source/ubl-strings.h:177 +#: source/ubl-strings.h:179 msgid "Don't set" msgstr "Не создавать" -#: source/ubl-strings.h:178 +#: source/ubl-strings.h:180 msgid "Create system user" msgstr "Создать системного пользователя" -#: source/ubl-strings.h:179 +#: source/ubl-strings.h:181 msgid "Create user with ununique (repeating) UID" msgstr "Создать пользователя с повторяющимися (не уникальными) UID" -#: source/ubl-strings.h:180 +#: source/ubl-strings.h:182 msgid "Do not check login for compliance with character rules" msgstr "Не проверять логин на несоответствие правилам использования символов" -#: source/ubl-strings.h:181 +#: source/ubl-strings.h:183 msgid "Temporary deactivation" msgstr "Временное отключение учётной записи" -#: source/ubl-strings.h:182 +#: source/ubl-strings.h:184 msgid "Save" msgstr "Сохранить" -#: source/ubl-strings.h:183 +#: source/ubl-strings.h:185 msgid "login_name" msgstr "Имя_логина" -#: source/ubl-strings.h:184 +#: source/ubl-strings.h:186 msgid "group_name" msgstr "Имя_группы" -#: source/ubl-strings.h:185 +#: source/ubl-strings.h:187 msgid "User name" msgstr "Имя пользователя" -#: source/ubl-strings.h:186 +#: source/ubl-strings.h:188 msgid "Sync user" msgstr "Синхронизировать пользователя" -#: source/ubl-strings.h:187 +#: source/ubl-strings.h:189 msgid "Sync user with password" msgstr "Синхронизировать пользователя с паролем" -#: source/ubl-strings.h:188 +#: source/ubl-strings.h:190 msgid "Encrypt all passwords" msgstr "Зашифровать все пароли" -#: source/ubl-strings.h:190 +#: source/ubl-strings.h:192 msgid "User configuration" msgstr "Настройка пользователя" -#: source/ubl-strings.h:191 +#: source/ubl-strings.h:193 msgid "User configuration synchronization" msgstr "Синхронизация настроек пользователя" -#: source/ubl-strings.h:192 +#: source/ubl-strings.h:194 msgid "During system startup, load the user from the configuration" msgstr "" "При запуске операционной системы применять настройки пользователя из " "конфигурации" -#: source/ubl-strings.h:193 +#: source/ubl-strings.h:195 msgid "When shutting down the system, save the user into the configuration" msgstr "" "При завершении работы операционной системы сохранить настройки пользователя " "в конфигурацию" -#: source/ubl-strings.h:194 +#: source/ubl-strings.h:196 msgid "User password configuration syncronization" msgstr "Синхронизация настроек пароля пользователя" -#: source/ubl-strings.h:195 +#: source/ubl-strings.h:197 msgid "" "During system startup, load the user's parameters from the configuration" msgstr "При загрузке системы загрузить параметры пользователя из конфигурации" -#: source/ubl-strings.h:196 +#: source/ubl-strings.h:198 msgid "" "When shutting down the system, save the user's parameters into the " "configuration" msgstr "" "При завершении работы системы сохранить параметры пользователя в конфигурацию" -#: source/ubl-strings.h:198 +#: source/ubl-strings.h:200 msgid "Basic" msgstr "Основные" -#: source/ubl-strings.h:199 +#: source/ubl-strings.h:201 msgid "Additional" msgstr "Дополнительные" -#: source/ubl-strings.h:200 +#: source/ubl-strings.h:202 msgid "Syncronization" msgstr "Синхронизация" -#: source/ubl-strings.h:202 +#: source/ubl-strings.h:204 msgid "Not specified" msgstr "Не задан" -#: source/ubl-strings.h:204 +#: source/ubl-strings.h:206 msgid "UID already exists in configuration" msgstr "UID уже существует в конфигурации" -#: source/ubl-strings.h:205 +#: source/ubl-strings.h:207 msgid "UID already exists in system" msgstr "UID уже существует в системе" -#: source/ubl-strings.h:206 +#: source/ubl-strings.h:208 msgid "GID already exists in configuration" msgstr "GID уже существует в конфигурации" -#: source/ubl-strings.h:207 +#: source/ubl-strings.h:209 msgid "GID already exists in system" msgstr "GID уже существует в системе" -#: source/ubl-strings.h:210 +#: source/ubl-strings.h:212 msgid "Repeat password:" msgstr "Подтверждение пароля:" -#: source/ubl-strings.h:211 +#: source/ubl-strings.h:213 msgid "Password hash:" msgstr "Хэш пароля:" -#: source/ubl-strings.h:212 +#: source/ubl-strings.h:214 msgid "Do not encrypt password" msgstr "Не шифровать пароль" #: source/ubl-strings.h:215 +msgid "Password contain restricted symbols" +msgstr "Пароль содержит запрещённые символы" + +#: source/ubl-strings.h:218 msgid "Additional configuration of service parameter saving" msgstr "Дополнительные настройки сохранения параметров сервисов" -#: source/ubl-strings.h:216 +#: source/ubl-strings.h:219 msgid "" "At every system shutdown save changes of (root)/var/lib/samba\n" "into (hd)/ublinux-data/rootcopy" @@ -812,80 +832,80 @@ msgstr "" "При каждом завершении работы ОС сохранять изменения (root)/var/lib/samba\n" "в (hd)/ublinux-data/rootcopy/" -#: source/ubl-strings.h:217 +#: source/ubl-strings.h:220 msgid "For system save mode \"Sandbox\"" msgstr "Для режима сохранения системы \"Песочница\"" -#: source/ubl-strings.h:220 +#: source/ubl-strings.h:223 msgid "Group deletion" msgstr "Удаление групп(-ы)" -#: source/ubl-strings.h:221 +#: source/ubl-strings.h:224 msgid "Confirm group(-s) deletion:" msgstr "Подтвердите удаление групп(-ы):" -#: source/ubl-strings.h:223 +#: source/ubl-strings.h:226 msgid "User deletion" msgstr "Удаление пользователя(-ей)" -#: source/ubl-strings.h:224 +#: source/ubl-strings.h:227 msgid "Confirm user(-s) deletion:" msgstr "Подтвердите удаление пользователя (-ей):" -#: source/ubl-strings.h:225 +#: source/ubl-strings.h:228 msgid "Chosen" msgstr "Выбран" -#: source/ubl-strings.h:226 +#: source/ubl-strings.h:229 msgid "User" msgstr "Пользователь" -#: source/ubl-strings.h:227 +#: source/ubl-strings.h:230 msgid "Home directory" msgstr "Домашний каталог" -#: source/ubl-strings.h:228 +#: source/ubl-strings.h:231 msgid "Delete home directory" msgstr "Удалить домашний каталог" -#: source/ubl-strings.h:230 +#: source/ubl-strings.h:233 msgid "Configuration users" msgstr "Пользователи конфигурации" -#: source/ubl-strings.h:231 +#: source/ubl-strings.h:234 msgid "Configuration groups" msgstr "Группы конфигурации" -#: source/ubl-strings.h:232 +#: source/ubl-strings.h:235 msgid "System users" msgstr "Пользователи системы" -#: source/ubl-strings.h:233 +#: source/ubl-strings.h:236 msgid "System groups" msgstr "Группы системы" -#: source/ubl-strings.h:234 source/ubl-strings.h:243 +#: source/ubl-strings.h:237 source/ubl-strings.h:246 msgid "Remove from system" msgstr "Удалить из системы" -#: source/ubl-strings.h:235 source/ubl-strings.h:241 +#: source/ubl-strings.h:238 source/ubl-strings.h:244 msgid "Remove from configuration" msgstr "Удалить из конфигурации" -#: source/ubl-strings.h:237 +#: source/ubl-strings.h:240 msgid "Group deletion has failed" msgstr "Удаление группы завершено с ошибкой" -#: source/ubl-strings.h:238 +#: source/ubl-strings.h:241 msgid "User deletion has failed" msgstr "Удаление пользователя завершено с ошибкой" -#: source/ubl-strings.h:240 +#: source/ubl-strings.h:243 #, fuzzy msgid "Add to configuration" msgstr "в конфигурацию?" -#: source/ubl-strings.h:242 +#: source/ubl-strings.h:245 #, fuzzy msgid "Add to system" msgstr "Добавить в новую:" From da9e873b6c761a08d285b56e328dcd08acf2950d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 20 Jan 2025 14:40:33 +0600 Subject: [PATCH 51/72] Localisatino edits --- source/ubl-strings.h | 2 +- ubl-settings-usergroups_ru.po | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 9a22b17..4bf8c74 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -212,7 +212,7 @@ #define PASSWORD_REPEAT_LABEL _("Repeat password:") #define PASSWORD_HASH_LABEL _("Password hash:") #define PASSWORD_NO_ENCRYPT_LABEL _("Do not encrypt password") -#define RESTRICTED_SYMBOLS_LABEL _("Password contain restricted symbols") +#define RESTRICTED_SYMBOLS_LABEL _("Password contain special symbols") //ubl-settings-usergroups-savesettings.glade #define SAVESETTINGS_TITLE_LABEL _("Additional configuration of service parameter saving") diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 29ed13f..fa2e510 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -817,8 +817,8 @@ msgid "Do not encrypt password" msgstr "Не шифровать пароль" #: source/ubl-strings.h:215 -msgid "Password contain restricted symbols" -msgstr "Пароль содержит запрещённые символы" +msgid "Password contain special symbols" +msgstr "Пароль содержит спецсимволы" #: source/ubl-strings.h:218 msgid "Additional configuration of service parameter saving" From 3c763b8a34a055beff688a8218c58c8f273c6443 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 22 Jan 2025 13:22:52 +0600 Subject: [PATCH 52/72] Additional settings sync tab WIP --- gresource.xml | 3 + source/CMakeLists.txt | 4 + source/ubl-cmake.in | 1 - ...bl-settings-usergroups-additional-config.c | 31 + source/ubl-settings-usergroups-group.c | 283 ++++++++ source/ubl-settings-usergroups-password.c | 152 +++++ source/ubl-settings-usergroups-settings.c | 109 ++++ source/ubl-settings-usergroups-user.c | 135 ++-- source/ubl-settings-usergroups.c | 609 ++---------------- source/ubl-settings-usergroups.h | 4 + sync_parameters.csv | 6 + 11 files changed, 723 insertions(+), 614 deletions(-) delete mode 100644 source/ubl-cmake.in create mode 100644 source/ubl-settings-usergroups-additional-config.c create mode 100644 source/ubl-settings-usergroups-group.c create mode 100644 source/ubl-settings-usergroups-password.c create mode 100644 sync_parameters.csv diff --git a/gresource.xml b/gresource.xml index 4a731e5..f5e3ee7 100644 --- a/gresource.xml +++ b/gresource.xml @@ -15,6 +15,9 @@ ubl-settings-usergroups.css + + sync_parameters.csv + ubl-settings-usergroups-banner.png diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 125f652..24cb0e2 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -39,6 +39,7 @@ set(DEPENDFILES ../ubl-settings-usergroups-savesettings.glade ../ubl-settings-usergroups-confirmation.glade ../ubl-settings-usergroups-system-deletion-confirmation.glade + ../sync_parameters.csv ../gresource.xml ../ubl-settings-usergroups-banner.png ../ubl-settings-usergroups.css @@ -83,6 +84,9 @@ set(SOURCE_FILES ubl-settings-usergroups-settings.c ubl-settings-usergroups-user.c ubl-settings-usergroups-system.c + ubl-settings-usergroups-additional-config.c + ubl-settings-usergroups-group.c + ubl-settings-usergroups-password.c ubl-settings-usergroups.h ubl-strings.h ) diff --git a/source/ubl-cmake.in b/source/ubl-cmake.in deleted file mode 100644 index d4623a7..0000000 --- a/source/ubl-cmake.in +++ /dev/null @@ -1 +0,0 @@ -#cmakedefine WEBKIT_FOUND diff --git a/source/ubl-settings-usergroups-additional-config.c b/source/ubl-settings-usergroups-additional-config.c new file mode 100644 index 0000000..e99741d --- /dev/null +++ b/source/ubl-settings-usergroups-additional-config.c @@ -0,0 +1,31 @@ +#include "ubl-settings-usergroups.h" + + + + void on_hash_changed(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ + + int hash_size=0; + config_str hash_algos = yon_file_open(hash_list_path,&hash_size); + for (int i=1;iPasswordHashCombo,parsed[1]); + yon_char_parsed_free(parsed,parsed_size); + } + yon_char_parsed_free(hash_algos,hash_size); + } + +void on_additional_settings_clicked(GtkWidget *, GtkEntry *){ + ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new(); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + gtk_widget_show(window->Window); + +} + +void on_passwords_encrypt(){ + int pid = fork(); + if (!pid){ + exit(system(encrypt_passwords_command)); + } +} \ No newline at end of file diff --git a/source/ubl-settings-usergroups-group.c b/source/ubl-settings-usergroups-group.c new file mode 100644 index 0000000..52e367e --- /dev/null +++ b/source/ubl-settings-usergroups-group.c @@ -0,0 +1,283 @@ +#include "ubl-settings-usergroups.h" + + + + +ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group_creation_new(){ + ubl_settings_usergroups_group_creation_window *window = malloc(sizeof(ubl_settings_usergroups_group_creation_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group_creation); + window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->userUIDAutoCheck=yon_gtk_builder_get_widget(builder,"GIDAutoCheck"); + window->userUIDEntry=yon_gtk_builder_get_widget(builder,"userUIDEntry"); + window->userLoginEntry=yon_gtk_builder_get_widget(builder,"userLoginEntry"); + window->userGroupsEntry=yon_gtk_builder_get_widget(builder,"userGroupsEntry"); + window->UserAdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"AdditionalGroupsButton"); + window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton"); + window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton"); + window->AdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"AdditionalGroupsButton"); + window->UnuniqueGIDCheck=yon_gtk_builder_get_widget(builder,"UnuniqueGIDCheck"); + window->SystemGroupCheck=yon_gtk_builder_get_widget(builder,"SystemGroupCheck"); + window->PasswordCombo=yon_gtk_builder_get_widget(builder,"PasswordCombo"); + window->PasswordEntry=yon_gtk_builder_get_widget(builder,"PasswordEntry"); + window->ChangePasswordButton=yon_gtk_builder_get_widget(builder,"ChangePasswordButton"); + window->userTitleNameLabel=yon_gtk_builder_get_widget(builder,"userTitleNameLabel"); + window->AdminGroupsEntry=yon_gtk_builder_get_widget(builder,"AdminGroupsEntry"); + window->AdminGroupsButton=yon_gtk_builder_get_widget(builder,"AdminGroupsButton"); + window->GroupaddShutdownCheck=yon_gtk_builder_get_widget(builder,"GroupaddShutdownCheck"); + window->groupExtraOptionsEntry=yon_gtk_builder_get_widget(builder,"groupExtraOptionsEntry"); + window->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook"); + window->last_gid=NULL; + + gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),GROUPS_TITLE_LABEL); + + on_GID_update(NULL,window); + dictionary *entry_dict=NULL; + yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"combo",window->PasswordCombo); + yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"entry",window->PasswordEntry); + yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateGroupWindow),"GroupAddWindow"); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); + g_signal_connect(G_OBJECT(window->ChangePasswordButton),"clicked",G_CALLBACK(on_password_change),entry_dict); + g_signal_connect(G_OBJECT(window->PasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->ChangePasswordButton); + g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->UserAdditionalGroupsButton),"clicked",G_CALLBACK(on_user_choose),window->userGroupsEntry); + g_signal_connect(G_OBJECT(window->AdminGroupsButton),"clicked",G_CALLBACK(on_user_choose),window->AdminGroupsEntry); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(on_GID_update),window); + g_signal_connect(G_OBJECT(window->SystemGroupCheck),"toggled",G_CALLBACK(on_GID_update),window); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_toggle_button_set_inactive_from_toggle_button),window->SystemGroupCheck); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->SystemGroupCheck); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_toggle_button_set_inactive_from_toggle_button_inversed),window->UnuniqueGIDCheck); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UnuniqueGIDCheck); + g_signal_connect(G_OBJECT(window->UnuniqueGIDCheck),"toggled",G_CALLBACK(on_system_parameter_changed),window); + g_signal_connect(G_OBJECT(window->SystemGroupCheck),"toggled",G_CALLBACK(on_system_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userUIDEntry),"insert-text",G_CALLBACK(yon_on_text_insert_only_digits),NULL); +return window; +} + + + +void on_GID_update(GtkWidget *, ubl_settings_usergroups_group_creation_window *window){ + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){ + if (window->last_gid){ + gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),window->last_gid); + } else { + int config_size=0; + int final_size=0; + config_str config_groups = yon_config_get_all_by_key(GROUPADD_parameter,&config_size); + yon_char_parsed_prepend_strings(config_groups,config_size,":"); + config_str final = yon_char_parsed_merge(main_config.groups,main_config.groups_size,config_groups,config_size,&final_size); + long prev_busy=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck))?0:main_config.MINGID; + + int minimum = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck))?0:main_config.MINGID; + int maximum = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck))?68000:main_config.MAXGID; + for (int i=0;i2&&minimumprev_busy){ + prev_busy=atol(parsed[2]); + } + } + yon_char_parsed_free(parsed, parsed_size); + } + gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),yon_char_from_long(prev_busy+1)); + } + } else { + gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),""); + } +} + +void on_group_save(GtkWidget *self, dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + ubl_settings_usergroups_group_creation_window *window = yon_dictionary_get_data(dict->first->next,ubl_settings_usergroups_group_creation_window*); + char *final_string = NULL; + char *group_name = NULL; + char *group_users = NULL; + char *gid = NULL; + char *non_unique = NULL; + char *gsystem = NULL; + char *admins = NULL; + char *password = NULL; + int gid_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck)); + if (gid_active){ + gid="x"; + } else { + gid = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry)); + if (yon_char_is_empty(gid)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); + yon_ubl_status_highlight_incorrect(window->userUIDEntry); + return; + } + + + if (!yon_char_is_empty(window->last_gid)&&strcmp(gid,window->last_gid)){ + int config_size=0; + int final_size=0; + config_str config_users = yon_config_get_all_by_key(GROUPADD_SEARCH_macro,&config_size); + config_str final = yon_char_parsed_merge(main_config.groups,main_config.groups_size,config_users,config_size,&final_size); + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UnuniqueGIDCheck))){ + int found=0; + char *uid_string = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry)); + for (int i=0;i2&&!strcmp(parsed[2],uid_string)){ + if (yon_char_is_empty(window->last_gid)||(!yon_char_is_empty(window->last_gid)&&strcmp(parsed[2],window->last_gid))){ + found = yon_char_parsed_check_exist(config_users,config_size,final[i])>-1?1:2; + break; + } + } + if (parsed_size) yon_char_parsed_free(parsed,parsed_size); + } + if (found){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),found==1?GID_ALREADY_EXIST_CONFIG_LABEL:GID_ALREADY_EXIST_SYSTEM_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userUIDEntry); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); + return; + } + } + } + } + + group_name = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)); + if (group_name[0]>'0'&&group_name[0]<'9'){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),GROUP_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userLoginEntry); + return; + } + if (yon_char_is_empty(group_name)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); + yon_ubl_status_highlight_incorrect(window->userLoginEntry); + return; + } + { + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->GroupsList); + for_iter(model,&iter){ + char *cur; + gtk_tree_model_get(model,&iter,1, &cur,-1); + if (!yon_char_is_empty(cur)&&!strcmp(cur,group_name)){ + if (!gtk_tree_selection_iter_is_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GroupsTree)),&iter)){ + + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),GROUP_EXIST_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userLoginEntry); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); + return; + } + } + } + } + + group_users = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry)); + + admins = (char*)gtk_entry_get_text(GTK_ENTRY(window->AdminGroupsEntry)); + int non_unique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UnuniqueGIDCheck)); + if(non_unique_active){ + non_unique="--non-unique"; + } else non_unique=""; + + int gsystem_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck)); + if(gsystem_active){ + gsystem="--system"; + } else gsystem=""; + + int shutdown_sync_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupaddShutdownCheck)); + if (shutdown_sync_active){ + char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD_SYNC(group_name)); + yon_config_register(GROUPADD_SYNC(group_name),final_command,"shutdown"); + yon_config_compare_ignore_set(GROUPADD_SYNC(group_name),1); + } else { + yon_config_remove_by_key(GROUPADD_SYNC(group_name)); + } + + + int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordCombo)); + if (password_active == 1) { + password = "!*"; + } else if (password_active == 2){ + password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); + if (yon_char_is_empty(password)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); + yon_ubl_status_highlight_incorrect(window->PasswordEntry); + return; + } + } else { + password=""; + } + final_string = yon_char_unite(yon_char_return_if_exist(group_users,""), + ":",yon_char_return_if_exist(gid,"x"), + ":",yon_char_return_if_exist(non_unique,""), + yon_char_return_if_exist(gsystem,""), + ":",yon_char_return_if_exist(admins,""), + ":",yon_char_return_if_exist(password,"x"), + NULL); + char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD_SYNC(group_name)); + yon_config_register(GROUPADD(group_name),final_command,final_string); + yon_interface_update(widgets); + on_subwindow_close(self); +} + + +void yon_group_delete_confirmation_open(main_window *widgets){ + yon_confirmation_window *window = yon_delete_confirmation_new(); + gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); + GtkTreeIter iter,itar; + dictionary *dict = NULL; + gtk_label_set_text(GTK_LABEL(window->TitleLabel),DELETE_GROUP_CONFIRMATION_CONFIRM_LABEL); + gtk_tree_view_column_set_title(window->UserCell,GROUP_LABEL); + gtk_label_set_text(GTK_LABEL(window->HatLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),2),0); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),3),0); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),4),0); + yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_group_delete_confirmation_save),dict); + GtkTreeModel *model = GTK_TREE_MODEL(widgets->GroupsList); + GList *list = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GroupsTree)),&model); + int chosen_size=0; + config_str chosen = NULL; + for (guint i=0;iGroupsList),&iter); + for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->GroupsList),&iter)){ + char *name; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,1,&name,-1); + gtk_list_store_append(window->list,&itar); + gtk_list_store_set(window->list,&itar,0,yon_char_parsed_check_exist(chosen,chosen_size,name)>-1?1:0,1,name,-1); + free(name); + } + gtk_widget_show(window->Window); +} + +void yon_group_delete_confirmation_save(GtkWidget *self, dictionary *dict){ + GtkTreeIter iter,itar; + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + yon_confirmation_window *window = yon_dictionary_get_data(dict->first->next,yon_confirmation_window*); + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter); + for (;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->GroupsList),&iter)){ + char *name; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,1,&name,-1); + int valid2 = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar); + for (;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itar)){ + char *name_check; + int delete; + gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&delete,1,&name_check,-1); + if (!strcmp(name,name_check)&&delete){ + yon_config_remove_by_key(GROUPADD(name)); + yon_config_remove_by_key(GROUPADD_SYNC(name)); + valid=0; + break; + } + } + } + yon_interface_update(widgets); + + on_subwindow_close(self); +} \ No newline at end of file diff --git a/source/ubl-settings-usergroups-password.c b/source/ubl-settings-usergroups-password.c new file mode 100644 index 0000000..8eef247 --- /dev/null +++ b/source/ubl-settings-usergroups-password.c @@ -0,0 +1,152 @@ +#include "ubl-settings-usergroups.h" + + + +void on_password_user_changed(GtkComboBox *,ubl_settings_usergroups_user_window *window){ + char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); + if ((passw[0]=='$')){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck),0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck),0); + gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),0); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck),0); + gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBACheck),1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck),0); + gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),1); + + } +} + + + +void on_password_change(GtkWidget *, dictionary *entry_dict){ + GtkEntry *output_target = yon_dictionary_get_data(entry_dict->first->next,GtkEntry*); + ubl_settings_usergroups_password_window *window = yon_ubl_settings_usergroups_password_new(); + dictionary *dict = NULL; + char *password = (char*)gtk_entry_get_text(output_target); + if (!yon_char_is_empty(password)){ + if (main_config.load_mode==0){ + password = yon_char_new(password); + if (!check_is_password_hash(password)){ + gtk_entry_set_text(GTK_ENTRY(window->PasswordHashEntry),password); + } else { + if (password[0]=='%'&&password[1]=='%'){ + free(yon_char_divide(password,1)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck),1); + } + gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),password); + } + } + } + yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); + yon_dictionary_add_or_create_if_exists_with_data(dict,"target",output_target); + g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_password_accept),dict); + g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(output_target)))); + gtk_widget_show(window->CreateGroupWindow); + +} + +void on_password_show_hide(GtkEntry *self, GtkEntryIconPosition icon_pos, GdkEvent*){ + if (icon_pos == GTK_ENTRY_ICON_SECONDARY){ + int visible = gtk_entry_get_visibility(self); + if (!visible){ + gtk_entry_set_visibility(self,1); + } else { + gtk_entry_set_visibility(self,0); + gtk_entry_set_invisible_char(self,'*'); + } + } +} + +void on_password_accept(GtkWidget *self, dictionary *dict){ + ubl_settings_usergroups_password_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_password_window*); + GtkEntry *entry = yon_dictionary_get_data(dict->first->next,GtkEntry*); + char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); + char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry)); + if (yon_char_is_empty(password)){ + char *pasted_hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry)); + if (!yon_char_is_empty(pasted_hash)){ + gtk_entry_set_text(entry,pasted_hash); + } else { + yon_ubl_status_highlight_incorrect(window->PasswordEntry); + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_SHORT_LABEL(yon_char_from_int(main_config.password_min_length)),5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + } else { + for (size_t i=0;iStatusBox),RESTRICTED_SYMBOLS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + } + if (yon_char_is_empty(password)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } else if (password[0]=='%'&&password[1]=='%'){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + if (strlen(password)StatusBox),PASSWORD_SHORT_LABEL(yon_char_from_int(main_config.password_min_length)),5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + if (!strcmp(password,password_check)){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){ + char *pasw=yon_char_append("%%",password); + password=pasw; + } + gtk_entry_set_text(GTK_ENTRY(entry),password); + } else { + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + } + on_subwindow_close(self); +} + +ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(){ + ubl_settings_usergroups_password_window *window = malloc(sizeof(ubl_settings_usergroups_password_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_password); + window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->PasswordEntry=yon_gtk_builder_get_widget(builder,"PasswordEntry"); + window->RepeatPasswordEntry=yon_gtk_builder_get_widget(builder,"RepeatPasswordEntry"); + window->PasswordHashEntry=yon_gtk_builder_get_widget(builder,"PasswordHashEntry"); + window->HashBox=yon_gtk_builder_get_widget(builder,"HashBox"); + window->PasswordBox=yon_gtk_builder_get_widget(builder,"PasswordBox"); + window->NoEncriptionCheck=yon_gtk_builder_get_widget(builder,"NoEncriptionCheck"); + + window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton"); + window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton"); + + yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateGroupWindow),"PasswordWindow"); + g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->PasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); + g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); + g_signal_connect(G_OBJECT(window->PasswordHashEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); + gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),PASSWORD_TITLE_LABEL); + +return window; +} + + +int yon_check_password_blocked(char *password){ + if (!yon_char_is_empty(password)){ + if (!strcmp(password,"!*")){ + memset(password,0,strlen(password)); + return 1; + } else if (password[0]=='!'&&password[1]=='*'){ + char *copy = yon_char_new(password); + memcpy(copy,password+2,strlen(password+2)); + memset(password,0,strlen(password)); + memcpy(password,copy,strlen(copy)); + free(copy); + return 1; + } else if (password[0]=='!'||password[0]=='*'){ + free(yon_char_divide(password,0)); + return 1; + } + } + return 0; +} \ No newline at end of file diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index dad7996..9a64078 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -200,6 +200,29 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->PasswordHashCombo),hash); } + char *parameter = config(USERADD_SYNC_parameter); + { + int size; + config_str parsed = yon_char_parse(parameter,&size,","); + int sync_parameters_size; + config_str sync_parameters = yon_resource_open_file(sync_parameters_path,&sync_parameters_size); + for(int i=0;iCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_additional_settings_save),window); dictionary *default_dict=NULL; @@ -246,4 +269,90 @@ void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *, main_windo g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); gtk_widget_show(window->Window); +} + +config_str yon_parameter_parse(char *parameter, int *size){ + if (yon_char_is_empty(parameter)) return NULL; + char *cur; + (*size)=0; + if ((cur = strstr(parameter,"<"))){ + config_str parsed = yon_char_parse(parameter,size,">"); + for (int i=0;i<(*size);i++){ + char *tag = strstr(parsed[i],">"); + int length = strlen(parsed[i])-strlen(tag+1); + free(yon_char_divide(parsed[i],length)); + } + return parsed; + } else { + config_str parsed = yon_char_parsed_new(size,parameter,NULL); + return parsed; + } +} + +int yon_parameter_check_tag(char *parameter, char *pattern){ + char *tag_template = "<([^>]+)>"; + char *converted = ""; + char *current = pattern; + while (!yon_char_is_empty(current)){ + if ((*current)=='<'){ + char *end = strchr(current,'>'); + if (end){ + converted = yon_char_append(converted,tag_template); + current = end+1; + } else { + // закрытие тэга не найдено + } + } else { + char *temp = yon_char_append_c(converted,*current); + if (!yon_char_is_empty(converted)) free(converted); + converted = temp; + current++; + } + } + + GRegex *regex = g_regex_new(converted,G_REGEX_EXTENDED,0,NULL); + if (regex){ + GMatchInfo *match; + if (g_regex_match(regex,parameter,0,&match)){ + return 1; + } + } + + + return 0; +} + +config_str yon_parameter_get_by_template(char *parameter, char *pattern, int *size){ + config_str final = NULL; + char *tag_template = "<([^>]+)>"; + char *converted = ""; + char *current = pattern; + while (!yon_char_is_empty(current)){ + if ((*current)=='<'){ + char *end = strchr(current,'>'); + if (end){ + converted = yon_char_append(converted,tag_template); + current = end+1; + } else { + // закрытие тэга не найдено + } + } else { + yon_char_append_c(converted,*current); + current++; + } + } + GRegex *regex = g_regex_new(converted,G_REGEX_EXTENDED,0,NULL); + if (regex){ + GMatchInfo *match; + if (g_regex_match(regex,parameter,0,&match)){ + int match_count = g_match_info_get_match_count(match); + for (int i=0;iuserDontCheckCheck)); + if (do_not_check_actve) + do_not_check = "--badnames"; + + login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)); + if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),USER_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); + yon_ubl_status_highlight_incorrect(window->userLoginEntry); + return; + } + if (yon_char_is_empty(login)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); + yon_ubl_status_highlight_incorrect(window->userLoginEntry); + return; + } + + int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo)); + if (user_shell_active>0){ + user_shell = yon_char_unite("--shell ",!strcmp(gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->userShellCombo)),"Set")?(char*)gtk_entry_get_text(GTK_ENTRY(window->userShellEntry)):(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL); + + } else user_shell=""; + + int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo)); + if (user_home_active==2){ + char *path = (char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry)); + if (!yon_char_is_empty(path)) + user_home=yon_char_unite("--home-dir ",path,NULL); + else user_home = ""; + } else if (user_home_active==1){ + user_home="--no-create-home"; + } else user_home = ""; + + int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck)); + if (system_user_active) + create_system_user = "--system"; + + int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck)); + if (create_ununique_active) + create_ununique = "--non-unique"; + int main_group_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck)); + if (!main_group_active){ + main_group = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry)); + if (yon_char_is_empty(main_group)){ + no_user_group="--no-user-group"; + } + } else { + main_group = ""; + } + char *final_string = user_home; + final_string = yon_char_unite(final_string,!yon_char_is_empty(final_string)?" ":"", + yon_char_return_if_exist(user_shell,""), + !yon_char_is_empty(user_shell)?" ":"", + yon_char_return_if_exist(create_system_user,""), + !yon_char_is_empty(create_system_user)?" ":"", + yon_char_return_if_exist(create_ununique,""), + !yon_char_is_empty(create_ununique)?" ":"", + yon_char_return_if_exist(do_not_check,""), + !yon_char_is_empty(do_not_check)?" ":"", + yon_char_return_if_exist(no_user_group,""), + NULL); + if (final_string&&strlen(final_string)){ + if (final_string[strlen(final_string)-1]==' ') final_string[strlen(final_string)-1]='\0'; + gtk_entry_set_text(GTK_ENTRY(window->userExtraOptionsEntry),final_string); + free(final_string); + } else { + gtk_entry_set_text(GTK_ENTRY(window->userExtraOptionsEntry),""); + } +} ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ ubl_settings_usergroups_user_window *window = malloc(sizeof(ubl_settings_usergroups_user_window)); @@ -194,12 +274,6 @@ void on_user_save(GtkWidget *self, dictionary *dict){ char *password_change_interval_maximum = NULL; char *warning_days = NULL; char *no_activity_days = NULL; - // char *force_at_next_login = NULL; - char *user_shell = NULL; - char *user_home = NULL; - char *create_system_user = NULL; - char *create_ununique = NULL; - char *do_not_check = NULL; int samba_sync = 0; int samba_password_sync = 0; int deactivate = 0; @@ -254,9 +328,6 @@ void on_user_save(GtkWidget *self, dictionary *dict){ } int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck)); - if (do_not_check_actve) - do_not_check = "--badnames"; - login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)); if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),USER_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); @@ -368,31 +439,6 @@ void on_user_save(GtkWidget *self, dictionary *dict){ no_activity_days = yon_char_from_long(no_activity_days_active); } - int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo)); - if (user_shell_active>0){ - char *shell_string = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)); - if (strcmp(shell_string,SET_LABEL)){ - user_shell = yon_char_unite("--shell ",shell_string," ",NULL); - } else { - user_shell = yon_char_unite("--shell ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userShellEntry)),NULL); - } - } else user_shell=""; - - int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo)); - if (user_home_active==2){ - user_home=yon_char_unite("--home-dir ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry)),NULL); - } else if (user_home_active==1){ - user_home="--no-create-home"; - } else user_home = ""; - - int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck)); - if (system_user_active) - create_system_user = "--system"; - - int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck)); - if (create_ununique_active) - create_ununique = "--non-unique"; - samba_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck)); samba_password_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck)); if (samba_sync){ @@ -491,25 +537,8 @@ void on_user_save(GtkWidget *self, dictionary *dict){ } else { yon_config_remove_by_key(USERSHADOW_SYNC(window->old_username)); } - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->UsersList); - char *password_status=NULL; - if (password_active==0) password_status = DEFAULT_USER_LABEL; - else if (password_active==1) password_status = NO_PASSWORD_LABEL; - else if (password[0]=='%'&&password[1]=='%') password_status = UNENCRYPTED_LABEL; - else password_status = ENCRYPTED_LABEL; - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter)) - gtk_list_store_append(widgets->UsersList,&iter); - gtk_list_store_set(widgets->UsersList,&iter, - 0,deactivate, - 1,yon_char_return_if_exist(uid_string,""), - 2,yon_char_return_if_exist(login,""), - 3,yon_char_return_if_exist(username,""), - 4,yon_char_return_if_exist(main_group,login), - 5,yon_char_return_if_exist(additional_groups,yon_config_get_by_key(USERGROUPS_parameter)), - 6,yon_char_unite(yon_char_return_if_exist(user_home,""),yon_char_return_if_exist(user_shell,""),yon_char_return_if_exist(create_system_user,""),yon_char_return_if_exist(create_ununique,""),yon_char_return_if_exist(do_not_check,""),NULL), - 7,password_status, - -1); + yon_interface_update(widgets); + on_subwindow_close(self); } diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index b20d96d..5f9c672 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -182,6 +182,43 @@ void yon_interface_update(main_window *widgets){ } yon_system_load(widgets); + + + if (!yon_window_config_check_exist("window","UserColumn1")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->UsersTree), 1,-1); + + } + if (!yon_window_config_check_exist("window","UserColumn2")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->UsersTree), 2,-1); + } + if (!yon_window_config_check_exist("window","UserColumn3")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->UsersTree), 3,-1); + } + + if (!yon_window_config_check_exist("window","GroupColumn1")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->GroupsTree),1,-1); + } + if (!yon_window_config_check_exist("window","GroupColumn2")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->GroupsTree),2,-1); + } + + if (!yon_window_config_check_exist("window","SystemUserColumn1")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemTree),1,-1); + } + if (!yon_window_config_check_exist("window","SystemUserColumn2")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemTree),2,-1); + } + if (!yon_window_config_check_exist("window","SystemUserColumn3")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemTree),3,-1); + } + + if (!yon_window_config_check_exist("window","SystemGroupColumn2")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemGroupsTree),1,-1); + } + if (!yon_window_config_check_exist("window","SystemGroupColumn2")){ + yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemGroupsTree),2,-1); + } + } void on_config_local_load(GtkWidget *, main_window *widgets){ @@ -606,51 +643,6 @@ void yon_delete_confirmation_save(GtkWidget *self, dictionary *dict){ on_subwindow_close(self); } -void yon_group_delete_confirmation_save(GtkWidget *self, dictionary *dict){ - GtkTreeIter iter,itar; - main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); - yon_confirmation_window *window = yon_dictionary_get_data(dict->first->next,yon_confirmation_window*); - int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter); - for (;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->GroupsList),&iter)){ - char *name; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,1,&name,-1); - int valid2 = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar); - for (;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itar)){ - char *name_check; - int delete; - gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&delete,1,&name_check,-1); - if (!strcmp(name,name_check)&&delete){ - yon_config_remove_by_key(GROUPADD(name)); - yon_config_remove_by_key(GROUPADD_SYNC(name)); - valid=0; - break; - } - } - } - yon_interface_update(widgets); - - on_subwindow_close(self); -} - -int yon_check_password_blocked(char *password){ - if (!yon_char_is_empty(password)){ - if (!strcmp(password,"!*")){ - memset(password,0,strlen(password)); - return 1; - } else if (password[0]=='!'&&password[1]=='*'){ - char *copy = yon_char_new(password); - memcpy(copy,password+2,strlen(password+2)); - memset(password,0,strlen(password)); - memcpy(password,copy,strlen(copy)); - free(copy); - return 1; - } else if (password[0]=='!'||password[0]=='*'){ - free(yon_char_divide(password,0)); - return 1; - } - } - return 0; -} yon_confirmation_window *yon_delete_confirmation_new(){ yon_confirmation_window *window = malloc(sizeof(yon_confirmation_window)); @@ -760,41 +752,6 @@ void yon_delete_confirmation_open(main_window *widgets){ gtk_widget_show(window->Window); } -void yon_group_delete_confirmation_open(main_window *widgets){ - yon_confirmation_window *window = yon_delete_confirmation_new(); - gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); - GtkTreeIter iter,itar; - dictionary *dict = NULL; - gtk_label_set_text(GTK_LABEL(window->TitleLabel),DELETE_GROUP_CONFIRMATION_CONFIRM_LABEL); - gtk_tree_view_column_set_title(window->UserCell,GROUP_LABEL); - gtk_label_set_text(GTK_LABEL(window->HatLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL); - gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),2),0); - gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),3),0); - gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),4),0); - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_group_delete_confirmation_save),dict); - GtkTreeModel *model = GTK_TREE_MODEL(widgets->GroupsList); - GList *list = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GroupsTree)),&model); - int chosen_size=0; - config_str chosen = NULL; - for (guint i=0;iGroupsList),&iter); - for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->GroupsList),&iter)){ - char *name; - gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,1,&name,-1); - gtk_list_store_append(window->list,&itar); - gtk_list_store_set(window->list,&itar,0,yon_char_parsed_check_exist(chosen,chosen_size,name)>-1?1:0,1,name,-1); - free(name); - } - gtk_widget_show(window->Window); -} - yon_savasettings_window *yon_saving_settings_new(){ GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_savesettings); yon_savasettings_window *window = malloc(sizeof(yon_savasettings_window)); @@ -1005,67 +962,11 @@ void on_groups_multiple_clicked(GtkWidget *, GtkEntry *output_target){ } -void on_passwords_encrypt(){ - int pid = fork(); - if (!pid){ - exit(system(encrypt_passwords_command)); - } -} - -void on_password_change(GtkWidget *, dictionary *entry_dict){ - GtkEntry *output_target = yon_dictionary_get_data(entry_dict->first->next,GtkEntry*); - ubl_settings_usergroups_password_window *window = yon_ubl_settings_usergroups_password_new(); - dictionary *dict = NULL; - char *password = (char*)gtk_entry_get_text(output_target); - if (!yon_char_is_empty(password)){ - if (main_config.load_mode==0){ - password = yon_char_new(password); - if (!check_is_password_hash(password)){ - gtk_entry_set_text(GTK_ENTRY(window->PasswordHashEntry),password); - } else { - if (password[0]=='%'&&password[1]=='%'){ - free(yon_char_divide(password,1)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck),1); - } - gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),password); - } - } - } - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); - yon_dictionary_add_or_create_if_exists_with_data(dict,"target",output_target); - g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_password_accept),dict); - g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(output_target)))); - gtk_widget_show(window->CreateGroupWindow); - -} - -void on_additional_settings_clicked(GtkWidget *, GtkEntry *){ - ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new(); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - gtk_widget_show(window->Window); - -} - void on_expiration_clicked(GtkWidget *, ubl_settings_usergroups_user_window *window){ gtk_popover_popup(GTK_POPOVER(window->CalendarPopup)); } // standard functions - - void on_hash_changed(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ - - int hash_size=0; - config_str hash_algos = yon_file_open(hash_list_path,&hash_size); - for (int i=1;iPasswordHashCombo,parsed[1]); - yon_char_parsed_free(parsed,parsed_size); - } - yon_char_parsed_free(hash_algos,hash_size); - } void on_user_choose(GtkWidget *, GtkEntry *target){ ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(1); @@ -1117,187 +1018,6 @@ void on_user_choose(GtkWidget *, GtkEntry *target){ gtk_widget_show(window->GroupsWindow); } -void on_GID_update(GtkWidget *, ubl_settings_usergroups_group_creation_window *window){ - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){ - if (window->last_gid){ - gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),window->last_gid); - } else { - int config_size=0; - int final_size=0; - config_str config_groups = yon_config_get_all_by_key(GROUPADD_parameter,&config_size); - yon_char_parsed_prepend_strings(config_groups,config_size,":"); - config_str final = yon_char_parsed_merge(main_config.groups,main_config.groups_size,config_groups,config_size,&final_size); - long prev_busy=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck))?0:main_config.MINGID; - - int minimum = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck))?0:main_config.MINGID; - int maximum = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck))?68000:main_config.MAXGID; - for (int i=0;i2&&minimumprev_busy){ - prev_busy=atol(parsed[2]); - } - } - yon_char_parsed_free(parsed, parsed_size); - } - gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),yon_char_from_long(prev_busy+1)); - } - } else { - gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),""); - } -} - -void on_group_save(GtkWidget *self, dictionary *dict){ - main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); - ubl_settings_usergroups_group_creation_window *window = yon_dictionary_get_data(dict->first->next,ubl_settings_usergroups_group_creation_window*); - char *final_string = NULL; - char *group_name = NULL; - char *group_users = NULL; - char *gid = NULL; - char *non_unique = NULL; - char *gsystem = NULL; - char *admins = NULL; - char *password = NULL; - int gid_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck)); - if (gid_active){ - gid="x"; - } else { - gid = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry)); - if (yon_char_is_empty(gid)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); - yon_ubl_status_highlight_incorrect(window->userUIDEntry); - return; - } - - - if (!yon_char_is_empty(window->last_gid)&&strcmp(gid,window->last_gid)){ - int config_size=0; - int final_size=0; - config_str config_users = yon_config_get_all_by_key(GROUPADD_SEARCH_macro,&config_size); - config_str final = yon_char_parsed_merge(main_config.groups,main_config.groups_size,config_users,config_size,&final_size); - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UnuniqueGIDCheck))){ - int found=0; - char *uid_string = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry)); - for (int i=0;i2&&!strcmp(parsed[2],uid_string)){ - if (yon_char_is_empty(window->last_gid)||(!yon_char_is_empty(window->last_gid)&&strcmp(parsed[2],window->last_gid))){ - found = yon_char_parsed_check_exist(config_users,config_size,final[i])>-1?1:2; - break; - } - } - if (parsed_size) yon_char_parsed_free(parsed,parsed_size); - } - if (found){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),found==1?GID_ALREADY_EXIST_CONFIG_LABEL:GID_ALREADY_EXIST_SYSTEM_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->userUIDEntry); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); - return; - } - } - } - } - - group_name = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)); - if (group_name[0]>'0'&&group_name[0]<'9'){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),GROUP_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->userLoginEntry); - return; - } - if (yon_char_is_empty(group_name)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); - yon_ubl_status_highlight_incorrect(window->userLoginEntry); - return; - } - { - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->GroupsList); - for_iter(model,&iter){ - char *cur; - gtk_tree_model_get(model,&iter,1, &cur,-1); - if (!yon_char_is_empty(cur)&&!strcmp(cur,group_name)){ - if (!gtk_tree_selection_iter_is_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GroupsTree)),&iter)){ - - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),GROUP_EXIST_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->userLoginEntry); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); - return; - } - } - } - } - - group_users = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry)); - - admins = (char*)gtk_entry_get_text(GTK_ENTRY(window->AdminGroupsEntry)); - int non_unique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UnuniqueGIDCheck)); - if(non_unique_active){ - non_unique="--non-unique"; - } else non_unique=""; - - int gsystem_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck)); - if(gsystem_active){ - gsystem="--system"; - } else gsystem=""; - - int shutdown_sync_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupaddShutdownCheck)); - if (shutdown_sync_active){ - char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD_SYNC(group_name)); - yon_config_register(GROUPADD_SYNC(group_name),final_command,"shutdown"); - yon_config_compare_ignore_set(GROUPADD_SYNC(group_name),1); - } else { - yon_config_remove_by_key(GROUPADD_SYNC(group_name)); - } - - - int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordCombo)); - if (password_active == 1) { - password = "!*"; - } else if (password_active == 2){ - password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); - if (yon_char_is_empty(password)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); - yon_ubl_status_highlight_incorrect(window->PasswordEntry); - return; - } - } else { - password=""; - } - final_string = yon_char_unite(yon_char_return_if_exist(group_users,""), - ":",yon_char_return_if_exist(gid,"x"), - ":",yon_char_return_if_exist(non_unique,""), - yon_char_return_if_exist(gsystem,""), - ":",yon_char_return_if_exist(admins,""), - ":",yon_char_return_if_exist(password,"x"), - NULL); - char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD_SYNC(group_name)); - yon_config_register(GROUPADD(group_name),final_command,final_string); - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(widgets->GroupsList); - if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GroupsTree)),&model,&iter)) - gtk_list_store_append(widgets->GroupsList,&iter); - char *passwor = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); - char *password_status=NULL; - if (password_active==0) - password_status=DEFAULT_USER_LABEL; - else if (password_active==1) - password_status = NO_PASSWORD_LABEL; - else if (password_active == 2){ - if (check_is_password_hash(passwor)){ - password_status=UNENCRYPTED_LABEL; - } else { - password_status=UNENCRYPTED_LABEL; - } - } - gtk_list_store_set(widgets->GroupsList,&iter,0,strcmp(gid,"x")?gid:"",1,group_name,2,group_users,3,yon_char_append(non_unique,gsystem),4,password_status,-1); - on_subwindow_close(self); -} - void on_system_parameter_changed(GtkWidget *, ubl_settings_usergroups_group_creation_window *window){ char *non_unique = NULL; @@ -1321,58 +1041,6 @@ void on_system_parameter_changed(GtkWidget *, ubl_settings_usergroups_group_crea gtk_entry_set_text(GTK_ENTRY(window->groupExtraOptionsEntry),final_str); free(final_str); } - -ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group_creation_new(){ - ubl_settings_usergroups_group_creation_window *window = malloc(sizeof(ubl_settings_usergroups_group_creation_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group_creation); - window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow"); - window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); - window->userUIDAutoCheck=yon_gtk_builder_get_widget(builder,"GIDAutoCheck"); - window->userUIDEntry=yon_gtk_builder_get_widget(builder,"userUIDEntry"); - window->userLoginEntry=yon_gtk_builder_get_widget(builder,"userLoginEntry"); - window->userGroupsEntry=yon_gtk_builder_get_widget(builder,"userGroupsEntry"); - window->UserAdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"AdditionalGroupsButton"); - window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton"); - window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton"); - window->AdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"AdditionalGroupsButton"); - window->UnuniqueGIDCheck=yon_gtk_builder_get_widget(builder,"UnuniqueGIDCheck"); - window->SystemGroupCheck=yon_gtk_builder_get_widget(builder,"SystemGroupCheck"); - window->PasswordCombo=yon_gtk_builder_get_widget(builder,"PasswordCombo"); - window->PasswordEntry=yon_gtk_builder_get_widget(builder,"PasswordEntry"); - window->ChangePasswordButton=yon_gtk_builder_get_widget(builder,"ChangePasswordButton"); - window->userTitleNameLabel=yon_gtk_builder_get_widget(builder,"userTitleNameLabel"); - window->AdminGroupsEntry=yon_gtk_builder_get_widget(builder,"AdminGroupsEntry"); - window->AdminGroupsButton=yon_gtk_builder_get_widget(builder,"AdminGroupsButton"); - window->GroupaddShutdownCheck=yon_gtk_builder_get_widget(builder,"GroupaddShutdownCheck"); - window->groupExtraOptionsEntry=yon_gtk_builder_get_widget(builder,"groupExtraOptionsEntry"); - window->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook"); - window->last_gid=NULL; - - gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),GROUPS_TITLE_LABEL); - - on_GID_update(NULL,window); - dictionary *entry_dict=NULL; - yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"combo",window->PasswordCombo); - yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"entry",window->PasswordEntry); - yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateGroupWindow),"GroupAddWindow"); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); - g_signal_connect(G_OBJECT(window->ChangePasswordButton),"clicked",G_CALLBACK(on_password_change),entry_dict); - g_signal_connect(G_OBJECT(window->PasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->ChangePasswordButton); - g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - g_signal_connect(G_OBJECT(window->UserAdditionalGroupsButton),"clicked",G_CALLBACK(on_user_choose),window->userGroupsEntry); - g_signal_connect(G_OBJECT(window->AdminGroupsButton),"clicked",G_CALLBACK(on_user_choose),window->AdminGroupsEntry); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(on_GID_update),window); - g_signal_connect(G_OBJECT(window->SystemGroupCheck),"toggled",G_CALLBACK(on_GID_update),window); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_toggle_button_set_inactive_from_toggle_button),window->SystemGroupCheck); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),window->SystemGroupCheck); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_toggle_button_set_inactive_from_toggle_button_inversed),window->UnuniqueGIDCheck); - g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UnuniqueGIDCheck); - g_signal_connect(G_OBJECT(window->UnuniqueGIDCheck),"toggled",G_CALLBACK(on_system_parameter_changed),window); - g_signal_connect(G_OBJECT(window->SystemGroupCheck),"toggled",G_CALLBACK(on_system_parameter_changed),window); - g_signal_connect(G_OBJECT(window->userUIDEntry),"insert-text",G_CALLBACK(yon_on_text_insert_only_digits),NULL); -return window; -} - void on_group_clicked(GtkCellRenderer *, char *path, ubl_settings_usergroups_group_window *window){ GtkTreeIter iter; gboolean status; @@ -1504,89 +1172,6 @@ void on_standard_groups_open(GtkWidget *, main_window *widgets){ gtk_widget_show(window->GroupsWindow); } -void on_password_show_hide(GtkEntry *self, GtkEntryIconPosition icon_pos, GdkEvent*){ - if (icon_pos == GTK_ENTRY_ICON_SECONDARY){ - int visible = gtk_entry_get_visibility(self); - if (!visible){ - gtk_entry_set_visibility(self,1); - } else { - gtk_entry_set_visibility(self,0); - gtk_entry_set_invisible_char(self,'*'); - } - } -} - -void on_password_accept(GtkWidget *self, dictionary *dict){ - ubl_settings_usergroups_password_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_password_window*); - GtkEntry *entry = yon_dictionary_get_data(dict->first->next,GtkEntry*); - char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); - char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry)); - if (yon_char_is_empty(password)){ - char *pasted_hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry)); - if (!yon_char_is_empty(pasted_hash)){ - gtk_entry_set_text(entry,pasted_hash); - } else { - yon_ubl_status_highlight_incorrect(window->PasswordEntry); - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_SHORT_LABEL(yon_char_from_int(main_config.password_min_length)),5,BACKGROUND_IMAGE_FAIL_TYPE); - return; - } - } else { - for (size_t i=0;iStatusBox),RESTRICTED_SYMBOLS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - return; - } - } - if (yon_char_is_empty(password)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - return; - } else if (password[0]=='%'&&password[1]=='%'){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - return; - } - if (strlen(password)StatusBox),PASSWORD_SHORT_LABEL(yon_char_from_int(main_config.password_min_length)),5,BACKGROUND_IMAGE_FAIL_TYPE); - return; - } - if (!strcmp(password,password_check)){ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){ - char *pasw=yon_char_append("%%",password); - password=pasw; - } - gtk_entry_set_text(GTK_ENTRY(entry),password); - } else { - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - return; - } - } - on_subwindow_close(self); -} - -ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(){ - ubl_settings_usergroups_password_window *window = malloc(sizeof(ubl_settings_usergroups_password_window)); - GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_password); - window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow"); - window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); - window->PasswordEntry=yon_gtk_builder_get_widget(builder,"PasswordEntry"); - window->RepeatPasswordEntry=yon_gtk_builder_get_widget(builder,"RepeatPasswordEntry"); - window->PasswordHashEntry=yon_gtk_builder_get_widget(builder,"PasswordHashEntry"); - window->HashBox=yon_gtk_builder_get_widget(builder,"HashBox"); - window->PasswordBox=yon_gtk_builder_get_widget(builder,"PasswordBox"); - window->NoEncriptionCheck=yon_gtk_builder_get_widget(builder,"NoEncriptionCheck"); - - window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton"); - window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton"); - - yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateGroupWindow),"PasswordWindow"); - g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - g_signal_connect(G_OBJECT(window->PasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); - g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); - g_signal_connect(G_OBJECT(window->PasswordHashEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL); - gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),PASSWORD_TITLE_LABEL); - -return window; -} - void yon_system_load(main_window *window){ gtk_list_store_clear(window->liststore1); gtk_list_store_clear(window->liststore2); @@ -1707,13 +1292,6 @@ void on_system_update(GtkWidget *, main_window *window){ yon_system_load(window); } - - - - - - - void on_toggle_button_set_active_from_combo_box(GtkComboBox *self,ubl_settings_usergroups_user_window *window){ char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); if (gtk_combo_box_get_active(self)<=1||(passw[0]=='$')){ @@ -1729,21 +1307,6 @@ void on_toggle_button_set_active_from_combo_box(GtkComboBox *self,ubl_settings_u } } -void on_password_user_changed(GtkComboBox *,ubl_settings_usergroups_user_window *window){ - char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); - if ((passw[0]=='$')){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck),0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck),0); - gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),0); - } else { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck),0); - gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBACheck),1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck),0); - gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),1); - - } -} - void on_toggle_button_set_active_from_toggle_button_inversed(GtkToggleButton *, ubl_settings_usergroups_user_window *window){ char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); if ((passw[0]!='$')&>k_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo))>1){ @@ -1786,87 +1349,6 @@ void on_date_selected(GtkWidget *, ubl_settings_usergroups_user_window *window){ free(yr); } -void on_parameter_changed(GtkWidget *,ubl_settings_usergroups_user_window *window){ - char *user_shell=NULL; - char *user_home=NULL; - char *login=NULL; - char *create_system_user=NULL; - char *create_ununique=NULL; - char *do_not_check=NULL; - char *main_group=NULL; - char *no_user_group=NULL; - - int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck)); - if (do_not_check_actve) - do_not_check = "--badnames"; - - login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)); - if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),USER_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); - yon_ubl_status_highlight_incorrect(window->userLoginEntry); - return; - } - if (yon_char_is_empty(login)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); - yon_ubl_status_highlight_incorrect(window->userLoginEntry); - return; - } - - int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo)); - if (user_shell_active>0){ - user_shell = yon_char_unite("--shell ",!strcmp(gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->userShellCombo)),"Set")?(char*)gtk_entry_get_text(GTK_ENTRY(window->userShellEntry)):(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL); - - } else user_shell=""; - - int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo)); - if (user_home_active==2){ - char *path = (char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry)); - if (!yon_char_is_empty(path)) - user_home=yon_char_unite("--home-dir ",path,NULL); - else user_home = ""; - } else if (user_home_active==1){ - user_home="--no-create-home"; - } else user_home = ""; - - int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck)); - if (system_user_active) - create_system_user = "--system"; - - int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck)); - if (create_ununique_active) - create_ununique = "--non-unique"; - int main_group_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck)); - if (!main_group_active){ - main_group = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry)); - if (yon_char_is_empty(main_group)){ - no_user_group="--no-user-group"; - } - } else { - main_group = ""; - } - char *final_string = user_home; - final_string = yon_char_unite(final_string,!yon_char_is_empty(final_string)?" ":"", - yon_char_return_if_exist(user_shell,""), - !yon_char_is_empty(user_shell)?" ":"", - yon_char_return_if_exist(create_system_user,""), - !yon_char_is_empty(create_system_user)?" ":"", - yon_char_return_if_exist(create_ununique,""), - !yon_char_is_empty(create_ununique)?" ":"", - yon_char_return_if_exist(do_not_check,""), - !yon_char_is_empty(do_not_check)?" ":"", - yon_char_return_if_exist(no_user_group,""), - NULL); - if (final_string&&strlen(final_string)){ - if (final_string[strlen(final_string)-1]==' ') final_string[strlen(final_string)-1]='\0'; - gtk_entry_set_text(GTK_ENTRY(window->userExtraOptionsEntry),final_string); - free(final_string); - } else { - gtk_entry_set_text(GTK_ENTRY(window->userExtraOptionsEntry),""); - } -} - void on_remove_expired(GtkWidget *, GtkEntryIconPosition icon_pos, GdkEvent *, GtkEntry *target){ if (icon_pos == GTK_ENTRY_ICON_SECONDARY){ gtk_entry_set_text(target,""); @@ -2548,12 +2030,19 @@ main_window *yon_main_window_complete(main_window *widgets){ yon_window_config_add_listener((GtkWidget*)g_list_nth_data(list,i),yon_char_append("GroupColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT); } g_list_free(list); + list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->SystemTree)); + for (guint i=0;iSystemGroupsTree)); + for (guint i=0;iUsersTree),1,-1); - // yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->GroupsTree),1,2,-1); - - // yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemTree),1,2,3,-1); - // yon_gtk_tree_view_set_fixed_size(GTK_TREE_VIEW(widgets->SystemGroupsTree),1,2,-1); yon_window_config_load(config_path); yon_save_window_set_postsave_function(on_save_done,widgets); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 7f9098e..2b94d1f 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -38,6 +38,7 @@ #define CssPath "/com/ublinux/css/ubl-settings-usergroups.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) #define icon_path "com.ublinux.ubl-settings-usergroups" +#define sync_parameters_path "resource:///com/ublinux/csv/sync_parameters.csv" #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-usergroups" @@ -534,4 +535,7 @@ system_remove_confirmation_window *yon_system_remove_confirmation_window_new(); void on_delete_system_user(GtkWidget *, dictionary *dict); void on_delete_system_group(GtkWidget *, dictionary *dict); char *yon_char_parsed_to_string_include_empty(config_str parsed, int parsed_size, char *divider); +config_str yon_parameter_parse(char *parameter, int *size); +int yon_parameter_check_tag(char *tag,char *string); +config_str yon_parameter_get_by_template(char *parameter, char *pattern, int *size); #endif \ No newline at end of file diff --git a/sync_parameters.csv b/sync_parameters.csv new file mode 100644 index 0000000..915b239 --- /dev/null +++ b/sync_parameters.csv @@ -0,0 +1,6 @@ +PARAMETER:DESCRIPTION +shutdown@all:When the system is shut down, synchronize all users in the system with the global configuration +shutdown@users:On system shutdown, synchronize users 1000<=UID<=6000 in the system with the global configuration +shutdown@systems:On system shutdown, synchronize system users 500<=UID<=999 in the system with the global configuration +shutdown@-:When the system is shut down, synchronize the range of UIDs of users in the system with the global configuration +shutdown@:When the system is shut down, synchronize the user UID in the system with the global configuration \ No newline at end of file From ff7573e76cedb0d6a3538e8dbff475b78b3208df Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 17 Feb 2025 18:22:07 +0600 Subject: [PATCH 53/72] Shutdown parameter WIP --- source/ubl-settings-usergroups-settings.c | 89 +++++++--- source/ubl-settings-usergroups.c | 9 +- source/ubl-settings-usergroups.h | 6 + sync_parameters.csv | 2 +- ...tings-usergroups-additional-settings.glade | 165 ++++++++++++++++-- 5 files changed, 231 insertions(+), 40 deletions(-) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index 9a64078..d2ac761 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -87,6 +87,38 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add // } } + void on_additional_settings_user_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *){ + + } + + void on_additional_settings_user_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ + GtkTreeModel *model; + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->UsersTree)),&model,&iter)){ + gboolean is_indeletable; + gtk_tree_model_get(model,&iter,4,&is_indeletable,-1); + if (!is_indeletable){ + gtk_list_store_remove(window->UsersShutdownList,&iter); + } + } + } + + void on_additional_settings_group_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *){ + + } + + void on_additional_settings_group_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ + GtkTreeModel *model; + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->GroupsTree)),&model,&iter)){ + gboolean is_indeletable; + gtk_tree_model_get(model,&iter,4,&is_indeletable,-1); + if (!is_indeletable){ + gtk_list_store_remove(window->GroupsShutdownList,&iter); + } + } + } + ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings); @@ -116,6 +148,8 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ window->GroupsTree=yon_gtk_builder_get_widget(builder,"GroupsTree"); window->GroupAddButton=yon_gtk_builder_get_widget(builder,"GroupAddButton"); window->GroupRemoveButton=yon_gtk_builder_get_widget(builder,"GroupRemoveButton"); + window->UsersShutdownList=GTK_LIST_STORE(gtk_builder_get_object(builder,"UsersShutdownList")); + window->GroupsShutdownList=GTK_LIST_STORE(gtk_builder_get_object(builder,"GroupsShutdownList")); window->default_password=NULL; window->default_root_password=NULL; @@ -124,6 +158,16 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ window->user_shutdown=-1; window->user_boot=-1; window->password_hash=NULL; + + g_signal_connect(G_OBJECT(window->UserAddButton),"clicked",G_CALLBACK(on_additional_settings_user_sync_add),window); + g_signal_connect(G_OBJECT(window->UserRemoveButton),"clicked",G_CALLBACK(on_additional_settings_user_sync_remove),window); + g_signal_connect(G_OBJECT(window->GroupAddButton),"clicked",G_CALLBACK(on_additional_settings_group_sync_add),window); + g_signal_connect(G_OBJECT(window->GroupRemoveButton),"clicked",G_CALLBACK(on_additional_settings_group_sync_remove),window); + + g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->GroupsShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); + yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->UserShutdownRevealer),GTK_SWITCH(window->UsersShutdownSwitch)); + yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->GroupShutdownRevealer),GTK_SWITCH(window->GroupsShutdownSwitch)); yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow"); gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL); @@ -211,10 +255,14 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ int sync_parsed_size; config_str sync_parsed = yon_char_parse(sync_parameters[j],&sync_parsed_size,":"); int cur_size; - int yes = yon_parameter_check_tag(parsed[i],sync_parsed[0]); - if (yes) { - config_str cur = yon_parameter_get_by_template(parsed[i],sync_parameters[i],&cur_size); - if (cur){}; + int sync_check = yon_parameter_check_tag(parsed[i],sync_parsed[0]); + if (sync_check) { + config_str cur = yon_parameter_get_by_template(parsed[i],sync_parsed[0],&cur_size); + if (cur){ + GtkTreeIter iter; + gtk_list_store_append(window->UsersShutdownList,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,1,sync_parsed[0],2,cur[0],3,cur_size>1?cur[1]:"",-1); + }; } yon_char_parsed_free(sync_parsed,sync_parsed_size); } @@ -248,11 +296,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_additional_settings_changed),window); g_signal_connect(G_OBJECT(window->DefaultUserAdministratorCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); - g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); g_signal_connect(G_OBJECT(window->GroupsBootCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); - g_signal_connect(G_OBJECT(window->GroupsShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); - yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->UserShutdownRevealer),GTK_SWITCH(window->UsersShutdownSwitch)); - yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->GroupShutdownRevealer),GTK_SWITCH(window->GroupsShutdownSwitch)); // g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_users_boot_toggled),NULL); // g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_users_shutdown_toggled),NULL); @@ -290,7 +334,7 @@ config_str yon_parameter_parse(char *parameter, int *size){ } int yon_parameter_check_tag(char *parameter, char *pattern){ - char *tag_template = "<([^>]+)>"; + char *tag_template = "[0-9]{1,}"; char *converted = ""; char *current = pattern; while (!yon_char_is_empty(current)){ @@ -314,7 +358,9 @@ int yon_parameter_check_tag(char *parameter, char *pattern){ if (regex){ GMatchInfo *match; if (g_regex_match(regex,parameter,0,&match)){ - return 1; + char *value = g_match_info_fetch(match, 0); + if (!strcmp(parameter,value)) + return 1; } } @@ -324,7 +370,7 @@ int yon_parameter_check_tag(char *parameter, char *pattern){ config_str yon_parameter_get_by_template(char *parameter, char *pattern, int *size){ config_str final = NULL; - char *tag_template = "<([^>]+)>"; + char *tag_template = "[0-9]{1,}"; char *converted = ""; char *current = pattern; while (!yon_char_is_empty(current)){ @@ -337,20 +383,23 @@ config_str yon_parameter_get_by_template(char *parameter, char *pattern, int *si // закрытие тэга не найдено } } else { - yon_char_append_c(converted,*current); + char *temp = yon_char_append_c(converted,*current); + if (!yon_char_is_empty(converted)) free(converted); + converted=temp; current++; } } - GRegex *regex = g_regex_new(converted,G_REGEX_EXTENDED,0,NULL); + GRegex *regex = g_regex_new("[0-9]{1,}",G_REGEX_EXTENDED,0,NULL); if (regex){ GMatchInfo *match; - if (g_regex_match(regex,parameter,0,&match)){ - int match_count = g_match_info_get_match_count(match); - for (int i=0;i - + + + + + + + + + + True + All groups in system + 1 + 65535 + True + True + + + False + Groups + 1000 + 6000 + True + False + + + False + System groups + 500 + 999 + True + False + + + False + Group GID range + 0 + 0 + True + False + + + False + Group GID in system + 0 + 0 + True + False + + @@ -20,10 +68,56 @@ - + - + + + + + + + + True + All system users + 1 + 65535 + True + True + + + False + Users + 1000 + 6000 + True + False + + + False + System users + 500 + 999 + True + False + + + False + Users UID range + 0 + 0 + True + False + + + False + User UID in system + 0 + 0 + True + False + + True @@ -512,10 +606,16 @@ True UsersShutdownList both + + + - + + + 0 + @@ -524,14 +624,22 @@ Syncronization type + + 1 + - Minimal UID + Minimum UID - + + 5 + + + 2 + @@ -539,7 +647,12 @@ Maximum UID - + + 5 + + + 3 + @@ -601,7 +714,7 @@ - False + True True 1 @@ -714,35 +827,55 @@ True GroupsShutdownList both + + + - - column + + + 0 + - column + Syncronization type + + 1 + - column + Minimum GID - + + True + 5 + + + 2 + - column + Maximum GID - + + True + 5 + + + 3 + @@ -804,7 +937,7 @@ - False + True True 1 From f51f31d97609bf611bd5695006609e7e356dcbff Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 18 Feb 2025 16:37:39 +0600 Subject: [PATCH 54/72] USERADD_SYNC shutdown WIP --- source/ubl-settings-usergroups-settings.c | 129 ++++++++++++++- source/ubl-settings-usergroups.h | 9 ++ ...tings-usergroups-additional-settings.glade | 150 ++++++++++++++---- 3 files changed, 257 insertions(+), 31 deletions(-) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index d2ac761..600a6fc 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -87,8 +87,26 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add // } } - void on_additional_settings_user_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *){ - + void on_additional_settings_user_sync_add(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){ + GtkTreeModel *model; + GtkTreeIter iter; + GtkWidget *tree; + if (self == window->UserAddButton){ + tree = window->UsersTree; + } else { + tree = window->GroupsTree; + } + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)),&model,&iter)){ + char *name; + char *parameter; + int min_sensitive; + int max_sensitive; + gtk_tree_model_get(model,&iter,1,&name,7,&min_sensitive,8,&max_sensitive,9,¶meter,-1); + + gtk_list_store_append(GTK_LIST_STORE(model),&iter); + gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,1,1,name,5,1,6,1,7,min_sensitive,8,max_sensitive,9,parameter,10,1,11,1,-1); + + } } void on_additional_settings_user_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ @@ -119,6 +137,96 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add } } +void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_settings_usergroups_additional_settings_window *window){ + GtkTreeIter iter; + GtkTreeModel *model = NULL; + if (self == window->UserActiveCell){ + model = GTK_TREE_MODEL(window->UsersShutdownList); + } else { + model = GTK_TREE_MODEL(window->GroupsShutdownList); + } + int status; + gtk_tree_model_get_iter_from_string(model,&iter,path); + gtk_tree_model_get(model,&iter,0,&status,-1); + gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,!status,6,!status,-1); + if (path[0]=='0'&&!!status){ + for_iter(model,&iter){ + gtk_list_store_set(GTK_LIST_STORE(model),&iter,5,1,-1); + } + } else if (path[0] == '0'&&!status) { + int i=0; + for_iter(model,&iter){ + if (i){ + gtk_list_store_set(GTK_LIST_STORE(model),&iter,5,0,-1); + } + i++; + } + } +} + +void on_additional_settings_cell_edited(GtkCellRenderer *self, char *path, char *new_text, ubl_settings_usergroups_additional_settings_window *window){ + for (size_t i=0;iUserMinCell){ + model = GTK_TREE_MODEL(window->UsersShutdownList); + place_to_set=2; + } else if (self == window->UserMaxCell) { + model = GTK_TREE_MODEL(window->UsersShutdownList); + place_to_set=3; + } else if (self == window->GroupMinCell) { + model = GTK_TREE_MODEL(window->GroupsShutdownList); + place_to_set=2; + } else if (self == window->GroupMaxCell) { + model = GTK_TREE_MODEL(window->GroupsShutdownList); + place_to_set=3; + } + gtk_tree_model_get_iter_from_string(model,&iter,path); + char *old_val; + gtk_tree_model_get(model,&iter,place_to_set==2?3:2,&old_val,-1); + if (yon_char_is_empty(old_val)) old_val = ""; + if (!yon_char_is_empty(old_val)){ + if (place_to_set==2){ + if (atoi(new_text)>atoi(old_val)){ + new_text=old_val; + } + } else { + if (atoi(old_val)>atoi(new_text)){ + new_text = old_val; + } + } + } + gtk_list_store_set(GTK_LIST_STORE(model),&iter,place_to_set,new_text,place_to_set==2?3:2,old_val,-1); +} + +void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){ + GtkTreeModel *model; + GtkTreeIter iter; + GtkWidget *tree; + GtkWidget *add_button; + GtkWidget *remove_button; + if (self == window->UsersTree){ + tree = window->UsersTree; + add_button = window->UserAddButton; + remove_button = window->UserRemoveButton; + } else { + tree = window->GroupsTree; + add_button = window->GroupAddButton; + remove_button = window->GroupRemoveButton; + } + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)),&model,&iter)){ + int deletable; + int creatable; + char *parameter; + gtk_tree_model_get(model,&iter,9,¶meter,10,&creatable,11,&deletable,-1); + if (creatable) gtk_widget_set_sensitive(add_button,1); else gtk_widget_set_sensitive(add_button,0); + if (deletable) gtk_widget_set_sensitive(remove_button,1); else gtk_widget_set_sensitive(remove_button,0); + } +} + ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings); @@ -150,6 +258,12 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ window->GroupRemoveButton=yon_gtk_builder_get_widget(builder,"GroupRemoveButton"); window->UsersShutdownList=GTK_LIST_STORE(gtk_builder_get_object(builder,"UsersShutdownList")); window->GroupsShutdownList=GTK_LIST_STORE(gtk_builder_get_object(builder,"GroupsShutdownList")); + window->UserActiveCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"UserActiveCell")); + window->UserMinCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"UserMinCell")); + window->UserMaxCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"UserMaxCell")); + window->GroupActiveCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupActiveCell")); + window->GroupMinCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupMinCell")); + window->GroupMaxCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupMaxCell")); window->default_password=NULL; window->default_root_password=NULL; @@ -164,8 +278,18 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ g_signal_connect(G_OBJECT(window->GroupAddButton),"clicked",G_CALLBACK(on_additional_settings_group_sync_add),window); g_signal_connect(G_OBJECT(window->GroupRemoveButton),"clicked",G_CALLBACK(on_additional_settings_group_sync_remove),window); + g_signal_connect(G_OBJECT(window->UserActiveCell),"toggled",G_CALLBACK(on_additional_settings_cell_toggled),window); + g_signal_connect(G_OBJECT(window->GroupActiveCell),"toggled",G_CALLBACK(on_additional_settings_cell_toggled),window); + g_signal_connect(G_OBJECT(window->UserMinCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window); + g_signal_connect(G_OBJECT(window->UserMaxCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window); + g_signal_connect(G_OBJECT(window->GroupMinCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window); + g_signal_connect(G_OBJECT(window->GroupMaxCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window); + g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); g_signal_connect(G_OBJECT(window->GroupsShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); + + g_signal_connect(G_OBJECT(window->UsersTree),"cursor-changed",G_CALLBACK(on_adiitional_settings_tree_selection_changed),window); + g_signal_connect(G_OBJECT(window->GroupsTree),"cursor-changed",G_CALLBACK(on_adiitional_settings_tree_selection_changed),window); yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->UserShutdownRevealer),GTK_SWITCH(window->UsersShutdownSwitch)); yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->GroupShutdownRevealer),GTK_SWITCH(window->GroupsShutdownSwitch)); @@ -180,7 +304,6 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ gtk_switch_set_active(GTK_SWITCH(window->UsersShutdownSwitch),1); } } - int hash_size=0; config_str hash_algos = yon_file_open(hash_list_path,&hash_size); if (main_config.hash_default_id==-1){ diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 14da670..a5c0ceb 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -258,6 +258,12 @@ typedef struct{ GtkWidget *GroupRemoveButton; GtkListStore *UsersShutdownList; GtkListStore *GroupsShutdownList; + GtkCellRenderer *UserActiveCell; + GtkCellRenderer *UserMinCell; + GtkCellRenderer *UserMaxCell; + GtkCellRenderer *GroupActiveCell; + GtkCellRenderer *GroupMinCell; + GtkCellRenderer *GroupMaxCell; const char *default_user_name; const char *default_password; @@ -544,4 +550,7 @@ config_str yon_parameter_get_by_template(char *parameter, char *pattern, int *si void on_additional_settings_group_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window); void on_additional_settings_user_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window); void on_additional_settings_user_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window); +void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_settings_usergroups_additional_settings_window *window); +void on_additional_settings_cell_edited(GtkCellRenderer *self, char *path, char *new_text, ubl_settings_usergroups_additional_settings_window *window); +void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window); #endif \ No newline at end of file diff --git a/ubl-settings-usergroups-additional-settings.glade b/ubl-settings-usergroups-additional-settings.glade index 954f8ef..749b5d4 100644 --- a/ubl-settings-usergroups-additional-settings.glade +++ b/ubl-settings-usergroups-additional-settings.glade @@ -10,54 +10,96 @@ - + - + + + + + + + + + + + + + True All groups in system - 1 - 65535 + 1 + 65535 True True + True + False + False + + False + False False Groups - 1000 - 6000 + 1000 + 6000 True False + False + False + False + + False + False False System groups - 500 - 999 + 500 + 999 True False + False + False + False + + False + False False Group GID range - 0 - 0 + + True False + False + True + True + + True + False False Group GID in system - 0 - 0 + + True False + False + True + False + + True + False @@ -68,54 +110,96 @@ - + - + + + + + + + + + + + + + True All system users - 1 - 65535 + 1 + 65535 True True + True + False + False + + False + False False Users - 1000 - 6000 + 1000 + 6000 True False + False + False + False + + False + False False System users - 500 - 999 + 500 + 999 True False + False + False + False + + False + False False Users UID range - 0 - 0 + + True False + False + True + True + + True + False False User UID in system - 0 - 0 + + True False + False + True + False + + True + False @@ -614,6 +698,7 @@ + 5 0 @@ -625,6 +710,7 @@ + 5 1 @@ -638,6 +724,8 @@ 5 + 6 + 7 2 @@ -651,6 +739,8 @@ 5 + 6 + 8 3 @@ -831,10 +921,11 @@ - + - + + 6 0 @@ -846,6 +937,7 @@ + 5 1 @@ -856,10 +948,11 @@ Minimum GID - True 5 + 6 + 7 2 @@ -870,10 +963,11 @@ Maximum GID - True 5 + 6 + 8 3 From 494f5443f8370dc37ceb5c9fdf733b71c2f24ee7 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 19 Feb 2025 15:43:06 +0600 Subject: [PATCH 55/72] USERADD_SYNC and GROUPADD_SYNC shutdown loading WIP --- source/ubl-settings-usergroups-settings.c | 264 +++++++++++++++++- source/ubl-settings-usergroups.h | 3 + source/ubl-strings.h | 8 + ...tings-usergroups-additional-settings.glade | 26 +- 4 files changed, 286 insertions(+), 15 deletions(-) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index 600a6fc..f4991de 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -121,8 +121,8 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add } } - void on_additional_settings_group_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *){ - + void on_additional_settings_group_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ + on_useradd_sync_changed(window); } void on_additional_settings_group_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ @@ -135,6 +135,7 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add gtk_list_store_remove(window->GroupsShutdownList,&iter); } } + on_useradd_sync_changed(window); } void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_settings_usergroups_additional_settings_window *window){ @@ -162,6 +163,7 @@ void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_ i++; } } + on_useradd_sync_changed(window); } void on_additional_settings_cell_edited(GtkCellRenderer *self, char *path, char *new_text, ubl_settings_usergroups_additional_settings_window *window){ @@ -200,6 +202,7 @@ GtkTreeIter iter; } } gtk_list_store_set(GTK_LIST_STORE(model),&iter,place_to_set,new_text,place_to_set==2?3:2,old_val,-1); + on_useradd_sync_changed(window); } void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){ @@ -227,6 +230,105 @@ void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings } } +void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window *window){ + char *useradd_sync = ""; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck))){ + useradd_sync = yon_char_new("boot"); + } + if (gtk_switch_get_active(GTK_SWITCH(window->UsersShutdownSwitch))){ + + GtkTreeIter iter; + for_iter(window->UsersShutdownList,&iter){ + int active; + char *min_str, max_str; + int sensitive; + char *parameter; + + gtk_tree_model_get(GTK_TREE_MODEL(window->UsersShutdownList),&iter,0,&active,2,&min_str,3,&max_str,6,&sensitive,9,¶meter,-1); + if (active&&sensitive){ + if (!strcmp(parameter,"shutdown@all")){ + char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"",parameter,NULL); + if(!yon_char_is_empty(useradd_sync)) free(useradd_sync); + useradd_sync = temp; + } else if (!strcmp(parameter,"shutdown@users")){ + char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"",parameter,NULL); + if(!yon_char_is_empty(useradd_sync)) free(useradd_sync); + useradd_sync = temp; + + } else if (!strcmp(parameter,"shutdown@systems")){ + char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"",parameter,NULL); + if(!yon_char_is_empty(useradd_sync)) free(useradd_sync); + useradd_sync = temp; + + } else if (!strcmp(parameter,"shutdown@min-max")){ + char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"","shutdown@",min_str,"-",max_str,NULL); + if(!yon_char_is_empty(useradd_sync)) free(useradd_sync); + useradd_sync = temp; + + } else if (!strcmp(parameter,"shutdown@uid")){ + char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"","shutdown@",min_str,NULL); + if(!yon_char_is_empty(useradd_sync)) free(useradd_sync); + useradd_sync = temp; + + } + } + } + } + if (!yon_char_is_empty(useradd_sync)){ + yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_get_command,useradd_sync); + } else { + yon_config_remove_by_key(USERADD_SYNC_parameter); + } + + char *groupadd_sync = ""; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck))){ + groupadd_sync = yon_char_new("boot"); + } + if (gtk_switch_get_active(GTK_SWITCH(window->UsersShutdownSwitch))){ + GtkTreeIter iter; + for_iter(window->UsersShutdownList,&iter){ + int active; + char *min_str, max_str; + int sensitive; + char *parameter; + + gtk_tree_model_get(GTK_TREE_MODEL(window->UsersShutdownList),&iter,0,&active,2,&min_str,3,&max_str,6,&sensitive,9,¶meter,-1); + if (active&&sensitive){ + if (!strcmp(parameter,"shutdown@all")){ + char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"",parameter,NULL); + if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); + groupadd_sync = temp; + } else if (!strcmp(parameter,"shutdown@users")){ + char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"",parameter,NULL); + if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); + groupadd_sync = temp; + + } else if (!strcmp(parameter,"shutdown@systems")){ + char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"",parameter,NULL); + if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); + groupadd_sync = temp; + + } else if (!strcmp(parameter,"shutdown@min-max")){ + char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"","shutdown@",min_str,"-",max_str,NULL); + if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); + groupadd_sync = temp; + + } else if (!strcmp(parameter,"shutdown@uid")){ + char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"","shutdown@",min_str,NULL); + if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); + groupadd_sync = temp; + + } + } + } + } + if (!yon_char_is_empty(useradd_sync)){ + yon_config_register(GROUPADD_SYNC_parameter,GROUPADD_SYNC_parameter_command,groupadd_sync); + } else { + yon_config_remove_by_key(GROUPADD_SYNC_parameter); + } +} + ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings); @@ -272,6 +374,164 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ window->user_shutdown=-1; window->user_boot=-1; window->password_hash=NULL; + + char *useradd_sync = yon_config_get_by_key(USERADD_SYNC_parameter); + char *groupadd_sync = yon_config_get_by_key(GROUPADD_SYNC_parameter); + + if (!yon_char_is_empty(useradd_sync)){ + GtkTreeModel *model = GTK_TREE_MODEL(window->UsersShutdownList); + GtkTreeIter iter; + int useradd_sync_size; + config_str parsed = yon_char_parse(useradd_sync,&useradd_sync_size,","); + if (yon_char_parsed_check_exist(parsed,useradd_sync_size,"shutdown@all")){ + int a=0; + for_iter(model,&iter){ + if (!a){ + gtk_list_store_set(window->UsersShutdownList,&iter,6,0,-1); + a++; + } else { + gtk_list_store_set(window->UsersShutdownList,&iter,5,1,-1); + } + } + } + int uid_set=0, maxmin_set=0; + for (int i=0;iUsersBootCheck),1); + } else if (!strcmp(parsed[i],"shutdown@all")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + } else if (!strcmp(parsed[i],"shutdown@users")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); + gtk_tree_model_get_iter_from_string(model,&iter,"1"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + + } else if (!strcmp(parsed[i],"shutdown@systems")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); + gtk_tree_model_get_iter_from_string(model,&iter,"2"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + + } else if (strstr(parsed[i],"-")){ + on_additional_settings_cell_toggled(window->UserActiveCell,"0",window); + if (!maxmin_set){ + gtk_tree_model_get_iter_from_string(model,&iter,"3"); + maxmin_set++; + } else { + gtk_list_store_append(window->UsersShutdownList,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,1,SHUTDOWN_UID_RANGE_LABEL,5,1,6,1,7,1,8,1,9,"shutdown@uid",10,1,11,1,-1); + } + + char *temp = yon_char_new(parsed[i]); + free(yon_char_divide_search(temp,"@",-1)); + char *min = yon_char_divide_search(temp,"-",-1); + + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,2,min,3,temp,-1); + + } else if (strstr(parsed[i],"shutdown@")) { + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); + + if (!uid_set){ + gtk_tree_model_get_iter_from_string(model,&iter,"4"); + uid_set++; + } else { + gtk_list_store_append(window->UsersShutdownList,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,1,SHUTDOWN_UID_LABEL,5,1,6,1,7,1,8,0,9,"shutdown@uid",10,1,11,1,-1); + } + char *temp = yon_char_new(parsed[i]); + free(yon_char_divide_search(temp,"@",-1)); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,2,temp,-1); + } else if (!strcmp(parsed[i],"shutdown")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,0,0,-1); + gtk_tree_model_get_iter_from_string(model,&iter,"1"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + gtk_tree_model_get_iter_from_string(model,&iter,"2"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + + } + } + } + + if (!yon_char_is_empty(groupadd_sync)){ + GtkTreeModel *model = GTK_TREE_MODEL(window->GroupsShutdownList); + GtkTreeIter iter; + int useradd_sync_size; + config_str parsed = yon_char_parse(groupadd_sync,&useradd_sync_size,","); + if (yon_char_parsed_check_exist(parsed,useradd_sync_size,"shutdown@all")){ + int a=0; + for_iter(model,&iter){ + if (!a){ + gtk_list_store_set(window->GroupsShutdownList,&iter,6,0,-1); + a++; + } else { + gtk_list_store_set(window->GroupsShutdownList,&iter,5,1,-1); + } + } + } + int uid_set=0, maxmin_set=0; + for (int i=0;iGroupsBootCheck),1); + } else if (!strcmp(parsed[i],"shutdown@all")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,-1); + } else if (!strcmp(parsed[i],"shutdown@users")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); + gtk_tree_model_get_iter_from_string(model,&iter,"1"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + + } else if (!strcmp(parsed[i],"shutdown@systems")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); + gtk_tree_model_get_iter_from_string(model,&iter,"2"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + + } else if (!strstr(parsed[i],"-")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); + if (!maxmin_set){ + gtk_tree_model_get_iter_from_string(model,&iter,"3"); + maxmin_set++; + } else { + gtk_list_store_append(window->GroupsShutdownList,&iter); + gtk_list_store_set(window->GroupsShutdownList,&iter,1,SHUTDOWN_GID_RANGE_LABEL,5,1,6,1,7,1,8,1,9,"shutdown@uid",10,1,11,1,-1); + } + + char *temp = yon_char_new(parsed[i]); + free(yon_char_divide_search(temp,"@",-1)); + char *min = yon_char_divide_search(temp,"-",-1); + + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,2,min,3,temp,-1); + + } else if (strstr(parsed[i],"shutdown@")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); + + if (!uid_set){ + gtk_tree_model_get_iter_from_string(model,&iter,"4"); + uid_set++; + } else { + gtk_list_store_append(window->GroupsShutdownList,&iter); + gtk_list_store_set(window->GroupsShutdownList,&iter,1,SHUTDOWN_GID_LABEL,5,1,6,1,7,1,8,0,9,"shutdown@uid",10,1,11,1,-1); + } + char *temp = yon_char_new(parsed[i]); + free(yon_char_divide_search(temp,"@",-1)); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,2,temp,-1); + } else if (!strcmp(parsed[i],"shutdown")){ + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); + gtk_tree_model_get_iter_from_string(model,&iter,"1"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + gtk_tree_model_get_iter_from_string(model,&iter,"2"); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + + } + } + } g_signal_connect(G_OBJECT(window->UserAddButton),"clicked",G_CALLBACK(on_additional_settings_user_sync_add),window); g_signal_connect(G_OBJECT(window->UserRemoveButton),"clicked",G_CALLBACK(on_additional_settings_user_sync_remove),window); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index a5c0ceb..2d0b5f7 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -83,6 +83,8 @@ #define USERADD_SYNC_command(target) yon_char_unite("ubconfig --source system get users USERADD_SYNC[",target,"]",NULL) #define USERSHADOW_SYNC(user) yon_char_unite("USERSHADOW_SYNC[",user,"]",NULL) #define GROUPADD_SYNC(user) yon_char_unite("GROUPADD_SYNC[",user,"]",NULL) +#define GROUPADD_SYNC_parameter "GROUPADD_SYNC" +#define GROUPADD_SYNC_parameter_command "ubconfig --source system get users USERADD_SYNC" #define add_icon_name "com.ublinux.ubl-settings-usergroups.increase-symbolic" #define edit_icon_name "com.ublinux.ubl-settings-usergroups.edit-symbolic" @@ -553,4 +555,5 @@ config_str yon_parameter_get_by_template(char *parameter, char *pattern, int *si void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_settings_usergroups_additional_settings_window *window); void on_additional_settings_cell_edited(GtkCellRenderer *self, char *path, char *new_text, ubl_settings_usergroups_additional_settings_window *window); void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window); +void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window *window); #endif \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 4bf8c74..0e5b44d 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -244,3 +244,11 @@ #define REMOVE_FROM_CONFIGURATION_TITLE_LABEL _("Remove from configuration") #define ADD_TO_SYSTEM_TITLE_LABEL _("Add to system") #define REMOVE_FROM_SYSTEM_TITLE_LABEL _("Remove from system") + +#define SHUTDOWN_ALL_SYSTEM_USERS_LABEL _("All system users") +#define SHUTDOWN_USERS_LABEL _("Users") +#define SHUTDOWN_SYSTEM_USER_LABEL _("System users") +#define SHUTDOWN_UID_RANGE_LABEL _("Users UID range") +#define SHUTDOWN_UID_LABEL _("User UID in system") +#define SHUTDOWN_GID_RANGE_LABEL _("Users GID range") +#define SHUTDOWN_GID_LABEL _("User GID in system") diff --git a/ubl-settings-usergroups-additional-settings.glade b/ubl-settings-usergroups-additional-settings.glade index 749b5d4..c962d1a 100644 --- a/ubl-settings-usergroups-additional-settings.glade +++ b/ubl-settings-usergroups-additional-settings.glade @@ -41,7 +41,7 @@ True False False - + shutdown@all False False @@ -55,7 +55,7 @@ False False False - + shutdown@users False False @@ -69,7 +69,7 @@ False False False - + shutdown@systems False False @@ -83,7 +83,7 @@ False True True - + shutdown@min-max True False @@ -97,7 +97,7 @@ False True False - + shutdown@gid True False @@ -141,7 +141,7 @@ True False False - + shutdown@all False False @@ -155,7 +155,7 @@ False False False - + shutdown@users False False @@ -169,7 +169,7 @@ False False False - + shutdown@systems False False @@ -183,7 +183,7 @@ False True True - + shutdown@min-max True False @@ -197,7 +197,7 @@ False True False - + shutdown@uid True False @@ -642,7 +642,7 @@ True False - While shutdown, save the settings of all users with UID>=1000 to the configuration + While shutdown, save the settings of all users to configuration False @@ -868,7 +868,7 @@ True False - While shutdown, save the settings of all groups with GID>=1000 to the configuration + While shutdown, save the settings of all groups to the configuration False @@ -925,7 +925,7 @@ - 6 + 5 0 From 116edf202bc3b052c9f82e0479aff0b93e277864 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 24 Feb 2025 12:38:06 +0600 Subject: [PATCH 56/72] Test fix for shadow and group shadow loading --- source/ubl-settings-usergroups-user.c | 2 +- source/ubl-settings-usergroups.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index 1b68cc8..65a382d 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -514,7 +514,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ } int home_delete = yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,login); if (home_delete>-1){ - yon_char_parsed_rip(main_config.remove_homes,&main_config.homes_size,home_delete); + main_config.remove_homes = yon_char_parsed_rip(main_config.remove_homes,&main_config.homes_size,home_delete); } if (!yon_char_is_empty(useradd_sync_string)){ diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index fa67a9d..e17a9d5 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1187,6 +1187,14 @@ void yon_system_load(main_window *window){ yon_char_parsed_free(main_config.users,main_config.users_size); main_config.users = yon_file_open(users_path,&main_config.users_size); } + if (main_config.shadow_size>0){ + yon_char_parsed_free(main_config.shadow,main_config.shadow_size); + main_config.shadow = yon_file_open(shadow_path,&main_config.shadow_size); + } + if (main_config.group_shadow_size>0){ + yon_char_parsed_free(main_config.group_shadow,main_config.group_shadow_size); + main_config.group_shadow = yon_file_open(users_path,&main_config.group_shadow_size); + } GtkTreeIter iter; for (int i=0;i Date: Mon, 24 Feb 2025 16:43:24 +0600 Subject: [PATCH 57/72] Fixed default saving --- source/ubl-settings-usergroups-user.c | 6 +++++- source/ubl-settings-usergroups.c | 25 +++++++++++++++---------- source/ubl-settings-usergroups.h | 7 ++++++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index 65a382d..6a79b90 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -154,6 +154,10 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ window->old_password=NULL; window->old_username=NULL; dictionary *entry_dict = NULL; + + struct target_struct *target = malloc(sizeof(struct target_struct)); + target->target=GTK_ENTRY(window->userGroupsEntry); + target->defaut_toggle=GTK_TOGGLE_BUTTON(window->userGroupsCheck); yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateUserWindow),"UserWindow"); yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"combo",window->userPasswordCombo); yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"entry",window->userPasswordEntry); @@ -161,7 +165,7 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); g_signal_connect(G_OBJECT(window->userHomeButton),"clicked",G_CALLBACK(on_filechooser_open),window->userHomeEntry); - g_signal_connect(G_OBJECT(window->UserGroupsButton),"clicked",G_CALLBACK(on_groups_clicked),window->userGroupsEntry); + g_signal_connect(G_OBJECT(window->UserGroupsButton),"clicked",G_CALLBACK(on_groups_clicked),target); g_signal_connect(G_OBJECT(window->userPasswordButton),"clicked",G_CALLBACK(on_password_change),entry_dict); g_signal_connect(G_OBJECT(window->userAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userAdditionalGroupsEntry); g_signal_connect(G_OBJECT(window->userPasswordExpirationButton),"clicked",G_CALLBACK(on_expiration_clicked),window); diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index e17a9d5..dddf319 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -799,19 +799,24 @@ void on_filechooser_open(GtkWidget *, GtkEntry *output_target){ void on_groups_save(GtkWidget *self, dictionary *dict){ ubl_settings_usergroups_group_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_group_window*); - GtkEntry *output = yon_dictionary_get_data(dict->first->next,GtkEntry*); - GtkTreeIter iter; - GtkTreeModel *model = GTK_TREE_MODEL(window->list); - if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->GroupsTree)),&model,&iter)){ - char *name; - gtk_tree_model_get(model,&iter,1,&name,-1); - gtk_entry_set_text(output,name); - free(name); + struct target_struct *output = yon_dictionary_get_data(dict->first->next,struct target_struct *); + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultCheck))){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(window->list); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->GroupsTree)),&model,&iter)){ + char *name; + gtk_tree_model_get(model,&iter,1,&name,-1); + gtk_entry_set_text(output->target,name); + free(name); + } + } else { + gtk_entry_set_text(output->target,""); + gtk_toggle_button_set_active(output->defaut_toggle,1); } on_subwindow_close(self); } -void on_groups_clicked(GtkWidget *, GtkEntry *output_target){ +void on_groups_clicked(GtkWidget *, struct target_struct *output_target){ ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(0); gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),MAIN_GROUP_TITLE_LABEL); gtk_label_set_text(GTK_LABEL(window->HeaderLabel),MAIN_GROUP_TITLE_LABEL); @@ -837,7 +842,7 @@ void on_groups_clicked(GtkWidget *, GtkEntry *output_target){ gtk_tree_view_column_set_title(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),1),GID_LABEL); gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),0),0); gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->GroupsTree)),GTK_SELECTION_SINGLE); - const char *current_group=gtk_entry_get_text(output_target); + const char *current_group=gtk_entry_get_text(output_target->target); size_t digits=0; for (guint k=0;k Date: Tue, 25 Feb 2025 09:54:13 +0600 Subject: [PATCH 58/72] Removed x if password is default --- source/ubl-settings-usergroups-group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups-group.c b/source/ubl-settings-usergroups-group.c index 52e367e..e9b1690 100644 --- a/source/ubl-settings-usergroups-group.c +++ b/source/ubl-settings-usergroups-group.c @@ -212,7 +212,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){ ":",yon_char_return_if_exist(non_unique,""), yon_char_return_if_exist(gsystem,""), ":",yon_char_return_if_exist(admins,""), - ":",yon_char_return_if_exist(password,"x"), + ":",yon_char_return_if_exist(password,""), NULL); char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD_SYNC(group_name)); yon_config_register(GROUPADD(group_name),final_command,final_string); From 8b3fd02f48483e1e15bbc063653fd3df0680678b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 25 Feb 2025 10:13:12 +0600 Subject: [PATCH 59/72] Fixed USERSHADOW always saving --- source/ubl-settings-usergroups-user.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index 6a79b90..901b90c 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -498,10 +498,10 @@ void on_user_save(GtkWidget *self, dictionary *dict){ ":",yon_char_return_if_exist(password_expiration_date,""), NULL); - final_user = yon_char_unite(yon_char_return_if_exist(username,"x"), - ":",yon_char_return_if_exist(uid_string,"x"), - ":",yon_char_return_if_exist(main_group,"x"), - ":",yon_char_return_if_exist(additional_groups,"x"), + final_user = yon_char_unite(yon_char_return_if_exist(username,""), + ":",yon_char_return_if_exist(uid_string,""), + ":",yon_char_return_if_exist(main_group,""), + ":",yon_char_return_if_exist(additional_groups,""), ":",yon_char_return_if_exist(extra_options,""), ":",yon_char_return_if_exist(password,""), NULL); @@ -511,10 +511,12 @@ void on_user_save(GtkWidget *self, dictionary *dict){ if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ yon_config_remove_by_key(USERADD(window->old_username)); } - final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW(login)); - yon_config_register(USERSHADOW(login),final_command,shadow_string); - if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ - yon_config_remove_by_key(USERSHADOW(window->old_username)); + if (strcmp(window->old_password,password)){ + final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW(login)); + yon_config_register(USERSHADOW(login),final_command,shadow_string); + if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ + yon_config_remove_by_key(USERSHADOW(window->old_username)); + } } int home_delete = yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,login); if (home_delete>-1){ From 42124f446351b40b6d26413ed0932ac3c757f5a0 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 25 Feb 2025 17:17:32 +0600 Subject: [PATCH 60/72] Shutdown rework finished --- source/ubl-settings-usergroups-settings.c | 168 +++++++++++------- source/ubl-settings-usergroups.h | 6 +- source/ubl-strings.h | 16 ++ ...tings-usergroups-additional-settings.glade | 47 +++-- ubl-settings-usergroups.pot | 70 +++++++- ubl-settings-usergroups_ru.po | 69 ++++++- 6 files changed, 284 insertions(+), 92 deletions(-) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index f4991de..f402ce8 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -85,6 +85,7 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add // if (window->user_boot>-1||window->user_boot>-1) // yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_parameter_command,sync); // } + on_useradd_sync_changed(window); } void on_additional_settings_user_sync_add(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){ @@ -121,8 +122,8 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add } } - void on_additional_settings_group_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ - on_useradd_sync_changed(window); + void on_additional_settings_group_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *){ + // on_useradd_sync_changed(window); } void on_additional_settings_group_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ @@ -135,7 +136,7 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add gtk_list_store_remove(window->GroupsShutdownList,&iter); } } - on_useradd_sync_changed(window); + // on_useradd_sync_changed(window); } void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_settings_usergroups_additional_settings_window *window){ @@ -163,7 +164,7 @@ void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_ i++; } } - on_useradd_sync_changed(window); + // on_useradd_sync_changed(window); } void on_additional_settings_cell_edited(GtkCellRenderer *self, char *path, char *new_text, ubl_settings_usergroups_additional_settings_window *window){ @@ -202,7 +203,7 @@ GtkTreeIter iter; } } gtk_list_store_set(GTK_LIST_STORE(model),&iter,place_to_set,new_text,place_to_set==2?3:2,old_val,-1); - on_useradd_sync_changed(window); + // on_useradd_sync_changed(window); } void on_adiitional_settings_tree_selection_changed(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){ @@ -235,16 +236,22 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck))){ useradd_sync = yon_char_new("boot"); } - if (gtk_switch_get_active(GTK_SWITCH(window->UsersShutdownSwitch))){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck))){ + char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"","shutdown",NULL); + if(!yon_char_is_empty(useradd_sync)) free(useradd_sync); + useradd_sync = temp; + + } GtkTreeIter iter; for_iter(window->UsersShutdownList,&iter){ int active; - char *min_str, max_str; + char *min_str, *max_str; int sensitive; char *parameter; gtk_tree_model_get(GTK_TREE_MODEL(window->UsersShutdownList),&iter,0,&active,2,&min_str,3,&max_str,6,&sensitive,9,¶meter,-1); + if (active&&sensitive){ if (!strcmp(parameter,"shutdown@all")){ char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"",parameter,NULL); @@ -273,7 +280,6 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window } } } - } if (!yon_char_is_empty(useradd_sync)){ yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_get_command,useradd_sync); } else { @@ -284,15 +290,18 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck))){ groupadd_sync = yon_char_new("boot"); } - if (gtk_switch_get_active(GTK_SWITCH(window->UsersShutdownSwitch))){ - GtkTreeIter iter; - for_iter(window->UsersShutdownList,&iter){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck))){ + char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"","shutdown",NULL); + if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); + groupadd_sync = temp; + } + for_iter(window->GroupsShutdownList,&iter){ int active; - char *min_str, max_str; + char *min_str, *max_str; int sensitive; char *parameter; - gtk_tree_model_get(GTK_TREE_MODEL(window->UsersShutdownList),&iter,0,&active,2,&min_str,3,&max_str,6,&sensitive,9,¶meter,-1); + gtk_tree_model_get(GTK_TREE_MODEL(window->GroupsShutdownList),&iter,0,&active,2,&min_str,3,&max_str,6,&sensitive,9,¶meter,-1); if (active&&sensitive){ if (!strcmp(parameter,"shutdown@all")){ char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"",parameter,NULL); @@ -321,12 +330,12 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window } } } - } if (!yon_char_is_empty(useradd_sync)){ yon_config_register(GROUPADD_SYNC_parameter,GROUPADD_SYNC_parameter_command,groupadd_sync); } else { yon_config_remove_by_key(GROUPADD_SYNC_parameter); } + on_subwindow_close(window->Window); } ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ @@ -347,13 +356,15 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton"); window->UsersBootCheck=yon_gtk_builder_get_widget(builder,"UsersBootCheck"); - window->UsersShutdownSwitch=yon_gtk_builder_get_widget(builder,"UsersShutdownSwitch"); + window->UsersShutdownCheck=yon_gtk_builder_get_widget(builder,"UsersShutdownCheck"); + window->UsersShutdownExpander=yon_gtk_builder_get_widget(builder,"UsersShutdownExpander"); window->UserShutdownRevealer=yon_gtk_builder_get_widget(builder,"UserShutdownRevealer"); window->UsersTree=yon_gtk_builder_get_widget(builder,"UsersTree"); window->UserAddButton=yon_gtk_builder_get_widget(builder,"UserAddButton"); window->UserRemoveButton=yon_gtk_builder_get_widget(builder,"UserRemoveButton"); window->GroupsBootCheck=yon_gtk_builder_get_widget(builder,"GroupsBootCheck"); - window->GroupsShutdownSwitch=yon_gtk_builder_get_widget(builder,"GroupsShutdownSwitch"); + window->GroupsShutdownCheck=yon_gtk_builder_get_widget(builder,"GroupsShutdownCheck"); + window->GroupsShutdownExpander=yon_gtk_builder_get_widget(builder,"GroupShutdownExpander"); window->GroupShutdownRevealer=yon_gtk_builder_get_widget(builder,"GroupShutdownRevealer"); window->GroupsTree=yon_gtk_builder_get_widget(builder,"GroupsTree"); window->GroupAddButton=yon_gtk_builder_get_widget(builder,"GroupAddButton"); @@ -367,6 +378,9 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ window->GroupMinCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupMinCell")); window->GroupMaxCell=GTK_CELL_RENDERER(gtk_builder_get_object(builder,"GroupMaxCell")); + yon_gtk_revealer_set_from_expander(GTK_REVEALER(window->UserShutdownRevealer),GTK_EXPANDER(window->UsersShutdownExpander)); + yon_gtk_revealer_set_from_expander(GTK_REVEALER(window->GroupShutdownRevealer),GTK_EXPANDER(window->GroupsShutdownExpander)); + window->default_password=NULL; window->default_root_password=NULL; window->default_user_name=NULL; @@ -396,22 +410,26 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ } int uid_set=0, maxmin_set=0; for (int i=0;iUsersShutdownExpander),1); + gtk_revealer_set_reveal_child(GTK_REVEALER(window->UserShutdownRevealer),1); if (!strcmp(parsed[i],"boot")){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1); } else if (!strcmp(parsed[i],"shutdown@all")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + gtk_expander_set_expanded(GTK_EXPANDER(window->UsersShutdownExpander),0); + gtk_revealer_set_reveal_child(GTK_REVEALER(window->UserShutdownRevealer),0); } else if (!strcmp(parsed[i],"shutdown@users")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"1"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); } else if (!strcmp(parsed[i],"shutdown@systems")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"2"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); } else if (strstr(parsed[i],"-")){ on_additional_settings_cell_toggled(window->UserActiveCell,"0",window); @@ -427,7 +445,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ free(yon_char_divide_search(temp,"@",-1)); char *min = yon_char_divide_search(temp,"-",-1); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,2,min,3,temp,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,2,min,3,temp,6,1,7,1,8,1,-1); } else if (strstr(parsed[i],"shutdown@")) { gtk_tree_model_get_iter_first(model,&iter); @@ -442,14 +460,14 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ } char *temp = yon_char_new(parsed[i]); free(yon_char_divide_search(temp,"@",-1)); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,2,temp,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,2,temp,6,1,7,1,8,1,-1); } else if (!strcmp(parsed[i],"shutdown")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"1"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); gtk_tree_model_get_iter_from_string(model,&iter,"2"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); } } @@ -471,6 +489,8 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ } } } + gtk_expander_set_expanded(GTK_EXPANDER(window->GroupsShutdownExpander),1); + gtk_revealer_set_reveal_child(GTK_REVEALER(window->GroupShutdownRevealer),1); int uid_set=0, maxmin_set=0; for (int i=0;iGroupsShutdownList,&iter,0,1,-1); + gtk_expander_set_expanded(GTK_EXPANDER(window->GroupsShutdownExpander),0); + gtk_revealer_set_reveal_child(GTK_REVEALER(window->GroupShutdownRevealer),0); } else if (!strcmp(parsed[i],"shutdown@users")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"1"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); } else if (!strcmp(parsed[i],"shutdown@systems")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"2"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); - } else if (!strstr(parsed[i],"-")){ + } else if (strstr(parsed[i],"-")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); if (!maxmin_set){ @@ -505,7 +527,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ free(yon_char_divide_search(temp,"@",-1)); char *min = yon_char_divide_search(temp,"-",-1); - gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,2,min,3,temp,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,2,min,3,temp,6,1,7,1,8,1,-1); } else if (strstr(parsed[i],"shutdown@")){ gtk_tree_model_get_iter_first(model,&iter); @@ -525,9 +547,9 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"1"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,6,1,7,1,8,1,-1); gtk_tree_model_get_iter_from_string(model,&iter,"2"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,6,1,7,1,8,1,-1); } } @@ -545,23 +567,40 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ g_signal_connect(G_OBJECT(window->GroupMinCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window); g_signal_connect(G_OBJECT(window->GroupMaxCell),"edited",G_CALLBACK(on_additional_settings_cell_edited),window); - g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); - g_signal_connect(G_OBJECT(window->GroupsShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->UsersShutdownExpander),"activate",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->GroupsShutdownExpander),"activate",G_CALLBACK(on_additional_settings_changed),window); + + g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); + g_signal_connect(G_OBJECT(window->GroupsShutdownCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); g_signal_connect(G_OBJECT(window->UsersTree),"cursor-changed",G_CALLBACK(on_adiitional_settings_tree_selection_changed),window); g_signal_connect(G_OBJECT(window->GroupsTree),"cursor-changed",G_CALLBACK(on_adiitional_settings_tree_selection_changed),window); - yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->UserShutdownRevealer),GTK_SWITCH(window->UsersShutdownSwitch)); - yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->GroupShutdownRevealer),GTK_SWITCH(window->GroupsShutdownSwitch)); - yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow"); gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL); - char *sync_parameters = yon_config_get_by_key(USERADD_SYNC_parameter); - if (sync_parameters){ - if (strstr(sync_parameters,"boot")){ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1); + { + char *sync_parameters = yon_config_get_by_key(USERADD_SYNC_parameter); + int size; + config_str parsed = yon_char_parse(sync_parameters,&size,","); + if (sync_parameters){ + if (strstr(sync_parameters,"boot")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1); + } + if (yon_char_parsed_check_exist(parsed,size,"shutdown")!=-1){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck),1); + } } - if (strstr(sync_parameters,"shutdown")){ - gtk_switch_set_active(GTK_SWITCH(window->UsersShutdownSwitch),1); + } + { + char *sync_parameters = yon_config_get_by_key(GROUPADD_SYNC_parameter); + int size; + config_str parsed = yon_char_parse(sync_parameters,&size,","); + if (sync_parameters){ + if (strstr(sync_parameters,"boot")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->GroupsBootCheck),1); + } + if (yon_char_parsed_check_exist(parsed,size,"shutdown")!=-1){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->GroupsShutdownCheck),1); + } } } int hash_size=0; @@ -627,32 +666,32 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->PasswordHashCombo),hash); } - char *parameter = config(USERADD_SYNC_parameter); - { - int size; - config_str parsed = yon_char_parse(parameter,&size,","); - int sync_parameters_size; - config_str sync_parameters = yon_resource_open_file(sync_parameters_path,&sync_parameters_size); - for(int i=0;iUsersShutdownList,&iter); - gtk_list_store_set(window->UsersShutdownList,&iter,1,sync_parsed[0],2,cur[0],3,cur_size>1?cur[1]:"",-1); - }; - } - yon_char_parsed_free(sync_parsed,sync_parsed_size); - } + // char *parameter = config(USERADD_SYNC_parameter); + // { + // int size; + // config_str parsed = yon_char_parse(parameter,&size,","); + // int sync_parameters_size; + // config_str sync_parameters = yon_resource_open_file(sync_parameters_path,&sync_parameters_size); + // for(int i=0;iUsersShutdownList,&iter); + // gtk_list_store_set(window->UsersShutdownList,&iter,1,sync_parsed[0],2,cur[0],3,cur_size>1?cur[1]:"",-1); + // }; + // } + // yon_char_parsed_free(sync_parsed,sync_parsed_size); + // } - } + // } - } + // } g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_additional_settings_save),window); @@ -689,11 +728,8 @@ return window; void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *, main_window *widgets){ ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new(); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); - g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window); - g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window); gtk_widget_show(window->Window); } diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 812bd3d..1a7edfc 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -246,14 +246,16 @@ typedef struct{ GtkWidget *AcceptButton; GtkWidget *EncryptAllPasswordsButton; GtkWidget *UsersBootCheck; - GtkWidget *UsersShutdownSwitch; + GtkWidget *UsersShutdownCheck; + GtkWidget *UsersShutdownExpander; GtkWidget *UserShutdownRevealer; GtkWidget *UsersTree; GtkWidget *UserAddButton; GtkWidget *UserRemoveButton; GtkWidget *GroupsBootCheck; - GtkWidget *GroupsShutdownSwitch; + GtkWidget *GroupsShutdownCheck; + GtkWidget *GroupsShutdownExpander; GtkWidget *GroupShutdownRevealer; GtkWidget *GroupsTree; GtkWidget *GroupAddButton; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 0e5b44d..6db4ae7 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -252,3 +252,19 @@ #define SHUTDOWN_UID_LABEL _("User UID in system") #define SHUTDOWN_GID_RANGE_LABEL _("Users GID range") #define SHUTDOWN_GID_LABEL _("User GID in system") + +#define SHUTDOWN_SAVE_USERS_LABEL _("While shutdown, save the settings of all users to configuration") +#define SHUTDOWN_SAVE_GROUPS_LABEL _("While shutdown, save the settings of all groups to the configuration") +#define SHUTDOWN_ALL_USERS_LABEL _("All groups in system") +#define SHUTDOWN_SYSTEM_GROUPS_USERS_LABEL _("System groups") +#define SHUTDOWN_GROUP_GID_RANGE_LABEL _("Group GID range") +#define SHUTDOWN_GID_IN_SYSTEM_LABEL _("Group GID in system") +#define SHUTDOWNALL_SYSTEM_USERS_LABEL _("All system users") +#define SHUTDOWN_SYSTEM_USERS_LABEL _("System users") +#define SHUTDOWN_UID_USERS_LABEL _("Users UID range") +#define SHUTDOWN_SYSTEM_ID_USERS_LABEL _("User UID in system") +#define SHUTDOWN_SYNC_TYPE_LABEL _("Syncronization type") +#define SHUTDOWN_MINIMUM_UID_LABEL _("Minimum UID") +#define SHUTDOWN_MAXIMUM_UID_LABEL _("Maximum UID") +#define SHUTDOWN_MINIMUM_GID_LABEL _("Minimum GID") +#define SHUTDOWN_MAXIMUM_GID_LABEL _("Maximum GID") diff --git a/ubl-settings-usergroups-additional-settings.glade b/ubl-settings-usergroups-additional-settings.glade index c962d1a..cf63c30 100644 --- a/ubl-settings-usergroups-additional-settings.glade +++ b/ubl-settings-usergroups-additional-settings.glade @@ -1,5 +1,5 @@ - + @@ -639,10 +639,12 @@ False 5 - - True - False + While shutdown, save the settings of all users to configuration + True + True + False + True False @@ -651,15 +653,21 @@ - + True True + + + + + + False True end - 1 + 2 @@ -864,28 +872,37 @@ True False + 5 - + True - False - While shutdown, save the settings of all groups to the configuration + True + + + + + + False True - 0 + end + 1 - + + While shutdown, save the settings of all groups to the configuration True True + False + True False True - end - 1 + 2 @@ -1130,4 +1147,8 @@ + + True + False + diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index dbd0619..f80ee21 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -139,7 +139,7 @@ msgid "" "status" msgstr "" -#: source/ubl-strings.h:36 +#: source/ubl-strings.h:36 source/ubl-strings.h:249 msgid "Users" msgstr "" @@ -159,7 +159,7 @@ msgid "" "users" msgstr "" -#: source/ubl-strings.h:40 +#: source/ubl-strings.h:40 source/ubl-strings.h:259 msgid "Groups" msgstr "" @@ -756,7 +756,7 @@ msgid "Do not encrypt password" msgstr "" #: source/ubl-strings.h:215 -msgid "Password contain restricted symbols" +msgid "Password contain special symbols" msgstr "" #: source/ubl-strings.h:218 @@ -813,11 +813,11 @@ msgstr "" msgid "Configuration groups" msgstr "" -#: source/ubl-strings.h:235 +#: source/ubl-strings.h:235 source/ubl-strings.h:250 source/ubl-strings.h:264 msgid "System users" msgstr "" -#: source/ubl-strings.h:236 +#: source/ubl-strings.h:236 source/ubl-strings.h:260 msgid "System groups" msgstr "" @@ -844,3 +844,63 @@ msgstr "" #: source/ubl-strings.h:245 msgid "Add to system" msgstr "" + +#: source/ubl-strings.h:248 source/ubl-strings.h:263 +msgid "All system users" +msgstr "" + +#: source/ubl-strings.h:251 source/ubl-strings.h:265 +msgid "Users UID range" +msgstr "" + +#: source/ubl-strings.h:252 source/ubl-strings.h:266 +msgid "User UID in system" +msgstr "" + +#: source/ubl-strings.h:253 +msgid "Users GID range" +msgstr "" + +#: source/ubl-strings.h:254 +msgid "User GID in system" +msgstr "" + +#: source/ubl-strings.h:256 +msgid "While shutdown, save the settings of all users to configuration" +msgstr "" + +#: source/ubl-strings.h:257 +msgid "While shutdown, save the settings of all groups to the configuration" +msgstr "" + +#: source/ubl-strings.h:258 +msgid "All groups in system" +msgstr "" + +#: source/ubl-strings.h:261 +msgid "Group GID range" +msgstr "" + +#: source/ubl-strings.h:262 +msgid "Group GID in system" +msgstr "" + +#: source/ubl-strings.h:267 +msgid "Syncronization type" +msgstr "" + +#: source/ubl-strings.h:268 +msgid "Minimum UID" +msgstr "" + +#: source/ubl-strings.h:269 +msgid "Maximum UID" +msgstr "" + +#: source/ubl-strings.h:270 +msgid "Minimum GID" +msgstr "" + +#: source/ubl-strings.h:271 +msgid "Maximum GID" +msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index fa2e510..d3fb4ec 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -149,7 +149,7 @@ msgstr "" "Статус\n" "пароля" -#: source/ubl-strings.h:36 +#: source/ubl-strings.h:36 source/ubl-strings.h:249 msgid "Users" msgstr "Пользователи" @@ -173,7 +173,7 @@ msgstr "" "Пользователи\n" "группы" -#: source/ubl-strings.h:40 +#: source/ubl-strings.h:40 source/ubl-strings.h:259 msgid "Groups" msgstr "Группы" @@ -417,8 +417,7 @@ msgid "" "While shutdown, save the settings of all groups with GID>=1000 to the " "configuration" msgstr "" -"При завершении работы сохранить настройки групп с GID>=1000 в " -"конфигурацию" +"При завершении работы сохранить настройки групп с GID>=1000 в конфигурацию" #: source/ubl-strings.h:112 msgid "Configure group" @@ -876,11 +875,11 @@ msgstr "Пользователи конфигурации" msgid "Configuration groups" msgstr "Группы конфигурации" -#: source/ubl-strings.h:235 +#: source/ubl-strings.h:235 source/ubl-strings.h:250 source/ubl-strings.h:264 msgid "System users" msgstr "Пользователи системы" -#: source/ubl-strings.h:236 +#: source/ubl-strings.h:236 source/ubl-strings.h:260 msgid "System groups" msgstr "Группы системы" @@ -909,3 +908,61 @@ msgstr "в конфигурацию?" #, fuzzy msgid "Add to system" msgstr "Добавить в новую:" + +#: source/ubl-strings.h:248 source/ubl-strings.h:263 +msgid "All system users" +msgstr "Все пользователи в системе" + +#: source/ubl-strings.h:251 source/ubl-strings.h:265 +msgid "Users UID range" +msgstr "Диапазон UID пользователей в системе" + +#: source/ubl-strings.h:253 +msgid "Users GID range" +msgstr "Диапазон UID пользователей в системе" + +#: source/ubl-strings.h:254 +msgid "User UID in system" +msgstr "Пользователь в системе с UID" + +#: source/ubl-strings.h:256 +msgid "While shutdown, save the settings of all users to configuration" +msgstr "" +"При завершении работы сохранить настройки пользователей" + +#: source/ubl-strings.h:257 +msgid "While shutdown, save the settings of all groups to the configuration" +msgstr "" +"При завершении работы сохранить настройки групп пользователей" + +#: source/ubl-strings.h:258 +msgid "All groups in system" +msgstr "Все группы в системе" + +#: source/ubl-strings.h:261 +msgid "Group GID range" +msgstr "Диапазон GID групп" + +#: source/ubl-strings.h:262 +msgid "Group GID in system" +msgstr "Группы в системе с GID" + +#: source/ubl-strings.h:267 +msgid "Syncronization type" +msgstr "Тип синхронизации с глобальной конфигурацией" + +#: source/ubl-strings.h:268 +msgid "Minimum UID" +msgstr "Минимальный UID" + +#: source/ubl-strings.h:269 +msgid "Maximum UID" +msgstr "Максимальный UID" + +#: source/ubl-strings.h:270 +msgid "Minimum GID" +msgstr "Минимальный GID" + +#: source/ubl-strings.h:271 +msgid "Maximum GID" +msgstr "Максимальный GID" From 10ef08bb86929d9fda457f9f7b47817ff2ccca2a Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 26 Feb 2025 14:22:33 +0600 Subject: [PATCH 61/72] Tables height increase --- ...tings-usergroups-additional-settings.glade | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ubl-settings-usergroups-additional-settings.glade b/ubl-settings-usergroups-additional-settings.glade index cf63c30..96723ce 100644 --- a/ubl-settings-usergroups-additional-settings.glade +++ b/ubl-settings-usergroups-additional-settings.glade @@ -76,8 +76,8 @@ False Group GID range - - + + True False False @@ -90,8 +90,8 @@ False Group GID in system - - + + True False False @@ -176,8 +176,8 @@ False Users UID range - - + + True False False @@ -190,8 +190,8 @@ False User UID in system - - + + True False False @@ -691,7 +691,7 @@ True True in - 150 + 160 True @@ -927,7 +927,7 @@ True True in - 150 + 160 True From 79c6053f389fdc320366ecd51033999ff2da5590 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 26 Feb 2025 16:44:36 +0600 Subject: [PATCH 62/72] Fixed shutdown@all always on --- source/ubl-settings-usergroups-settings.c | 8 ++----- ...tings-usergroups-additional-settings.glade | 24 +++++++++---------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index f402ce8..b4a3cd5 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -287,10 +287,10 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window } char *groupadd_sync = ""; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck))){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsBootCheck))){ groupadd_sync = yon_char_new("boot"); } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck))){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsShutdownCheck))){ char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"","shutdown",NULL); if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); groupadd_sync = temp; @@ -417,8 +417,6 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ } else if (!strcmp(parsed[i],"shutdown@all")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); - gtk_expander_set_expanded(GTK_EXPANDER(window->UsersShutdownExpander),0); - gtk_revealer_set_reveal_child(GTK_REVEALER(window->UserShutdownRevealer),0); } else if (!strcmp(parsed[i],"shutdown@users")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); @@ -498,8 +496,6 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ } else if (!strcmp(parsed[i],"shutdown@all")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,-1); - gtk_expander_set_expanded(GTK_EXPANDER(window->GroupsShutdownExpander),0); - gtk_revealer_set_reveal_child(GTK_REVEALER(window->GroupShutdownRevealer),0); } else if (!strcmp(parsed[i],"shutdown@users")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); diff --git a/ubl-settings-usergroups-additional-settings.glade b/ubl-settings-usergroups-additional-settings.glade index 96723ce..db39dfe 100644 --- a/ubl-settings-usergroups-additional-settings.glade +++ b/ubl-settings-usergroups-additional-settings.glade @@ -32,13 +32,13 @@ - True + False All groups in system 1 65535 True True - True + False False False shutdown@all @@ -51,7 +51,7 @@ 1000 6000 True - False + True False False False @@ -65,7 +65,7 @@ 500 999 True - False + True False False False @@ -79,7 +79,7 @@ True - False + True False True True @@ -93,7 +93,7 @@ True - False + True False True False @@ -132,13 +132,13 @@ - True + False All system users 1 65535 True True - True + False False False shutdown@all @@ -151,7 +151,7 @@ 1000 6000 True - False + True False False False @@ -165,7 +165,7 @@ 500 999 True - False + True False False False @@ -179,7 +179,7 @@ True - False + True False True True @@ -193,7 +193,7 @@ True - False + True False True False From 3f4b2ac1c769a311032ac085644d3d2c262b53cb Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 27 Feb 2025 17:37:01 +0600 Subject: [PATCH 63/72] Additional settings shutdown fixes --- source/ubl-settings-usergroups-settings.c | 29 ++++++++++--------- ...tings-usergroups-additional-settings.glade | 16 +++++----- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index b4a3cd5..6d4dc33 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -322,7 +322,7 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); groupadd_sync = temp; - } else if (!strcmp(parameter,"shutdown@uid")){ + } else if (!strcmp(parameter,"shutdown@gid")){ char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"","shutdown@",min_str,NULL); if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); groupadd_sync = temp; @@ -416,21 +416,22 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1); } else if (!strcmp(parsed[i],"shutdown@all")){ gtk_tree_model_get_iter_first(model,&iter); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,7,0,8,0,-1); } else if (!strcmp(parsed[i],"shutdown@users")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"1"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,0,8,0,-1); } else if (!strcmp(parsed[i],"shutdown@systems")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"2"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,0,8,0,-1); } else if (strstr(parsed[i],"-")){ - on_additional_settings_cell_toggled(window->UserActiveCell,"0",window); + gtk_tree_model_get_iter_first(model,&iter); + gtk_list_store_set(window->UsersShutdownList,&iter,0,0,5,0,6,0,-1); if (!maxmin_set){ gtk_tree_model_get_iter_from_string(model,&iter,"3"); maxmin_set++; @@ -463,9 +464,9 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->UsersShutdownList,&iter,0,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"1"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); gtk_tree_model_get_iter_from_string(model,&iter,"2"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); + gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,-1); } } @@ -500,13 +501,13 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"1"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,5,1,6,1,-1); } else if (!strcmp(parsed[i],"shutdown@systems")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"2"); - gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,5,1,6,1,7,1,8,1,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,5,1,6,1,-1); } else if (strstr(parsed[i],"-")){ gtk_tree_model_get_iter_first(model,&iter); @@ -516,7 +517,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ maxmin_set++; } else { gtk_list_store_append(window->GroupsShutdownList,&iter); - gtk_list_store_set(window->GroupsShutdownList,&iter,1,SHUTDOWN_GID_RANGE_LABEL,5,1,6,1,7,1,8,1,9,"shutdown@uid",10,1,11,1,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,1,SHUTDOWN_GID_RANGE_LABEL,5,1,6,1,9,"shutdown@uid",10,1,11,1,-1); } char *temp = yon_char_new(parsed[i]); @@ -534,18 +535,18 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ uid_set++; } else { gtk_list_store_append(window->GroupsShutdownList,&iter); - gtk_list_store_set(window->GroupsShutdownList,&iter,1,SHUTDOWN_GID_LABEL,5,1,6,1,7,1,8,0,9,"shutdown@uid",10,1,11,1,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,1,SHUTDOWN_GID_LABEL,5,1,6,1,7,1,8,1,9,"shutdown@uid",10,1,11,1,-1); } char *temp = yon_char_new(parsed[i]); free(yon_char_divide_search(temp,"@",-1)); - gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,2,temp,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,2,temp,5,1,6,1,-1); } else if (!strcmp(parsed[i],"shutdown")){ gtk_tree_model_get_iter_first(model,&iter); gtk_list_store_set(window->GroupsShutdownList,&iter,0,0,-1); gtk_tree_model_get_iter_from_string(model,&iter,"1"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,6,1,7,1,8,1,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,6,1,-1); gtk_tree_model_get_iter_from_string(model,&iter,"2"); - gtk_list_store_set(window->UsersShutdownList,&iter,0,1,6,1,7,1,8,1,-1); + gtk_list_store_set(window->GroupsShutdownList,&iter,0,1,6,1,-1); } } diff --git a/ubl-settings-usergroups-additional-settings.glade b/ubl-settings-usergroups-additional-settings.glade index db39dfe..6772a79 100644 --- a/ubl-settings-usergroups-additional-settings.glade +++ b/ubl-settings-usergroups-additional-settings.glade @@ -76,8 +76,8 @@ False Group GID range - - + + True True False @@ -90,8 +90,8 @@ False Group GID in system - - + + True True False @@ -176,8 +176,8 @@ False Users UID range - - + + True True False @@ -190,8 +190,8 @@ False User UID in system - - + + True True False From 8218ab18adaf2ef2885f567cffa056bee267a2ae Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 3 Mar 2025 12:31:58 +0600 Subject: [PATCH 64/72] Added stutdown error checking --- source/ubl-settings-usergroups-settings.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index 6d4dc33..8cfefb0 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -268,11 +268,19 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window useradd_sync = temp; } else if (!strcmp(parameter,"shutdown@min-max")){ + if (yon_char_is_empty(min_str)||yon_char_is_empty(max_str)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"","shutdown@",min_str,"-",max_str,NULL); if(!yon_char_is_empty(useradd_sync)) free(useradd_sync); useradd_sync = temp; } else if (!strcmp(parameter,"shutdown@uid")){ + if (yon_char_is_empty(min_str)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } char *temp = yon_char_unite(useradd_sync,!yon_char_is_empty(useradd_sync)?",":"","shutdown@",min_str,NULL); if(!yon_char_is_empty(useradd_sync)) free(useradd_sync); useradd_sync = temp; @@ -318,11 +326,19 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window groupadd_sync = temp; } else if (!strcmp(parameter,"shutdown@min-max")){ + if (yon_char_is_empty(min_str)||yon_char_is_empty(max_str)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"","shutdown@",min_str,"-",max_str,NULL); if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); groupadd_sync = temp; } else if (!strcmp(parameter,"shutdown@gid")){ + if (yon_char_is_empty(min_str)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } char *temp = yon_char_unite(groupadd_sync,!yon_char_is_empty(groupadd_sync)?",":"","shutdown@",min_str,NULL); if(!yon_char_is_empty(groupadd_sync)) free(groupadd_sync); groupadd_sync = temp; From 7536ccab3a206b09a72ad36a9cded80b7495b847 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 6 Mar 2025 18:20:38 +0600 Subject: [PATCH 65/72] Fixed GROUPADD_SYNC saving --- source/ubl-settings-usergroups-settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index 8cfefb0..4d331b9 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -346,7 +346,7 @@ void on_useradd_sync_changed(ubl_settings_usergroups_additional_settings_window } } } - if (!yon_char_is_empty(useradd_sync)){ + if (!yon_char_is_empty(groupadd_sync)){ yon_config_register(GROUPADD_SYNC_parameter,GROUPADD_SYNC_parameter_command,groupadd_sync); } else { yon_config_remove_by_key(GROUPADD_SYNC_parameter); From 0ac48bfdafb1ace8ad638145a0f583a33f999856 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 6 Mar 2025 18:30:08 +0600 Subject: [PATCH 66/72] Removed ignoring USERADD_SYNC[] compare at sawing window --- source/ubl-settings-usergroups-user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index 901b90c..c846e89 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -526,7 +526,6 @@ void on_user_save(GtkWidget *self, dictionary *dict){ if (!yon_char_is_empty(useradd_sync_string)){ final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD_SYNC(login)); yon_config_register(USERADD_SYNC(login),final_command,useradd_sync_string); - yon_config_compare_ignore_set(USERADD_SYNC(login),1); if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ yon_config_remove_by_key(USERADD_SYNC(window->old_username)); } From 6a7a141fe3dd78c7420d9335f77dfbe604dffb16 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 6 Mar 2025 18:31:13 +0600 Subject: [PATCH 67/72] Removed ignoring GROUPADD_SYNC[] compare at sawing window --- source/ubl-settings-usergroups-group.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/ubl-settings-usergroups-group.c b/source/ubl-settings-usergroups-group.c index e9b1690..fb4ff76 100644 --- a/source/ubl-settings-usergroups-group.c +++ b/source/ubl-settings-usergroups-group.c @@ -187,7 +187,6 @@ void on_group_save(GtkWidget *self, dictionary *dict){ if (shutdown_sync_active){ char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",GROUPADD_SYNC(group_name)); yon_config_register(GROUPADD_SYNC(group_name),final_command,"shutdown"); - yon_config_compare_ignore_set(GROUPADD_SYNC(group_name),1); } else { yon_config_remove_by_key(GROUPADD_SYNC(group_name)); } From 792acf268286fd4741a218427e66780cb31f2aa5 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 7 Mar 2025 10:56:05 +0600 Subject: [PATCH 68/72] Test fix for crash --- source/ubl-settings-usergroups-user.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups-user.c b/source/ubl-settings-usergroups-user.c index c846e89..c7ced30 100644 --- a/source/ubl-settings-usergroups-user.c +++ b/source/ubl-settings-usergroups-user.c @@ -333,6 +333,12 @@ void on_user_save(GtkWidget *self, dictionary *dict){ int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck)); login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)); + if (yon_char_is_empty(login)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->userLoginEntry); + return; + + } if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),USER_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_highlight_incorrect(window->userLoginEntry); @@ -511,7 +517,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ yon_config_remove_by_key(USERADD(window->old_username)); } - if (strcmp(window->old_password,password)){ + if (window->old_password&&strcmp(window->old_password,password)){ final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW(login)); yon_config_register(USERSHADOW(login),final_command,shadow_string); if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){ From 104fad9f617534c0c1d39b9308d5ee0cec610362 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 7 Mar 2025 11:06:43 +0600 Subject: [PATCH 69/72] Fixed users main group loading --- source/ubl-settings-usergroups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index dddf319..34878d1 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1449,7 +1449,7 @@ void on_main_edit(GtkWidget *, main_window *widgets){ window->last_uid=yon_char_new(parameters[1]); } if (parsed_size>2){ - if (!strcmp(parameters[2],"x")) + if (!strcmp(parameters[2],"x")||!strcmp(parameters[2],"")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck),1); else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck),0); From 7b158aee96acc410963dfad65efd3431b28cf15e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 7 Mar 2025 11:23:14 +0600 Subject: [PATCH 70/72] Fixed system group syncing with configuration --- source/ubl-settings-usergroups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 34878d1..b90ed51 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1198,7 +1198,7 @@ void yon_system_load(main_window *window){ } if (main_config.group_shadow_size>0){ yon_char_parsed_free(main_config.group_shadow,main_config.group_shadow_size); - main_config.group_shadow = yon_file_open(users_path,&main_config.group_shadow_size); + main_config.group_shadow = yon_file_open(group_shadow_path,&main_config.group_shadow_size); } GtkTreeIter iter; From 0c326cfb53559b9ef897b074d9a4518ac3b6636c Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 7 Mar 2025 13:19:41 +0600 Subject: [PATCH 71/72] Password status fixes --- source/ubl-settings-usergroups.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index b90ed51..68a9a09 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -158,7 +158,7 @@ void yon_interface_update(main_window *widgets){ if (parameters_size>4&&strcmp(parameters[4],"x")&&strcmp(parameters[4],"")){ if (!check_is_password_hash(parameters[4])&¶meters[4][0]!='%'&¶meters[4][1]!='%'){ pars = ENCRYPTED_LABEL; - } else if (!strcmp(parameters[4],"!*")){ + } else if (!strcmp(parameters[4],"!*")||!strcmp(parameters[4],"*")||!strcmp(parameters[4],"!")){ pars = NO_PASSWORD_LABEL; } else { pars = UNENCRYPTED_LABEL; @@ -1626,12 +1626,13 @@ void on_main_edit(GtkWidget *, main_window *widgets){ } if (size>4){ if (!yon_char_is_empty(parsed[4])){ - if (!strcmp(parsed[4],"!*")){ + if (!strcmp(parsed[4],"!*")||!strcmp(parsed[4],"!")||!strcmp(parsed[4],"*")){ gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),1); gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),""); } else if (strcmp(parsed[4],"x")){ gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),parsed[4]); gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),2); + } } } else { From 1f83aad84a3790eaa3f920df7f26e6099a816eb3 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 7 Mar 2025 16:45:26 +0600 Subject: [PATCH 72/72] Fixed group sync adding --- source/ubl-settings-usergroups-settings.c | 6 +----- source/ubl-settings-usergroups.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/source/ubl-settings-usergroups-settings.c b/source/ubl-settings-usergroups-settings.c index 4d331b9..5a0aada 100644 --- a/source/ubl-settings-usergroups-settings.c +++ b/source/ubl-settings-usergroups-settings.c @@ -122,10 +122,6 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add } } - void on_additional_settings_group_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *){ - // on_useradd_sync_changed(window); - } - void on_additional_settings_group_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window){ GtkTreeModel *model; GtkTreeIter iter; @@ -570,7 +566,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_ g_signal_connect(G_OBJECT(window->UserAddButton),"clicked",G_CALLBACK(on_additional_settings_user_sync_add),window); g_signal_connect(G_OBJECT(window->UserRemoveButton),"clicked",G_CALLBACK(on_additional_settings_user_sync_remove),window); - g_signal_connect(G_OBJECT(window->GroupAddButton),"clicked",G_CALLBACK(on_additional_settings_group_sync_add),window); + g_signal_connect(G_OBJECT(window->GroupAddButton),"clicked",G_CALLBACK(on_additional_settings_user_sync_add),window); g_signal_connect(G_OBJECT(window->GroupRemoveButton),"clicked",G_CALLBACK(on_additional_settings_group_sync_remove),window); g_signal_connect(G_OBJECT(window->UserActiveCell),"toggled",G_CALLBACK(on_additional_settings_cell_toggled),window); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index 1a7edfc..37af024 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -556,7 +556,6 @@ config_str yon_parameter_parse(char *parameter, int *size); int yon_parameter_check_tag(char *tag,char *string); config_str yon_parameter_get_by_template(char *parameter, char *pattern, int *size); void on_additional_settings_group_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window); - void on_additional_settings_group_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window); void on_additional_settings_user_sync_remove(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window); void on_additional_settings_user_sync_add(GtkWidget *, ubl_settings_usergroups_additional_settings_window *window); void on_additional_settings_cell_toggled(GtkCellRenderer *self, char *path, ubl_settings_usergroups_additional_settings_window *window);