@ -110,8 +110,12 @@ void yon_interface_update(main_window *widgets){
if ( ! check_is_password_hash ( parameters [ 5 ] ) & & parameters [ 5 ] [ 0 ] ! = ' % ' & & parameters [ 5 ] [ 1 ] ! = ' % ' ) {
if ( ! check_is_password_hash ( parameters [ 5 ] ) & & parameters [ 5 ] [ 0 ] ! = ' % ' & & parameters [ 5 ] [ 1 ] ! = ' % ' ) {
pars = ENCRYPTED_LABEL ;
pars = ENCRYPTED_LABEL ;
} else if ( ! strcmp ( parameters [ 5 ] , " !* " ) ) {
} else if ( ! strcmp ( parameters [ 5 ] , " " ) ) {
pars = NO_PASSWORD_LABEL ;
pars = NO_PASSWORD_LABEL ;
} else if ( ! strcmp ( parameters [ 5 ] , " !* " ) ) {
pars = DENY_LOGIN_LABEL ;
} else if ( parameters [ 5 ] [ 0 ] = = ' ! ' ) {
pars = BLOCK_LOGIN_LABEL ;
} else {
} else {
pars = UNENCRYPTED_LABEL ;
pars = UNENCRYPTED_LABEL ;
@ -121,7 +125,7 @@ void yon_interface_update(main_window *widgets){
}
}
gtk_list_store_set ( widgets - > UsersList , & iter ,
gtk_list_store_set ( widgets - > UsersList , & iter ,
0 , parameters_size > 5 ? ( parameters [ 5 ] [ 0 ] = = ' ! ' || parameters [ 5 ] [ 0 ] = = ' * ' ) | | ( parameters [ 5 ] [ 0 ] = = ' ! ' && parameters [ 5 ] [ 1 ] = = ' * ' ) : 0 ,
0 , parameters_size > 5 ? ( parameters [ 5 ] [ 0 ] = = ' ! ' && parameters [ 5 ] [ 1 ] = = ' * ' ) ? check_checked_icon_name : ( parameters [ 5 ] [ 0 ] = = ' ! ' || parameters [ 5 ] [ 0 ] = = ' * ' ) ? check_attention_icon_name : NULL : NULL ,
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 ] : " " ,
1 , parameters_size > 1 & & ! yon_char_is_empty ( parameters [ 1 ] ) ? parameters [ 1 ] : " " ,
@ -158,8 +162,12 @@ void yon_interface_update(main_window *widgets){
if ( parameters_size > 4 & & strcmp ( parameters [ 4 ] , " x " ) & & strcmp ( parameters [ 4 ] , " " ) ) {
if ( parameters_size > 4 & & strcmp ( parameters [ 4 ] , " x " ) & & strcmp ( parameters [ 4 ] , " " ) ) {
if ( ! check_is_password_hash ( parameters [ 4 ] ) & & parameters [ 4 ] [ 0 ] ! = ' % ' & & parameters [ 4 ] [ 1 ] ! = ' % ' ) {
if ( ! check_is_password_hash ( parameters [ 4 ] ) & & parameters [ 4 ] [ 0 ] ! = ' % ' & & parameters [ 4 ] [ 1 ] ! = ' % ' ) {
pars = ENCRYPTED_LABEL ;
pars = ENCRYPTED_LABEL ;
} else if ( ! strcmp ( parameters [ 4 ] , " !*" ) | | ! strcmp ( parameters [ 4 ] , " * " ) | | ! strcmp ( parameters [ 4 ] , " ! " ) ) {
} else if ( ! strcmp ( parameters [ 4 ] , " " ) ) {
pars = NO_PASSWORD_LABEL ;
pars = NO_PASSWORD_LABEL ;
} else if ( ! strcmp ( parameters [ 4 ] , " !* " ) ) {
pars = DENY_LOGIN_LABEL ;
} else if ( parameters [ 4 ] [ 0 ] = = ' ! ' ) {
pars = BLOCK_LOGIN_LABEL ;
} else {
} else {
pars = UNENCRYPTED_LABEL ;
pars = UNENCRYPTED_LABEL ;
@ -226,7 +234,7 @@ void on_config_local_load(GtkWidget *, main_window *widgets){
textdomain ( template_ui_LocaleName ) ;
textdomain ( template_ui_LocaleName ) ;
yon_ubl_status_box_render ( LOCAL_LOAD_SUCCESS_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
yon_ubl_status_box_render ( LOCAL_LOAD_SUCCESS_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
textdomain ( LocaleName ) ;
textdomain ( LocaleName ) ;
main_config . load_mode = 1 ;
main_config . load_mode = YON_CONFIG_LOCAL ;
yon_interface_update ( widgets ) ;
yon_interface_update ( widgets ) ;
}
}
@ -235,7 +243,7 @@ void on_config_global_load(GtkWidget *, main_window *widgets){
textdomain ( template_ui_LocaleName ) ;
textdomain ( template_ui_LocaleName ) ;
yon_ubl_status_box_render ( GLOBAL_LOAD_SUCCESS_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
yon_ubl_status_box_render ( GLOBAL_LOAD_SUCCESS_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
textdomain ( LocaleName ) ;
textdomain ( LocaleName ) ;
main_config . load_mode = 0 ;
main_config . load_mode = YON_CONFIG_GLOBAL ;
yon_interface_update ( widgets ) ;
yon_interface_update ( widgets ) ;
}
}
@ -244,7 +252,7 @@ void on_config_custom_load(GtkWidget *,main_window *widgets){
textdomain ( template_ui_LocaleName ) ;
textdomain ( template_ui_LocaleName ) ;
yon_ubl_status_box_render ( GLOBAL_LOAD_SUCCESS_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
yon_ubl_status_box_render ( GLOBAL_LOAD_SUCCESS_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
textdomain ( LocaleName ) ;
textdomain ( LocaleName ) ;
main_config . load_mode = 3 ;
main_config . load_mode = YON_CONFIG_CUSTOM ;
yon_interface_update ( widgets ) ;
yon_interface_update ( widgets ) ;
}
}
@ -395,7 +403,7 @@ 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 ] = = ' $ ' ) {
if ( main_config . load_mode = = 1 ) {
if ( main_config . load_mode = = YON_CONFIG_LOCAL ) {
newv = new_value ;
newv = new_value ;
} else {
} else {
newv = " ******* " ;
newv = " ******* " ;
@ -404,7 +412,7 @@ void yon_hide_passwords(template_saving_window *window){
newv = " ******* " ;
newv = " ******* " ;
}
}
if ( ! yon_char_is_empty ( old_value ) ) {
if ( ! yon_char_is_empty ( old_value ) ) {
if ( main_config . load_mode = = 1 ) {
if ( main_config . load_mode = = YON_CONFIG_LOCAL ) {
old = yon_char_new ( " <s>*******</s> " ) ;
old = yon_char_new ( " <s>*******</s> " ) ;
} else {
} else {
@ -421,7 +429,7 @@ 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 ] = = ' $ ' ) {
if ( main_config . load_mode = = 1 ) {
if ( main_config . load_mode = = YON_CONFIG_LOCAL ) {
newv = new_value ;
newv = new_value ;
} else {
} else {
newv = " ******* " ;
newv = " ******* " ;
@ -430,7 +438,7 @@ void yon_hide_passwords(template_saving_window *window){
newv = " ******* " ;
newv = " ******* " ;
}
}
if ( ! yon_char_is_empty ( old_value ) ) {
if ( ! yon_char_is_empty ( old_value ) ) {
if ( main_config . load_mode = = 1 ) {
if ( main_config . load_mode = = YON_CONFIG_LOCAL ) {
old = yon_char_new ( " <s>*******</s> " ) ;
old = yon_char_new ( " <s>*******</s> " ) ;
} else {
} else {
old = yon_char_unite ( " <s> " , old_value , " </s> " , NULL ) ;
old = yon_char_unite ( " <s> " , old_value , " </s> " , NULL ) ;
@ -451,7 +459,7 @@ void on_save_done(main_window *widgets, config_str output, int size){
}
}
yon_char_parsed_free ( output , size ) ;
yon_char_parsed_free ( output , size ) ;
on_config_update ( NULL , widgets ) ;
on_config_update ( NULL , widgets ) ;
if ( main_config . load_mode = = 1 ) {
if ( main_config . load_mode = = YON_CONFIG_LOCAL ) {
yon_accept_changes ( ) ;
yon_accept_changes ( ) ;
yon_samba_sync_proceed ( ) ;
yon_samba_sync_proceed ( ) ;
}
}
@ -593,62 +601,111 @@ void on_delete_confirmation_delete_check(GtkCellRenderer *, char *path, yon_conf
}
}
void yon_delete_confirmation_save ( GtkWidget * self , dictionary * dict ) {
char * yon_user_get_group_string ( char * user ) {
GtkTreeIter iter , itar ;
char * cur_user = config ( USERADD ( user ) ) ;
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 size ;
int valid = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter ) ;
config_str parsed = yon_char_parse ( cur_user , & size , " : " ) ;
for ( ; valid ; valid = gtk_tree_model_iter_next ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter ) ) {
if ( size > 2 & & ! yon_char_is_empty ( parsed [ 2 ] ) ) {
char * name ;
char * current_group = parsed [ 2 ] ;
gtk_tree_model_get ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter , 2 , & name , - 1 ) ;
size_t digits = 0 ;
int valid2 = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( window - > list ) , & itar ) ;
for ( guint k = 0 ; k < strlen ( current_group ) ; k + + ) {
for ( ; valid2 ; valid2 = gtk_tree_model_iter_next ( GTK_TREE_MODEL ( window - > list ) , & itar ) ) {
if ( g_ascii_isdigit ( current_group [ k ] ) ) {
char * name_check ;
digits + + ;
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 ) {
// char *user = config(USERADD(name));
char * final_group_name = NULL ;
// int size;
// config_str parsed = yon_char_parse(user,&size,":");
if ( digits & & digits = = strlen ( current_group ) ) {
// if (size>3&&(strcmp(parsed[3],name)&&strcmp(parsed[2],parsed[3]))){
for ( int i = 0 ; i < main_config . groups_size ; i + + ) {
// yon_ubl_status_box_spawn_infinite(window->)
int group_size = 0 ;
// }
config_str groups_parsed = yon_char_parse ( main_config . groups [ i ] , & group_size , " : " ) ;
gtk_list_store_remove ( widgets - > UsersList , & iter ) ;
if ( group_size > 2 & & ! strcmp ( groups_parsed [ 2 ] , current_group ) ) {
yon_config_remove_by_key ( USERADD ( name ) ) ;
final_group_name = yon_char_new ( groups_parsed [ 0 ] ) ;
yon_config_remove_by_key ( USERSHADOW ( name ) ) ;
if ( group_size ) yon_char_parsed_free ( groups_parsed , group_size ) ;
yon_config_register ( USERADD_SYNC ( name ) , USERADD_SYNC_command ( name ) , " " ) ;
break ;
yon_config_remove_by_key ( USERADD_SYNC ( name ) ) ;
yon_config_remove_by_key ( USERSHADOW_SYNC ( name ) ) ;
gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( widgets - > UsersList ) , & 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 ) ;
}
}
}
if ( group_size ) yon_char_parsed_free ( groups_parsed , group_size ) ;
}
}
} else {
final_group_name = yon_char_new ( current_group ) ;
}
}
return final_group_name ;
} else {
return user ;
}
}
return NULL ;
}
char * yon_user_check_groups ( GtkListStore * list , char * target ) {
char * final = " " ;
GtkTreeIter iter ;
GtkTreeModel * model = GTK_TREE_MODEL ( list ) ;
for_iter ( model , & iter ) {
char * name ;
char * name ;
if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter ) ) {
char * group ;
gtk_tree_model_get ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter , 2 , & name , - 1 ) ;
gtk_tree_model_get ( model , & iter , 1 , & name , 6 , & group , - 1 ) ;
int valid2 = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( window - > list ) , & itar ) ;
if ( ! strcmp ( group , target ) & & strcmp ( name , target ) ) {
for ( ; valid2 ; valid2 = gtk_tree_model_iter_next ( GTK_TREE_MODEL ( window - > list ) , & itar ) ) {
char * temp = yon_char_unite ( final , ! yon_char_is_empty ( final ) ? " , " : " " , name , NULL ) ;
char * name_check ;
if ( ! yon_char_is_empty ( final ) ) free ( final ) ;
int status , delete ;
final = temp ;
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 - > UsersList , & iter ) ;
return ! yon_char_is_empty ( final ) ? final : NULL ;
yon_config_remove_by_key ( USERADD ( name ) ) ;
}
yon_config_remove_by_key ( USERSHADOW ( name ) ) ;
gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter ) ;
void yon_delete_confirmation_save ( GtkWidget * self , dictionary * dict ) {
if ( status ) {
main_window * widgets = yon_dictionary_get_data ( dict - > first , main_window * ) ;
if ( yon_char_parsed_check_exist ( main_config . remove_homes , main_config . homes_size , name ) = = - 1 ) {
yon_confirmation_window * window = yon_dictionary_get_data ( dict - > first - > next , yon_confirmation_window * ) ;
yon_char_parsed_add_or_create_if_exists ( main_config . remove_homes , & main_config . homes_size , name ) ;
GtkTreeIter iter ;
}
GtkTreeModel * model = GTK_TREE_MODEL ( window - > list ) ;
}
char * single_target = NULL ;
int founds = 0 ;
char * depends = NULL ;
for_iter ( model , & iter ) {
int selected ;
char * target ;
char * group ;
gtk_tree_model_get ( model , & iter , 0 , & selected , 1 , & target , 6 , & group , - 1 ) ;
if ( selected & & ! yon_char_is_empty ( target ) & & ! yon_char_is_empty ( group ) ) {
if ( ( ! strcmp ( target , group ) ) ) {
depends = yon_user_check_groups ( window - > list , target ) ;
if ( ! yon_char_is_empty ( depends ) ) {
single_target = target ;
founds + + ;
}
}
}
}
}
}
}
if ( founds = = 1 ) {
dialog_confirmation_data * data = yon_confirmation_dialog_data_new ( ) ;
data - > action_text = CONFIRMATION_GROUP_DEPENDS_SINGLE_LABEL ( single_target , depends ) ;
if ( yon_confirmation_dialog_call ( window - > Window , data ) ! = GTK_RESPONSE_ACCEPT ) {
return ;
}
} else if ( founds > 1 ) {
dialog_confirmation_data * data = yon_confirmation_dialog_data_new ( ) ;
data - > action_text = CONFIRMATION_GROUP_DEPENDS_MULTIPLE_LABEL ;
if ( yon_confirmation_dialog_call ( window - > Window , data ) ! = GTK_RESPONSE_ACCEPT ) {
return ;
}
}
for_iter ( model , & iter ) {
int selected ;
char * target ;
gtk_tree_model_get ( model , & iter , 0 , & selected , 1 , & target , - 1 ) ;
if ( selected ) {
yon_config_remove_by_key ( USERADD ( target ) ) ;
yon_config_remove_by_key ( USERSHADOW ( target ) ) ;
yon_config_remove_by_key ( USERADD_SYNC ( target ) ) ;
yon_config_remove_by_key ( USERSHADOW_SYNC ( target ) ) ;
}
}
yon_interface_update ( widgets ) ;
on_subwindow_close ( self ) ;
on_subwindow_close ( self ) ;
}
}
@ -737,8 +794,8 @@ void yon_delete_confirmation_open(main_window *widgets){
}
}
int valid = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter ) ;
int valid = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter ) ;
for ( ; valid ; valid = gtk_tree_model_iter_next ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter ) ) {
for ( ; valid ; valid = gtk_tree_model_iter_next ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter ) ) {
char * name , * username , * parameters , * homedir = NULL ;
char * name , * username , * parameters , * homedir = NULL , * group = NULL ;
gtk_tree_model_get ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter , 2 , & name , 3 , & username , 6, & parameters , - 1 ) ;
gtk_tree_model_get ( GTK_TREE_MODEL ( widgets - > UsersList ) , & iter , 2 , & name , 3 , & username , 4, & group , 6, & parameters , - 1 ) ;
int size ;
int size ;
config_str home = yon_config_load ( get_home_command ( name ) , & size ) ;
config_str home = yon_config_load ( get_home_command ( name ) , & size ) ;
if ( size > 0 & & ! yon_char_is_empty ( home [ 0 ] ) ) {
if ( size > 0 & & ! yon_char_is_empty ( home [ 0 ] ) ) {
@ -751,7 +808,9 @@ void yon_delete_confirmation_open(main_window *widgets){
int status = 0 ;
int status = 0 ;
if ( homedir ) status = 1 ;
if ( homedir ) status = 1 ;
gtk_list_store_append ( window - > list , & itar ) ;
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 , 2 , homedir , 3 , 0 , 4 , yon_char_parsed_check_exist ( chosen , chosen_size , name ) > - 1 & & status ? 1 : 0 , 5 , username , - 1 ) ;
group = yon_user_get_group_string ( name ) ;
gtk_list_store_set ( window - > list , & itar , 0 , yon_char_parsed_check_exist ( chosen , chosen_size , name ) > - 1 ? 1 : 0 , 1 , name , 2 , homedir , 3 , 0 , 4 , yon_char_parsed_check_exist ( chosen , chosen_size , name ) > - 1 & & status ? 1 : 0 , 5 , username , 6 , group , - 1 ) ;
free ( name ) ;
free ( name ) ;
free ( username ) ;
free ( username ) ;
free ( parameters ) ;
free ( parameters ) ;
@ -787,7 +846,20 @@ void on_saving_settings_open(GtkWidget *, main_window *widgets){
}
}
void on_password_combo_changed ( GtkComboBox * self , GtkWidget * target ) {
void on_password_combo_changed ( GtkComboBox * self , GtkWidget * target ) {
gtk_widget_set_sensitive ( target , gtk_combo_box_get_active ( self ) > 1 ) ;
int active = gtk_combo_box_get_active ( self ) ;
switch ( active ) {
case 0 :
case 2 :
case 3 :
case 5 :
gtk_widget_set_sensitive ( target , 0 ) ;
break ;
case 1 :
case 4 :
gtk_widget_set_sensitive ( target , 1 ) ;
break ;
}
}
}
@ -1335,7 +1407,7 @@ void on_toggle_button_set_active_from_combo_box(GtkComboBox *self,ubl_settings_u
void on_toggle_button_set_active_from_toggle_button_inversed ( GtkToggleButton * , ubl_settings_usergroups_user_window * window ) {
void on_toggle_button_set_active_from_toggle_button_inversed ( GtkToggleButton * , ubl_settings_usergroups_user_window * window ) {
char * passw = ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > userPasswordEntry ) ) ;
char * passw = ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > userPasswordEntry ) ) ;
if ( ( passw [ 0 ] ! = ' $ ' ) & & gtk_combo_box_get_active ( GTK_COMBO_BOX ( window - > userPasswordCombo ) ) > 1 ) {
if ( ( passw [ 0 ] ! = ' $ ' ) & & gtk_combo_box_get_active ( GTK_COMBO_BOX ( window - > userPasswordCombo ) ) == 1 ) {
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userSyncSAMBACheck ) ) ) {
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userSyncSAMBACheck ) ) ) {
gtk_widget_set_sensitive ( GTK_WIDGET ( window - > userSyncSAMBAPasswordCheck ) , 0 ) ;
gtk_widget_set_sensitive ( GTK_WIDGET ( window - > userSyncSAMBAPasswordCheck ) , 0 ) ;
} else if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userSyncSAMBAPasswordCheck ) ) ) {
} else if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userSyncSAMBAPasswordCheck ) ) ) {
@ -1506,18 +1578,15 @@ void on_main_edit(GtkWidget *, main_window *widgets){
}
}
}
}
if ( parsed_size > 5 ) {
if ( parsed_size > 5 ) {
if ( check_is_password_has h( parameters [ 5 ] ) ) {
if ( strcmp( parameters [ 5 ] , " " ) & & ! yon_char_check_begins_with ( parameters [ 5 ] , " ! " ) & & ! yon_char_check_begins_with ( parameters [ 5 ] , " * " ) & & ! yon_char_check_begins_wit h( parameters [ 5 ] , " %% " ) ) {
if ( strcmp( parameters [ 5 ] , " !* " ) & & ! yon_char_check_begins_wit h( parameters [ 5 ] , " %% " ) ) {
if ( check_is_password_has h( parameters [ 5 ] ) ) {
char * temp = yon_char_append ( " %% " , parameters [ 5 ] ) ;
char * temp = yon_char_append ( " %% " , parameters [ 5 ] ) ;
free ( parameters [ 5 ] ) ;
free ( parameters [ 5 ] ) ;
parameters [ 5 ] = temp ;
parameters [ 5 ] = temp ;
}
}
}
}
window - > old_password = yon_char_new ( parameters [ 5 ] ) ;
window - > old_password = yon_char_new ( parameters [ 5 ] ) ;
if ( strcmp ( parameters [ 5 ] , " x " ) & & strcmp ( parameters [ 5 ] , " " ) ) {
if ( strcmp ( parameters [ 5 ] , " x " ) & & strcmp ( parameters [ 5 ] , " " ) ) {
if ( yon_check_password_blocked ( parameters [ 5 ] ) ) {
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( window - > userDeactivatedCheck ) , 1 ) ;
}
if ( ! yon_char_is_empty ( parameters [ 5 ] ) ) {
if ( ! yon_char_is_empty ( parameters [ 5 ] ) ) {
if ( check_is_password_hash ( parameters [ 5 ] ) ) {
if ( check_is_password_hash ( parameters [ 5 ] ) ) {
if ( yon_char_check_begins_with ( parameters [ 5 ] , " %% " ) = = - 1 ) {
if ( yon_char_check_begins_with ( parameters [ 5 ] , " %% " ) = = - 1 ) {
@ -1529,10 +1598,18 @@ void on_main_edit(GtkWidget *, main_window *widgets){
g_signal_handlers_block_by_func ( G_OBJECT ( window - > userSyncSAMBACheck ) , G_CALLBACK ( yon_gtk_widget_set_sensitive_from_toggle_button_inversed ) , window - > userSyncSAMBAPasswordCheck ) ;
g_signal_handlers_block_by_func ( G_OBJECT ( window - > userSyncSAMBACheck ) , G_CALLBACK ( yon_gtk_widget_set_sensitive_from_toggle_button_inversed ) , window - > userSyncSAMBAPasswordCheck ) ;
}
}
if ( ! strcmp ( parameters [ 5 ] , " !* " ) ) {
if ( ! strcmp ( parameters [ 5 ] , " !* " ) ) {
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > userPasswordCombo ) , 1 ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > userPasswordCombo ) , 2 ) ;
} else if ( ! strcmp ( parameters [ 5 ] , " " ) ) {
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > userPasswordCombo ) , 5 ) ;
} else if ( parameters [ 5 ] [ 0 ] = = ' ! ' ) {
char * password_or = yon_char_new ( parameters [ 5 ] ) ;
free ( yon_char_divide ( password_or , 0 ) ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > userPasswordEntry ) , password_or ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > userPasswordCombo ) , 3 ) ;
free ( password_or ) ;
} else {
} else {
gtk_entry_set_text ( GTK_ENTRY ( window - > userPasswordEntry ) , parameters [ 5 ] ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > userPasswordEntry ) , parameters [ 5 ] ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > userPasswordCombo ) , 2 ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > userPasswordCombo ) , 1 ) ;
}
}
}
}
}
}
@ -1633,14 +1710,37 @@ void on_main_edit(GtkWidget *, main_window *widgets){
}
}
}
}
if ( size > 4 ) {
if ( size > 4 ) {
if ( ! yon_char_is_empty ( parsed [ 4 ] ) ) {
if ( strcmp ( parsed [ 4 ] , " " ) & & ! yon_char_check_begins_with ( parsed [ 4 ] , " ! " ) & & ! yon_char_check_begins_with ( parsed [ 4 ] , " * " ) & & ! yon_char_check_begins_with ( parsed [ 4 ] , " %% " ) ) {
if ( ! strcmp ( parsed [ 4 ] , " !* " ) | | ! strcmp ( parsed [ 4 ] , " ! " ) | | ! strcmp ( parsed [ 4 ] , " * " ) ) {
if ( check_is_password_hash ( parsed [ 4 ] ) ) {
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > PasswordCombo ) , 1 ) ;
char * temp = yon_char_append ( " %% " , parsed [ 4 ] ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > PasswordEntry ) , " " ) ;
free ( parsed [ 4 ] ) ;
} else if ( strcmp ( parsed [ 4 ] , " x " ) ) {
parsed [ 4 ] = temp ;
gtk_entry_set_text ( GTK_ENTRY ( window - > PasswordEntry ) , parsed [ 4 ] ) ;
}
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > PasswordCombo ) , 2 ) ;
}
window - > old_password = yon_char_new ( parsed [ 4 ] ) ;
if ( strcmp ( parsed [ 4 ] , " x " ) & & strcmp ( parsed [ 4 ] , " " ) ) {
if ( ! yon_char_is_empty ( parsed [ 4 ] ) ) {
if ( check_is_password_hash ( parsed [ 4 ] ) ) {
if ( yon_char_check_begins_with ( parsed [ 4 ] , " %% " ) = = - 1 ) {
char * temp = yon_char_append ( " %% " , parsed [ 4 ] ) ;
free ( parsed [ 4 ] ) ;
parsed [ 4 ] = temp ;
}
}
if ( ! strcmp ( parsed [ 4 ] , " !* " ) ) {
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > PasswordCombo ) , 2 ) ;
} else if ( ! strcmp ( parsed [ 4 ] , " " ) ) {
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > PasswordCombo ) , 5 ) ;
} else if ( parsed [ 4 ] [ 0 ] = = ' ! ' ) {
char * password_or = yon_char_new ( parsed [ 4 ] ) ;
free ( yon_char_divide ( password_or , 0 ) ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > PasswordEntry ) , password_or ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > PasswordCombo ) , 3 ) ;
free ( password_or ) ;
} else {
gtk_entry_set_text ( GTK_ENTRY ( window - > PasswordEntry ) , parsed [ 4 ] ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > PasswordCombo ) , 1 ) ;
}
}
}
}
}
} else {
} else {
@ -1736,7 +1836,7 @@ void on_main_delete(GtkWidget *, main_window *widgets){
}
}
void on_config_update ( GtkWidget * , main_window * widgets ) {
void on_config_update ( GtkWidget * , main_window * widgets ) {
if ( main_config . load_mode = = 0 ) {
if ( main_config . load_mode = = YON_CONFIG_GLOBAL ) {
on_config_global_load ( NULL , widgets ) ;
on_config_global_load ( NULL , widgets ) ;
} else {
} else {
on_config_local_load ( NULL , widgets ) ;
on_config_local_load ( NULL , widgets ) ;
@ -1767,7 +1867,7 @@ void config_init(){
main_config . lock_save_local = 0 ;
main_config . lock_save_local = 0 ;
main_config . groups_size = 0 ;
main_config . groups_size = 0 ;
main_config . users_size = 0 ;
main_config . users_size = 0 ;
main_config . load_mode = 1 ;
main_config . load_mode = YON_CONFIG_LOCAL ;
main_config . hash_default_id = - 1 ;
main_config . hash_default_id = - 1 ;
main_config . save_config = 0 ;
main_config . save_config = 0 ;
main_config . groups = yon_file_open ( groups_path , & main_config . groups_size ) ;
main_config . groups = yon_file_open ( groups_path , & main_config . groups_size ) ;