|
|
|
@ -182,6 +182,43 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
yon_system_load(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){
|
|
|
|
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);
|
|
|
|
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 *yon_delete_confirmation_new(){
|
|
|
|
yon_confirmation_window *window = malloc(sizeof(yon_confirmation_window));
|
|
|
|
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);
|
|
|
|
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;i<g_list_length(list);i++){
|
|
|
|
|
|
|
|
char *current;
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter(model,&iter,(GtkTreePath*)g_list_nth_data(list,i));
|
|
|
|
|
|
|
|
gtk_tree_model_get(model,&iter,1,¤t,-1);
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(chosen,&chosen_size,current);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
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(){
|
|
|
|
yon_savasettings_window *yon_saving_settings_new(){
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_savesettings);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_savesettings);
|
|
|
|
yon_savasettings_window *window = malloc(sizeof(yon_savasettings_window));
|
|
|
|
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){
|
|
|
|
void on_expiration_clicked(GtkWidget *, ubl_settings_usergroups_user_window *window){
|
|
|
|
gtk_popover_popup(GTK_POPOVER(window->CalendarPopup));
|
|
|
|
gtk_popover_popup(GTK_POPOVER(window->CalendarPopup));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// standard functions
|
|
|
|
// 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;i<hash_size;i++){
|
|
|
|
|
|
|
|
if (hash_algos[i][strlen(hash_algos[i])-1]=='\n') hash_algos[i][strlen(hash_algos[i])-1]='\0';
|
|
|
|
|
|
|
|
int parsed_size;
|
|
|
|
|
|
|
|
config_str parsed = yon_char_parse(hash_algos[i],&parsed_size,";");
|
|
|
|
|
|
|
|
gtk_widget_set_tooltip_text(window->PasswordHashCombo,parsed[1]);
|
|
|
|
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_free(hash_algos,hash_size);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_user_choose(GtkWidget *, GtkEntry *target){
|
|
|
|
void on_user_choose(GtkWidget *, GtkEntry *target){
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(1);
|
|
|
|
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);
|
|
|
|
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;i<final_size;i++){
|
|
|
|
|
|
|
|
int parsed_size;
|
|
|
|
|
|
|
|
config_str parsed = yon_char_parse(final[i],&parsed_size,":");
|
|
|
|
|
|
|
|
if (parsed_size>2&&minimum<atol(parsed[2])&&atol(parsed[2])<maximum){
|
|
|
|
|
|
|
|
if (atol(parsed[2])>prev_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;i<final_size;i++){
|
|
|
|
|
|
|
|
int parsed_size;
|
|
|
|
|
|
|
|
config_str parsed = yon_char_parse(final[i],&parsed_size,":");
|
|
|
|
|
|
|
|
if (parsed_size>2&&!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){
|
|
|
|
void on_system_parameter_changed(GtkWidget *, ubl_settings_usergroups_group_creation_window *window){
|
|
|
|
|
|
|
|
|
|
|
|
char *non_unique = NULL;
|
|
|
|
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);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->groupExtraOptionsEntry),final_str);
|
|
|
|
free(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){
|
|
|
|
void on_group_clicked(GtkCellRenderer *, char *path, ubl_settings_usergroups_group_window *window){
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gboolean status;
|
|
|
|
gboolean status;
|
|
|
|
@ -1504,89 +1172,6 @@ void on_standard_groups_open(GtkWidget *, main_window *widgets){
|
|
|
|
gtk_widget_show(window->GroupsWindow);
|
|
|
|
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;i<strlen(password);i++){
|
|
|
|
|
|
|
|
if (password[i]=='!'||password[i]=='@'||password[i]=='#'||password[i]=='%'||password[i]=='^'||password[i]=='&'||password[i]=='*'||password[i]=='\"'||password[i]=='\''){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),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)<main_config.password_min_length){
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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){
|
|
|
|
void yon_system_load(main_window *window){
|
|
|
|
gtk_list_store_clear(window->liststore1);
|
|
|
|
gtk_list_store_clear(window->liststore1);
|
|
|
|
gtk_list_store_clear(window->liststore2);
|
|
|
|
gtk_list_store_clear(window->liststore2);
|
|
|
|
@ -1707,13 +1292,6 @@ void on_system_update(GtkWidget *, main_window *window){
|
|
|
|
yon_system_load(window);
|
|
|
|
yon_system_load(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_toggle_button_set_active_from_combo_box(GtkComboBox *self,ubl_settings_usergroups_user_window *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));
|
|
|
|
char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry));
|
|
|
|
if (gtk_combo_box_get_active(self)<=1||(passw[0]=='$')){
|
|
|
|
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){
|
|
|
|
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));
|
|
|
|
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){
|
|
|
|
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);
|
|
|
|
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){
|
|
|
|
void on_remove_expired(GtkWidget *, GtkEntryIconPosition icon_pos, GdkEvent *, GtkEntry *target){
|
|
|
|
if (icon_pos == GTK_ENTRY_ICON_SECONDARY){
|
|
|
|
if (icon_pos == GTK_ENTRY_ICON_SECONDARY){
|
|
|
|
gtk_entry_set_text(target,"");
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
g_list_free(list);
|
|
|
|
|
|
|
|
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->SystemTree));
|
|
|
|
|
|
|
|
for (guint i=0;i<g_list_length(list);i++){
|
|
|
|
|
|
|
|
yon_gtk_tree_view_column_minimal_fixed_size_set(GTK_TREE_VIEW_COLUMN(g_list_nth_data(list,i)));
|
|
|
|
|
|
|
|
yon_window_config_add_listener((GtkWidget*)g_list_nth_data(list,i),yon_char_append("SystemUserColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free(list);
|
|
|
|
|
|
|
|
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->SystemGroupsTree));
|
|
|
|
|
|
|
|
for (guint i=0;i<g_list_length(list);i++){
|
|
|
|
|
|
|
|
yon_gtk_tree_view_column_minimal_fixed_size_set(GTK_TREE_VIEW_COLUMN(g_list_nth_data(list,i)));
|
|
|
|
|
|
|
|
yon_window_config_add_listener((GtkWidget*)g_list_nth_data(list,i),yon_char_append("SystemGroupColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free(list);
|
|
|
|
|
|
|
|
|
|
|
|
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_window_config_load(config_path);
|
|
|
|
yon_window_config_load(config_path);
|
|
|
|
|
|
|
|
|
|
|
|
yon_save_window_set_postsave_function(on_save_done,widgets);
|
|
|
|
yon_save_window_set_postsave_function(on_save_done,widgets);
|
|
|
|
|