|
|
|
@ -136,6 +136,19 @@ void on_parameter_changed(GtkWidget *,ubl_settings_usergroups_user_window *windo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_homedir_changed(GtkComboBox *self, GtkWidget *target){
|
|
|
|
|
|
|
|
int active = gtk_combo_box_get_active(self);
|
|
|
|
|
|
|
|
switch(active){
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(target,1);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(target,0);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
@ -185,7 +198,8 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
window->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook");
|
|
|
|
window->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook");
|
|
|
|
window->expiration_unix=NULL;
|
|
|
|
window->expiration_unix=NULL;
|
|
|
|
window->last_uid=NULL;
|
|
|
|
window->last_uid=NULL;
|
|
|
|
yon_gtk_entry_block_symbols(GTK_ENTRY(window->userUserNameEntry),":");
|
|
|
|
yon_gtk_entry_block_symbols(GTK_ENTRY(window->userUserNameEntry),"\"'[]");
|
|
|
|
|
|
|
|
yon_on_entry_set_allowed_symbols(GTK_ENTRY(window->userLoginEntry),"abcdefghijklmnopqrstuvwxyz1234567890");
|
|
|
|
|
|
|
|
|
|
|
|
time_t t = time(NULL);
|
|
|
|
time_t t = time(NULL);
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
@ -226,8 +240,8 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
g_signal_connect(G_OBJECT(window->userAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userAdditionalGroupsEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->userAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userAdditionalGroupsEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->userPasswordExpirationButton),"clicked",G_CALLBACK(on_expiration_clicked),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->userPasswordExpirationButton),"clicked",G_CALLBACK(on_expiration_clicked),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userHomeEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_homedir_changed),window->userHomeButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userHomeButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->userHomeCombo),"changed",G_CALLBACK(on_homedir_changed),window->userHomeEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userPasswordButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->userPasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->userPasswordButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userGroupsEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userGroupsEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UserGroupsButton);
|
|
|
|
g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UserGroupsButton);
|
|
|
|
@ -355,7 +369,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
config_str final = yon_char_parsed_merge(main_config.users,main_config.users_size,config_users,config_size,&final_size);
|
|
|
|
config_str final = yon_char_parsed_merge(main_config.users,main_config.users_size,config_users,config_size,&final_size);
|
|
|
|
|
|
|
|
|
|
|
|
uid_string = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry));
|
|
|
|
uid_string = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry));
|
|
|
|
if (window->last_uid&&strcmp(uid_string,window->last_uid)){
|
|
|
|
if (!window->last_uid||strcmp(uid_string,window->last_uid)){
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck))){
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck))){
|
|
|
|
int found=0;
|
|
|
|
int found=0;
|
|
|
|
for (int i=0;i<final_size;i++){
|
|
|
|
for (int i=0;i<final_size;i++){
|
|
|
|
@ -377,13 +391,13 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (yon_char_is_empty(uid_string)){
|
|
|
|
if (yon_char_is_empty(uid_string)){
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userUIDEntry);
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userUIDEntry);
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0);
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -514,17 +528,19 @@ void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
password_change_interval_maximum = yon_char_from_long(password_change_interval_maximum_active);
|
|
|
|
password_change_interval_maximum = yon_char_from_long(password_change_interval_maximum_active);
|
|
|
|
} else password_change_interval_maximum = 0;
|
|
|
|
} else password_change_interval_maximum = 0;
|
|
|
|
|
|
|
|
|
|
|
|
guint year, month, day;
|
|
|
|
if (!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry)))){
|
|
|
|
gtk_calendar_get_date(GTK_CALENDAR(window->ExpirationCalendar),&year,&month,&day);
|
|
|
|
guint year, month, day;
|
|
|
|
char *dy = yon_char_from_int(day);
|
|
|
|
gtk_calendar_get_date(GTK_CALENDAR(window->ExpirationCalendar),&year,&month,&day);
|
|
|
|
char *mn = yon_char_from_int(month+1);
|
|
|
|
char *dy = yon_char_from_int(day);
|
|
|
|
char *yr = yon_char_from_int(year);
|
|
|
|
char *mn = yon_char_from_int(month+1);
|
|
|
|
if (month+1<10) mn = yon_char_append("0",mn);
|
|
|
|
char *yr = yon_char_from_int(year);
|
|
|
|
if (day<10) dy = yon_char_append("0",dy);
|
|
|
|
if (month+1<10) mn = yon_char_append("0",mn);
|
|
|
|
password_expiration_date = yon_char_unite(yr,"-",mn,"-",dy,NULL);
|
|
|
|
if (day<10) dy = yon_char_append("0",dy);
|
|
|
|
// password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry));
|
|
|
|
password_expiration_date = yon_char_unite(yr,"-",mn,"-",dy,NULL);
|
|
|
|
if (yon_char_is_empty(password_expiration_date)){
|
|
|
|
// password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry));
|
|
|
|
password_expiration_date="-1";
|
|
|
|
if (yon_char_is_empty(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));
|
|
|
|
@ -674,11 +690,13 @@ int yon_system_user_sync(char *target_user){
|
|
|
|
free(optionals);
|
|
|
|
free(optionals);
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(config_user)){
|
|
|
|
if (!yon_char_is_empty(config_user)){
|
|
|
|
char *user_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",USERADD(target_user));
|
|
|
|
|
|
|
|
char *parameter_name = USERADD(target_user);
|
|
|
|
char *parameter_name = USERADD(target_user);
|
|
|
|
|
|
|
|
char *user_command = yon_config_parameter_prepare_command(dull_parameter_get_command,NULL,"users",parameter_name);
|
|
|
|
yon_config_register(parameter_name,user_command,config_user);
|
|
|
|
yon_config_register(parameter_name,user_command,config_user);
|
|
|
|
yon_config_remove_ignore(parameter_name);
|
|
|
|
yon_config_remove_ignore(parameter_name);
|
|
|
|
free(config_user);
|
|
|
|
free(config_user);
|
|
|
|
|
|
|
|
free(user_command);
|
|
|
|
|
|
|
|
free(parameter_name);
|
|
|
|
} else return 0;
|
|
|
|
} else return 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(config_shadow)){
|
|
|
|
if (!yon_char_is_empty(config_shadow)){
|
|
|
|
|