|
|
|
@ -74,7 +74,7 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!strcmp(parameters[0],"x"))
|
|
|
|
if(!strcmp(parameters[0],"x"))
|
|
|
|
parameters[0]="";
|
|
|
|
parameters[0]="";
|
|
|
|
if (parameters_size>1&&!strcmp(parameters[1],"x")) parameters[1]=AUTOMATICALLY_LABEL;
|
|
|
|
if (parameters_size>1&&!strcmp(parameters[1],"x")) parameters[1]="";
|
|
|
|
if (parameters_size>2&&!strcmp(parameters[2],"x")) parameters[2]=login;
|
|
|
|
if (parameters_size>2&&!strcmp(parameters[2],"x")) parameters[2]=login;
|
|
|
|
char *pars = "";
|
|
|
|
char *pars = "";
|
|
|
|
if (parameters_size>5&&strcmp(parameters[5],"x")&&strcmp(parameters[5],"")){
|
|
|
|
if (parameters_size>5&&strcmp(parameters[5],"x")&&strcmp(parameters[5],"")){
|
|
|
|
@ -92,10 +92,10 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
gtk_list_store_set(widgets->UsersList,&iter,
|
|
|
|
gtk_list_store_set(widgets->UsersList,&iter,
|
|
|
|
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]:AUTOMATICALLY_LABEL,
|
|
|
|
1,parameters_size>1&&!yon_char_is_empty(parameters[1])?parameters[1]:"",
|
|
|
|
4,parameters_size>2&&!yon_char_is_empty(parameters[2])?parameters[2]:login,
|
|
|
|
4,parameters_size>2&&!yon_char_is_empty(parameters[2])?parameters[2]:login,
|
|
|
|
5,parameters_size>3?!strcmp(parameters[3],"x")||!strcmp(parameters[3],"")?def_groups:parameters[3]:def_groups,
|
|
|
|
5,parameters_size>3?!strcmp(parameters[3],"x")||!strcmp(parameters[3],"")?def_groups:parameters[3]:def_groups,
|
|
|
|
6,parameters_size>4?!strcmp(parameters[3],"x")?"":parameters[4]:"",
|
|
|
|
6,parameters_size>4?!strcmp(parameters[4],"x")?"":parameters[4]:"",
|
|
|
|
7,pars,
|
|
|
|
7,pars,
|
|
|
|
-1);
|
|
|
|
-1);
|
|
|
|
if(parameters)
|
|
|
|
if(parameters)
|
|
|
|
@ -118,13 +118,29 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
login = yon_char_divide_search(parameters[0],"=",-1);
|
|
|
|
login = yon_char_divide_search(parameters[0],"=",-1);
|
|
|
|
login[strlen(login)-1]='\0';
|
|
|
|
login[strlen(login)-1]='\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!strcmp(parameters[1],"x")) parameters[1]=AUTOMATICALLY_LABEL;
|
|
|
|
if (parameters_size>2&&!strcmp(parameters[2],"x")){
|
|
|
|
|
|
|
|
parameters[2]="";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(parameters[1],"x")) parameters[1]="";
|
|
|
|
|
|
|
|
char *pars="";
|
|
|
|
|
|
|
|
if (parameters_size>3&&strcmp(parameters[3],"x")&&strcmp(parameters[3],"")){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!check_is_password_hash(parameters[3])){
|
|
|
|
|
|
|
|
pars = ENCRYPTED_LABEL;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pars = UNENCRYPTED_LABEL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pars = PASSWORD_NO_SET_LABEL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
gtk_list_store_set(widgets->GroupsList,&iter,
|
|
|
|
gtk_list_store_set(widgets->GroupsList,&iter,
|
|
|
|
1,login,
|
|
|
|
1,login,
|
|
|
|
0,parameters_size>1?parameters[1]:"",
|
|
|
|
0,parameters_size>1?parameters[1]:"",
|
|
|
|
2,parameters_size>0?parameters[0]:"",
|
|
|
|
2,parameters_size>0?parameters[0]:"",
|
|
|
|
3,parameters_size>2?parameters[2]:"",
|
|
|
|
3,parameters_size>2?parameters[2]:"",
|
|
|
|
4,parameters_size>3?ENCRYPTED_LABEL:DEFAULT_USER_LABEL,
|
|
|
|
4,pars,
|
|
|
|
-1);
|
|
|
|
-1);
|
|
|
|
if(parameters)
|
|
|
|
if(parameters)
|
|
|
|
free(parameters);
|
|
|
|
free(parameters);
|
|
|
|
@ -222,6 +238,22 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!yon_char_is_empty(old_value)){
|
|
|
|
if(!yon_char_is_empty(old_value)){
|
|
|
|
|
|
|
|
config_str parsed = NULL;
|
|
|
|
|
|
|
|
parsed = yon_char_parse(old_value,&size,":");
|
|
|
|
|
|
|
|
if (size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")&&parsed[5][0]!='%'&&parsed[5][1]!='%'){
|
|
|
|
|
|
|
|
free(old_value);
|
|
|
|
|
|
|
|
free(parsed[5]);
|
|
|
|
|
|
|
|
parsed[5]=yon_char_new("*******");
|
|
|
|
|
|
|
|
old_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
|
|
|
|
} else if (size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")) {
|
|
|
|
|
|
|
|
free(old_value);
|
|
|
|
|
|
|
|
free(yon_char_divide(parsed[5],1));
|
|
|
|
|
|
|
|
old_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parsed){
|
|
|
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
old=yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
old=yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!yon_char_is_empty(new_value)){
|
|
|
|
if(!yon_char_is_empty(new_value)){
|
|
|
|
@ -244,6 +276,21 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
new_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
new_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!yon_char_is_empty(old_value)){
|
|
|
|
if(!yon_char_is_empty(old_value)){
|
|
|
|
|
|
|
|
config_str parsed = NULL;
|
|
|
|
|
|
|
|
parsed = yon_char_parse(old_value,&size,":");
|
|
|
|
|
|
|
|
if (size>4&&!yon_char_is_empty(parsed[4])&&strcmp(parsed[4],"x")&&parsed[4][0]!='%'&&parsed[4][1]!='%'){
|
|
|
|
|
|
|
|
free(old_value);
|
|
|
|
|
|
|
|
free(parsed[4]);
|
|
|
|
|
|
|
|
parsed[4]=yon_char_new("*******");
|
|
|
|
|
|
|
|
old_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
|
|
|
|
} else if (size>4&&!yon_char_is_empty(parsed[4])&&strcmp(parsed[4],"x")) {
|
|
|
|
|
|
|
|
free(old_value);
|
|
|
|
|
|
|
|
free(yon_char_divide(parsed[4],1));
|
|
|
|
|
|
|
|
old_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parsed){
|
|
|
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
|
|
|
}
|
|
|
|
old=yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
old=yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!yon_char_is_empty(new_value)){
|
|
|
|
if(!yon_char_is_empty(new_value)){
|
|
|
|
@ -260,12 +307,21 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
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]=='$') {
|
|
|
|
newv=new_value;
|
|
|
|
if (main_config.load_mode){
|
|
|
|
|
|
|
|
newv=new_value;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
newv="*******";
|
|
|
|
|
|
|
|
}
|
|
|
|
}else if (!yon_char_is_empty(new_value)){
|
|
|
|
}else if (!yon_char_is_empty(new_value)){
|
|
|
|
newv="*******";
|
|
|
|
newv="*******";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
old = yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
if (main_config.load_mode){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
old = yon_char_new("<s>*******</s>");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
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,7,new_string,-1);
|
|
|
|
@ -277,12 +333,20 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
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]=='$') {
|
|
|
|
newv=new_value;
|
|
|
|
if (main_config.load_mode){
|
|
|
|
|
|
|
|
newv=new_value;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
newv="*******";
|
|
|
|
|
|
|
|
}
|
|
|
|
}else if (!yon_char_is_empty(new_value)){
|
|
|
|
}else if (!yon_char_is_empty(new_value)){
|
|
|
|
newv="*******";
|
|
|
|
newv="*******";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
old = yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
if (main_config.load_mode){
|
|
|
|
|
|
|
|
old = yon_char_new("<s>*******</s>");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
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,7,new_string,-1);
|
|
|
|
@ -296,8 +360,60 @@ void on_config_save(GtkWidget *self, main_window *widgets){
|
|
|
|
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,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
if (window){
|
|
|
|
if (window){
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
if (main_config.load_mode==0){
|
|
|
|
g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_save_window_close_update),widgets);
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
|
|
|
|
for(;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
|
|
|
|
|
|
|
|
char *parameter,*old_value, *new_value;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,¶meter,2,&old_value,3,&new_value,-1);
|
|
|
|
|
|
|
|
int old_size, new_size;
|
|
|
|
|
|
|
|
config_str old_parsed = yon_char_parse(old_value,&old_size,":");
|
|
|
|
|
|
|
|
config_str new_parsed = yon_char_parse(new_value,&new_size,":");
|
|
|
|
|
|
|
|
if (old_parsed&&new_parsed){
|
|
|
|
|
|
|
|
char *parameter_type = yon_char_divide_search(parameter,"[",-1);
|
|
|
|
|
|
|
|
if (!strcmp(parameter_type,"USERADD")){
|
|
|
|
|
|
|
|
if (old_size>5){
|
|
|
|
|
|
|
|
old_parsed = yon_char_parsed_rip(old_parsed,&old_size,5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_size>5){
|
|
|
|
|
|
|
|
new_parsed = yon_char_parsed_rip(new_parsed,&new_size,5);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char *old_final = yon_char_parsed_to_string(old_parsed,old_size,":");
|
|
|
|
|
|
|
|
char *new_final = yon_char_parsed_to_string(new_parsed,new_size,":");
|
|
|
|
|
|
|
|
if (!strcmp(old_final,new_final)){
|
|
|
|
|
|
|
|
gtk_list_store_set(window->list,&iter,5,0,-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free(old_final);
|
|
|
|
|
|
|
|
free(new_final);
|
|
|
|
|
|
|
|
yon_char_parsed_free(old_parsed,old_size);
|
|
|
|
|
|
|
|
yon_char_parsed_free(new_parsed,new_size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (!strcmp(parameter_type,"GROUPADD")){
|
|
|
|
|
|
|
|
if (old_size>3){
|
|
|
|
|
|
|
|
old_parsed = yon_char_parsed_rip(old_parsed,&old_size,3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_size>3){
|
|
|
|
|
|
|
|
new_parsed = yon_char_parsed_rip(new_parsed,&new_size,3);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char *old_final = yon_char_parsed_to_string(old_parsed,old_size,":");
|
|
|
|
|
|
|
|
char *new_final = yon_char_parsed_to_string(new_parsed,new_size,":");
|
|
|
|
|
|
|
|
if (!strcmp(old_final,new_final)){
|
|
|
|
|
|
|
|
gtk_list_store_set(window->list,&iter,5,0,-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free(old_final);
|
|
|
|
|
|
|
|
free(new_final);
|
|
|
|
|
|
|
|
yon_char_parsed_free(old_parsed,old_size);
|
|
|
|
|
|
|
|
yon_char_parsed_free(new_parsed,new_size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_save_window_close_update),widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -452,6 +568,50 @@ void yon_delete_confirmation_save(GtkWidget *self, dictionary *dict){
|
|
|
|
on_subwindow_close(self);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_group_delete_confirmation_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
|
|
|
|
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
|
|
|
|
yon_confirmation_window *window = yon_dictionary_get_data(dict->first->next,yon_confirmation_window*);
|
|
|
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter);
|
|
|
|
|
|
|
|
for (;valid;valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->GroupsList),&iter)){
|
|
|
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,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;
|
|
|
|
|
|
|
|
int status,delete;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&delete,1,&name_check,-1);
|
|
|
|
|
|
|
|
if (!strcmp(name,name_check)&&delete){
|
|
|
|
|
|
|
|
gtk_list_store_remove(widgets->GroupsList,&iter);
|
|
|
|
|
|
|
|
yon_config_remove_by_key(USERADD(name));
|
|
|
|
|
|
|
|
yon_config_remove_by_key(USERSHADOW(name));
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter)){
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,1,&name,-1);
|
|
|
|
|
|
|
|
int valid2 = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itar);
|
|
|
|
|
|
|
|
for (;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itar)){
|
|
|
|
|
|
|
|
char *name_check;
|
|
|
|
|
|
|
|
int status,delete;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itar,0,&delete,1,&name_check,3,&status,-1);
|
|
|
|
|
|
|
|
if (!strcmp(name,name_check)&&delete){
|
|
|
|
|
|
|
|
gtk_list_store_remove(widgets->GroupsList,&iter);
|
|
|
|
|
|
|
|
yon_config_remove_by_key(GROUPADD(name));
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter);
|
|
|
|
|
|
|
|
if (status){
|
|
|
|
|
|
|
|
if (yon_char_parsed_check_exist(main_config.remove_homes,main_config.homes_size,name)==-1){
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(main_config.remove_homes,&main_config.homes_size,name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
yon_confirmation_window *yon_delete_confirmation_new(){
|
|
|
|
yon_confirmation_window *yon_delete_confirmation_new(){
|
|
|
|
yon_confirmation_window *window = malloc(sizeof(yon_confirmation_window));
|
|
|
|
yon_confirmation_window *window = malloc(sizeof(yon_confirmation_window));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_confirmation);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_confirmation);
|
|
|
|
@ -514,6 +674,38 @@ void yon_delete_confirmation_open(main_window *widgets){
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_group_delete_confirmation_open(main_window *widgets){
|
|
|
|
|
|
|
|
yon_confirmation_window *window = yon_delete_confirmation_new();
|
|
|
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window));
|
|
|
|
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
|
|
|
gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),2),0);
|
|
|
|
|
|
|
|
gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),3),0);
|
|
|
|
|
|
|
|
gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),4),0);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_group_delete_confirmation_save),dict);
|
|
|
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->GroupsList);
|
|
|
|
|
|
|
|
GList *list = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GroupsTree)),&model);
|
|
|
|
|
|
|
|
int chosen_size=0;
|
|
|
|
|
|
|
|
config_str chosen = NULL;
|
|
|
|
|
|
|
|
for (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,1,¤t,-1);
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(chosen,&chosen_size,current);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->GroupsList),&iter);
|
|
|
|
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->GroupsList),&iter)){
|
|
|
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->GroupsList),&iter,1,&name,-1);
|
|
|
|
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
|
|
|
|
gtk_list_store_set(window->list,&itar,0,yon_char_parsed_check_exist(chosen,chosen_size,name)>-1?1:0,1,name,-1);
|
|
|
|
|
|
|
|
free(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
yon_savasettings_window *yon_saving_settings_new(){
|
|
|
|
yon_savasettings_window *yon_saving_settings_new(){
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_savesettings);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_savesettings);
|
|
|
|
yon_savasettings_window *window = malloc(sizeof(yon_savasettings_window));
|
|
|
|
yon_savasettings_window *window = malloc(sizeof(yon_savasettings_window));
|
|
|
|
@ -571,16 +763,26 @@ void on_groups_save(GtkWidget *self, dictionary *dict){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_groups_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
void on_groups_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new();
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(0);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),MAIN_GROUP_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),MAIN_GROUP_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),MAIN_GROUP_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),MAIN_GROUP_LABEL);
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
GtkTreeIter iter, itar,itor;
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.groups_list),&iter);
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.groups_list),&iter);
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.groups_list),&iter)){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.groups_list),&iter)){
|
|
|
|
char *groupname;
|
|
|
|
char *groupname;
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.groups_list),&iter,1,&groupname,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.groups_list),&iter,1,&groupname,-1);
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
int valid1 = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itor);
|
|
|
|
gtk_list_store_set(window->list,&itar,1,groupname,-1);
|
|
|
|
for (;valid1;valid1 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itor)){
|
|
|
|
|
|
|
|
char *checked;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itor,1,&checked,-1);
|
|
|
|
|
|
|
|
if (!strcmp(groupname,checked)){
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!valid1){
|
|
|
|
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
|
|
|
|
gtk_list_store_set(window->list,&itar,1,groupname,-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
free(groupname);
|
|
|
|
free(groupname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),0),0);
|
|
|
|
gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),0),0);
|
|
|
|
@ -616,10 +818,10 @@ void on_groups_multiple_save(GtkWidget *self, dictionary *dict){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_groups_multiple_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
void on_groups_multiple_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new();
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(0);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),ADDITIONAL_GROUPS_TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),ADDITIONAL_GROUPS_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),ADDITIONAL_GROUPS_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),ADDITIONAL_GROUPS_TITLE_LABEL);
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
GtkTreeIter iter, itar,itor;
|
|
|
|
char *output = (char*)gtk_entry_get_text(output_target);
|
|
|
|
char *output = (char*)gtk_entry_get_text(output_target);
|
|
|
|
int size=0;
|
|
|
|
int size=0;
|
|
|
|
config_str parsed=NULL;
|
|
|
|
config_str parsed=NULL;
|
|
|
|
@ -630,8 +832,18 @@ void on_groups_multiple_clicked(GtkWidget *self, GtkEntry *output_target){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.groups_list),&iter)){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.groups_list),&iter)){
|
|
|
|
char *groupname;
|
|
|
|
char *groupname;
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.groups_list),&iter,1,&groupname,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.groups_list),&iter,1,&groupname,-1);
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
int valid1 = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itor);
|
|
|
|
gtk_list_store_set(window->list,&itar,1,groupname,-1);
|
|
|
|
for (;valid1;valid1 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itor)){
|
|
|
|
|
|
|
|
char *checked;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itor,1,&checked,-1);
|
|
|
|
|
|
|
|
if (!strcmp(groupname,checked)){
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!valid1){
|
|
|
|
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
|
|
|
|
gtk_list_store_set(window->list,&itar,1,groupname,-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
free(groupname);
|
|
|
|
free(groupname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
@ -659,7 +871,7 @@ void on_passwords_encrypt(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_password_change(GtkWidget *self, dictionary *entry_dict){//
|
|
|
|
void on_password_change(GtkWidget *self, dictionary *entry_dict){
|
|
|
|
GtkComboBox *combo = yon_dictionary_get_data(entry_dict->first,GtkComboBox*);
|
|
|
|
GtkComboBox *combo = yon_dictionary_get_data(entry_dict->first,GtkComboBox*);
|
|
|
|
GtkEntry *output_target = yon_dictionary_get_data(entry_dict->first->next,GtkEntry*);
|
|
|
|
GtkEntry *output_target = yon_dictionary_get_data(entry_dict->first->next,GtkEntry*);
|
|
|
|
ubl_settings_usergroups_password_window *window = yon_ubl_settings_usergroups_password_new();
|
|
|
|
ubl_settings_usergroups_password_window *window = yon_ubl_settings_usergroups_password_new();
|
|
|
|
@ -796,7 +1008,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
if (hash_algos[i][strlen(hash_algos[i])-1]=='\n') hash_algos[i][strlen(hash_algos[i])-1]='\0';
|
|
|
|
if (hash_algos[i][strlen(hash_algos[i])-1]=='\n') hash_algos[i][strlen(hash_algos[i])-1]='\0';
|
|
|
|
int parsed_size;
|
|
|
|
int parsed_size;
|
|
|
|
config_str parsed = yon_char_parse(hash_algos[i],&parsed_size,";");
|
|
|
|
config_str parsed = yon_char_parse(hash_algos[i],&parsed_size,";");
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->PasswordHashCombo),parsed[0],parsed[1]);
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->PasswordHashCombo),parsed[0],_(parsed[1]));
|
|
|
|
gtk_widget_set_tooltip_text(window->PasswordHashCombo,parsed[1]);
|
|
|
|
gtk_widget_set_tooltip_text(window->PasswordHashCombo,parsed[1]);
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -863,11 +1075,11 @@ void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *self, main_w
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_user_choose(GtkWidget *self, GtkEntry *target){
|
|
|
|
void on_user_choose(GtkWidget *self, GtkEntry *target){
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new();
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(1);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),GROUP_USERS_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),GROUP_USERS_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),GROUP_USERS_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),GROUP_USERS_TITLE_LABEL);
|
|
|
|
gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(window->GroupColumn),USERS_LABEL);
|
|
|
|
gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(window->GroupColumn),USERS_LABEL);
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
GtkTreeIter iter, itar,itor;
|
|
|
|
char *output = (char*)gtk_entry_get_text(target);
|
|
|
|
char *output = (char*)gtk_entry_get_text(target);
|
|
|
|
int size=0;
|
|
|
|
int size=0;
|
|
|
|
config_str parsed=NULL;
|
|
|
|
config_str parsed=NULL;
|
|
|
|
@ -878,8 +1090,18 @@ void on_user_choose(GtkWidget *self, GtkEntry *target){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.users_list),&iter)){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.users_list),&iter)){
|
|
|
|
char *groupname;
|
|
|
|
char *groupname;
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.users_list),&iter,2,&groupname,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.users_list),&iter,2,&groupname,-1);
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
int valid1 = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itor);
|
|
|
|
gtk_list_store_set(window->list,&itar,1,groupname,-1);
|
|
|
|
for (;valid1;valid1 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itor)){
|
|
|
|
|
|
|
|
char *checked;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itor,1,&checked,-1);
|
|
|
|
|
|
|
|
if (!strcmp(groupname,checked)){
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!valid1){
|
|
|
|
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
|
|
|
|
gtk_list_store_set(window->list,&itar,1,groupname,-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
free(groupname);
|
|
|
|
free(groupname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
|
|
|
|
@ -975,12 +1197,12 @@ void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
admins = (char*)gtk_entry_get_text(GTK_ENTRY(window->AdminGroupsEntry));
|
|
|
|
admins = (char*)gtk_entry_get_text(GTK_ENTRY(window->AdminGroupsEntry));
|
|
|
|
int non_unique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UnuniqueGIDCheck));
|
|
|
|
int non_unique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UnuniqueGIDCheck));
|
|
|
|
if(non_unique_active){
|
|
|
|
if(non_unique_active){
|
|
|
|
non_unique=" --non-unique";
|
|
|
|
non_unique="--non-unique";
|
|
|
|
} else non_unique="";
|
|
|
|
} else non_unique="";
|
|
|
|
|
|
|
|
|
|
|
|
int gsystem_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck));
|
|
|
|
int gsystem_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck));
|
|
|
|
if(gsystem_active){
|
|
|
|
if(gsystem_active){
|
|
|
|
gsystem=" --system";
|
|
|
|
gsystem="--system";
|
|
|
|
} else gsystem="";
|
|
|
|
} else gsystem="";
|
|
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
@ -1003,7 +1225,8 @@ void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
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);
|
|
|
|
gtk_list_store_set(widgets->GroupsList,&iter,0,strcmp(gid,"x")?gid:AUTOMATICALLY_LABEL,1,group_name,2,group_users,3,yon_char_append(non_unique,gsystem),4,gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->PasswordCombo)),-1);
|
|
|
|
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)?UNENCRYPTED_LABEL:ENCRYPTED_LABEL,-1);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1087,7 +1310,7 @@ void on_group_clicked(GtkCellRenderer *self, char *path, ubl_settings_usergroups
|
|
|
|
gtk_list_store_set(window->list,&iter,0,!status,-1);
|
|
|
|
gtk_list_store_set(window->list,&iter,0,!status,-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(){
|
|
|
|
ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(int mode){ // 1 - user, 0 - group
|
|
|
|
ubl_settings_usergroups_group_window *window = malloc(sizeof(ubl_settings_usergroups_group_window));
|
|
|
|
ubl_settings_usergroups_group_window *window = malloc(sizeof(ubl_settings_usergroups_group_window));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group);
|
|
|
|
window->GroupsWindow=yon_gtk_builder_get_widget(builder,"GroupsWindow");
|
|
|
|
window->GroupsWindow=yon_gtk_builder_get_widget(builder,"GroupsWindow");
|
|
|
|
@ -1103,13 +1326,22 @@ ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(){
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),GROUPS_TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),GROUPS_TITLE_LABEL);
|
|
|
|
g_signal_connect(G_OBJECT(window->StatusCell),"toggled",G_CALLBACK(on_group_clicked),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->StatusCell),"toggled",G_CALLBACK(on_group_clicked),window);
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->GroupsTree),GTK_TREE_MODEL(window->list));
|
|
|
|
config_str current;
|
|
|
|
for (int i=0;i<main_config.groups_size;i++){
|
|
|
|
int current_size;
|
|
|
|
char *group_record = yon_char_new(main_config.groups[i]);
|
|
|
|
if (mode==1){
|
|
|
|
|
|
|
|
current = main_config.users;
|
|
|
|
|
|
|
|
current_size = main_config.users_size;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
current = main_config.groups;
|
|
|
|
|
|
|
|
current_size = main_config.groups_size;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i=0;i<current_size;i++){
|
|
|
|
|
|
|
|
char *group_record = yon_char_new(current[i]);
|
|
|
|
char *group_name = yon_char_divide_search(group_record,":",-1);
|
|
|
|
char *group_name = yon_char_divide_search(group_record,":",-1);
|
|
|
|
gtk_list_store_append(window->list,&iter);
|
|
|
|
gtk_list_store_append(window->list,&iter);
|
|
|
|
gtk_list_store_set(window->list,&iter,0,0,1,group_name,-1);
|
|
|
|
gtk_list_store_set(window->list,&iter,0,0,1,group_name,-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->GroupsTree),GTK_TREE_MODEL(window->list));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
@ -1137,16 +1369,26 @@ void on_standard_groups_accept(GtkWidget *self, ubl_settings_usergroups_group_wi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_standard_groups_open(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_standard_groups_open(GtkWidget *self, main_window *widgets){
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new();
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(0);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),DEFAULT_GROUPS_TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),DEFAULT_GROUPS_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),DEFAULT_GROUPS_TITLE_LABEL);
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderLabel),DEFAULT_GROUPS_TITLE_LABEL);
|
|
|
|
GtkTreeIter iter, itar;
|
|
|
|
GtkTreeIter iter, itar,itor;
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.groups_list),&iter);
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.groups_list),&iter);
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.groups_list),&iter)){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.groups_list),&iter)){
|
|
|
|
char *groupname;
|
|
|
|
char *groupname;
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.groups_list),&iter,1,&groupname,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.groups_list),&iter,1,&groupname,-1);
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
int valid1 = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&itor);
|
|
|
|
gtk_list_store_set(window->list,&itar,1,groupname,-1);
|
|
|
|
for (;valid1;valid1 = gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&itor)){
|
|
|
|
|
|
|
|
char *checked;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&itor,1,&checked,-1);
|
|
|
|
|
|
|
|
if (!strcmp(groupname,checked)){
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!valid1){
|
|
|
|
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
|
|
|
|
gtk_list_store_set(window->list,&itar,1,groupname,-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
free(groupname);
|
|
|
|
free(groupname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
@ -1160,11 +1402,11 @@ void on_standard_groups_open(GtkWidget *self, main_window *widgets){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
|
|
|
|
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
|
|
|
|
char *cur_name;
|
|
|
|
char *cur_name;
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,&cur_name,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,&cur_name,-1);
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
if (!strcmp(standard_groups[i],cur_name)){
|
|
|
|
if (!strcmp(standard_groups[i],cur_name)){
|
|
|
|
gtk_list_store_set(window->list,&iter,0,1,-1);
|
|
|
|
gtk_list_store_set(window->list,&iter,0,1,-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free(cur_name);
|
|
|
|
free(cur_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1381,7 +1623,6 @@ return window;
|
|
|
|
|
|
|
|
|
|
|
|
void on_settings_usergroups_system_open(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_settings_usergroups_system_open(GtkWidget *self, main_window *widgets){
|
|
|
|
ubl_settings_usergroups_system_window *window = yon_ubl_settings_usergroups_system_new();
|
|
|
|
ubl_settings_usergroups_system_window *window = yon_ubl_settings_usergroups_system_new();
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->MonitorWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
|
|
|
|
gtk_widget_show(window->MonitorWindow);
|
|
|
|
gtk_widget_show(window->MonitorWindow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1489,7 +1730,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
|
|
|
|
int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck));
|
|
|
|
int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck));
|
|
|
|
if (do_not_check_actve)
|
|
|
|
if (do_not_check_actve)
|
|
|
|
do_not_check = " --badnames";
|
|
|
|
do_not_check = "--badnames";
|
|
|
|
|
|
|
|
|
|
|
|
login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry));
|
|
|
|
login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry));
|
|
|
|
if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){
|
|
|
|
if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){
|
|
|
|
@ -1511,18 +1752,20 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userPasswordEntry);
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userPasswordEntry);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck))){
|
|
|
|
|
|
|
|
if (password[0]=='%'&&password[1]=='%'){
|
|
|
|
|
|
|
|
char *temp = yon_char_replace(password,"%%","!!");
|
|
|
|
|
|
|
|
password = yon_char_replace(temp,"!!","%%!*");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
password = yon_char_append("!*",password);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
password="";
|
|
|
|
password="";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deactivate = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck));
|
|
|
|
|
|
|
|
if (deactivate){
|
|
|
|
|
|
|
|
if (strlen(password)>1&&password[0]=='%'&&password[1]=='%'){
|
|
|
|
|
|
|
|
char *temp = yon_char_replace(password,"%%","!!");
|
|
|
|
|
|
|
|
password = yon_char_replace(temp,"!!","%%!*");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
password = yon_char_append("!*",password);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
username = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUserNameEntry));
|
|
|
|
username = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUserNameEntry));
|
|
|
|
if (yon_char_is_empty(username)){
|
|
|
|
if (yon_char_is_empty(username)){
|
|
|
|
username="";
|
|
|
|
username="";
|
|
|
|
@ -1557,8 +1800,8 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
long password_interval_maximum = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin));
|
|
|
|
long password_interval_maximum = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin));
|
|
|
|
|
|
|
|
|
|
|
|
password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry));
|
|
|
|
password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry));
|
|
|
|
if (!yon_char_is_empty(password_expiration_date)){
|
|
|
|
if (yon_char_is_empty(password_expiration_date)){
|
|
|
|
password_expiration_date = window->expiration_unix;
|
|
|
|
password_expiration_date="";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long warning_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin));
|
|
|
|
long warning_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin));
|
|
|
|
@ -1572,9 +1815,9 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
|
|
|
|
int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo));
|
|
|
|
int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo));
|
|
|
|
if (user_shell_active>0){
|
|
|
|
if (user_shell_active>0){
|
|
|
|
user_shell = yon_char_unite(" --shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
user_shell = yon_char_unite("--shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
if (!strcmp(user_shell,SET_LABEL)){
|
|
|
|
if (!strcmp(user_shell,SET_LABEL)){
|
|
|
|
user_shell = yon_char_unite(" --shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
user_shell = yon_char_unite("--shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else user_shell="";
|
|
|
|
} else user_shell="";
|
|
|
|
|
|
|
|
|
|
|
|
@ -1587,11 +1830,11 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
|
|
|
|
int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck));
|
|
|
|
int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck));
|
|
|
|
if (system_user_active)
|
|
|
|
if (system_user_active)
|
|
|
|
create_system_user = " --system";
|
|
|
|
create_system_user = "--system";
|
|
|
|
|
|
|
|
|
|
|
|
int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck));
|
|
|
|
int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck));
|
|
|
|
if (create_ununique_active)
|
|
|
|
if (create_ununique_active)
|
|
|
|
create_ununique = " --non-unique";
|
|
|
|
create_ununique = "--non-unique";
|
|
|
|
|
|
|
|
|
|
|
|
samba_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck));
|
|
|
|
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));
|
|
|
|
samba_password_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck));
|
|
|
|
@ -1607,9 +1850,6 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
yon_samba_sync_remove(login);
|
|
|
|
yon_samba_sync_remove(login);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int deactivate_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck));
|
|
|
|
|
|
|
|
if (deactivate_active);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extra_options=(char*)gtk_entry_get_text(GTK_ENTRY(window->userExtraOptionsEntry));
|
|
|
|
extra_options=(char*)gtk_entry_get_text(GTK_ENTRY(window->userExtraOptionsEntry));
|
|
|
|
|
|
|
|
|
|
|
|
if (!window->old_password||window->old_password&&strcmp(window->old_password,password)){
|
|
|
|
if (!window->old_password||window->old_password&&strcmp(window->old_password,password)){
|
|
|
|
@ -1624,6 +1864,8 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
day=yon_char_append("0",day);
|
|
|
|
day=yon_char_append("0",day);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 {
|
|
|
|
|
|
|
|
password_changed_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordChangedEntry));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int force_at_next_login_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userForceChangeCheck));
|
|
|
|
int force_at_next_login_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userForceChangeCheck));
|
|
|
|
@ -1709,7 +1951,8 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter))
|
|
|
|
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter))
|
|
|
|
gtk_list_store_append(widgets->UsersList,&iter);
|
|
|
|
gtk_list_store_append(widgets->UsersList,&iter);
|
|
|
|
gtk_list_store_set(widgets->UsersList,&iter,
|
|
|
|
gtk_list_store_set(widgets->UsersList,&iter,
|
|
|
|
1,yon_char_return_if_exist(uid_string,AUTOMATICALLY_LABEL),
|
|
|
|
0,deactivate,
|
|
|
|
|
|
|
|
1,yon_char_return_if_exist(uid_string,""),
|
|
|
|
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),
|
|
|
|
@ -1773,10 +2016,23 @@ void on_toggle_button_set_active_from_toggle_button_inversed(GtkToggleButton *se
|
|
|
|
void on_date_selected(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
void on_date_selected(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
int year=0, month=0, day=0;
|
|
|
|
int year=0, month=0, day=0;
|
|
|
|
gtk_calendar_get_date(GTK_CALENDAR(window->ExpirationCalendar),&year,&month,&day);
|
|
|
|
gtk_calendar_get_date(GTK_CALENDAR(window->ExpirationCalendar),&year,&month,&day);
|
|
|
|
GDateTime *date = g_date_time_new_local(year,month,day,23,59,59);
|
|
|
|
time_t t = time(NULL);
|
|
|
|
char *date_string = g_date_time_format(date,"%Y-%m-%d");
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
|
|
|
|
if ((1900+tm.tm_year)>year||((1900+tm.tm_year)==year&&tm.tm_mon>month)||((1900+tm.tm_year)==year&&tm.tm_mon==month&&tm.tm_mday>day)) {
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry), "");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char *dy = yon_char_from_int(day);
|
|
|
|
|
|
|
|
char *mn = yon_char_from_int(month+1);
|
|
|
|
|
|
|
|
char *yr = yon_char_from_int(year);
|
|
|
|
|
|
|
|
if (tm.tm_mon+1<10) mn = yon_char_append("0",mn);
|
|
|
|
|
|
|
|
if (tm.tm_mday<10) dy = yon_char_append("0",dy);
|
|
|
|
|
|
|
|
char *date_string = yon_char_unite(yr,"-",mn,"-",dy);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry), date_string);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry), date_string);
|
|
|
|
window->expiration_unix=date_string;
|
|
|
|
window->expiration_unix=date_string;
|
|
|
|
|
|
|
|
free(dy);
|
|
|
|
|
|
|
|
free(mn);
|
|
|
|
|
|
|
|
free(yr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *window){
|
|
|
|
void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *window){
|
|
|
|
@ -1807,26 +2063,29 @@ void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *w
|
|
|
|
|
|
|
|
|
|
|
|
int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo));
|
|
|
|
int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo));
|
|
|
|
if (user_shell_active>0){
|
|
|
|
if (user_shell_active>0){
|
|
|
|
user_shell = yon_char_unite(" --shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
user_shell = yon_char_unite("--shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
if (!strcmp(user_shell,SET_LABEL)){
|
|
|
|
if (!strcmp(user_shell,SET_LABEL)){
|
|
|
|
user_shell = yon_char_unite(" --shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
user_shell = yon_char_unite("--shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else user_shell="";
|
|
|
|
} else user_shell="";
|
|
|
|
|
|
|
|
|
|
|
|
int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo));
|
|
|
|
int user_home_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userHomeCombo));
|
|
|
|
if (user_home_active==2){
|
|
|
|
if (user_home_active==2){
|
|
|
|
user_home=yon_char_unite("--home-dir ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry)),NULL);
|
|
|
|
char *path = (char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry));
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(path))
|
|
|
|
|
|
|
|
user_home=yon_char_unite("--home-dir ",path,NULL);
|
|
|
|
|
|
|
|
else user_home = "";
|
|
|
|
} else if (user_home_active==1){
|
|
|
|
} else if (user_home_active==1){
|
|
|
|
user_home="--no-create-home";
|
|
|
|
user_home="--no-create-home";
|
|
|
|
} else user_home = "";
|
|
|
|
} else user_home = "";
|
|
|
|
|
|
|
|
|
|
|
|
int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck));
|
|
|
|
int system_user_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck));
|
|
|
|
if (system_user_active)
|
|
|
|
if (system_user_active)
|
|
|
|
create_system_user = " --system";
|
|
|
|
create_system_user = "--system";
|
|
|
|
|
|
|
|
|
|
|
|
int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck));
|
|
|
|
int create_ununique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck));
|
|
|
|
if (create_ununique_active)
|
|
|
|
if (create_ununique_active)
|
|
|
|
create_ununique = " --non-unique";
|
|
|
|
create_ununique = "--non-unique";
|
|
|
|
int main_group_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck));
|
|
|
|
int main_group_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck));
|
|
|
|
if (!main_group_active){
|
|
|
|
if (!main_group_active){
|
|
|
|
main_group = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry));
|
|
|
|
main_group = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry));
|
|
|
|
@ -1837,7 +2096,7 @@ void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *w
|
|
|
|
main_group = "";
|
|
|
|
main_group = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *final_string = user_home;
|
|
|
|
char *final_string = user_home;
|
|
|
|
final_string = yon_char_unite(!yon_char_is_empty(final_string)?" ":"",
|
|
|
|
final_string = yon_char_unite(final_string,!yon_char_is_empty(final_string)?" ":"",
|
|
|
|
yon_char_return_if_exist(user_shell,""),
|
|
|
|
yon_char_return_if_exist(user_shell,""),
|
|
|
|
!yon_char_is_empty(user_shell)?" ":"",
|
|
|
|
!yon_char_is_empty(user_shell)?" ":"",
|
|
|
|
yon_char_return_if_exist(create_system_user,""),
|
|
|
|
yon_char_return_if_exist(create_system_user,""),
|
|
|
|
@ -1848,6 +2107,7 @@ void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *w
|
|
|
|
!yon_char_is_empty(do_not_check)?" ":"",
|
|
|
|
!yon_char_is_empty(do_not_check)?" ":"",
|
|
|
|
yon_char_return_if_exist(no_user_group,""),
|
|
|
|
yon_char_return_if_exist(no_user_group,""),
|
|
|
|
NULL);
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (final_string[strlen(final_string)-1]==' ') final_string[strlen(final_string)-1]='\0';
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userExtraOptionsEntry),final_string);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userExtraOptionsEntry),final_string);
|
|
|
|
free(final_string);
|
|
|
|
free(final_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1900,6 +2160,12 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
window->userTitleNameLabel=yon_gtk_builder_get_widget(builder,"userTitleNameLabel");
|
|
|
|
window->userTitleNameLabel=yon_gtk_builder_get_widget(builder,"userTitleNameLabel");
|
|
|
|
window->expiration_unix=NULL;
|
|
|
|
window->expiration_unix=NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
time_t t = time(NULL);
|
|
|
|
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
|
|
|
|
gtk_calendar_select_day(GTK_CALENDAR(window->ExpirationCalendar),tm.tm_mday);
|
|
|
|
|
|
|
|
gtk_calendar_select_month(GTK_CALENDAR(window->ExpirationCalendar),tm.tm_mon,1900+tm.tm_year);
|
|
|
|
|
|
|
|
|
|
|
|
on_UID_update(NULL,window);
|
|
|
|
on_UID_update(NULL,window);
|
|
|
|
int shell_size=0;
|
|
|
|
int shell_size=0;
|
|
|
|
config_str shells = yon_file_open(shell_list_path,&shell_size);
|
|
|
|
config_str shells = yon_file_open(shell_list_path,&shell_size);
|
|
|
|
@ -2029,7 +2295,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUserNameEntry), parsed_size>0?parameters[0]:"");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUserNameEntry), parsed_size>0?parameters[0]:"");
|
|
|
|
window->old_username=name;
|
|
|
|
window->old_username=name;
|
|
|
|
if (parsed_size>1){
|
|
|
|
if (parsed_size>1){
|
|
|
|
if (parsed_size>1&&!strcmp(parameters[1],"x")||parsed_size<=1||strcmp(parameters[1],"")){
|
|
|
|
if (parsed_size>1&&!strcmp(parameters[1],"x")&&!strcmp(parameters[1],"")||parsed_size<=1){
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck),0);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck),0);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry), parsed_size>1?parameters[1]:"");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry), parsed_size>1?parameters[1]:"");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -2049,7 +2315,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (parsed_size>4&&!yon_char_is_empty(parameters[4])){
|
|
|
|
if (parsed_size>4&&!yon_char_is_empty(parameters[4])&&strcmp(parameters[4],"")&&strcmp(parameters[4],"x")){
|
|
|
|
int params_size;
|
|
|
|
int params_size;
|
|
|
|
config_str parameters_substring = yon_char_parse(parameters[4],¶ms_size," ");
|
|
|
|
config_str parameters_substring = yon_char_parse(parameters[4],¶ms_size," ");
|
|
|
|
for (int i=0;i<params_size;i++){
|
|
|
|
for (int i=0;i<params_size;i++){
|
|
|
|
@ -2070,7 +2336,6 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--no-create-home")||!strcmp(parameters_substring[i],"-M")){
|
|
|
|
}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);
|
|
|
|
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")){
|
|
|
|
}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_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck),0);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),"");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),"");
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--non-unique")||!strcmp(parameters_substring[i],"-o")){
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--non-unique")||!strcmp(parameters_substring[i],"-o")){
|
|
|
|
@ -2079,7 +2344,6 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck),1);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck),1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(window->), parsed_size>4?parameters[4]:"");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (parsed_size>5){
|
|
|
|
if (parsed_size>5){
|
|
|
|
window->old_password=parameters[5];
|
|
|
|
window->old_password=parameters[5];
|
|
|
|
@ -2088,8 +2352,10 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
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);
|
|
|
|
yon_char_divide(strstr(parameters[5],"!*"),1);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),parameters[5]);
|
|
|
|
if (!yon_char_is_empty(parameters[5])){
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),parameters[5]);
|
|
|
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int samba_sync = yon_samba_sync_get(name);
|
|
|
|
int samba_sync = yon_samba_sync_get(name);
|
|
|
|
@ -2157,10 +2423,10 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
if (size>1&&strcmp(parsed[0],"x"))
|
|
|
|
if (size>1&&strcmp(parsed[0],"x"))
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),parsed[0]);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry),parsed[0]);
|
|
|
|
if (size>1){
|
|
|
|
if (size>1){
|
|
|
|
if (!strcmp(parsed[1],"")||!strcmp(parsed[1],"x"))
|
|
|
|
if (strcmp(parsed[1],"")&&strcmp(parsed[1],"x")){
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck),1);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),parsed[1]);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry),parsed[1]);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck),0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (size>2&&!yon_char_is_empty(parsed[2])){
|
|
|
|
if (size>2&&!yon_char_is_empty(parsed[2])){
|
|
|
|
int parsed_size=0;
|
|
|
|
int parsed_size=0;
|
|
|
|
@ -2218,18 +2484,7 @@ void on_main_delete(GtkWidget *self, main_window *widgets){
|
|
|
|
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){
|
|
|
|
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){
|
|
|
|
yon_delete_confirmation_open(widgets);
|
|
|
|
yon_delete_confirmation_open(widgets);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
model = GTK_TREE_MODEL(widgets->GroupsList);
|
|
|
|
yon_group_delete_confirmation_open(widgets);
|
|
|
|
cur_tree=widgets->GroupsTree;
|
|
|
|
|
|
|
|
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,1,&name,-1);
|
|
|
|
|
|
|
|
data->action_text=DELETE_CONFIRMATION_LABEL("group",name);
|
|
|
|
|
|
|
|
if (yon_confirmation_dialog_call(self,data)==GTK_RESPONSE_ACCEPT){
|
|
|
|
|
|
|
|
yon_config_remove_by_key(GROUPADD(name));
|
|
|
|
|
|
|
|
gtk_list_store_remove(GTK_LIST_STORE(model),&iter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -2302,9 +2557,6 @@ void config_init(){
|
|
|
|
if (!strcmp(divided,"minlen")){
|
|
|
|
if (!strcmp(divided,"minlen")){
|
|
|
|
main_config.password_min_length = atol(strstr(login_defs[i],"\t"));
|
|
|
|
main_config.password_min_length = atol(strstr(login_defs[i],"\t"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// else if (!strcmp(divided,"UID_MIN")){
|
|
|
|
|
|
|
|
// main_config.MINUID = atol(strstr(login_defs[i],"\t"));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -2320,7 +2572,6 @@ void config_init(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(parameter);
|
|
|
|
free(parameter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// yon_char_parsed_free(file_output,size);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_selection_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_selection_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|