|
|
|
|
@ -6,10 +6,48 @@ config main_config;
|
|
|
|
|
|
|
|
|
|
int yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
|
|
yon_config_load_register(YON_CONFIG_DEFAULT,"users","DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM",NULL);
|
|
|
|
|
if (yon_config_load_register_no_cleaning(type,"users","DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]","[system]","SYSTEMBOOT_STATEMODE","[save]","SAVE_ROOTCOPY_CHANGES",NULL)){
|
|
|
|
|
yon_config_load_register_no_cleaning(type,"users","DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]","[system]","SYSTEMBOOT_STATEMODE","[save]","SAVE_ROOTCOPY_CHANGES",NULL);
|
|
|
|
|
if (type!=YON_CONFIG_GLOBAL){
|
|
|
|
|
yon_config_load_register_no_cleaning(YON_CONFIG_GLOBAL,"users","DEFAULTPASSWD DEFAULTROOTPASSWD",NULL);
|
|
|
|
|
}
|
|
|
|
|
if (type==YON_CONFIG_LOCAL){
|
|
|
|
|
int size;
|
|
|
|
|
config_str passwords = yon_config_load(get_passwords_command,&size);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
char *key, *value;
|
|
|
|
|
if (yon_config_parse_parameter(passwords[i],&key, &value)){
|
|
|
|
|
int parsed_size;
|
|
|
|
|
char *local_value = yon_config_get_by_key(key);
|
|
|
|
|
config_str parsed = yon_char_parse(value,&parsed_size,":");
|
|
|
|
|
if (strstr(key,"USERADD[")&&local_value){
|
|
|
|
|
if (parsed_size>5){
|
|
|
|
|
char *temp = yon_char_append(local_value,parsed[5]);
|
|
|
|
|
free(local_value);
|
|
|
|
|
local_value=temp;
|
|
|
|
|
yon_config_set(key,yon_char_new(local_value));
|
|
|
|
|
yon_config_set_status(key,0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (strstr(key,"GROUPADD[")&&local_value){
|
|
|
|
|
if (parsed_size>4){
|
|
|
|
|
char *temp = yon_char_append(local_value,parsed[4]);
|
|
|
|
|
free(local_value);
|
|
|
|
|
local_value=temp;
|
|
|
|
|
yon_config_set(key,yon_char_new(local_value));
|
|
|
|
|
yon_config_set_status(key,0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
|
free(key);
|
|
|
|
|
free(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -34,16 +72,28 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
login = yon_char_divide_search(parameters[0],"=",-1);
|
|
|
|
|
login[strlen(login)-1]='\0';
|
|
|
|
|
}
|
|
|
|
|
if (!strcmp(parameters[1],"x")) parameters[1]=AUTOMATICALLY_LABEL;
|
|
|
|
|
if (!strcmp(parameters[2],"x")) parameters[2]=login;
|
|
|
|
|
if (parameters_size>1&&!strcmp(parameters[1],"x")) parameters[1]=AUTOMATICALLY_LABEL;
|
|
|
|
|
if (parameters_size>2&&!strcmp(parameters[2],"x")) parameters[2]=login;
|
|
|
|
|
char *pars = "";
|
|
|
|
|
if (parameters_size>5&&strcmp(parameters[5],"x")&&strcmp(parameters[5],"")){
|
|
|
|
|
if (!check_is_password_hash(parameters[5])){
|
|
|
|
|
pars = ENCRYPTED_LABEL;
|
|
|
|
|
} else {
|
|
|
|
|
pars = UNENCRYPTED_LABEL;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
pars = DEFAULT_USER_LABEL;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
gtk_list_store_set(widgets->UsersList,&iter,
|
|
|
|
|
2,login,
|
|
|
|
|
3,parameters_size>0?parameters[0]:"",
|
|
|
|
|
1,parameters_size>1?parameters[1]:"",
|
|
|
|
|
4,parameters_size>2?parameters[2]:"",
|
|
|
|
|
1,parameters_size>1&&!yon_char_is_empty(parameters[1])?parameters[1]:AUTOMATICALLY_LABEL,
|
|
|
|
|
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,
|
|
|
|
|
6,parameters_size>4?parameters[4]:"",
|
|
|
|
|
7,parameters_size>5?strcmp(parameters[5],"x")&&strcmp(parameters[5],"")? parameters[5][0]=='%'&¶meters[5][1]=='%'? UNENCRYPTED_LABEL: ENCRYPTED_LABEL : DEFAULT_USER_LABEL : DEFAULT_USER_LABEL,
|
|
|
|
|
7,pars,
|
|
|
|
|
-1);
|
|
|
|
|
if(parameters)
|
|
|
|
|
free(parameters);
|
|
|
|
|
@ -136,57 +186,91 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
|
char *new_value;
|
|
|
|
|
gtk_tree_model_get(model,&iter,1,&name,2,&old_value,3,&new_value,-1);
|
|
|
|
|
if (strstr(name,"USERADD[")){
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_char_parse(new_value,&size,":");
|
|
|
|
|
if (size>5 &&parsed[5][0] !='$'&&parsed[5][0]!='%'){
|
|
|
|
|
parsed[5]="******";
|
|
|
|
|
char *new_compare = yon_char_unite(!yon_char_is_empty(old_value)?"<s>":"",!yon_char_is_empty(old_value)?old_value:"",!yon_char_is_empty(old_value)?"</s>":"","\n",yon_char_parsed_to_string(parsed,size,":"),NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_compare,-1);
|
|
|
|
|
free(new_compare);
|
|
|
|
|
} else {
|
|
|
|
|
char *new_compare = yon_char_unite(!yon_char_is_empty(old_value)?"<s>":"",!yon_char_is_empty(old_value)?old_value:"",!yon_char_is_empty(old_value)?"</s>":"","\n",NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_compare,-1);
|
|
|
|
|
free(new_compare);
|
|
|
|
|
|
|
|
|
|
char *old=NULL;
|
|
|
|
|
char *newv=NULL;
|
|
|
|
|
int size = 0;
|
|
|
|
|
if (!yon_char_is_empty(new_value)){
|
|
|
|
|
config_str parsed = NULL;
|
|
|
|
|
parsed = yon_char_parse(new_value,&size,":");
|
|
|
|
|
if (size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")&&parsed[5][0]!='%'&&parsed[5][1]!='%'){
|
|
|
|
|
free(new_value);
|
|
|
|
|
free(parsed[5]);
|
|
|
|
|
parsed[5]=yon_char_new("*******");
|
|
|
|
|
new_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
|
} else if (size>5&&!yon_char_is_empty(parsed[5])&&strcmp(parsed[5],"x")) {
|
|
|
|
|
free(new_value);
|
|
|
|
|
free(yon_char_divide(parsed[5],1));
|
|
|
|
|
new_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
|
}
|
|
|
|
|
if (parsed){
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!yon_char_is_empty(old_value)){
|
|
|
|
|
old=yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
|
}
|
|
|
|
|
if(!yon_char_is_empty(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);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_string,-1);
|
|
|
|
|
|
|
|
|
|
} else if (strstr(name,"GROUPADD[")){
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_char_parse(new_value,&size,":");
|
|
|
|
|
if (size>4&&parsed[4][0] !='$'&&parsed[4][0]!='%'){
|
|
|
|
|
parsed[4]="******";
|
|
|
|
|
char *new_compare = yon_char_unite(!yon_char_is_empty(old_value)?"<s>":"",!yon_char_is_empty(old_value)?old_value:"",!yon_char_is_empty(old_value)?"</s>":"","\n",yon_char_parsed_to_string(parsed,size,":"),NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_compare,-1);
|
|
|
|
|
} else {
|
|
|
|
|
char *new_compare = yon_char_unite(!yon_char_is_empty(old_value)?"<s>":"",!yon_char_is_empty(old_value)?old_value:"",!yon_char_is_empty(old_value)?"</s>":"","\n",NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_compare,-1);
|
|
|
|
|
free(new_compare);
|
|
|
|
|
|
|
|
|
|
char *old=NULL;
|
|
|
|
|
char *newv=NULL;
|
|
|
|
|
int size = 0;
|
|
|
|
|
if (new_value){
|
|
|
|
|
config_str parsed = yon_char_parse(new_value,&size,":");
|
|
|
|
|
free(new_value);
|
|
|
|
|
if (size>4&&!yon_char_is_empty(parsed[4])&&strcmp(parsed[4],"x")&&parsed[4][0]!='%'&&parsed[4][1]!='%'){
|
|
|
|
|
free(parsed[4]);
|
|
|
|
|
parsed[4]=yon_char_new("*******");
|
|
|
|
|
}
|
|
|
|
|
new_value = yon_char_parsed_to_string(parsed,size,":");
|
|
|
|
|
}
|
|
|
|
|
if(!yon_char_is_empty(old_value)){
|
|
|
|
|
old=yon_char_unite("<s>",old_value,"</s>",NULL);
|
|
|
|
|
}
|
|
|
|
|
if(!yon_char_is_empty(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);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_string,-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (strstr(name,"DEFAULTPASSWD")){
|
|
|
|
|
if (!yon_char_is_empty(new_value) && new_value[0] !='$'&&new_value[0]!='%'){
|
|
|
|
|
char *new_compare = yon_char_unite("<s>",old_value,"</s>\n",NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_compare,-1);
|
|
|
|
|
free(new_compare);
|
|
|
|
|
} else {
|
|
|
|
|
char *new_compare = yon_char_unite("<s>",old_value,"</s>\n",NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_compare,-1);
|
|
|
|
|
free(new_compare);
|
|
|
|
|
|
|
|
|
|
char *old=NULL;
|
|
|
|
|
char *newv=NULL;
|
|
|
|
|
if (!yon_char_is_empty(new_value)&&strlen(new_value)>2&&new_value[0]=='%'&&new_value[1]=='%'){
|
|
|
|
|
free(yon_char_divide(new_value,1));
|
|
|
|
|
newv=new_value;
|
|
|
|
|
} else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') {
|
|
|
|
|
newv=new_value;
|
|
|
|
|
}else if (!yon_char_is_empty(new_value)){
|
|
|
|
|
newv="*******";
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
|
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);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_string,-1);
|
|
|
|
|
|
|
|
|
|
} else if (strstr(name,"DEFAULTROOTPASSWD")){
|
|
|
|
|
if (!yon_char_is_empty(new_value) &&new_value[0] !='$'&&new_value[0]!='%'){
|
|
|
|
|
char *new_compare = yon_char_unite("<s>",old_value,"</s>\n******",NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_compare,-1);
|
|
|
|
|
free(new_compare);
|
|
|
|
|
} else {
|
|
|
|
|
char *new_compare = yon_char_unite("<s>",old_value,"</s>\n******",NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_compare,-1);
|
|
|
|
|
free(new_compare);
|
|
|
|
|
|
|
|
|
|
char *old=NULL;
|
|
|
|
|
char *newv=NULL;
|
|
|
|
|
if (!yon_char_is_empty(new_value)&&strlen(new_value)>2&&new_value[0]=='%'&&new_value[1]=='%'){
|
|
|
|
|
free(yon_char_divide(new_value,1));
|
|
|
|
|
newv=new_value;
|
|
|
|
|
} else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') {
|
|
|
|
|
newv=new_value;
|
|
|
|
|
}else if (!yon_char_is_empty(new_value)){
|
|
|
|
|
newv="*******";
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(old_value)){
|
|
|
|
|
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);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,7,new_string,-1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -208,10 +292,32 @@ void on_config_global_save(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_local_save(){
|
|
|
|
|
int size;
|
|
|
|
|
config_str keys = yon_config_get_all_by_key("USERADD[",&size);
|
|
|
|
|
int passw_size;
|
|
|
|
|
config_str passwords = NULL;
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
int parsed_size;
|
|
|
|
|
char *key,*value;
|
|
|
|
|
yon_config_parse_parameter(keys[i],&key,&value);
|
|
|
|
|
config_str parsed = yon_char_parse(value,&parsed_size,":");
|
|
|
|
|
if (parsed_size>5&&!yon_char_is_empty(parsed[5])){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(passwords,&passw_size,yon_char_new(parsed[5]));
|
|
|
|
|
parsed = yon_char_parsed_rip(parsed,&parsed_size,5);
|
|
|
|
|
yon_config_set(key,yon_char_parsed_to_string(parsed,parsed_size,":"));
|
|
|
|
|
}
|
|
|
|
|
free(key);
|
|
|
|
|
free(value);
|
|
|
|
|
}
|
|
|
|
|
yon_accept_changes();
|
|
|
|
|
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);
|
|
|
|
|
if (window) yon_hide_passwords(window);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
char *key,*value;
|
|
|
|
|
yon_config_parse_parameter(keys[i],&key,&value);
|
|
|
|
|
yon_config_set(key,value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_saving_settings_save(GtkWidget *self, yon_savasettings_window *window){
|
|
|
|
|
@ -396,6 +502,7 @@ yon_savasettings_window *yon_saving_settings_new(){
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"savingSettingsWindow");
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),SAVESETTINGS_TITLE_LABEL);
|
|
|
|
|
char *string = yon_config_get_by_key("SAVE_ROOTCOPY_CHANGES");
|
|
|
|
|
if (!yon_char_is_empty(string)&&strstr(string,"/var/lib/samba")){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->SambaCheck),1);
|
|
|
|
|
@ -538,13 +645,10 @@ void on_password_change(GtkWidget *self, dictionary *entry_dict){//
|
|
|
|
|
if (!yon_char_is_empty(password)){
|
|
|
|
|
password = yon_char_new(password);
|
|
|
|
|
if (main_config.load_mode==0){
|
|
|
|
|
if (password[0]=='$'){
|
|
|
|
|
if (!check_is_password_hash(password)){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordHashEntry),password);
|
|
|
|
|
} else {
|
|
|
|
|
if (password[0]=='%'&&password[1]=='%'){
|
|
|
|
|
free(yon_char_divide(password,1));
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck),1);
|
|
|
|
|
}
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -679,6 +783,10 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
char *default_user = yon_config_get_by_key("DEFAULTUSER");
|
|
|
|
|
if (!yon_char_is_empty(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->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton);
|
|
|
|
|
char *default_password = yon_config_get_by_key("DEFAULTPASSWD");
|
|
|
|
|
if (!yon_char_is_empty(default_password)){
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),default_password);
|
|
|
|
|
@ -714,9 +822,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->EncryptAllPasswordsButton),"clicked",G_CALLBACK(on_passwords_encrypt),NULL);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RootPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->RootPasswordButton);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->DefaultPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->DefaultPasswordButton);
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
@ -1037,11 +1143,14 @@ void on_password_changed(GtkEntry *self, ubl_settings_usergroups_password_window
|
|
|
|
|
void on_password_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
|
ubl_settings_usergroups_password_window *window = yon_dictionary_get_data(dict->first,ubl_settings_usergroups_password_window*);
|
|
|
|
|
GtkEntry *entry = yon_dictionary_get_data(dict->first->next,GtkEntry*);
|
|
|
|
|
char *pasted_hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
|
if (!yon_char_is_empty(pasted_hash)){
|
|
|
|
|
char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
if (yon_char_is_empty(password)){
|
|
|
|
|
char *pasted_hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
|
if (!yon_char_is_empty(pasted_hash)){
|
|
|
|
|
gtk_entry_set_text(entry,pasted_hash);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
char *password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
|
|
|
|
|
if (yon_char_is_empty(password)){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_empty",EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
return;
|
|
|
|
|
@ -1090,7 +1199,7 @@ ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_ne
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashEntry),"icon-press",G_CALLBACK(on_password_show_hide),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"changed",G_CALLBACK(on_password_changed),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"changed",G_CALLBACK(on_password_changed),window);
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),GROUPS_TITLE_LABEL);
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->CreateGroupWindow),PASSWORD_TITLE_LABEL);
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
@ -1320,8 +1429,12 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck));
|
|
|
|
|
if (do_not_check_actve)
|
|
|
|
|
do_not_check = " --badnames";
|
|
|
|
|
|
|
|
|
|
login = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry));
|
|
|
|
|
if (login[0]>'0'&&login[0]<'9'){
|
|
|
|
|
if (login[0]>'0'&&login[0]<'9'&&!do_not_check_actve){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),USER_BEGINS_WITH_DIGIT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userLoginEntry);
|
|
|
|
|
return;
|
|
|
|
|
@ -1341,7 +1454,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
password="x";
|
|
|
|
|
password="";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
username = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUserNameEntry));
|
|
|
|
|
@ -1419,10 +1532,6 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
if (create_ununique_active)
|
|
|
|
|
create_ununique = " --non-unique";
|
|
|
|
|
|
|
|
|
|
int do_not_check_actve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck));
|
|
|
|
|
if (do_not_check_actve)
|
|
|
|
|
do_not_check = " --badnames";
|
|
|
|
|
|
|
|
|
|
samba_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck));
|
|
|
|
|
samba_password_sync = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck));
|
|
|
|
|
if (samba_sync){
|
|
|
|
|
@ -1491,8 +1600,9 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
yon_char_return_if_exist(create_system_user,""),
|
|
|
|
|
yon_char_return_if_exist(create_ununique,""),
|
|
|
|
|
yon_char_return_if_exist(do_not_check,""),
|
|
|
|
|
":",yon_char_return_if_exist(password,"x"),
|
|
|
|
|
":",yon_char_return_if_exist(extra_options,""),
|
|
|
|
|
!yon_char_is_empty(extra_options)?extra_options:"",
|
|
|
|
|
yon_char_return_if_exist(extra_options,""),
|
|
|
|
|
":",yon_char_return_if_exist(password,""),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
yon_config_register(USERADD(login),"users",final_user);
|
|
|
|
|
@ -1965,8 +2075,12 @@ void on_main_delete(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_update(GtkWidget *self, main_window *widgets){
|
|
|
|
|
yon_config_load_register(main_config.load_mode==1?YON_CONFIG_LOCAL:YON_CONFIG_GLOBAL,"users","DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
|
if (main_config.load_mode==0){
|
|
|
|
|
on_config_global_load(NULL,widgets);
|
|
|
|
|
} else {
|
|
|
|
|
on_config_local_load(NULL,widgets);
|
|
|
|
|
}
|
|
|
|
|
// yon_interface_update(widgets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1986,7 +2100,7 @@ void config_init(){
|
|
|
|
|
main_config.lock_save_global=0;
|
|
|
|
|
main_config.lock_save_local=0;
|
|
|
|
|
main_config.groups_size=0;
|
|
|
|
|
main_config.load_mode=0;
|
|
|
|
|
main_config.load_mode=1;
|
|
|
|
|
main_config.hash_default_id=-1;
|
|
|
|
|
main_config.groups = yon_file_open(groups_path,&main_config.groups_size);
|
|
|
|
|
main_config.users = yon_file_open(users_path,&main_config.users_size);
|
|
|
|
|
@ -2126,8 +2240,7 @@ main_window *yon_main_window_complete(main_window *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);
|
|
|
|
|
main_config.load_mode=0;
|
|
|
|
|
yon_load_proceed(YON_CONFIG_GLOBAL);
|
|
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
|
|
yon_interface_update((main_window*)widgets);
|
|
|
|
|
gtk_widget_realize(GTK_WIDGET(widgets->UsersTree));
|
|
|
|
|
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(widgets->UsersTree));
|
|
|
|
|
@ -2157,9 +2270,6 @@ int main(int argc, char *argv[]){
|
|
|
|
|
yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL);
|
|
|
|
|
gtk_init(&argc,&argv);
|
|
|
|
|
template_main_window *widgets = yon_ubl_window_setup();
|
|
|
|
|
textdomain (template_ui_LocaleName);
|
|
|
|
|
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
textdomain (LocaleName);
|
|
|
|
|
yon_main_window_complete((main_window*)widgets);
|
|
|
|
|
yon_window_config_load(config_path);
|
|
|
|
|
gtk_main();
|
|
|
|
|
|