|
|
|
|
@ -6,7 +6,7 @@ config main_config;
|
|
|
|
|
|
|
|
|
|
int yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
yon_config_load_register(YON_CONFIG_DEFAULT,"users","DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM",NULL);
|
|
|
|
|
if (yon_config_load_register_no_cleaning(type,"users","DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL)){
|
|
|
|
|
if (yon_config_load_register_no_cleaning(type,"users","DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]","[system]","SYSTEMBOOT_STATEMODE","[save]","SAVE_ROOTCOPY_CHANGES",NULL)){
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
@ -97,6 +97,26 @@ void on_config_global_load(GtkWidget *self, main_window *widgets){
|
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_samba_sync_proceed(){
|
|
|
|
|
if (main_config.sync_users){
|
|
|
|
|
for (int i=0;i<main_config.sync_size;i++){
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_char_parse(main_config.sync_users[i],&size,":");
|
|
|
|
|
if (!yon_char_is_empty(parsed[1])){
|
|
|
|
|
if (parsed[1][0]==' '&&parsed[1][1]=='.'&&parsed[1][2]==' ')
|
|
|
|
|
free(parsed[1]=yon_char_divide(parsed[1],3));
|
|
|
|
|
|
|
|
|
|
system (samba_sync_password_command(parsed[0],parsed[1]));
|
|
|
|
|
} else {
|
|
|
|
|
system ( samba_sync_command(parsed[0]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_save(){
|
|
|
|
|
yon_save_proceed(NULL,YON_CONFIG_BOTH,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
|
}
|
|
|
|
|
@ -109,6 +129,179 @@ void on_config_local_save(){
|
|
|
|
|
yon_save_proceed("system",YON_CONFIG_LOCAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_saving_settings_save(GtkWidget *self, yon_savasettings_window *window){
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SambaCheck))){
|
|
|
|
|
if (!yon_config_append("SAVE_ROOTCOPY_CHANGES","/var/lib/samba",",")){
|
|
|
|
|
yon_config_register("SAVE_ROOTCOPY_CHANGES","[save]","/var/lib/samba");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_element("SAVE_ROOTCOPY_CHANGES","/var/lib/samba",",");
|
|
|
|
|
}
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_samba_sync_add(char *user, char*password){
|
|
|
|
|
int sync_place = yon_char_parsed_check_exist(main_config.sync_users,main_config.sync_size,yon_char_append(user,":"));
|
|
|
|
|
if (sync_place==-1){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(main_config.sync_users,&main_config.sync_size,yon_char_unite(user,":",password,NULL));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_samba_sync_remove(char *user){
|
|
|
|
|
int sync_place = yon_char_parsed_check_exist(main_config.sync_users,main_config.sync_size,yon_char_append(user,":"));
|
|
|
|
|
if (sync_place>-1){
|
|
|
|
|
config_str temp = yon_char_parsed_rip(main_config.sync_users,&main_config.sync_size,sync_place);
|
|
|
|
|
free(main_config.sync_users);
|
|
|
|
|
main_config.sync_users = temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int yon_samba_sync_get(char *user){
|
|
|
|
|
int sync_place = yon_char_parsed_check_exist(main_config.sync_users,main_config.sync_size,yon_char_append(user,":"));
|
|
|
|
|
if (sync_place>-1){
|
|
|
|
|
if (!main_config.sync_users)
|
|
|
|
|
return 0;
|
|
|
|
|
int active = main_config.sync_users[sync_place][strlen(main_config.sync_users[sync_place])-1]==':'? 1:2;
|
|
|
|
|
return active;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_delete_confirmation_delete_home_check(GtkCellRenderer *self, char *path, yon_confirmation_window *window){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
gboolean status;
|
|
|
|
|
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),&iter,path);
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,3,&status,-1);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,3,!status,-1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_delete_confirmation_delete_check(GtkCellRenderer *self, char *path, yon_confirmation_window *window){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
gboolean status;
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_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->UsersList),&iter);
|
|
|
|
|
for (;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->UsersList),&iter)){
|
|
|
|
|
char *name;
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->UsersList),&iter,2,&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;
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,1,&name_check,-1);
|
|
|
|
|
if (!strcmp(name,name_check)){
|
|
|
|
|
GtkTreeIter *it = gtk_tree_iter_copy(&iter);
|
|
|
|
|
if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->UsersList),&iter)){
|
|
|
|
|
iter = *gtk_tree_iter_copy(it);
|
|
|
|
|
if (!gtk_tree_model_iter_previous(GTK_TREE_MODEL(widgets->UsersList),&iter)){
|
|
|
|
|
iter = *gtk_tree_iter_copy(it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_list_store_remove(widgets->UsersList,it);
|
|
|
|
|
yon_config_remove_by_key(USERADD(name));
|
|
|
|
|
yon_config_remove_by_key(USERSHADOW(name));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yon_confirmation_window *yon_delete_confirmation_new(){
|
|
|
|
|
yon_confirmation_window *window = malloc(sizeof(yon_confirmation_window));
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_confirmation);
|
|
|
|
|
window->Window = yon_gtk_builder_get_widget(builder,"Window");
|
|
|
|
|
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
|
window->DeletionTree = yon_gtk_builder_get_widget(builder,"DeletionTree");
|
|
|
|
|
window->DeleteCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"DeleteCell"));
|
|
|
|
|
window->DeleteHomeCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"DeleteHomeCell"));
|
|
|
|
|
window->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),DELETE_CONFIRMATION_TITLE_LABEL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->DeleteCell),"toggled",G_CALLBACK(on_delete_confirmation_delete_check),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->DeleteHomeCell),"toggled",G_CALLBACK(on_delete_confirmation_delete_home_check),window);
|
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"DeleteConfirmationWindow");
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_delete_confirmation_open(main_window *widgets){
|
|
|
|
|
yon_confirmation_window *window = yon_delete_confirmation_new();
|
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
|
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->UsersList);
|
|
|
|
|
GList *list = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model);
|
|
|
|
|
int chosen_size=0;
|
|
|
|
|
config_str chosen = NULL;
|
|
|
|
|
for (int 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,2,¤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->UsersList),&iter);
|
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->UsersList),&iter)){
|
|
|
|
|
char *name,*parameters,*homedir=NULL;
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->UsersList),&iter,2,&name,6,¶meters,-1);
|
|
|
|
|
if (strstr(parameters,"--home-dir")){
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_char_parse(parameters,&size," ");
|
|
|
|
|
for (int i=0;i<size-1;i++){
|
|
|
|
|
if (!strcmp(parsed[i],"--home-dir")){
|
|
|
|
|
homedir = yon_char_new(parsed[i+1]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
}
|
|
|
|
|
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,-1);
|
|
|
|
|
free(name);
|
|
|
|
|
free(parameters);
|
|
|
|
|
free(homedir);
|
|
|
|
|
}
|
|
|
|
|
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));
|
|
|
|
|
window->Window = yon_gtk_builder_get_widget(builder,"Window");
|
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
|
window->SambaCheck = yon_gtk_builder_get_widget(builder,"SambaSaveCheck");
|
|
|
|
|
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"savingSettingsWindow");
|
|
|
|
|
char *string = yon_config_get_by_key("SAVE_ROOTCOPY_CHANGES");
|
|
|
|
|
if (!yon_char_is_empty(string)&&strstr(string,"/var/lib/samba")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->SambaCheck),1);
|
|
|
|
|
}
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savemode",SYSTEM_SAVEMODE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_saving_settings_open(GtkWidget *self, main_window *widgets){
|
|
|
|
|
yon_savasettings_window *window = yon_saving_settings_new();
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window));
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_saving_settings_save),window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_combo_changed(GtkComboBox *self, GtkWidget *target){
|
|
|
|
|
gtk_widget_set_sensitive(target,gtk_combo_box_get_active(self)>1);
|
|
|
|
|
}
|
|
|
|
|
@ -209,15 +402,17 @@ void on_groups_multiple_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_passwords_encrypt(){
|
|
|
|
|
int pid = fork();
|
|
|
|
|
if (!pid){
|
|
|
|
|
exit(system(encrypt_passwords_command));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_change(GtkWidget *self, dictionary *entry_dict){
|
|
|
|
|
GtkComboBox *combo = yon_dictionary_get_data(entry_dict->first,GtkComboBox*);
|
|
|
|
|
GtkEntry *output_target = yon_dictionary_get_data(entry_dict->first->next,GtkEntry*);
|
|
|
|
|
ubl_settings_usergroups_password_window *window = yon_ubl_settings_usergroups_password_new();
|
|
|
|
|
int active = gtk_combo_box_get_active(combo);
|
|
|
|
|
if (active == 2)
|
|
|
|
|
gtk_widget_hide(window->HashBox);
|
|
|
|
|
else if (active==3)
|
|
|
|
|
gtk_widget_hide(window->PasswordBox);
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
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);
|
|
|
|
|
@ -266,9 +461,13 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_register("ADDADM","users","no");
|
|
|
|
|
}
|
|
|
|
|
char *hash = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->PasswordHashCombo));
|
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
|
yon_config_register("HASHPASSWD","users",hash);
|
|
|
|
|
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","users",hash);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
yon_config_remove_by_key("HASHPASSWD");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -300,13 +499,36 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow");
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL);
|
|
|
|
|
|
|
|
|
|
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;i<hash_size;i++){
|
|
|
|
|
if (hash_algos[i][0]!='!'){
|
|
|
|
|
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,";");
|
|
|
|
|
if (!strcmp(hash,parsed[0])){
|
|
|
|
|
char *def_settings = yon_char_new(parsed[1]);
|
|
|
|
|
char *def = yon_char_divide_search(def_settings," ",-1);
|
|
|
|
|
free(def_settings);
|
|
|
|
|
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(window->PasswordHashCombo),yon_char_unite(DEFAULT_USER_LABEL," (",def,")",NULL));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int i=1;i<hash_size;i++){
|
|
|
|
|
if (hash_algos[i][0]!='!'){
|
|
|
|
|
if (hash_algos[i][strlen(hash_algos[i])-1]=='\n') hash_algos[i][strlen(hash_algos[i])-1]='\0';
|
|
|
|
|
@ -343,7 +565,6 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
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;
|
|
|
|
|
@ -356,6 +577,8 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->EncryptAllPasswordsButton),"clicked",G_CALLBACK(on_passwords_encrypt),NULL);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RootPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->RootPasswordButton);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton);
|
|
|
|
|
@ -432,6 +655,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
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){
|
|
|
|
|
@ -459,6 +683,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
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));
|
|
|
|
|
if(non_unique_active){
|
|
|
|
|
non_unique=" --non-unique";
|
|
|
|
|
@ -469,11 +694,19 @@ void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
gsystem=" --system";
|
|
|
|
|
} else gsystem="";
|
|
|
|
|
|
|
|
|
|
int shutdown_sync_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupaddShutdownCheck));
|
|
|
|
|
if (shutdown_sync_active){
|
|
|
|
|
yon_config_register(GROUPADD_SYNC(group_name),"users","shutdown");
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_by_key(GROUPADD_SYNC(group_name));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
final_string = yon_char_unite(yon_char_return_if_exist(group_users,"x"),
|
|
|
|
|
":",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(password,"x"),
|
|
|
|
|
NULL);
|
|
|
|
|
yon_config_register(GROUPADD(group_name),"users",final_string);
|
|
|
|
|
@ -504,6 +737,9 @@ ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),GROUPS_TITLE_LABEL);
|
|
|
|
|
|
|
|
|
|
@ -517,8 +753,13 @@ ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group
|
|
|
|
|
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);
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -629,7 +870,9 @@ void on_password_changed(GtkEntry *self, ubl_settings_usergroups_password_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_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_mismatch",PASSWORD_MISMATCH_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
} else if (strlen(self_text)<main_config.password_min_length){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->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));
|
|
|
|
|
}
|
|
|
|
|
@ -638,18 +881,16 @@ void on_password_changed(GtkEntry *self, ubl_settings_usergroups_password_window
|
|
|
|
|
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*);
|
|
|
|
|
if (gtk_widget_get_visible(window->HashBox)){
|
|
|
|
|
char *pasted_hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
|
if (yon_char_is_empty(pasted_hash)){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
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 {
|
|
|
|
|
char *password = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)));
|
|
|
|
|
char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
if (yon_char_is_empty(password)){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_empty",EMPTY_IMPORTANT_LABEL,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);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strlen(password)<main_config.password_min_length){
|
|
|
|
|
@ -658,13 +899,15 @@ void on_password_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
|
}
|
|
|
|
|
char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
|
|
|
|
|
if (!strcmp(password,password_check)){
|
|
|
|
|
char *passwd_hash = g_malloc0(101);
|
|
|
|
|
FILE *fl = popen(password_hash_get_command(password),"r");
|
|
|
|
|
fgets(passwd_hash,100,fl);
|
|
|
|
|
if (passwd_hash[strlen(passwd_hash)-1]=='\n') passwd_hash[strlen(passwd_hash)-1]='\0';
|
|
|
|
|
gtk_entry_set_text(entry,passwd_hash);
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){
|
|
|
|
|
char *pasw=yon_char_append("%%",password);
|
|
|
|
|
free(password);
|
|
|
|
|
password=pasw;
|
|
|
|
|
}
|
|
|
|
|
password = yon_char_append(" . ",password);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(entry),password);
|
|
|
|
|
} else {
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),PASSWORD_MISMATCH_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_mismatch",PASSWORD_MISMATCH_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -681,6 +924,7 @@ ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_ne
|
|
|
|
|
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");
|
|
|
|
|
@ -741,7 +985,7 @@ void yon_system_load(ubl_settings_usergroups_system_window *window){
|
|
|
|
|
if (yon_gtk_list_store_find_text(window->liststore1,&iter,3,parsed[0])){
|
|
|
|
|
GDateTime *date = g_date_time_new_from_unix_local(atol(parsed[2]));
|
|
|
|
|
char *date_string;
|
|
|
|
|
date_string = g_date_time_format(date,"%c");
|
|
|
|
|
date_string = g_date_time_format(date,"%Y-%m-%d");
|
|
|
|
|
|
|
|
|
|
gtk_list_store_set(window->liststore1,&iter,8,parsed_size>2?date_string:"",9,parsed_size>7?parsed[7]:"",10,parsed_size>3?parsed[3]:"",11,parsed_size>4?parsed[4]:"",12,parsed_size>5?parsed[5]:"",13,parsed_size>2?parsed[6]:"",-1);
|
|
|
|
|
}
|
|
|
|
|
@ -843,7 +1087,7 @@ void on_UID_update(GtkWidget *self, ubl_settings_usergroups_user_window *window)
|
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){
|
|
|
|
|
int config_size=0;
|
|
|
|
|
int final_size=0;
|
|
|
|
|
config_str config_users = yon_config_get_all_by_key("USERADD",&config_size);
|
|
|
|
|
config_str config_users = yon_config_get_all_by_key("USERADD[",&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;
|
|
|
|
|
@ -899,7 +1143,8 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
char *create_system_user = NULL;
|
|
|
|
|
char *create_ununique = NULL;
|
|
|
|
|
char *do_not_check = NULL;
|
|
|
|
|
char *samba_sync = NULL;
|
|
|
|
|
int samba_sync = 0;
|
|
|
|
|
int samba_password_sync = 0;
|
|
|
|
|
char *deactivate = NULL;
|
|
|
|
|
char *extra_options = NULL;
|
|
|
|
|
char *useradd_boot = "";
|
|
|
|
|
@ -907,6 +1152,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
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="";
|
|
|
|
|
@ -974,7 +1220,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
|
|
password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry));
|
|
|
|
|
if (!yon_char_is_empty(password_expiration_date)){
|
|
|
|
|
password_expiration_date = yon_char_from_long(window->expiration_unix);
|
|
|
|
|
password_expiration_date = window->expiration_unix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
warning_days = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin)));
|
|
|
|
|
@ -1014,8 +1260,19 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
if (do_not_check_actve)
|
|
|
|
|
do_not_check = " --badnames";
|
|
|
|
|
|
|
|
|
|
int samba_sync_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck));
|
|
|
|
|
if (samba_sync_active);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int deactivate_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck));
|
|
|
|
|
if (deactivate_active);
|
|
|
|
|
@ -1025,7 +1282,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
if (window->old_password&&strcmp(window->old_password,password)){
|
|
|
|
|
time_t t = time(NULL);
|
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
|
password_changed_date = yon_char_unite(yon_char_from_int(tm.tm_mday),".",yon_char_from_int(tm.tm_mon+1),".",yon_char_from_int(1900+tm.tm_year),NULL);
|
|
|
|
|
password_changed_date = yon_char_unite(yon_char_from_int(1900+tm.tm_year),"-",yon_char_from_int(tm.tm_mon+1),"-",yon_char_from_int(tm.tm_mday),NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int useradd_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck));
|
|
|
|
|
@ -1048,6 +1305,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
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;
|
|
|
|
|
@ -1097,12 +1355,63 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
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));
|
|
|
|
|
if (gtk_combo_box_get_active(self)<=1||(passw[0]!=' '&&passw[1]!='.'&&passw[2]!=' ')){
|
|
|
|
|
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_user_changed(GtkComboBox *self,ubl_settings_usergroups_user_window *window){
|
|
|
|
|
char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry));
|
|
|
|
|
if ((passw[0]!=' '&&passw[1]!='.'&&passw[2]!=' ')){
|
|
|
|
|
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 *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
|
char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry));
|
|
|
|
|
if ((passw[0]==' '&&passw[1]=='.'&&passw[2]==' ')&>k_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo))>1){
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck))){
|
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),0);
|
|
|
|
|
} else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck))){
|
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBACheck),0);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBACheck),1);
|
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
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),0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_date_selected(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
|
int year=0, month=0, day=0;
|
|
|
|
|
gtk_calendar_get_date(GTK_CALENDAR(window->ExpirationCalendar),&year,&month,&day);
|
|
|
|
|
GDateTime *date = g_date_time_new_local(year,month,day,23,59,59);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry), g_date_time_format(date,"%c"));
|
|
|
|
|
window->expiration_unix=g_date_time_to_unix(date);
|
|
|
|
|
char *date_string = g_date_time_format(date,"%Y-%m-%d");
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry), date_string);
|
|
|
|
|
window->expiration_unix=date_string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
|
@ -1139,6 +1448,7 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
|
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");
|
|
|
|
|
@ -1150,6 +1460,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->expiration_unix=NULL;
|
|
|
|
|
|
|
|
|
|
on_UID_update(NULL,window);
|
|
|
|
|
int shell_size=0;
|
|
|
|
|
@ -1190,6 +1501,17 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
|
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);
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1245,103 +1567,110 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->UsersList),&iter,2,&name,-1);
|
|
|
|
|
char *parameter_string = yon_config_get_by_key(USERADD(name));
|
|
|
|
|
int parsed_size=0;
|
|
|
|
|
if (parameter_string[0]=='\"') yon_char_divide(parameter_string,0);
|
|
|
|
|
if (parameter_string[strlen(parameter_string)-1]=='\"') parameter_string[strlen(parameter_string)-1]='\0';
|
|
|
|
|
config_str parameters = yon_char_parse(parameter_string,&parsed_size,":");
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userLoginEntry), name);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry), name);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUserNameEntry), parsed_size>0?parameters[0]:"");
|
|
|
|
|
if (parsed_size>1){
|
|
|
|
|
if (strcmp(parameters[1],"x")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck),0);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry), parsed_size>1?parameters[1]:"");
|
|
|
|
|
if (parameter_string){
|
|
|
|
|
if (parameter_string[0]=='\"') yon_char_divide(parameter_string,0);
|
|
|
|
|
if (parameter_string[strlen(parameter_string)-1]=='\"') parameter_string[strlen(parameter_string)-1]='\0';
|
|
|
|
|
config_str parameters = yon_char_parse(parameter_string,&parsed_size,":");
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userLoginEntry), name);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry), name);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUserNameEntry), parsed_size>0?parameters[0]:"");
|
|
|
|
|
if (parsed_size>1){
|
|
|
|
|
if (strcmp(parameters[1],"x")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck),0);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry), parsed_size>1?parameters[1]:"");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (parsed_size>2){
|
|
|
|
|
if (!strcmp(parameters[2],"x"))
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck),1);
|
|
|
|
|
else
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry), parsed_size>2?parameters[2]:"");
|
|
|
|
|
}
|
|
|
|
|
if (parsed_size>3){
|
|
|
|
|
if (strcmp(parameters[3],"x"))
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), parsed_size>3?parameters[3]:"");
|
|
|
|
|
if (parsed_size>2){
|
|
|
|
|
if (!strcmp(parameters[2],"x"))
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck),1);
|
|
|
|
|
else
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry), parsed_size>2?parameters[2]:"");
|
|
|
|
|
}
|
|
|
|
|
if (parsed_size>3){
|
|
|
|
|
if (strcmp(parameters[3],"x"))
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), parsed_size>3?parameters[3]:"");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (parsed_size>4&&!yon_char_is_empty(parameters[4])){
|
|
|
|
|
int params_size;
|
|
|
|
|
config_str parameters_substring = yon_char_parse(parameters[4],¶ms_size," ");
|
|
|
|
|
for (int i=0;i<params_size;i++){
|
|
|
|
|
if (!strcmp(parameters_substring[i],"--home-dir")){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userHomeEntry),parameters_substring[i+1]);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userHomeCombo),2);
|
|
|
|
|
i++;
|
|
|
|
|
} else if (!strcmp(parameters_substring[i],"--shell")||!strcmp(parameters_substring[i],"-s")){
|
|
|
|
|
int active = yon_gtk_combo_box_text_find(window->userShellCombo,parameters_substring[i+1]);
|
|
|
|
|
if (!active){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userShellEntry),parameters_substring[i+1]);
|
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->userShellCombo),"Set");
|
|
|
|
|
}
|
|
|
|
|
if (parsed_size>4&&!yon_char_is_empty(parameters[4])){
|
|
|
|
|
int params_size;
|
|
|
|
|
config_str parameters_substring = yon_char_parse(parameters[4],¶ms_size," ");
|
|
|
|
|
for (int i=0;i<params_size;i++){
|
|
|
|
|
if (!strcmp(parameters_substring[i],"--home-dir")){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userHomeEntry),parameters_substring[i+1]);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userHomeCombo),2);
|
|
|
|
|
i++;
|
|
|
|
|
} else if (!strcmp(parameters_substring[i],"--shell")||!strcmp(parameters_substring[i],"-s")){
|
|
|
|
|
int active = yon_gtk_combo_box_text_find(window->userShellCombo,parameters_substring[i+1]);
|
|
|
|
|
if (!active){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userShellEntry),parameters_substring[i+1]);
|
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->userShellCombo),"Set");
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--system")||!strcmp(parameters_substring[i],"-r")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck),1);
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--no-create-home")||!strcmp(parameters_substring[i],"-M")){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userHomeCombo),2);
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--no-user-group")||!strcmp(parameters_substring[i],"-N")){
|
|
|
|
|
// gtk
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck),0);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),"");
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--non-unique")||!strcmp(parameters_substring[i],"-o")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck),1);
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--badnames")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck),1);
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--system")||!strcmp(parameters_substring[i],"-r")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck),1);
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--no-create-home")||!strcmp(parameters_substring[i],"-M")){
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userHomeCombo),2);
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--no-user-group")||!strcmp(parameters_substring[i],"-N")){
|
|
|
|
|
// gtk
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck),0);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),"");
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--non-unique")||!strcmp(parameters_substring[i],"-o")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck),1);
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--badnames")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck),1);
|
|
|
|
|
}
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(window->), parsed_size>4?parameters[4]:"");
|
|
|
|
|
}
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(window->), parsed_size>4?parameters[4]:"");
|
|
|
|
|
}
|
|
|
|
|
window->old_password=parameters[5];
|
|
|
|
|
if(parsed_size>5){
|
|
|
|
|
if (strcmp(parameters[5],"x")){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry), parsed_size>5?parameters[5]:"");
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
free(parameters);
|
|
|
|
|
parameters=yon_char_parse(yon_config_get_by_key(USERSHADOW(name)),&parsed_size,":");
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordChangedEntry),parsed_size>0?parameters[0]:"");
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMinimumSpin),atol(parsed_size>1?parameters[1]:"0"));
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin),atol(parsed_size>2?parameters[2]:"0"));
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userWarningSpin),atol(parsed_size>3?parameters[3]:"0"));
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userActivitySpin),atol(parsed_size>4?parameters[4]:"0"));
|
|
|
|
|
if (parsed_size>5&&!yon_char_is_empty(parameters[5])){
|
|
|
|
|
GDateTime *date = g_date_time_new_from_unix_local(atol(parameters[5]));
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry),g_date_time_format(date,"%c"));
|
|
|
|
|
}
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateUserWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
|
gtk_widget_show(window->CreateUserWindow);
|
|
|
|
|
window->old_password=parameters[5];
|
|
|
|
|
if(parsed_size>5){
|
|
|
|
|
if (strcmp(parameters[5],"x")){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry), parsed_size>5?parameters[5]:"");
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *useradd_sync = NULL;
|
|
|
|
|
useradd_sync = yon_config_get_by_key(USERADD_SYNC(name));
|
|
|
|
|
if (useradd_sync){
|
|
|
|
|
if (strstr(useradd_sync,"boot")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck),1);
|
|
|
|
|
}
|
|
|
|
|
if (strstr(useradd_sync,"shutdown")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck),1);
|
|
|
|
|
int samba_sync = yon_samba_sync_get(name);
|
|
|
|
|
if (samba_sync==1){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck),1);
|
|
|
|
|
} else if (samba_sync==2){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck),1);
|
|
|
|
|
}
|
|
|
|
|
free(useradd_sync);
|
|
|
|
|
}
|
|
|
|
|
char *usershadow_sync =yon_config_get_by_key(USERSHADOW_SYNC(name));
|
|
|
|
|
if (usershadow_sync){
|
|
|
|
|
if (strstr(usershadow_sync,"boot")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowBootCheck),1);
|
|
|
|
|
free(parameters);
|
|
|
|
|
parameters=yon_char_parse(yon_config_get_by_key(USERSHADOW(name)),&parsed_size,":");
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordChangedEntry),parsed_size>0?parameters[0]:"");
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMinimumSpin),atol(parsed_size>1?parameters[1]:"0"));
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin),atol(parsed_size>2?parameters[2]:"0"));
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userWarningSpin),atol(parsed_size>3?parameters[3]:"0"));
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userActivitySpin),atol(parsed_size>4?parameters[4]:"0"));
|
|
|
|
|
if (parsed_size>5&&!yon_char_is_empty(parameters[5])){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry),parameters[5]);
|
|
|
|
|
}
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateUserWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
|
gtk_widget_show(window->CreateUserWindow);
|
|
|
|
|
|
|
|
|
|
char *useradd_sync = NULL;
|
|
|
|
|
useradd_sync = yon_config_get_by_key(USERADD_SYNC(name));
|
|
|
|
|
if (useradd_sync){
|
|
|
|
|
if (strstr(useradd_sync,"boot")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck),1);
|
|
|
|
|
}
|
|
|
|
|
if (strstr(useradd_sync,"shutdown")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck),1);
|
|
|
|
|
}
|
|
|
|
|
free(useradd_sync);
|
|
|
|
|
}
|
|
|
|
|
if (strstr(usershadow_sync,"shutdown")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck),1);
|
|
|
|
|
char *usershadow_sync =yon_config_get_by_key(USERSHADOW_SYNC(name));
|
|
|
|
|
if (usershadow_sync){
|
|
|
|
|
if (strstr(usershadow_sync,"boot")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowBootCheck),1);
|
|
|
|
|
}
|
|
|
|
|
if (strstr(usershadow_sync,"shutdown")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck),1);
|
|
|
|
|
}
|
|
|
|
|
free(usershadow_sync);
|
|
|
|
|
}
|
|
|
|
|
free(usershadow_sync);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1388,12 +1717,21 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
if (size>3){
|
|
|
|
|
if (strcmp(parsed[3],"")&&strcmp(parsed[3],"x")){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),parsed[3]);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),3);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->AdminGroupsEntry),parsed[3]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (size>4){
|
|
|
|
|
if (strcmp(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),1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
char *sync = yon_config_get_by_key(GROUPADD_SYNC(name));
|
|
|
|
|
if (sync){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->GroupaddShutdownCheck),1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
yon_ubl_status_box_render(LOADING_FAILED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
@ -1413,19 +1751,7 @@ void on_main_delete(GtkWidget *self, main_window *widgets){
|
|
|
|
|
data->function=NULL;
|
|
|
|
|
data->data=NULL;
|
|
|
|
|
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){
|
|
|
|
|
model = GTK_TREE_MODEL(widgets->UsersList);
|
|
|
|
|
cur_tree=widgets->UsersTree;
|
|
|
|
|
if(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(cur_tree)),&model,&iter)){
|
|
|
|
|
char *name;
|
|
|
|
|
gtk_tree_model_get(model,&iter,2,&name,-1);
|
|
|
|
|
data->action_text=DELETE_CONFIRMATION_LABEL("user",name);
|
|
|
|
|
if (yon_confirmation_dialog_call(self,data)==GTK_RESPONSE_ACCEPT){
|
|
|
|
|
yon_config_remove_by_key(USERADD(name));
|
|
|
|
|
yon_config_remove_by_key(USERADD_SYNC(name));
|
|
|
|
|
yon_config_remove_by_key(USERSHADOW(name));
|
|
|
|
|
gtk_list_store_remove(GTK_LIST_STORE(model),&iter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_delete_confirmation_open(widgets);
|
|
|
|
|
} else {
|
|
|
|
|
model = GTK_TREE_MODEL(widgets->GroupsList);
|
|
|
|
|
cur_tree=widgets->GroupsTree;
|
|
|
|
|
@ -1465,11 +1791,14 @@ void config_init(){
|
|
|
|
|
main_config.lock_save_local=0;
|
|
|
|
|
main_config.groups_size=0;
|
|
|
|
|
main_config.load_mode=1;
|
|
|
|
|
main_config.hash_default_id=-1;
|
|
|
|
|
main_config.groups = yon_file_open(groups_path,&main_config.groups_size);
|
|
|
|
|
main_config.users = yon_file_open(users_path,&main_config.users_size);
|
|
|
|
|
main_config.users_list=NULL;
|
|
|
|
|
main_config.groups_list=NULL;
|
|
|
|
|
main_config.password_min_length=6;
|
|
|
|
|
main_config.sync_users = NULL;
|
|
|
|
|
main_config.sync_size=0;
|
|
|
|
|
int login_size;
|
|
|
|
|
config_str login_defs = yon_file_open(uid_path,&login_size);
|
|
|
|
|
for (int i=0;i<login_size;i++){
|
|
|
|
|
@ -1516,19 +1845,15 @@ void on_selection_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->UsersList);
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter)){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->DeleteButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->EditButton,1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(widgets->DeleteButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->EditButton,0);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
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_widget_set_sensitive(widgets->DeleteButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->EditButton,1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(widgets->DeleteButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->EditButton,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1539,19 +1864,15 @@ void on_notebook_page_changed(GtkWidget *self, GtkWidget *page, int num, main_wi
|
|
|
|
|
if (num==0){
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->UsersList);
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter)){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->DeleteButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->EditButton,1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(widgets->DeleteButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->EditButton,0);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
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_widget_set_sensitive(widgets->DeleteButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->EditButton,1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(widgets->DeleteButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->EditButton,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1583,6 +1904,7 @@ main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
|
widgets->UsersTree=yon_gtk_builder_get_widget(builder,"UsersTree");
|
|
|
|
|
widgets->GroupsTree=yon_gtk_builder_get_widget(builder,"GroupsTree");
|
|
|
|
|
widgets->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook");
|
|
|
|
|
widgets->SavingSettingsButton=yon_gtk_builder_get_widget(builder,"SavingSettingsButton");
|
|
|
|
|
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(widgets->DocumentationMenuItem),"menuitemmiddlemargin");
|
|
|
|
|
|
|
|
|
|
@ -1608,6 +1930,7 @@ main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->button2),"clicked",G_CALLBACK(on_ubl_settings_usergroups_additional_settings_open),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->button1),"clicked",G_CALLBACK(on_settings_usergroups_system_open),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->UpdateButton),"clicked",G_CALLBACK(on_config_update),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SavingSettingsButton),"clicked",G_CALLBACK(on_saving_settings_open),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveMenuItem),"activate",G_CALLBACK(on_config_save),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->UsersTree),"cursor-changed",G_CALLBACK(on_selection_changed),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->GroupsTree),"cursor-changed",G_CALLBACK(on_selection_changed),widgets);
|
|
|
|
|
@ -1681,7 +2004,7 @@ int main(int argc, char *argv[]){
|
|
|
|
|
if(optarg)
|
|
|
|
|
main_config.load_socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 'c': system(yon_char_unite("rm -rfd ", yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",NULL));
|
|
|
|
|
case 'c': system(remove_config_dir_command);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
main_config.lock_help=1;
|
|
|
|
|
|