|
|
|
@ -5,12 +5,16 @@ config main_config;
|
|
|
|
//functions
|
|
|
|
//functions
|
|
|
|
|
|
|
|
|
|
|
|
int yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
int yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
yon_config_load_register(YON_CONFIG_DEFAULT,"users","DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM",NULL);
|
|
|
|
yon_config_clean();
|
|
|
|
yon_config_load_register_no_cleaning(type,"users","DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERADD_SYNC USERSHADOW[*] GROUPADD[*]","[system]","SYSTEMBOOT_STATEMODE","[save]","SAVE_ROOTCOPY_CHANGES",NULL);
|
|
|
|
yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
|
|
|
|
if (type!=YON_CONFIG_GLOBAL){
|
|
|
|
if (type==YON_CONFIG_GLOBAL){
|
|
|
|
yon_config_load_register_no_cleaning(YON_CONFIG_GLOBAL,"users","DEFAULTPASSWD DEFAULTROOTPASSWD",NULL);
|
|
|
|
yon_config_load_config(type,config_get_command("global"),NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type==YON_CONFIG_LOCAL){
|
|
|
|
if (type==YON_CONFIG_LOCAL){
|
|
|
|
|
|
|
|
yon_config_load_config(type,config_get_command("system"),NULL);
|
|
|
|
|
|
|
|
yon_config_load_config(YON_CONFIG_GLOBAL,config_get_global_only_parameters,NULL);
|
|
|
|
|
|
|
|
yon_config_set_status(DEFAULTPASSWD_parameter,-2);
|
|
|
|
|
|
|
|
yon_config_set_status(DEFAULTROOTPASSWD_parameter,-2);
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
config_str passwords = yon_config_load(get_passwords_command,&size);
|
|
|
|
config_str passwords = yon_config_load(get_passwords_command,&size);
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
@ -19,7 +23,7 @@ int yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
int parsed_size;
|
|
|
|
int parsed_size;
|
|
|
|
char *local_value = yon_config_get_by_key(key);
|
|
|
|
char *local_value = yon_config_get_by_key(key);
|
|
|
|
config_str parsed = yon_char_parse(value,&parsed_size,":");
|
|
|
|
config_str parsed = yon_char_parse(value,&parsed_size,":");
|
|
|
|
if (strstr(key,"USERADD[")&&local_value){
|
|
|
|
if (strstr(key,USERADD_SEARCH_macro)&&local_value){
|
|
|
|
if (parsed_size>5){
|
|
|
|
if (parsed_size>5){
|
|
|
|
char *temp = yon_char_append(local_value,parsed[5]);
|
|
|
|
char *temp = yon_char_append(local_value,parsed[5]);
|
|
|
|
free(local_value);
|
|
|
|
free(local_value);
|
|
|
|
@ -29,7 +33,7 @@ int yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else if (strstr(key,"GROUPADD[")&&local_value){
|
|
|
|
} else if (strstr(key,GROUPADD_SEARCH_macro)&&local_value){
|
|
|
|
if (parsed_size>4){
|
|
|
|
if (parsed_size>4){
|
|
|
|
char *temp = yon_char_append(local_value,parsed[4]);
|
|
|
|
char *temp = yon_char_append(local_value,parsed[4]);
|
|
|
|
free(local_value);
|
|
|
|
free(local_value);
|
|
|
|
@ -47,7 +51,26 @@ int yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (type==YON_CONFIG_CUSTOM){
|
|
|
|
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
GtkWidget *dialog = gtk_file_chooser_dialog_new(template_app_information.app_title,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
|
|
|
|
GtkFileFilter *filter = gtk_file_filter_new();
|
|
|
|
|
|
|
|
gtk_file_filter_add_pattern(filter,"*.ini");
|
|
|
|
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter);
|
|
|
|
|
|
|
|
gtk_widget_show(dialog);
|
|
|
|
|
|
|
|
int response = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
|
|
|
|
if (response == GTK_RESPONSE_ACCEPT){
|
|
|
|
|
|
|
|
char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(file)){
|
|
|
|
|
|
|
|
path=file;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_config_load_config(type,config_get_command(path),NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -56,8 +79,8 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
gtk_list_store_clear(widgets->GroupsList);
|
|
|
|
gtk_list_store_clear(widgets->GroupsList);
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
char *def_groups = yon_config_get_by_key("USERGROUPS");
|
|
|
|
char *def_groups = yon_config_get_by_key(USERGROUPS_parameter);
|
|
|
|
config_str users = yon_config_get_all_by_key("USERADD",&size);
|
|
|
|
config_str users = yon_config_get_all_by_key(USERADD_parameter,&size);
|
|
|
|
if (users){
|
|
|
|
if (users){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
gtk_list_store_append(widgets->UsersList,&iter);
|
|
|
|
gtk_list_store_append(widgets->UsersList,&iter);
|
|
|
|
@ -90,6 +113,7 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_list_store_set(widgets->UsersList,&iter,
|
|
|
|
gtk_list_store_set(widgets->UsersList,&iter,
|
|
|
|
|
|
|
|
0,parameters[5][0]=='!'||parameters[5][0]=='*',
|
|
|
|
2,login,
|
|
|
|
2,login,
|
|
|
|
3,parameters_size>0?parameters[0]:"",
|
|
|
|
3,parameters_size>0?parameters[0]:"",
|
|
|
|
1,parameters_size>1&&!yon_char_is_empty(parameters[1])?parameters[1]:"",
|
|
|
|
1,parameters_size>1&&!yon_char_is_empty(parameters[1])?parameters[1]:"",
|
|
|
|
@ -103,7 +127,7 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(users);
|
|
|
|
free(users);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
config_str groups = yon_config_get_all_by_key("GROUPADD",&size);
|
|
|
|
config_str groups = yon_config_get_all_by_key(GROUPADD_parameter,&size);
|
|
|
|
if (groups){
|
|
|
|
if (groups){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
gtk_list_store_append(widgets->GroupsList,&iter);
|
|
|
|
gtk_list_store_append(widgets->GroupsList,&iter);
|
|
|
|
@ -123,16 +147,16 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!strcmp(parameters[1],"x")) parameters[1]="";
|
|
|
|
if (!strcmp(parameters[1],"x")) parameters[1]="";
|
|
|
|
char *pars="";
|
|
|
|
char *pars="";
|
|
|
|
if (parameters_size>3&&strcmp(parameters[3],"x")&&strcmp(parameters[3],"")){
|
|
|
|
if (parameters_size>4&&strcmp(parameters[4],"x")&&strcmp(parameters[4],"")){
|
|
|
|
|
|
|
|
|
|
|
|
if (!check_is_password_hash(parameters[3])&¶meters[5][0]!='%'&¶meters[5][1]!='%'){
|
|
|
|
if (!check_is_password_hash(parameters[4])&¶meters[4][0]!='%'&¶meters[4][1]!='%'){
|
|
|
|
pars = ENCRYPTED_LABEL;
|
|
|
|
pars = ENCRYPTED_LABEL;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
pars = UNENCRYPTED_LABEL;
|
|
|
|
pars = UNENCRYPTED_LABEL;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
pars = PASSWORD_NO_SET_LABEL;
|
|
|
|
pars = DEFAULT_USER_LABEL;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_list_store_set(widgets->GroupsList,&iter,
|
|
|
|
gtk_list_store_set(widgets->GroupsList,&iter,
|
|
|
|
@ -157,10 +181,6 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_save_window_close_update(GtkWidget *self, main_window *widgets){
|
|
|
|
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_local_load(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_config_local_load(GtkWidget *self, main_window *widgets){
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
@ -178,6 +198,15 @@ void on_config_global_load(GtkWidget *self, main_window *widgets){
|
|
|
|
main_config.load_mode=0;
|
|
|
|
main_config.load_mode=0;
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_custom_load(GtkWidget *self,main_window *widgets){
|
|
|
|
|
|
|
|
yon_load_proceed(YON_CONFIG_CUSTOM);
|
|
|
|
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
|
|
|
|
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
|
|
|
main_config.load_mode=3;
|
|
|
|
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_samba_sync_proceed(){
|
|
|
|
void yon_samba_sync_proceed(){
|
|
|
|
if (main_config.sync_users){
|
|
|
|
if (main_config.sync_users){
|
|
|
|
@ -216,7 +245,7 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
char *old_value;
|
|
|
|
char *old_value;
|
|
|
|
char *new_value;
|
|
|
|
char *new_value;
|
|
|
|
gtk_tree_model_get(model,&iter,1,&name,2,&old_value,3,&new_value,-1);
|
|
|
|
gtk_tree_model_get(model,&iter,1,&name,2,&old_value,3,&new_value,-1);
|
|
|
|
if (strstr(name,"USERADD[")){
|
|
|
|
if (strstr(name,USERADD_SEARCH_macro)){
|
|
|
|
char *old=NULL;
|
|
|
|
char *old=NULL;
|
|
|
|
char *newv=NULL;
|
|
|
|
char *newv=NULL;
|
|
|
|
int size = 0;
|
|
|
|
int size = 0;
|
|
|
|
@ -260,9 +289,9 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
newv=new_value;
|
|
|
|
newv=new_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *new_string = yon_char_unite(!yon_char_is_empty(old)?old:"","\n",!yon_char_is_empty(newv)?newv:"",NULL);
|
|
|
|
char *new_string = yon_char_unite(!yon_char_is_empty(old)?old:"","\n",!yon_char_is_empty(newv)?newv:"",NULL);
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_string,-1);
|
|
|
|
gtk_list_store_set(window->list,&iter,4,new_string,-1);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (strstr(name,"GROUPADD[")){
|
|
|
|
} else if (strstr(name,GROUPADD_SEARCH_macro)){
|
|
|
|
char *old=NULL;
|
|
|
|
char *old=NULL;
|
|
|
|
char *newv=NULL;
|
|
|
|
char *newv=NULL;
|
|
|
|
int size = 0;
|
|
|
|
int size = 0;
|
|
|
|
@ -297,17 +326,17 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
newv=new_value;
|
|
|
|
newv=new_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *new_string = yon_char_unite(!yon_char_is_empty(old)?old:"","\n",!yon_char_is_empty(newv)?newv:"",NULL);
|
|
|
|
char *new_string = yon_char_unite(!yon_char_is_empty(old)?old:"","\n",!yon_char_is_empty(newv)?newv:"",NULL);
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_string,-1);
|
|
|
|
gtk_list_store_set(window->list,&iter,4,new_string,-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (strstr(name,"DEFAULTPASSWD")){
|
|
|
|
} else if (strstr(name,DEFAULTPASSWD_parameter)){
|
|
|
|
char *old=NULL;
|
|
|
|
char *old=NULL;
|
|
|
|
char *newv=NULL;
|
|
|
|
char *newv=NULL;
|
|
|
|
if (!yon_char_is_empty(new_value)&&strlen(new_value)>2&&new_value[0]=='%'&&new_value[1]=='%'){
|
|
|
|
if (!yon_char_is_empty(new_value)&&strlen(new_value)>2&&new_value[0]=='%'&&new_value[1]=='%'){
|
|
|
|
free(yon_char_divide(new_value,1));
|
|
|
|
free(yon_char_divide(new_value,1));
|
|
|
|
newv=new_value;
|
|
|
|
newv=new_value;
|
|
|
|
} else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') {
|
|
|
|
} else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') {
|
|
|
|
if (main_config.load_mode){
|
|
|
|
if (main_config.load_mode==1){
|
|
|
|
newv=new_value;
|
|
|
|
newv=new_value;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
newv="*******";
|
|
|
|
newv="*******";
|
|
|
|
@ -316,7 +345,7 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
newv="*******";
|
|
|
|
newv="*******";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
if (main_config.load_mode){
|
|
|
|
if (main_config.load_mode==1){
|
|
|
|
|
|
|
|
|
|
|
|
old = yon_char_new("<s>*******</s>");
|
|
|
|
old = yon_char_new("<s>*******</s>");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -324,16 +353,16 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *new_string = yon_char_unite(!yon_char_is_empty(old)?old:"","\n",!yon_char_is_empty(newv)?newv:"",NULL);
|
|
|
|
char *new_string = yon_char_unite(!yon_char_is_empty(old)?old:"","\n",!yon_char_is_empty(newv)?newv:"",NULL);
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_string,-1);
|
|
|
|
gtk_list_store_set(window->list,&iter,4,new_string,-1);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (strstr(name,"DEFAULTROOTPASSWD")){
|
|
|
|
} else if (strstr(name,DEFAULTROOTPASSWD_parameter)){
|
|
|
|
char *old=NULL;
|
|
|
|
char *old=NULL;
|
|
|
|
char *newv=NULL;
|
|
|
|
char *newv=NULL;
|
|
|
|
if (!yon_char_is_empty(new_value)&&strlen(new_value)>2&&new_value[0]=='%'&&new_value[1]=='%'){
|
|
|
|
if (!yon_char_is_empty(new_value)&&strlen(new_value)>2&&new_value[0]=='%'&&new_value[1]=='%'){
|
|
|
|
free(yon_char_divide(new_value,1));
|
|
|
|
free(yon_char_divide(new_value,1));
|
|
|
|
newv=new_value;
|
|
|
|
newv=new_value;
|
|
|
|
} else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') {
|
|
|
|
} else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') {
|
|
|
|
if (main_config.load_mode){
|
|
|
|
if (main_config.load_mode==1){
|
|
|
|
newv=new_value;
|
|
|
|
newv=new_value;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
newv="*******";
|
|
|
|
newv="*******";
|
|
|
|
@ -342,28 +371,37 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
newv="*******";
|
|
|
|
newv="*******";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
if (main_config.load_mode){
|
|
|
|
if (main_config.load_mode==1){
|
|
|
|
old = yon_char_new("<s>*******</s>");
|
|
|
|
old = yon_char_new("<s>*******</s>");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
old = yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
old = yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *new_string = yon_char_unite(!yon_char_is_empty(old)?old:"","\n",!yon_char_is_empty(newv)?newv:"",NULL);
|
|
|
|
char *new_string = yon_char_unite(!yon_char_is_empty(old)?old:"","\n",!yon_char_is_empty(newv)?newv:"",NULL);
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_string,-1);
|
|
|
|
gtk_list_store_set(window->list,&iter,4,new_string,-1);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_save_done(main_window *widgets){
|
|
|
|
void on_save_done(main_window *widgets, config_str output, int size){
|
|
|
|
|
|
|
|
char *final_output = yon_char_parsed_to_string(output,size,"");
|
|
|
|
|
|
|
|
printf("%s\n",final_output);
|
|
|
|
|
|
|
|
free(final_output);
|
|
|
|
|
|
|
|
yon_char_parsed_free(output,size);
|
|
|
|
on_config_update(NULL,widgets);
|
|
|
|
on_config_update(NULL,widgets);
|
|
|
|
|
|
|
|
if (main_config.load_mode==1){
|
|
|
|
|
|
|
|
yon_accept_changes();
|
|
|
|
|
|
|
|
yon_samba_sync_proceed();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_save(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_config_save(GtkWidget *self, main_window *widgets){
|
|
|
|
yon_accept_changes();
|
|
|
|
yon_accept_changes();
|
|
|
|
yon_samba_sync_proceed();
|
|
|
|
yon_samba_sync_proceed();
|
|
|
|
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_BOTH,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_command("global"),NULL);
|
|
|
|
if (window){
|
|
|
|
if (window){
|
|
|
|
if (main_config.load_mode==0){
|
|
|
|
if (main_config.load_mode==0){
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
@ -376,7 +414,7 @@ void on_config_save(GtkWidget *self, main_window *widgets){
|
|
|
|
config_str new_parsed = yon_char_parse(new_value,&new_size,":");
|
|
|
|
config_str new_parsed = yon_char_parse(new_value,&new_size,":");
|
|
|
|
if (old_parsed&&new_parsed){
|
|
|
|
if (old_parsed&&new_parsed){
|
|
|
|
char *parameter_type = yon_char_divide_search(parameter,"[",-1);
|
|
|
|
char *parameter_type = yon_char_divide_search(parameter,"[",-1);
|
|
|
|
if (!strcmp(parameter_type,"USERADD")){
|
|
|
|
if (!strcmp(parameter_type,USERADD_parameter)){
|
|
|
|
if (old_size>5){
|
|
|
|
if (old_size>5){
|
|
|
|
old_parsed = yon_char_parsed_rip(old_parsed,&old_size,5);
|
|
|
|
old_parsed = yon_char_parsed_rip(old_parsed,&old_size,5);
|
|
|
|
|
|
|
|
|
|
|
|
@ -394,7 +432,7 @@ void on_config_save(GtkWidget *self, main_window *widgets){
|
|
|
|
yon_char_parsed_free(old_parsed,old_size);
|
|
|
|
yon_char_parsed_free(old_parsed,old_size);
|
|
|
|
yon_char_parsed_free(new_parsed,new_size);
|
|
|
|
yon_char_parsed_free(new_parsed,new_size);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (!strcmp(parameter_type,"GROUPADD")){
|
|
|
|
} else if (!strcmp(parameter_type,GROUPADD_parameter)){
|
|
|
|
if (old_size>3){
|
|
|
|
if (old_size>3){
|
|
|
|
old_parsed = yon_char_parsed_rip(old_parsed,&old_size,3);
|
|
|
|
old_parsed = yon_char_parsed_rip(old_parsed,&old_size,3);
|
|
|
|
|
|
|
|
|
|
|
|
@ -415,17 +453,13 @@ void on_config_save(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_save_window_close_update),widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_global_save(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_config_global_save(GtkWidget *self, main_window *widgets){
|
|
|
|
yon_accept_changes();
|
|
|
|
template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,config_get_command("global"),NULL);
|
|
|
|
yon_samba_sync_proceed();
|
|
|
|
|
|
|
|
template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
|
|
|
|
if (window){
|
|
|
|
if (window){
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -433,7 +467,7 @@ void on_config_global_save(GtkWidget *self, main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_local_save(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_config_local_save(GtkWidget *self, main_window *widgets){
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
config_str keys = yon_config_get_all_by_key("USERADD[",&size);
|
|
|
|
config_str keys = yon_config_get_all_by_key(USERADD_SEARCH_macro,&size);
|
|
|
|
int passw_size;
|
|
|
|
int passw_size;
|
|
|
|
config_str passwords = NULL;
|
|
|
|
config_str passwords = NULL;
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
@ -455,10 +489,11 @@ void on_config_local_save(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_accept_changes();
|
|
|
|
yon_accept_changes();
|
|
|
|
yon_samba_sync_proceed();
|
|
|
|
yon_samba_sync_proceed();
|
|
|
|
template_saving_window *window = yon_save_proceed("system",YON_CONFIG_LOCAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
// char *output = yon_config_save_simple(YON_CONFIG_LOCAL,"system");
|
|
|
|
|
|
|
|
// if (output) puts(output);
|
|
|
|
|
|
|
|
template_saving_window *window = yon_save_proceed("system",YON_CONFIG_LOCAL,config_get_command("system"),NULL);
|
|
|
|
if (window){
|
|
|
|
if (window){
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_save_window_close_update),widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
char *key,*value;
|
|
|
|
char *key,*value;
|
|
|
|
@ -467,13 +502,20 @@ void on_config_local_save(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_custom_save(GtkWidget *self, main_window *widgets){
|
|
|
|
|
|
|
|
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_CUSTOM,config_get_command("system"),NULL);
|
|
|
|
|
|
|
|
if (window){
|
|
|
|
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_saving_settings_save(GtkWidget *self, yon_savasettings_window *window){
|
|
|
|
void on_saving_settings_save(GtkWidget *self, yon_savasettings_window *window){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SambaCheck))){
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SambaCheck))){
|
|
|
|
if (!yon_config_append("SAVE_ROOTCOPY_CHANGES","/var/lib/samba",",")){
|
|
|
|
if (!yon_config_append(SAVE_ROOTCOPY_CHANGES_parameter,"/var/lib/samba",",")){
|
|
|
|
yon_config_register("SAVE_ROOTCOPY_CHANGES","[save]","/var/lib/samba");
|
|
|
|
yon_config_register(SAVE_ROOTCOPY_CHANGES_parameter,SAVE_ROOTCOPY_CHANGES_get_command,"/var/lib/samba");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_element("SAVE_ROOTCOPY_CHANGES","/var/lib/samba",",");
|
|
|
|
yon_config_remove_element(SAVE_ROOTCOPY_CHANGES_parameter,"/var/lib/samba",",");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
on_subwindow_close(self);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -581,7 +623,7 @@ void yon_group_delete_confirmation_save(GtkWidget *self, dictionary *dict){
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter);
|
|
|
|
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)){
|
|
|
|
for (;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->GroupsList),&iter)){
|
|
|
|
char *name;
|
|
|
|
char *name;
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,2,&name,-1);
|
|
|
|
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);
|
|
|
|
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)){
|
|
|
|
for (;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itar)){
|
|
|
|
char *name_check;
|
|
|
|
char *name_check;
|
|
|
|
@ -589,8 +631,7 @@ void yon_group_delete_confirmation_save(GtkWidget *self, dictionary *dict){
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&delete,1,&name_check,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&delete,1,&name_check,-1);
|
|
|
|
if (!strcmp(name,name_check)&&delete){
|
|
|
|
if (!strcmp(name,name_check)&&delete){
|
|
|
|
gtk_list_store_remove(widgets->GroupsList,&iter);
|
|
|
|
gtk_list_store_remove(widgets->GroupsList,&iter);
|
|
|
|
yon_config_remove_by_key(USERADD(name));
|
|
|
|
yon_config_remove_by_key(GROUPADD(name));
|
|
|
|
yon_config_remove_by_key(USERSHADOW(name));
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter);
|
|
|
|
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -730,7 +771,7 @@ yon_savasettings_window *yon_saving_settings_new(){
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"savingSettingsWindow");
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"savingSettingsWindow");
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),SAVESETTINGS_TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),SAVESETTINGS_TITLE_LABEL);
|
|
|
|
char *string = yon_config_get_by_key("SAVE_ROOTCOPY_CHANGES");
|
|
|
|
char *string = yon_config_get_by_key(SAVE_ROOTCOPY_CHANGES_parameter);
|
|
|
|
if (!yon_char_is_empty(string)&&strstr(string,"/var/lib/samba")){
|
|
|
|
if (!yon_char_is_empty(string)&&strstr(string,"/var/lib/samba")){
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->SambaCheck),1);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->SambaCheck),1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -926,35 +967,35 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window
|
|
|
|
void on_additional_settings_save(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){
|
|
|
|
void on_additional_settings_save(GtkWidget *self, ubl_settings_usergroups_additional_settings_window *window){
|
|
|
|
const char *default_user = (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultUserNameEntry));
|
|
|
|
const char *default_user = (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultUserNameEntry));
|
|
|
|
if (!yon_char_is_empty(default_user)){
|
|
|
|
if (!yon_char_is_empty(default_user)){
|
|
|
|
yon_config_register("DEFAULTUSER","users",yon_char_new((char*)default_user));
|
|
|
|
yon_config_register(DEFAULTUSER_parameter,"users",yon_char_new((char*)default_user));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_by_key("DEFAULTUSER");
|
|
|
|
yon_config_remove_by_key(DEFAULTUSER_parameter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *default_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->DefaultPasswordCombo))>1? (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry)):NULL;
|
|
|
|
char *default_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->DefaultPasswordCombo))>1? (char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry)):NULL;
|
|
|
|
if (!yon_char_is_empty(default_password)){
|
|
|
|
if (!yon_char_is_empty(default_password)){
|
|
|
|
yon_config_register("DEFAULTPASSWD","users",default_password);
|
|
|
|
yon_config_register(DEFAULTPASSWD_parameter,"users",default_password);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_by_key("DEFAULTPASSWD");
|
|
|
|
yon_config_remove_by_key(DEFAULTPASSWD_parameter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *root_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RootPasswordCombo)) > 1 ? (char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordEntry)) : NULL;
|
|
|
|
char *root_password = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RootPasswordCombo)) > 1 ? (char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordEntry)) : NULL;
|
|
|
|
if (!yon_char_is_empty(root_password)){
|
|
|
|
if (!yon_char_is_empty(root_password)){
|
|
|
|
yon_config_register("DEFAULTROOTPASSWD","users",root_password);
|
|
|
|
yon_config_register(DEFAULTROOTPASSWD_parameter,"users",root_password);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_by_key("DEFAULTROOTPASSWD");
|
|
|
|
yon_config_remove_by_key(DEFAULTROOTPASSWD_parameter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int user_k_admin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck));
|
|
|
|
int user_k_admin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck));
|
|
|
|
if (user_k_admin){
|
|
|
|
if (user_k_admin){
|
|
|
|
yon_config_register("ADDADM","users","yes");
|
|
|
|
yon_config_register(ADDADM_parameter,"users","yes");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_register("ADDADM","users","no");
|
|
|
|
yon_config_register(ADDADM_parameter,"users","no");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordHashCombo))!=0){
|
|
|
|
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));
|
|
|
|
char *hash = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->PasswordHashCombo));
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
yon_config_register("HASHPASSWD","users",hash);
|
|
|
|
yon_config_register(HASHPASSWD_parameter,"users",hash);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
yon_config_remove_by_key("HASHPASSWD");
|
|
|
|
yon_config_remove_by_key(HASHPASSWD_parameter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -974,27 +1015,27 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window
|
|
|
|
|
|
|
|
|
|
|
|
void on_users_boot_toggled(GtkToggleButton *self){
|
|
|
|
void on_users_boot_toggled(GtkToggleButton *self){
|
|
|
|
if (gtk_toggle_button_get_active(self)){
|
|
|
|
if (gtk_toggle_button_get_active(self)){
|
|
|
|
char *parameter = yon_config_get_by_key("USERADD_SYNC");
|
|
|
|
char *parameter = yon_config_get_by_key(USERADD_SYNC_parameter);
|
|
|
|
if (!parameter){
|
|
|
|
if (!parameter){
|
|
|
|
yon_config_register("USERADD_SYNC","users","boot");
|
|
|
|
yon_config_register(USERADD_SYNC_parameter,"users","boot");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_append("USERADD_SYNC","boot",",");
|
|
|
|
yon_config_append(USERADD_SYNC_parameter,"boot",",");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_element("USERADD_SYNC","boot",",");
|
|
|
|
yon_config_remove_element(USERADD_SYNC_parameter,"boot",",");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_users_shutdown_toggled(GtkToggleButton *self){
|
|
|
|
void on_users_shutdown_toggled(GtkToggleButton *self){
|
|
|
|
if (gtk_toggle_button_get_active(self)){
|
|
|
|
if (gtk_toggle_button_get_active(self)){
|
|
|
|
char *parameter = yon_config_get_by_key("USERADD_SYNC");
|
|
|
|
char *parameter = yon_config_get_by_key(USERADD_SYNC_parameter);
|
|
|
|
if (!parameter){
|
|
|
|
if (!parameter){
|
|
|
|
yon_config_register("USERADD_SYNC","users","shutdown");
|
|
|
|
yon_config_register(USERADD_SYNC_parameter,"users","shutdown");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_append("USERADD_SYNC","shutdown",",");
|
|
|
|
yon_config_append(USERADD_SYNC_parameter,"shutdown",",");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_element("USERADD_SYNC","shutdown",",");
|
|
|
|
yon_config_remove_element(USERADD_SYNC_parameter,"shutdown",",");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1020,7 +1061,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
|
|
|
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow");
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"AdditionalSettingsWindow");
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),ADDITIONAL_SETTINGS_TITLE_LABEL);
|
|
|
|
char *sync_parameters = yon_config_get_by_key("USERADD_SYNC");
|
|
|
|
char *sync_parameters = yon_config_get_by_key(USERADD_SYNC_parameter);
|
|
|
|
if (sync_parameters){
|
|
|
|
if (sync_parameters){
|
|
|
|
if (strstr(sync_parameters,"boot")){
|
|
|
|
if (strstr(sync_parameters,"boot")){
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1);
|
|
|
|
@ -1065,30 +1106,30 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_char_parsed_free(hash_algos,hash_size);
|
|
|
|
yon_char_parsed_free(hash_algos,hash_size);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordHashCombo),0);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordHashCombo),0);
|
|
|
|
char *default_user = yon_config_get_by_key("DEFAULTUSER");
|
|
|
|
char *default_user = yon_config_get_by_key(DEFAULTUSER_parameter);
|
|
|
|
if (!yon_char_is_empty(default_user))
|
|
|
|
if (!yon_char_is_empty(default_user))
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->DefaultUserNameEntry),default_user);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->DefaultUserNameEntry),default_user);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RootPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->RootPasswordButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->RootPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->RootPasswordButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton);
|
|
|
|
char *default_password = yon_config_get_by_key("DEFAULTPASSWD");
|
|
|
|
char *default_password = yon_config_get_by_key(DEFAULTPASSWD_parameter);
|
|
|
|
if (!yon_char_is_empty(default_password)){
|
|
|
|
if (!yon_char_is_empty(default_password)){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),default_password);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),default_password);
|
|
|
|
if(!yon_config_check_ignore("DEFAULTPASSWD"))
|
|
|
|
if(!yon_config_check_ignore(DEFAULTPASSWD_parameter))
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),2);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *root_password = yon_config_get_by_key("DEFAULTROOTPASSWD");
|
|
|
|
char *root_password = yon_config_get_by_key(DEFAULTROOTPASSWD_parameter);
|
|
|
|
if (!yon_char_is_empty(root_password)){
|
|
|
|
if (!yon_char_is_empty(root_password)){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->RootPasswordEntry),root_password);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->RootPasswordEntry),root_password);
|
|
|
|
if(!yon_config_check_ignore("DEFAULTROOTPASSWD"))
|
|
|
|
if(!yon_config_check_ignore(DEFAULTROOTPASSWD_parameter))
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->RootPasswordCombo),2);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->RootPasswordCombo),2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *is_k_admin = yon_config_get_by_key("ADDADM");
|
|
|
|
char *is_k_admin = yon_config_get_by_key(ADDADM_parameter);
|
|
|
|
if (!yon_char_is_empty(is_k_admin))
|
|
|
|
if (!yon_char_is_empty(is_k_admin))
|
|
|
|
if (!strcmp(is_k_admin,"yes"))
|
|
|
|
if (!strcmp(is_k_admin,"yes"))
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck),1);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DefaultUserAdministratorCheck),1);
|
|
|
|
char *hash = yon_config_get_by_key("HASHPASSWD");
|
|
|
|
char *hash = yon_config_get_by_key(HASHPASSWD_parameter);
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
if (!yon_char_is_empty(hash)){
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->PasswordHashCombo),hash);
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->PasswordHashCombo),hash);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1179,7 +1220,7 @@ void on_GID_update(GtkWidget *self, ubl_settings_usergroups_group_creation_windo
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){
|
|
|
|
int config_size=0;
|
|
|
|
int config_size=0;
|
|
|
|
int final_size=0;
|
|
|
|
int final_size=0;
|
|
|
|
config_str config_groups = yon_config_get_all_by_key("GROUPADD",&config_size);
|
|
|
|
config_str config_groups = yon_config_get_all_by_key(GROUPADD_parameter,&config_size);
|
|
|
|
yon_char_parsed_prepend_strings(config_groups,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);
|
|
|
|
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;
|
|
|
|
long prev_busy=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck))?0:main_config.MINGID;
|
|
|
|
@ -1260,12 +1301,24 @@ void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
|
|
|
|
int shutdown_sync_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupaddShutdownCheck));
|
|
|
|
int shutdown_sync_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupaddShutdownCheck));
|
|
|
|
if (shutdown_sync_active){
|
|
|
|
if (shutdown_sync_active){
|
|
|
|
yon_config_register(GROUPADD_SYNC(group_name),"users","shutdown");
|
|
|
|
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");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_by_key(GROUPADD_SYNC(group_name));
|
|
|
|
yon_config_remove_by_key(GROUPADD_SYNC(group_name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
|
|
|
|
|
|
|
int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordCombo));
|
|
|
|
|
|
|
|
if (password_active > 1){
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
password="";
|
|
|
|
|
|
|
|
}
|
|
|
|
final_string = yon_char_unite(yon_char_return_if_exist(group_users,"x"),
|
|
|
|
final_string = yon_char_unite(yon_char_return_if_exist(group_users,"x"),
|
|
|
|
":",yon_char_return_if_exist(gid,"x"),
|
|
|
|
":",yon_char_return_if_exist(gid,"x"),
|
|
|
|
":",yon_char_return_if_exist(non_unique,""),
|
|
|
|
":",yon_char_return_if_exist(non_unique,""),
|
|
|
|
@ -1273,13 +1326,26 @@ void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
":",yon_char_return_if_exist(admins,"x"),
|
|
|
|
":",yon_char_return_if_exist(admins,"x"),
|
|
|
|
":",yon_char_return_if_exist(password,"x"),
|
|
|
|
":",yon_char_return_if_exist(password,"x"),
|
|
|
|
NULL);
|
|
|
|
NULL);
|
|
|
|
yon_config_register(GROUPADD(group_name),"users",final_string);
|
|
|
|
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;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->GroupsList);
|
|
|
|
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))
|
|
|
|
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);
|
|
|
|
gtk_list_store_append(widgets->GroupsList,&iter);
|
|
|
|
char *passwor = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
char *passwor = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
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,gtk_combo_box_get_active(GTK_COMBO_BOX(window->PasswordCombo))==0?PASSWORD_NO_SET_LABEL:check_is_password_hash(passwor)&&passwor[0]=='%'?UNENCRYPTED_LABEL:ENCRYPTED_LABEL,-1);
|
|
|
|
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);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1418,7 +1484,7 @@ void on_standard_groups_accept(GtkWidget *self, ubl_settings_usergroups_group_wi
|
|
|
|
standard_groups=extend_groups;
|
|
|
|
standard_groups=extend_groups;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_config_register("USERGROUPS","users",standard_groups);
|
|
|
|
yon_config_register(USERGROUPS_parameter,USERGROUPS_get_command,standard_groups);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1447,7 +1513,7 @@ void on_standard_groups_open(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_standard_groups_accept),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_standard_groups_accept),window);
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->GroupsWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->GroupsWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
char *groups = yon_config_get_by_key("USERGROUPS");
|
|
|
|
char *groups = yon_config_get_by_key(USERGROUPS_parameter);
|
|
|
|
if (!yon_char_is_empty(groups)){
|
|
|
|
if (!yon_char_is_empty(groups)){
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
@ -1703,7 +1769,7 @@ void on_UID_update(GtkWidget *self, ubl_settings_usergroups_user_window *window)
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck))){
|
|
|
|
int config_size=0;
|
|
|
|
int config_size=0;
|
|
|
|
int final_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_SEARCH_macro,&config_size);
|
|
|
|
yon_char_parsed_prepend_strings(config_users,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);
|
|
|
|
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;
|
|
|
|
long prev_busy=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck))?0:main_config.MINGID;
|
|
|
|
@ -1810,7 +1876,12 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
password="";
|
|
|
|
password="";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!window->old_password||window->old_password&&strcmp(window->old_password,password)){
|
|
|
|
char *old_password = NULL;
|
|
|
|
|
|
|
|
if (window->old_password){
|
|
|
|
|
|
|
|
old_password = window->old_password;
|
|
|
|
|
|
|
|
if (old_password[0]=='!') free(yon_char_divide(old_password,0));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!old_password||old_password&&strcmp(old_password,password)){
|
|
|
|
time_t t = time(NULL);
|
|
|
|
time_t t = time(NULL);
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
char *month = yon_char_from_int(tm.tm_mon+1);
|
|
|
|
char *month = yon_char_from_int(tm.tm_mon+1);
|
|
|
|
@ -1824,15 +1895,15 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
password_changed_date = yon_char_unite(yon_char_from_int(1900+tm.tm_year),"-",month,"-",day,NULL);
|
|
|
|
password_changed_date = yon_char_unite(yon_char_from_int(1900+tm.tm_year),"-",month,"-",day,NULL);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
password_changed_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordChangedEntry));
|
|
|
|
password_changed_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordChangedEntry));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
deactivate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck));
|
|
|
|
deactivate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck));
|
|
|
|
if (deactivate){
|
|
|
|
if (deactivate){
|
|
|
|
if (strlen(password)>1&&password[0]=='%'&&password[1]=='%'){
|
|
|
|
if (strlen(password)>1&&password[0]=='%'&&password[1]=='%'){
|
|
|
|
char *temp = yon_char_replace(password,"%%","!!");
|
|
|
|
char *temp = yon_char_replace(password,"%%","!!");
|
|
|
|
password = yon_char_replace(temp,"!!","%%!*");
|
|
|
|
password = yon_char_replace(temp,"!!","%%!");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
password = yon_char_append("!*",password);
|
|
|
|
password = yon_char_append("!",password);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1852,7 +1923,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
additional_groups = (char*)gtk_entry_get_text(GTK_ENTRY(window->userAdditionalGroupsEntry));
|
|
|
|
additional_groups = (char*)gtk_entry_get_text(GTK_ENTRY(window->userAdditionalGroupsEntry));
|
|
|
|
char *default_groups = yon_config_get_by_key("USERGROUPS");
|
|
|
|
char *default_groups = yon_config_get_by_key(USERGROUPS_parameter);
|
|
|
|
if (!yon_char_is_empty(default_groups)&&!strcmp(default_groups,additional_groups)){
|
|
|
|
if (!yon_char_is_empty(default_groups)&&!strcmp(default_groups,additional_groups)){
|
|
|
|
additional_groups="";
|
|
|
|
additional_groups="";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1969,11 +2040,13 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
":",yon_char_return_if_exist(password,""),
|
|
|
|
":",yon_char_return_if_exist(password,""),
|
|
|
|
NULL);
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
|
|
yon_config_register(USERADD(login),"users",final_user);
|
|
|
|
char *final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD(login));
|
|
|
|
|
|
|
|
yon_config_register(USERADD(login),final_command,final_user);
|
|
|
|
if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){
|
|
|
|
if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){
|
|
|
|
yon_config_remove_by_key(USERADD(window->old_username));
|
|
|
|
yon_config_remove_by_key(USERADD(window->old_username));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_config_register(USERSHADOW(login),"users",shadow_string);
|
|
|
|
final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW(login));
|
|
|
|
|
|
|
|
yon_config_register(USERSHADOW(login),final_command,shadow_string);
|
|
|
|
if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){
|
|
|
|
if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){
|
|
|
|
yon_config_remove_by_key(USERSHADOW(window->old_username));
|
|
|
|
yon_config_remove_by_key(USERSHADOW(window->old_username));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1983,14 +2056,16 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(useradd_sync_string)){
|
|
|
|
if (!yon_char_is_empty(useradd_sync_string)){
|
|
|
|
yon_config_register(USERADD_SYNC(login),"users",useradd_sync_string);
|
|
|
|
final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD_SYNC(login));
|
|
|
|
|
|
|
|
yon_config_register(USERADD_SYNC(login),final_command,useradd_sync_string);
|
|
|
|
if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){
|
|
|
|
if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){
|
|
|
|
yon_config_remove_by_key(USERADD_SYNC(window->old_username));
|
|
|
|
yon_config_remove_by_key(USERADD_SYNC(window->old_username));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(usershadow_sync_string)){
|
|
|
|
if (!yon_char_is_empty(usershadow_sync_string)){
|
|
|
|
yon_config_register(USERSHADOW_SYNC(login),"users",usershadow_sync_string);
|
|
|
|
final_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERSHADOW_SYNC(login));
|
|
|
|
|
|
|
|
yon_config_register(USERSHADOW_SYNC(login),final_command,usershadow_sync_string);
|
|
|
|
if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){
|
|
|
|
if (!yon_char_is_empty(window->old_username)&&strcmp(window->old_username,login)){
|
|
|
|
yon_config_remove_by_key(USERSHADOW_SYNC(window->old_username));
|
|
|
|
yon_config_remove_by_key(USERSHADOW_SYNC(window->old_username));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -2010,7 +2085,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
2,yon_char_return_if_exist(login,""),
|
|
|
|
2,yon_char_return_if_exist(login,""),
|
|
|
|
3,yon_char_return_if_exist(username,""),
|
|
|
|
3,yon_char_return_if_exist(username,""),
|
|
|
|
4,yon_char_return_if_exist(main_group,login),
|
|
|
|
4,yon_char_return_if_exist(main_group,login),
|
|
|
|
5,yon_char_return_if_exist(additional_groups,yon_config_get_by_key("USERGROUPS")),
|
|
|
|
5,yon_char_return_if_exist(additional_groups,yon_config_get_by_key(USERGROUPS_parameter)),
|
|
|
|
6,yon_char_unite(yon_char_return_if_exist(user_home,""),yon_char_return_if_exist(user_shell,""),yon_char_return_if_exist(create_system_user,""),yon_char_return_if_exist(create_ununique,""),yon_char_return_if_exist(do_not_check,""),NULL),
|
|
|
|
6,yon_char_unite(yon_char_return_if_exist(user_home,""),yon_char_return_if_exist(user_shell,""),yon_char_return_if_exist(create_system_user,""),yon_char_return_if_exist(create_ununique,""),yon_char_return_if_exist(do_not_check,""),NULL),
|
|
|
|
7,password_status,
|
|
|
|
7,password_status,
|
|
|
|
-1);
|
|
|
|
-1);
|
|
|
|
@ -2301,7 +2376,7 @@ void on_main_add(GtkWidget *self, main_window *widgets){
|
|
|
|
ubl_settings_usergroups_user_window *window = yon_ubl_settings_usergroups_user_new();
|
|
|
|
ubl_settings_usergroups_user_window *window = yon_ubl_settings_usergroups_user_new();
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->CreateUserWindow),ADD_USER_TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->CreateUserWindow),ADD_USER_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->userTitleNameLabel),ADD_USER_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->userTitleNameLabel),ADD_USER_TITLE_LABEL);
|
|
|
|
char *default_groups = yon_config_get_by_key("USERGROUPS");
|
|
|
|
char *default_groups = yon_config_get_by_key(USERGROUPS_parameter);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), default_groups);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), default_groups);
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
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,"widgets",widgets);
|
|
|
|
@ -2371,7 +2446,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
if (strcmp(parameters[3],"x")){
|
|
|
|
if (strcmp(parameters[3],"x")){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), parameters[3]);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), parameters[3]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
char *default_groups = yon_config_get_by_key("USERGROUPS");
|
|
|
|
char *default_groups = yon_config_get_by_key(USERGROUPS_parameter);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), default_groups);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), default_groups);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -2412,10 +2487,10 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
free(yon_char_divide(window->old_password,1));
|
|
|
|
free(yon_char_divide(window->old_password,1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strcmp(parameters[5],"x")&&strcmp(parameters[5],"")){
|
|
|
|
if (strcmp(parameters[5],"x")&&strcmp(parameters[5],"")){
|
|
|
|
if (strstr(parameters[5],"!*")){
|
|
|
|
if (parameters[5][0]=='!'){
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck),1);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck),1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_char_divide(strstr(parameters[5],"!*"),1);
|
|
|
|
free(yon_char_divide(parameters[5],0));
|
|
|
|
if (!yon_char_is_empty(parameters[5])){
|
|
|
|
if (!yon_char_is_empty(parameters[5])){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),parameters[5]);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),parameters[5]);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2);
|
|
|
|
@ -2520,7 +2595,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),parsed[4]);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),parsed[4]);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),2);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),2);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),1);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->PasswordCombo),0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *sync = yon_config_get_by_key(GROUPADD_SYNC(name));
|
|
|
|
char *sync = yon_config_get_by_key(GROUPADD_SYNC(name));
|
|
|
|
@ -2564,7 +2639,10 @@ void on_config_update(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int *yon_element_chosen(GtkWidget *target){
|
|
|
|
|
|
|
|
return (int*)0x1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**config_init()
|
|
|
|
/**config_init()
|
|
|
|
* [EN]
|
|
|
|
* [EN]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -2680,6 +2758,23 @@ void on_notebook_page_changed(GtkWidget *self, GtkWidget *page, int num, main_wi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef int (*RmbCheck)(void*);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gboolean on_menu_open(GtkWidget *self,GdkEventButton *event, rmb_menu_window *window){
|
|
|
|
|
|
|
|
if (event->button==3){
|
|
|
|
|
|
|
|
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter_first(model,&iter)&>k_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(self)),&model,&iter)){
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(window->buttons->first->next->data),1);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(window->buttons->first->next->next->data),1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(window->buttons->first->next->data),0);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(window->buttons->first->next->next->data),0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_main_window_complete(main_window *widgets)
|
|
|
|
/**yon_main_window_complete(main_window *widgets)
|
|
|
|
* [EN]
|
|
|
|
* [EN]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -2729,12 +2824,16 @@ main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
g_signal_connect(G_OBJECT(widgets->MainNotebook),"switch-page",G_CALLBACK(on_notebook_page_changed),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->MainNotebook),"switch-page",G_CALLBACK(on_notebook_page_changed),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveGlobalMenuItem),"activate",G_CALLBACK(on_config_global_save),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveGlobalMenuItem),"activate",G_CALLBACK(on_config_global_save),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveLocalMenuItem),"activate",G_CALLBACK(on_config_local_save),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveLocalMenuItem),"activate",G_CALLBACK(on_config_local_save),widgets);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveCustomMenuItem),"activate",G_CALLBACK(on_config_custom_save),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadGlobalMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadGlobalMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets);
|
|
|
|
yon_rmb_menu_setup(widgets->UsersTree,EDIT_LABEL,edit_icon_name,G_CALLBACK(on_main_edit),widgets,REMOVE_LABEL,delete_icon_name,G_CALLBACK(on_main_delete),widgets,NULL);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadCustomMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets);
|
|
|
|
yon_rmb_menu_setup(widgets->GroupsTree,EDIT_LABEL,edit_icon_name,G_CALLBACK(on_main_edit),widgets,REMOVE_LABEL,delete_icon_name,G_CALLBACK(on_main_delete),widgets,NULL);
|
|
|
|
widgets->UsersMenu = yon_rmb_menu_setup(widgets->UsersTree,(RmbCheck)yon_element_chosen,widgets->UsersTree,CREATE_NEW_LABEL,add_icon_name,G_CALLBACK(on_main_add),widgets,EDIT_LABEL,edit_icon_name,G_CALLBACK(on_main_edit),widgets, REMOVE_LABEL,delete_icon_name,G_CALLBACK(on_main_delete),widgets,NULL);
|
|
|
|
|
|
|
|
widgets->GroupsMenu = yon_rmb_menu_setup(widgets->GroupsTree,(RmbCheck)yon_element_chosen,widgets->GroupsTree,CREATE_NEW_LABEL,add_icon_name,G_CALLBACK(on_main_add),widgets,EDIT_LABEL,edit_icon_name,G_CALLBACK(on_main_edit),widgets,REMOVE_LABEL,delete_icon_name,G_CALLBACK(on_main_delete),widgets,NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->UsersTree),"button-press-event",G_CALLBACK(on_menu_open),widgets->UsersMenu);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->GroupsTree),"button-press-event",G_CALLBACK(on_menu_open),widgets->GroupsMenu);
|
|
|
|
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(widgets->UsersTree));
|
|
|
|
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(widgets->UsersTree));
|
|
|
|
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(widgets->GroupsTree));
|
|
|
|
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(widgets->GroupsTree));
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
|