|
|
|
@ -215,17 +215,87 @@ void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *self, main_w
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_user_choose(GtkWidget *self, GtkEntry *target){
|
|
|
|
|
|
|
|
ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new();
|
|
|
|
|
|
|
|
gtk_list_store_new(2,G_TYPE_BOOLEAN,G_TYPE_STRING);
|
|
|
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"output",target);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_groups_multiple_save),dict);
|
|
|
|
|
|
|
|
gtk_widget_show(window->GroupsWindow);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_group_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
|
|
|
|
ubl_settings_usergroups_group_creation_window *window = yon_dictionary_get_data(dict->first->next,ubl_settings_usergroups_group_creation_window*);
|
|
|
|
|
|
|
|
char *final_string = NULL;
|
|
|
|
|
|
|
|
char *group_name = NULL;
|
|
|
|
|
|
|
|
char *group_users = NULL;
|
|
|
|
|
|
|
|
char *gid = NULL;
|
|
|
|
|
|
|
|
char *non_unique = NULL;
|
|
|
|
|
|
|
|
char *gsystem = NULL;
|
|
|
|
|
|
|
|
char *password = NULL;
|
|
|
|
|
|
|
|
int gid_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck));
|
|
|
|
|
|
|
|
if (gid_active){
|
|
|
|
|
|
|
|
gid="x";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gid = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUIDEntry));
|
|
|
|
|
|
|
|
if (yon_char_is_empty(gid)){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userUIDEntry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
group_name = (char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry));
|
|
|
|
|
|
|
|
if (yon_char_is_empty(group_name)){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userLoginEntry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
group_users = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry));
|
|
|
|
|
|
|
|
if (yon_char_is_empty(group_users)){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userGroupsEntry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int non_unique_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UnuniqueGIDCheck));
|
|
|
|
|
|
|
|
if(non_unique_active){
|
|
|
|
|
|
|
|
non_unique=" --non-unique";
|
|
|
|
|
|
|
|
} else non_unique="";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int gsystem_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->SystemGroupCheck));
|
|
|
|
|
|
|
|
if(gsystem_active){
|
|
|
|
|
|
|
|
gsystem=" --system";
|
|
|
|
|
|
|
|
} else gsystem="";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
password = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
|
|
|
if (yon_char_is_empty(password)){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
final_string = yon_char_unite(yon_char_return_if_exist(group_users,"x"),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(gid,"x"),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(non_unique,""),
|
|
|
|
|
|
|
|
yon_char_return_if_exist(gsystem,""),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(password,"x"),
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
yon_config_register(GROUPADD(group_name),"users",final_string);
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
gtk_list_store_append(widgets->GroupsList,&iter);
|
|
|
|
|
|
|
|
gtk_list_store_set(widgets->GroupsList,&iter,0,gid,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);
|
|
|
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group_creation_new(){
|
|
|
|
ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group_creation_new(){
|
|
|
|
ubl_settings_usergroups_group_creation_window *window = malloc(sizeof(ubl_settings_usergroups_group_creation_window));
|
|
|
|
ubl_settings_usergroups_group_creation_window *window = malloc(sizeof(ubl_settings_usergroups_group_creation_window));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group_creation);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group_creation);
|
|
|
|
window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow");
|
|
|
|
window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow");
|
|
|
|
window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
window->userUIDAutoCheck=yon_gtk_builder_get_widget(builder,"userUIDAutoCheck");
|
|
|
|
window->userUIDAutoCheck=yon_gtk_builder_get_widget(builder,"GIDAutoCheck");
|
|
|
|
window->userUIDEntry=yon_gtk_builder_get_widget(builder,"userUIDEntry");
|
|
|
|
window->userUIDEntry=yon_gtk_builder_get_widget(builder,"userUIDEntry");
|
|
|
|
window->userLoginEntry=yon_gtk_builder_get_widget(builder,"userLoginEntry");
|
|
|
|
window->userLoginEntry=yon_gtk_builder_get_widget(builder,"userLoginEntry");
|
|
|
|
window->userGroupsEntry=yon_gtk_builder_get_widget(builder,"userGroupsEntry");
|
|
|
|
window->userGroupsEntry=yon_gtk_builder_get_widget(builder,"userGroupsEntry");
|
|
|
|
window->UserAdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"UserAdditionalGroupsButton");
|
|
|
|
window->UserAdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"AdditionalGroupsButton");
|
|
|
|
window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton");
|
|
|
|
window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton");
|
|
|
|
window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton");
|
|
|
|
window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton");
|
|
|
|
window->AdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"AdditionalGroupsButton");
|
|
|
|
window->AdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"AdditionalGroupsButton");
|
|
|
|
@ -236,9 +306,11 @@ ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group
|
|
|
|
window->ChangePasswordButton=yon_gtk_builder_get_widget(builder,"ChangePasswordButton");
|
|
|
|
window->ChangePasswordButton=yon_gtk_builder_get_widget(builder,"ChangePasswordButton");
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UnuniqueGIDCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userLoginEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->UnuniqueGIDCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userLoginEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->AdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userGroupsEntry);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->ChangePasswordButton),"clicked",G_CALLBACK(on_password_change),window->PasswordEntry);
|
|
|
|
g_signal_connect(G_OBJECT(window->ChangePasswordButton),"clicked",G_CALLBACK(on_password_change),window->PasswordEntry);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordCombo),"changed",G_CALLBACK(on_password_combo_changed),window->ChangePasswordButton);
|
|
|
|
|
|
|
|
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->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserAdditionalGroupsButton),"clicked",G_CALLBACK(on_user_choose),window);
|
|
|
|
return window;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -346,12 +418,19 @@ void on_password_changed(GtkEntry *self, ubl_settings_usergroups_password_window
|
|
|
|
void on_password_accept(GtkWidget *self, dictionary *dict){
|
|
|
|
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*);
|
|
|
|
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*);
|
|
|
|
GtkEntry *entry = yon_dictionary_get_data(dict->first->next,GtkEntry*);
|
|
|
|
char *password = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)));
|
|
|
|
char *pasted_hash = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
if (yon_char_is_empty(pasted_hash)){
|
|
|
|
if (strcmp(password,password_check)){
|
|
|
|
char *password = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)));
|
|
|
|
|
|
|
|
char *password_check = (char*)gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
|
|
|
if (!strcmp(password,password_check)){
|
|
|
|
|
|
|
|
char *passwd_hash = g_malloc0(101);
|
|
|
|
|
|
|
|
FILE *fl = popen(password_hash_get_command(password),"r");
|
|
|
|
|
|
|
|
fgets(passwd_hash,100,fl);
|
|
|
|
|
|
|
|
if (passwd_hash[strlen(passwd_hash)-1]=='\n') passwd_hash[strlen(passwd_hash)-1]='\0';
|
|
|
|
|
|
|
|
gtk_entry_set_text(entry,passwd_hash);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(){
|
|
|
|
ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(){
|
|
|
|
@ -413,7 +492,9 @@ void on_user_shell_changed(GtkWidget *self, ubl_settings_usergroups_user_window
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_user_save(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
void on_user_save(GtkWidget *self, dictionary *dict){
|
|
|
|
|
|
|
|
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
|
|
|
|
ubl_settings_usergroups_user_window *window = yon_dictionary_get_data(dict->first->next,ubl_settings_usergroups_user_window*);
|
|
|
|
char *final_user="";
|
|
|
|
char *final_user="";
|
|
|
|
char *uid_string = NULL;
|
|
|
|
char *uid_string = NULL;
|
|
|
|
char *password = NULL;
|
|
|
|
char *password = NULL;
|
|
|
|
@ -456,11 +537,16 @@ void on_user_save(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
password = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry));
|
|
|
|
int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo));
|
|
|
|
if (yon_char_is_empty(password)){
|
|
|
|
if (password_active > 1){
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
password = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry));
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userPasswordEntry);
|
|
|
|
if (yon_char_is_empty(password)){
|
|
|
|
return;
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userPasswordEntry);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
password="x";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
username = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUserNameEntry));
|
|
|
|
username = (char*)gtk_entry_get_text(GTK_ENTRY(window->userUserNameEntry));
|
|
|
|
@ -470,46 +556,43 @@ void on_user_save(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
main_group = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry));
|
|
|
|
int main_group_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck));
|
|
|
|
if (yon_char_is_empty(main_group)){
|
|
|
|
if (!main_group_active){
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
main_group = (char*)gtk_entry_get_text(GTK_ENTRY(window->userGroupsEntry));
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userGroupsEntry);
|
|
|
|
if (yon_char_is_empty(main_group)){
|
|
|
|
return;
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userGroupsEntry);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
main_group = "x";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
additional_groups = (char*)gtk_entry_get_text(GTK_ENTRY(window->userAdditionalGroupsEntry));
|
|
|
|
additional_groups = (char*)gtk_entry_get_text(GTK_ENTRY(window->userAdditionalGroupsEntry));
|
|
|
|
if (yon_char_is_empty(additional_groups)){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userAdditionalGroupsEntry);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
password_change_interval_minimum = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMinimumSpin)));
|
|
|
|
long password_change_interval_minimum_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMinimumSpin));
|
|
|
|
if (yon_char_is_empty(password_change_interval_minimum)){
|
|
|
|
if (password_change_interval_minimum_active>0){
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
password_change_interval_minimum = yon_char_from_long(password_change_interval_minimum_active);
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userPasswordChangeDelayMinimumSpin);
|
|
|
|
} else password_change_interval_minimum = 0;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
password_change_interval_maximum = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin)));
|
|
|
|
long password_change_interval_maximum_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin));
|
|
|
|
if (yon_char_is_empty(password_change_interval_maximum)){
|
|
|
|
if (password_change_interval_minimum_active>0){
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
password_change_interval_maximum = yon_char_from_long(password_change_interval_maximum_active);
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userPasswordChangeDelayMaximumSpin);
|
|
|
|
} else password_change_interval_maximum = 0;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
warning_days = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin)));
|
|
|
|
|
|
|
|
if (yon_char_is_empty(warning_days)){
|
|
|
|
long password_interval_maximum = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin));
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userWarningSpin);
|
|
|
|
password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry));
|
|
|
|
return;
|
|
|
|
if (!yon_char_is_empty(password_expiration_date)){
|
|
|
|
|
|
|
|
password_expiration_date = password_expiration_date;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
warning_days = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin)));
|
|
|
|
|
|
|
|
|
|
|
|
no_activity_days = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userActivitySpin)));
|
|
|
|
int no_activity_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userActivitySpin));
|
|
|
|
if (yon_char_is_empty(no_activity_days)){
|
|
|
|
if (no_activity_days_active>0){
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
no_activity_days = yon_char_from_long(no_activity_days_active);
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userActivitySpin);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
@ -517,34 +600,30 @@ void on_user_save(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
user_shell = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo));
|
|
|
|
int user_shell_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userShellCombo));
|
|
|
|
if (!strcmp(user_shell,SET_LABEL)){
|
|
|
|
if (user_shell_active>0){
|
|
|
|
user_shell = (char*)gtk_entry_get_text(GTK_ENTRY(window->userShellCombo));
|
|
|
|
user_shell = yon_char_unite(" --shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
if (yon_char_is_empty(user_shell)){
|
|
|
|
if (!strcmp(user_shell,SET_LABEL)){
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
user_shell = yon_char_unite(" --shell ",(char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userShellCombo)),NULL);
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userShellEntry);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} 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=(char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry));
|
|
|
|
user_home=yon_char_unite(" --home-dir ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry)),NULL);
|
|
|
|
if (yon_char_is_empty(user_home)){
|
|
|
|
} else user_home = "";
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->userHomeCombo);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
if (do_not_check_actve)
|
|
|
|
|
|
|
|
do_not_check = " --badnames";
|
|
|
|
|
|
|
|
|
|
|
|
int samba_sync_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck));
|
|
|
|
int samba_sync_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck));
|
|
|
|
if (samba_sync_active);
|
|
|
|
if (samba_sync_active);
|
|
|
|
@ -553,6 +632,38 @@ void on_user_save(GtkWidget *self, ubl_settings_usergroups_user_window *window){
|
|
|
|
if (deactivate_active);
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
time_t t = time(NULL);
|
|
|
|
|
|
|
|
struct tm tm = *localtime(&t);
|
|
|
|
|
|
|
|
password_changed_date = yon_char_unite(yon_char_from_int(tm.tm_mday),".",yon_char_from_int(tm.tm_mon+1),".",yon_char_from_int(1900+tm.tm_year),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *shadow_string = NULL;
|
|
|
|
|
|
|
|
shadow_string = yon_char_unite(yon_char_return_if_exist(password_changed_date,""),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(password_change_interval_minimum,""),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(password_change_interval_maximum,""),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(warning_days,""),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(no_activity_days,""),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(password_expiration_date,""),
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final_user = yon_char_unite(yon_char_return_if_exist(username,"x"),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(uid_string,"x"),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(main_group,"x"),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(additional_groups,"x"),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(user_home,""),
|
|
|
|
|
|
|
|
yon_char_return_if_exist(user_shell,""),
|
|
|
|
|
|
|
|
yon_char_return_if_exist(create_system_user,""),
|
|
|
|
|
|
|
|
yon_char_return_if_exist(create_ununique,""),
|
|
|
|
|
|
|
|
yon_char_return_if_exist(do_not_check,""),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(password,"x"),
|
|
|
|
|
|
|
|
":",yon_char_return_if_exist(extra_options,""),
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
yon_config_register(USERADD(login),"users",final_user);
|
|
|
|
|
|
|
|
yon_config_register(USERSHADOW(login),"users",shadow_string);
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
gtk_list_store_append(widgets->UsersList,&iter);
|
|
|
|
|
|
|
|
gtk_list_store_set(widgets->UsersList,&iter,1,yon_char_return_if_exist(uid_string,""),2,yon_char_return_if_exist(login,""),3,yon_char_return_if_exist(username,""),4,yon_char_return_if_exist(main_group,""),5,yon_char_return_if_exist(additional_groups,""),6,yon_char_unite(yon_char_return_if_exist(user_home,""),yon_char_return_if_exist(user_shell,""),yon_char_return_if_exist(create_system_user,""),yon_char_return_if_exist(create_ununique,""),yon_char_return_if_exist(do_not_check,""),NULL),7,yon_char_return_if_exist(gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->userPasswordCombo)),""),-1);
|
|
|
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){
|
|
|
|
@ -617,14 +728,20 @@ void on_main_add(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){
|
|
|
|
model = GTK_TREE_MODEL(widgets->UsersList);
|
|
|
|
model = GTK_TREE_MODEL(widgets->UsersList);
|
|
|
|
ubl_settings_usergroups_user_window *window = yon_ubl_settings_usergroups_user_new();
|
|
|
|
ubl_settings_usergroups_user_window *window = yon_ubl_settings_usergroups_user_new();
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_user_save),dict);
|
|
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
gtk_widget_show(window->CreateUserWindow);
|
|
|
|
gtk_widget_show(window->CreateUserWindow);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
model = GTK_TREE_MODEL(widgets->GroupsList);
|
|
|
|
model = GTK_TREE_MODEL(widgets->GroupsList);
|
|
|
|
ubl_settings_usergroups_group_creation_window *window = yon_ubl_settings_usergroups_group_creation_new();
|
|
|
|
ubl_settings_usergroups_group_creation_window *window = yon_ubl_settings_usergroups_group_creation_new();
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_group_save),dict);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_widget_show(window->CreateGroupWindow);
|
|
|
|
gtk_widget_show(window->CreateGroupWindow);
|
|
|
|
@ -640,8 +757,67 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
model = GTK_TREE_MODEL(widgets->UsersList);
|
|
|
|
model = GTK_TREE_MODEL(widgets->UsersList);
|
|
|
|
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)){
|
|
|
|
ubl_settings_usergroups_user_window *window = yon_ubl_settings_usergroups_user_new();
|
|
|
|
ubl_settings_usergroups_user_window *window = yon_ubl_settings_usergroups_user_new();
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_user_save),dict);
|
|
|
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->UsersList),&iter,2,&name,-1);
|
|
|
|
|
|
|
|
char *parameter_string = yon_config_get_by_key(USERADD(name));
|
|
|
|
|
|
|
|
int parsed_size;
|
|
|
|
|
|
|
|
config_str parameters = yon_char_parse(parameter_string,&parsed_size,":");
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userLoginEntry), name);
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUserNameEntry), parsed_size>0?parameters[0]:"");
|
|
|
|
|
|
|
|
if (parsed_size>1){
|
|
|
|
|
|
|
|
if (!strcmp(parameters[1],"x"))
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck),1);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userUIDEntry), parsed_size>1?parameters[1]:"");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parsed_size>2){
|
|
|
|
|
|
|
|
if (!strcmp(parameters[2],"x"))
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userGroupsCheck),1);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userGroupsEntry), parsed_size>2?parameters[2]:"");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userAdditionalGroupsEntry), parsed_size>3?parameters[3]:"");
|
|
|
|
|
|
|
|
if (parsed_size>4&&!yon_char_is_empty(parameters[4])){
|
|
|
|
|
|
|
|
int params_size;
|
|
|
|
|
|
|
|
config_str parameters_substring = yon_char_parse(parameters[4],¶ms_size," ");
|
|
|
|
|
|
|
|
for (int i=0;i<params_size;i++){
|
|
|
|
|
|
|
|
if (!strcmp(parameters_substring[i],"--home-dir")){
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userHomeEntry),parameters_substring[i+1]);
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
} else if (!strcmp(parameters_substring[i],"--shell")||!strcmp(parameters_substring[i],"-s")){
|
|
|
|
|
|
|
|
int active = yon_gtk_combo_box_text_find(window->userShellCombo,parameters_substring[i+1]);
|
|
|
|
|
|
|
|
if (!active){
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userShellEntry),parameters_substring[i+1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--system")||!strcmp(parameters_substring[i],"-r")){
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userCreateSystemCheck),1);
|
|
|
|
|
|
|
|
}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);
|
|
|
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--no-user-group")||!strcmp(parameters_substring[i],"-N")){
|
|
|
|
|
|
|
|
// gtk
|
|
|
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--non-unique")||!strcmp(parameters_substring[i],"-o")){
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userCreateUnuniqueCheck),1);
|
|
|
|
|
|
|
|
}else if (!strcmp(parameters_substring[i],"--badnames")){
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userDontCheckCheck),1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(window->), parsed_size>4?parameters[4]:"");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry), parsed_size>5?parameters[5]:"");
|
|
|
|
|
|
|
|
free(parameters);
|
|
|
|
|
|
|
|
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]:"");
|
|
|
|
|
|
|
|
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->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_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry),parsed_size>5?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));
|
|
|
|
gtk_widget_show(window->CreateUserWindow);
|
|
|
|
gtk_widget_show(window->CreateUserWindow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -649,7 +825,10 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
|
|
|
|
model = GTK_TREE_MODEL(widgets->GroupsList);
|
|
|
|
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)){
|
|
|
|
ubl_settings_usergroups_group_creation_window *window = yon_ubl_settings_usergroups_group_creation_new();
|
|
|
|
ubl_settings_usergroups_group_creation_window *window = yon_ubl_settings_usergroups_group_creation_new();
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_group_save),dict);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(widgets->Window));
|
|
|
|
gtk_widget_show(window->CreateGroupWindow);
|
|
|
|
gtk_widget_show(window->CreateGroupWindow);
|
|
|
|
|