|
|
|
|
@ -117,15 +117,28 @@ if (main_config.sync_users){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_accept_changes(){
|
|
|
|
|
char *remove_homes = "";
|
|
|
|
|
for (int i=0;i<main_config.homes_size;i++){
|
|
|
|
|
remove_homes = yon_char_unite(remove_homes,yon_char_is_empty(remove_homes)?"":",",main_config.remove_homes[i],NULL);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(remove_homes)){
|
|
|
|
|
if (system(remove_home_dirs_command(remove_homes))){};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_save(){
|
|
|
|
|
yon_accept_changes();
|
|
|
|
|
yon_save_proceed(NULL,YON_CONFIG_BOTH,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_global_save(){
|
|
|
|
|
yon_accept_changes();
|
|
|
|
|
yon_save_proceed("global",YON_CONFIG_GLOBAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_local_save(){
|
|
|
|
|
yon_accept_changes();
|
|
|
|
|
yon_save_proceed("system",YON_CONFIG_LOCAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -197,7 +210,8 @@ void yon_delete_confirmation_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
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);
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,1,&name_check,3,&status,-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)){
|
|
|
|
|
@ -209,6 +223,11 @@ void yon_delete_confirmation_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
gtk_list_store_remove(widgets->UsersList,it);
|
|
|
|
|
yon_config_remove_by_key(USERADD(name));
|
|
|
|
|
yon_config_remove_by_key(USERSHADOW(name));
|
|
|
|
|
if (status){
|
|
|
|
|
if (yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,name)==-1){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(main_config.remove_homes,&main_config.homes_size,name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -255,17 +274,27 @@ void yon_delete_confirmation_open(main_window *widgets){
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
int found = yon_char_parsed_check_exist(main_config.users,main_config.users_size,yon_char_append(name,":"));
|
|
|
|
|
|
|
|
|
|
if (found>-1){
|
|
|
|
|
int parsed_size;
|
|
|
|
|
config_str parsed = yon_char_parse(main_config.users[found],&parsed_size,":");
|
|
|
|
|
if (parsed_size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")){
|
|
|
|
|
|
|
|
|
|
homedir = yon_char_new(parsed[5]);
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
|
}
|
|
|
|
|
// 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;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
int status=0;
|
|
|
|
|
if (homedir) status=1;
|
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
|
@ -1072,7 +1101,8 @@ void on_settings_usergroups_system_open(GtkWidget *self, main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_user_shell_changed(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
|
if (!strcmp(gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),SET_LABEL)){
|
|
|
|
|
const char *current = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo));
|
|
|
|
|
if (!strcmp(current,SET_LABEL)){
|
|
|
|
|
if(gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo))>1){
|
|
|
|
|
gtk_widget_set_sensitive(window->userShellEntry,1);
|
|
|
|
|
} else {
|
|
|
|
|
@ -1333,6 +1363,10 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
NULL);
|
|
|
|
|
yon_config_register(USERADD(login),"users",final_user);
|
|
|
|
|
yon_config_register(USERSHADOW(login),"users",shadow_string);
|
|
|
|
|
int home_delete = yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,login);
|
|
|
|
|
if (home_delete>-1){
|
|
|
|
|
yon_char_parsed_rip(main_config.remove_homes,&main_config.homes_size,home_delete);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(useradd_sync_string))
|
|
|
|
|
yon_config_register(USERADD_SYNC(login),"users",useradd_sync_string);
|
|
|
|
|
@ -1799,6 +1833,8 @@ void config_init(){
|
|
|
|
|
main_config.password_min_length=6;
|
|
|
|
|
main_config.sync_users = NULL;
|
|
|
|
|
main_config.sync_size=0;
|
|
|
|
|
main_config.homes_size=0;
|
|
|
|
|
main_config.remove_homes=NULL;
|
|
|
|
|
int login_size;
|
|
|
|
|
config_str login_defs = yon_file_open(uid_path,&login_size);
|
|
|
|
|
for (int i=0;i<login_size;i++){
|
|
|
|
|
|