|
|
|
@ -6,7 +6,7 @@ config main_config;
|
|
|
|
|
|
|
|
|
|
|
|
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_load_register(YON_CONFIG_DEFAULT,"users","DEFAULTPASSWD DEFAULTROOTPASSWD USERGROUPS DEFAULTUSER HASHPASSWD ADDADM",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);
|
|
|
|
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);
|
|
|
|
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_register_no_cleaning(YON_CONFIG_GLOBAL,"users","DEFAULTPASSWD DEFAULTROOTPASSWD",NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -79,7 +79,7 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
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],"")){
|
|
|
|
|
|
|
|
|
|
|
|
if (!check_is_password_hash(parameters[5])){
|
|
|
|
if (!check_is_password_hash(parameters[5])&¶meters[5][0]!='%'&¶meters[5][1]!='%'){
|
|
|
|
pars = ENCRYPTED_LABEL;
|
|
|
|
pars = ENCRYPTED_LABEL;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
pars = UNENCRYPTED_LABEL;
|
|
|
|
pars = UNENCRYPTED_LABEL;
|
|
|
|
@ -125,7 +125,7 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
char *pars="";
|
|
|
|
char *pars="";
|
|
|
|
if (parameters_size>3&&strcmp(parameters[3],"x")&&strcmp(parameters[3],"")){
|
|
|
|
if (parameters_size>3&&strcmp(parameters[3],"x")&&strcmp(parameters[3],"")){
|
|
|
|
|
|
|
|
|
|
|
|
if (!check_is_password_hash(parameters[3])){
|
|
|
|
if (!check_is_password_hash(parameters[3])&¶meters[5][0]!='%'&¶meters[5][1]!='%'){
|
|
|
|
pars = ENCRYPTED_LABEL;
|
|
|
|
pars = ENCRYPTED_LABEL;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
pars = UNENCRYPTED_LABEL;
|
|
|
|
pars = UNENCRYPTED_LABEL;
|
|
|
|
@ -355,6 +355,11 @@ void yon_hide_passwords(template_saving_window *window){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_save_done(main_window *widgets){
|
|
|
|
|
|
|
|
on_config_update(NULL,widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
@ -417,12 +422,13 @@ void on_config_save(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_global_save(){
|
|
|
|
void on_config_global_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("global",YON_CONFIG_GLOBAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,"users", "DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*]",NULL);
|
|
|
|
if (window) yon_hide_passwords(window);
|
|
|
|
if (window){
|
|
|
|
|
|
|
|
yon_hide_passwords(window);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_config_local_save(GtkWidget *self, main_window *widgets){
|
|
|
|
void on_config_local_save(GtkWidget *self, main_window *widgets){
|
|
|
|
@ -620,8 +626,11 @@ yon_confirmation_window *yon_delete_confirmation_new(){
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
window->DeletionTree = yon_gtk_builder_get_widget(builder,"DeletionTree");
|
|
|
|
window->DeletionTree = yon_gtk_builder_get_widget(builder,"DeletionTree");
|
|
|
|
|
|
|
|
window->HatLabel = yon_gtk_builder_get_widget(builder,"userTitleNameLabel");
|
|
|
|
window->DeleteCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"DeleteCell"));
|
|
|
|
window->DeleteCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"DeleteCell"));
|
|
|
|
window->DeleteHomeCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"DeleteHomeCell"));
|
|
|
|
window->DeleteHomeCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"DeleteHomeCell"));
|
|
|
|
|
|
|
|
window->UserCell = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"UserCell"));
|
|
|
|
|
|
|
|
window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel");
|
|
|
|
window->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
|
|
|
|
window->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),DELETE_CONFIRMATION_TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),DELETE_CONFIRMATION_TITLE_LABEL);
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
@ -679,6 +688,9 @@ void yon_group_delete_confirmation_open(main_window *widgets){
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window));
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
GtkTreeIter iter,itar;
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->TitleLabel),DELETE_GROUP_CONFIRMATION_CONFIRM_LABEL);
|
|
|
|
|
|
|
|
gtk_tree_view_column_set_title(window->UserCell,GROUP_LABEL);
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HatLabel),DELETE_GROUP_CONFIRMATION_TITLE_LABEL);
|
|
|
|
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),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),3),0);
|
|
|
|
gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),4),0);
|
|
|
|
gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->DeletionTree),4),0);
|
|
|
|
@ -883,6 +895,7 @@ void on_password_change(GtkWidget *self, dictionary *entry_dict){
|
|
|
|
if (!check_is_password_hash(password)){
|
|
|
|
if (!check_is_password_hash(password)){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordHashEntry),password);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordHashEntry),password);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (password[0]=='%'&&password[1]=='%')
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck),1);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck),1);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),password);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),password);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -959,6 +972,32 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window
|
|
|
|
yon_char_parsed_free(hash_algos,hash_size);
|
|
|
|
yon_char_parsed_free(hash_algos,hash_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_users_boot_toggled(GtkToggleButton *self){
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active(self)){
|
|
|
|
|
|
|
|
char *parameter = yon_config_get_by_key("USERADD_SYNC");
|
|
|
|
|
|
|
|
if (!parameter){
|
|
|
|
|
|
|
|
yon_config_register("USERADD_SYNC","users","boot");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_config_append("USERADD_SYNC","boot",",");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_config_remove_element("USERADD_SYNC","boot",",");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_users_shutdown_toggled(GtkToggleButton *self){
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active(self)){
|
|
|
|
|
|
|
|
char *parameter = yon_config_get_by_key("USERADD_SYNC");
|
|
|
|
|
|
|
|
if (!parameter){
|
|
|
|
|
|
|
|
yon_config_register("USERADD_SYNC","users","shutdown");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_config_append("USERADD_SYNC","shutdown",",");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_config_remove_element("USERADD_SYNC","shutdown",",");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){
|
|
|
|
ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){
|
|
|
|
ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window));
|
|
|
|
ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings);
|
|
|
|
@ -976,9 +1015,20 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
window->EncryptAllPasswordsButton=yon_gtk_builder_get_widget(builder,"EncryptAllPasswordsButton");
|
|
|
|
window->EncryptAllPasswordsButton=yon_gtk_builder_get_widget(builder,"EncryptAllPasswordsButton");
|
|
|
|
window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
|
|
|
|
window->UsersBootCheck=yon_gtk_builder_get_widget(builder,"UsersBootCheck");
|
|
|
|
|
|
|
|
window->UsersShutdownCheck=yon_gtk_builder_get_widget(builder,"UsersShutdownCheck");
|
|
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
if (sync_parameters){
|
|
|
|
|
|
|
|
if (strstr(sync_parameters,"boot")){
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strstr(sync_parameters,"shutdown")){
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck),1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int hash_size=0;
|
|
|
|
int hash_size=0;
|
|
|
|
config_str hash_algos = yon_file_open(hash_list_path,&hash_size);
|
|
|
|
config_str hash_algos = yon_file_open(hash_list_path,&hash_size);
|
|
|
|
@ -1062,6 +1112,9 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_hash_changed),window);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_users_boot_toggled),NULL);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_users_shutdown_toggled),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1226,7 +1279,7 @@ void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
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)?UNENCRYPTED_LABEL:ENCRYPTED_LABEL,-1);
|
|
|
|
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);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1321,6 +1374,7 @@ ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(int
|
|
|
|
window->StatusCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"StatusCell"));
|
|
|
|
window->StatusCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"StatusCell"));
|
|
|
|
window->GroupColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"GroupColumn"));
|
|
|
|
window->GroupColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"GroupColumn"));
|
|
|
|
window->list = gtk_list_store_new(2,G_TYPE_BOOLEAN,G_TYPE_STRING);
|
|
|
|
window->list = gtk_list_store_new(2,G_TYPE_BOOLEAN,G_TYPE_STRING);
|
|
|
|
|
|
|
|
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(window->list),1,GTK_SORT_ASCENDING);
|
|
|
|
|
|
|
|
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->GroupsWindow),"GroupWindow");
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->GroupsWindow),"GroupWindow");
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),GROUPS_TITLE_LABEL);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->GroupsWindow),GROUPS_TITLE_LABEL);
|
|
|
|
@ -1756,6 +1810,22 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
password="";
|
|
|
|
password="";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!window->old_password||window->old_password&&strcmp(window->old_password,password)){
|
|
|
|
|
|
|
|
time_t t = time(NULL);
|
|
|
|
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
|
|
|
|
char *month = yon_char_from_int(tm.tm_mon+1);
|
|
|
|
|
|
|
|
if (strlen(month)==1){
|
|
|
|
|
|
|
|
month=yon_char_append("0",month);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char *day = yon_char_from_int(tm.tm_mday);
|
|
|
|
|
|
|
|
if (strlen(day)<2){
|
|
|
|
|
|
|
|
day=yon_char_append("0",day);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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]=='%'){
|
|
|
|
@ -1801,7 +1871,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
|
|
|
|
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="";
|
|
|
|
password_expiration_date="-1";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
@ -1852,22 +1922,6 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
|
|
|
|
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)){
|
|
|
|
|
|
|
|
time_t t = time(NULL);
|
|
|
|
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
|
|
|
|
char *month = yon_char_from_int(tm.tm_mon+1);
|
|
|
|
|
|
|
|
if (strlen(month)==1){
|
|
|
|
|
|
|
|
month=yon_char_append("0",month);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char *day = yon_char_from_int(tm.tm_mday);
|
|
|
|
|
|
|
|
if (strlen(day)==1){
|
|
|
|
|
|
|
|
day=yon_char_append("0",day);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
|
|
|
if (force_at_next_login_active){
|
|
|
|
if (force_at_next_login_active){
|
|
|
|
password_changed_date = "0";
|
|
|
|
password_changed_date = "0";
|
|
|
|
@ -2025,9 +2079,9 @@ void on_date_selected(GtkWidget *self, ubl_settings_usergroups_user_window *wind
|
|
|
|
char *dy = yon_char_from_int(day);
|
|
|
|
char *dy = yon_char_from_int(day);
|
|
|
|
char *mn = yon_char_from_int(month+1);
|
|
|
|
char *mn = yon_char_from_int(month+1);
|
|
|
|
char *yr = yon_char_from_int(year);
|
|
|
|
char *yr = yon_char_from_int(year);
|
|
|
|
if (tm.tm_mon+1<10) mn = yon_char_append("0",mn);
|
|
|
|
if (month+1<10) mn = yon_char_append("0",mn);
|
|
|
|
if (tm.tm_mday<10) dy = yon_char_append("0",dy);
|
|
|
|
if (day<10) dy = yon_char_append("0",dy);
|
|
|
|
char *date_string = yon_char_unite(yr,"-",mn,"-",dy);
|
|
|
|
char *date_string = yon_char_unite(yr,"-",mn,"-",dy,NULL);
|
|
|
|
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(dy);
|
|
|
|
@ -2112,6 +2166,12 @@ void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *w
|
|
|
|
free(final_string);
|
|
|
|
free(final_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_remove_expired(GtkWidget *self, GtkEntryIconPosition icon_pos, GdkEvent *event, GtkEntry *target){
|
|
|
|
|
|
|
|
if (icon_pos == GTK_ENTRY_ICON_SECONDARY){
|
|
|
|
|
|
|
|
gtk_entry_set_text(target,"");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
ubl_settings_usergroups_user_window *window = malloc(sizeof(ubl_settings_usergroups_user_window));
|
|
|
|
ubl_settings_usergroups_user_window *window = malloc(sizeof(ubl_settings_usergroups_user_window));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_user);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_user);
|
|
|
|
@ -2227,6 +2287,7 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
g_signal_connect(G_OBJECT(window->userDontCheckCheck),"toggled",G_CALLBACK(on_parameter_changed),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->userDontCheckCheck),"toggled",G_CALLBACK(on_parameter_changed),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(on_parameter_changed),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(on_parameter_changed),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->userGroupsEntry),"changed",G_CALLBACK(on_parameter_changed),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->userGroupsEntry),"changed",G_CALLBACK(on_parameter_changed),window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->userPasswordExpirationEntry),"icon-press",G_CALLBACK(on_remove_expired),window->userPasswordExpirationEntry);
|
|
|
|
return window;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -2346,7 +2407,10 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (parsed_size>5){
|
|
|
|
if (parsed_size>5){
|
|
|
|
window->old_password=parameters[5];
|
|
|
|
window->old_password=yon_char_new(parameters[5]);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(window->old_password)&&strlen(window->old_password)&&window->old_password[0]=='!'&&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 (strstr(parameters[5],"!*")){
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck),1);
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDeactivatedCheck),1);
|
|
|
|
@ -2366,12 +2430,16 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(parameters);
|
|
|
|
free(parameters);
|
|
|
|
parameters=yon_char_parse(yon_config_get_by_key(USERSHADOW(name)),&parsed_size,":");
|
|
|
|
parameters=yon_char_parse(yon_config_get_by_key(USERSHADOW(name)),&parsed_size,":");
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordChangedEntry),parsed_size>0?parameters[0]:"");
|
|
|
|
if (parameters&&!strcmp(parameters[0],"0"))
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userForceChangeCheck),1);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordChangedEntry),parsed_size>0?parameters[0]:"");
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMinimumSpin),atol(parsed_size>1?parameters[1]:"0"));
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMinimumSpin),atol(parsed_size>1?parameters[1]:"0"));
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin),atol(parsed_size>2?parameters[2]:"0"));
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin),atol(parsed_size>2?parameters[2]:"0"));
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userWarningSpin),atol(parsed_size>3?parameters[3]:"0"));
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userWarningSpin),atol(parsed_size>3?parameters[3]:"0"));
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userActivitySpin),atol(parsed_size>4?parameters[4]:"0"));
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userActivitySpin),atol(parsed_size>4?parameters[4]:"0"));
|
|
|
|
if (parsed_size>5&&!yon_char_is_empty(parameters[5])){
|
|
|
|
|
|
|
|
|
|
|
|
if (parsed_size>5&&!yon_char_is_empty(parameters[5])&&strcmp(parameters[5],"-1")){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry),parameters[5]);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry),parameters[5]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateUserWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateUserWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
@ -2685,6 +2753,7 @@ main_window *yon_main_window_complete(main_window *widgets){
|
|
|
|
yon_window_config_add_listener((GtkWidget*)g_list_nth_data(list,i),yon_char_append("GroupColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
|
yon_window_config_add_listener((GtkWidget*)g_list_nth_data(list,i),yon_char_append("GroupColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_list_free(list);
|
|
|
|
g_list_free(list);
|
|
|
|
|
|
|
|
yon_save_window_set_postsave_function(on_save_done,widgets);
|
|
|
|
return widgets;
|
|
|
|
return widgets;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|