@ -5,12 +5,16 @@ config main_config;
//functions
//functions
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_ clean( ) ;
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 ) ;
yon_config_load_config ( YON_CONFIG_DEFAULT , config_get_default_command , 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_ config( type , config_get_global_command , NULL ) ;
}
}
if ( type = = YON_CONFIG_LOCAL ) {
if ( type = = YON_CONFIG_LOCAL ) {
yon_config_load_config ( type , config_get_local_command , NULL ) ;
yon_config_load_config ( YON_CONFIG_GLOBAL , config_get_global_only_parameters , NULL ) ;
yon_config_set_status ( DEFAULTPASSWD_parameter , - 2 ) ;
yon_config_set_status ( DEFAULTROOTPASSWD_parameter , - 2 ) ;
int size ;
int size ;
config_str passwords = yon_config_load ( get_passwords_command , & size ) ;
config_str passwords = yon_config_load ( get_passwords_command , & size ) ;
for ( int i = 0 ; i < size ; i + + ) {
for ( int i = 0 ; i < size ; i + + ) {
@ -19,7 +23,7 @@ int yon_load_proceed(YON_CONFIG_TYPE type){
int parsed_size ;
int parsed_size ;
char * local_value = yon_config_get_by_key ( key ) ;
char * local_value = yon_config_get_by_key ( key ) ;
config_str parsed = yon_char_parse ( value , & parsed_size , " : " ) ;
config_str parsed = yon_char_parse ( value , & parsed_size , " : " ) ;
if ( strstr ( key , " USERADD[ " ) & & local_value ) {
if ( strstr ( key , USERADD_SEARCH_macro ) & & local_value ) {
if ( parsed_size > 5 ) {
if ( parsed_size > 5 ) {
char * temp = yon_char_append ( local_value , parsed [ 5 ] ) ;
char * temp = yon_char_append ( local_value , parsed [ 5 ] ) ;
free ( local_value ) ;
free ( local_value ) ;
@ -29,7 +33,7 @@ int yon_load_proceed(YON_CONFIG_TYPE type){
}
}
} else if ( strstr ( key , " GROUPADD[ " ) & & local_value ) {
} else if ( strstr ( key , GROUPADD_SEARCH_macro ) & & local_value ) {
if ( parsed_size > 4 ) {
if ( parsed_size > 4 ) {
char * temp = yon_char_append ( local_value , parsed [ 4 ] ) ;
char * temp = yon_char_append ( local_value , parsed [ 4 ] ) ;
free ( local_value ) ;
free ( local_value ) ;
@ -56,8 +60,8 @@ void yon_interface_update(main_window *widgets){
gtk_list_store_clear ( widgets - > GroupsList ) ;
gtk_list_store_clear ( widgets - > GroupsList ) ;
int size ;
int size ;
GtkTreeIter iter ;
GtkTreeIter iter ;
char * def_groups = yon_config_get_by_key ( " USERGROUPS " ) ;
char * def_groups = yon_config_get_by_key ( USERGROUPS_parameter ) ;
config_str users = yon_config_get_all_by_key ( " USERADD " , & size ) ;
config_str users = yon_config_get_all_by_key ( USERADD_parameter , & size ) ;
if ( users ) {
if ( users ) {
for ( int i = 0 ; i < size ; i + + ) {
for ( int i = 0 ; i < size ; i + + ) {
gtk_list_store_append ( widgets - > UsersList , & iter ) ;
gtk_list_store_append ( widgets - > UsersList , & iter ) ;
@ -103,7 +107,7 @@ void yon_interface_update(main_window *widgets){
}
}
free ( users ) ;
free ( users ) ;
}
}
config_str groups = yon_config_get_all_by_key ( " GROUPADD " , & size ) ;
config_str groups = yon_config_get_all_by_key ( GROUPADD_parameter , & size ) ;
if ( groups ) {
if ( groups ) {
for ( int i = 0 ; i < size ; i + + ) {
for ( int i = 0 ; i < size ; i + + ) {
gtk_list_store_append ( widgets - > GroupsList , & iter ) ;
gtk_list_store_append ( widgets - > GroupsList , & iter ) ;
@ -216,7 +220,7 @@ void yon_hide_passwords(template_saving_window *window){
char * old_value ;
char * old_value ;
char * new_value ;
char * new_value ;
gtk_tree_model_get ( model , & iter , 1 , & name , 2 , & old_value , 3 , & new_value , - 1 ) ;
gtk_tree_model_get ( model , & iter , 1 , & name , 2 , & old_value , 3 , & new_value , - 1 ) ;
if ( strstr ( name , " USERADD[ " ) ) {
if ( strstr ( name , USERADD_SEARCH_macro ) ) {
char * old = NULL ;
char * old = NULL ;
char * newv = NULL ;
char * newv = NULL ;
int size = 0 ;
int size = 0 ;
@ -262,7 +266,7 @@ void yon_hide_passwords(template_saving_window *window){
char * new_string = yon_char_unite ( ! yon_char_is_empty ( old ) ? old : " " , " \n " , ! yon_char_is_empty ( newv ) ? newv : " " , NULL ) ;
char * new_string = yon_char_unite ( ! yon_char_is_empty ( old ) ? old : " " , " \n " , ! yon_char_is_empty ( newv ) ? newv : " " , NULL ) ;
gtk_list_store_set ( window - > list , & iter , 7 , new_string , - 1 ) ;
gtk_list_store_set ( window - > list , & iter , 7 , new_string , - 1 ) ;
} else if ( strstr ( name , " GROUPADD[ " ) ) {
} else if ( strstr ( name , GROUPADD_SEARCH_macro ) ) {
char * old = NULL ;
char * old = NULL ;
char * newv = NULL ;
char * newv = NULL ;
int size = 0 ;
int size = 0 ;
@ -300,7 +304,7 @@ void yon_hide_passwords(template_saving_window *window){
gtk_list_store_set ( window - > list , & iter , 7 , new_string , - 1 ) ;
gtk_list_store_set ( window - > list , & iter , 7 , new_string , - 1 ) ;
} else if ( strstr ( name , " DEFAULTPASSWD " ) ) {
} else if ( strstr ( name , DEFAULTPASSWD_parameter ) ) {
char * old = NULL ;
char * old = NULL ;
char * newv = NULL ;
char * newv = NULL ;
if ( ! yon_char_is_empty ( new_value ) & & strlen ( new_value ) > 2 & & new_value [ 0 ] = = ' % ' & & new_value [ 1 ] = = ' % ' ) {
if ( ! yon_char_is_empty ( new_value ) & & strlen ( new_value ) > 2 & & new_value [ 0 ] = = ' % ' & & new_value [ 1 ] = = ' % ' ) {
@ -326,7 +330,7 @@ void yon_hide_passwords(template_saving_window *window){
char * new_string = yon_char_unite ( ! yon_char_is_empty ( old ) ? old : " " , " \n " , ! yon_char_is_empty ( newv ) ? newv : " " , NULL ) ;
char * new_string = yon_char_unite ( ! yon_char_is_empty ( old ) ? old : " " , " \n " , ! yon_char_is_empty ( newv ) ? newv : " " , NULL ) ;
gtk_list_store_set ( window - > list , & iter , 7 , new_string , - 1 ) ;
gtk_list_store_set ( window - > list , & iter , 7 , new_string , - 1 ) ;
} else if ( strstr ( name , " DEFAULTROOTPASSWD " ) ) {
} else if ( strstr ( name , DEFAULTROOTPASSWD_parameter ) ) {
char * old = NULL ;
char * old = NULL ;
char * newv = NULL ;
char * newv = NULL ;
if ( ! yon_char_is_empty ( new_value ) & & strlen ( new_value ) > 2 & & new_value [ 0 ] = = ' % ' & & new_value [ 1 ] = = ' % ' ) {
if ( ! yon_char_is_empty ( new_value ) & & strlen ( new_value ) > 2 & & new_value [ 0 ] = = ' % ' & & new_value [ 1 ] = = ' % ' ) {
@ -355,7 +359,11 @@ void yon_hide_passwords(template_saving_window *window){
}
}
}
}
void on_save_done ( main_window * widgets ) {
void on_save_done ( main_window * widgets , config_str output , int size ) {
char * final_output = yon_char_parsed_to_string ( output , size , " " ) ;
printf ( " testove%s \n " , final_output ) ;
free ( final_output ) ;
yon_char_parsed_free ( output , size ) ;
on_config_update ( NULL , widgets ) ;
on_config_update ( NULL , widgets ) ;
}
}
@ -363,7 +371,7 @@ void on_save_done(main_window *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 ( ) ;
template_saving_window * window = yon_save_proceed ( NULL , YON_CONFIG_BOTH , " users " , " DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*] " , NULL ) ;
template_saving_window * window = yon_save_proceed ( NULL , YON_CONFIG_BOTH , config_get_global_command , NULL ) ;
if ( window ) {
if ( window ) {
if ( main_config . load_mode = = 0 ) {
if ( main_config . load_mode = = 0 ) {
GtkTreeIter iter ;
GtkTreeIter iter ;
@ -376,7 +384,7 @@ void on_config_save(GtkWidget *self, main_window *widgets){
config_str new_parsed = yon_char_parse ( new_value , & new_size , " : " ) ;
config_str new_parsed = yon_char_parse ( new_value , & new_size , " : " ) ;
if ( old_parsed & & new_parsed ) {
if ( old_parsed & & new_parsed ) {
char * parameter_type = yon_char_divide_search ( parameter , " [ " , - 1 ) ;
char * parameter_type = yon_char_divide_search ( parameter , " [ " , - 1 ) ;
if ( ! strcmp ( parameter_type , " USERADD " ) ) {
if ( ! strcmp ( parameter_type , USERADD_parameter ) ) {
if ( old_size > 5 ) {
if ( old_size > 5 ) {
old_parsed = yon_char_parsed_rip ( old_parsed , & old_size , 5 ) ;
old_parsed = yon_char_parsed_rip ( old_parsed , & old_size , 5 ) ;
@ -394,7 +402,7 @@ void on_config_save(GtkWidget *self, main_window *widgets){
yon_char_parsed_free ( old_parsed , old_size ) ;
yon_char_parsed_free ( old_parsed , old_size ) ;
yon_char_parsed_free ( new_parsed , new_size ) ;
yon_char_parsed_free ( new_parsed , new_size ) ;
} else if ( ! strcmp ( parameter_type , " GROUPADD " ) ) {
} else if ( ! strcmp ( parameter_type , GROUPADD_parameter ) ) {
if ( old_size > 3 ) {
if ( old_size > 3 ) {
old_parsed = yon_char_parsed_rip ( old_parsed , & old_size , 3 ) ;
old_parsed = yon_char_parsed_rip ( old_parsed , & old_size , 3 ) ;
@ -425,7 +433,7 @@ void on_config_save(GtkWidget *self, main_window *widgets){
void on_config_global_save ( GtkWidget * self , main_window * widgets ) {
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 , config_get_global_command , NULL ) ;
if ( window ) {
if ( window ) {
yon_hide_passwords ( window ) ;
yon_hide_passwords ( window ) ;
}
}
@ -433,7 +441,7 @@ void on_config_global_save(GtkWidget *self, main_window *widgets){
void on_config_local_save ( GtkWidget * self , main_window * widgets ) {
void on_config_local_save ( GtkWidget * self , main_window * widgets ) {
int size ;
int size ;
config_str keys = yon_config_get_all_by_key ( " USERADD[ " , & size ) ;
config_str keys = yon_config_get_all_by_key ( USERADD_SEARCH_macro , & size ) ;
int passw_size ;
int passw_size ;
config_str passwords = NULL ;
config_str passwords = NULL ;
for ( int i = 0 ; i < size ; i + + ) {
for ( int i = 0 ; i < size ; i + + ) {
@ -455,7 +463,9 @@ void on_config_local_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 ( " system " , YON_CONFIG_LOCAL , " users " , " DEFAULTPASSWD DEFAULTROOTPASSWD DEFAULTUSER HASHPASSWD USERGROUPS ADDADM USERADD[*] USERSHADOW[*] GROUPADD[*] " , NULL ) ;
// char *output = yon_config_save_simple(YON_CONFIG_LOCAL,"system");
// if (output) puts(output);
template_saving_window * window = yon_save_proceed ( " system " , YON_CONFIG_LOCAL , config_get_local_command , NULL ) ;
if ( window ) {
if ( window ) {
yon_hide_passwords ( window ) ;
yon_hide_passwords ( window ) ;
g_signal_connect ( G_OBJECT ( window - > Window ) , " destroy " , G_CALLBACK ( on_save_window_close_update ) , widgets ) ;
g_signal_connect ( G_OBJECT ( window - > Window ) , " destroy " , G_CALLBACK ( on_save_window_close_update ) , widgets ) ;
@ -469,11 +479,11 @@ void on_config_local_save(GtkWidget *self, main_window *widgets){
void on_saving_settings_save ( GtkWidget * self , yon_savasettings_window * window ) {
void on_saving_settings_save ( GtkWidget * self , yon_savasettings_window * window ) {
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > SambaCheck ) ) ) {
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > SambaCheck ) ) ) {
if ( ! yon_config_append ( " SAVE_ROOTCOPY_CHANGES " , " /var/lib/samba " , " , " ) ) {
if ( ! yon_config_append ( SAVE_ROOTCOPY_CHANGES_parameter , " /var/lib/samba " , " , " ) ) {
yon_config_register ( " SAVE_ROOTCOPY_CHANGES " , " [save] " , " /var/lib/samba " ) ;
yon_config_register ( SAVE_ROOTCOPY_CHANGES_parameter , SAVE_ROOTCOPY_CHANGES_get_command , " /var/lib/samba " ) ;
}
}
} else {
} else {
yon_config_remove_element ( " SAVE_ROOTCOPY_CHANGES " , " /var/lib/samba " , " , " ) ;
yon_config_remove_element ( SAVE_ROOTCOPY_CHANGES_parameter , " /var/lib/samba " , " , " ) ;
}
}
on_subwindow_close ( self ) ;
on_subwindow_close ( self ) ;
}
}
@ -730,7 +740,7 @@ yon_savasettings_window *yon_saving_settings_new(){
gtk_widget_show ( window - > Window ) ;
gtk_widget_show ( window - > Window ) ;
yon_window_config_custom_window_setup ( GTK_WINDOW ( window - > Window ) , " savingSettingsWindow " ) ;
yon_window_config_custom_window_setup ( GTK_WINDOW ( window - > Window ) , " savingSettingsWindow " ) ;
gtk_window_set_title ( GTK_WINDOW ( window - > Window ) , SAVESETTINGS_TITLE_LABEL ) ;
gtk_window_set_title ( GTK_WINDOW ( window - > Window ) , SAVESETTINGS_TITLE_LABEL ) ;
char * string = yon_config_get_by_key ( " SAVE_ROOTCOPY_CHANGES " ) ;
char * string = yon_config_get_by_key ( SAVE_ROOTCOPY_CHANGES_parameter ) ;
if ( ! yon_char_is_empty ( string ) & & strstr ( string , " /var/lib/samba " ) ) {
if ( ! yon_char_is_empty ( string ) & & strstr ( string , " /var/lib/samba " ) ) {
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( window - > SambaCheck ) , 1 ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( window - > SambaCheck ) , 1 ) ;
}
}
@ -926,35 +936,35 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window
void on_additional_settings_save ( GtkWidget * self , ubl_settings_usergroups_additional_settings_window * window ) {
void on_additional_settings_save ( GtkWidget * self , ubl_settings_usergroups_additional_settings_window * window ) {
const char * default_user = ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > DefaultUserNameEntry ) ) ;
const char * default_user = ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > DefaultUserNameEntry ) ) ;
if ( ! yon_char_is_empty ( default_user ) ) {
if ( ! yon_char_is_empty ( default_user ) ) {
yon_config_register ( " DEFAULTUSER " , " users " , yon_char_new ( ( char * ) default_user ) ) ;
yon_config_register ( DEFAULTUSER_parameter , " users " , yon_char_new ( ( char * ) default_user ) ) ;
} else {
} else {
yon_config_remove_by_key ( " DEFAULTUSER " ) ;
yon_config_remove_by_key ( DEFAULTUSER_parameter ) ;
}
}
char * default_password = gtk_combo_box_get_active ( GTK_COMBO_BOX ( window - > DefaultPasswordCombo ) ) > 1 ? ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > DefaultPasswordEntry ) ) : NULL ;
char * default_password = gtk_combo_box_get_active ( GTK_COMBO_BOX ( window - > DefaultPasswordCombo ) ) > 1 ? ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > DefaultPasswordEntry ) ) : NULL ;
if ( ! yon_char_is_empty ( default_password ) ) {
if ( ! yon_char_is_empty ( default_password ) ) {
yon_config_register ( " DEFAULTPASSWD " , " users " , default_password ) ;
yon_config_register ( DEFAULTPASSWD_parameter , " users " , default_password ) ;
} else {
} else {
yon_config_remove_by_key ( " DEFAULTPASSWD " ) ;
yon_config_remove_by_key ( DEFAULTPASSWD_parameter ) ;
}
}
char * root_password = gtk_combo_box_get_active ( GTK_COMBO_BOX ( window - > RootPasswordCombo ) ) > 1 ? ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > RootPasswordEntry ) ) : NULL ;
char * root_password = gtk_combo_box_get_active ( GTK_COMBO_BOX ( window - > RootPasswordCombo ) ) > 1 ? ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > RootPasswordEntry ) ) : NULL ;
if ( ! yon_char_is_empty ( root_password ) ) {
if ( ! yon_char_is_empty ( root_password ) ) {
yon_config_register ( " DEFAULTROOTPASSWD " , " users " , root_password ) ;
yon_config_register ( DEFAULTROOTPASSWD_parameter , " users " , root_password ) ;
} else {
} else {
yon_config_remove_by_key ( " DEFAULTROOTPASSWD " ) ;
yon_config_remove_by_key ( DEFAULTROOTPASSWD_parameter ) ;
}
}
int user_k_admin = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > DefaultUserAdministratorCheck ) ) ;
int user_k_admin = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > DefaultUserAdministratorCheck ) ) ;
if ( user_k_admin ) {
if ( user_k_admin ) {
yon_config_register ( " ADDADM " , " users " , " yes " ) ;
yon_config_register ( ADDADM_parameter , " users " , " yes " ) ;
} else {
} else {
yon_config_register ( " ADDADM " , " users " , " no " ) ;
yon_config_register ( ADDADM_parameter , " users " , " no " ) ;
}
}
if ( gtk_combo_box_get_active ( GTK_COMBO_BOX ( window - > PasswordHashCombo ) ) ! = 0 ) {
if ( gtk_combo_box_get_active ( GTK_COMBO_BOX ( window - > PasswordHashCombo ) ) ! = 0 ) {
char * hash = ( char * ) gtk_combo_box_get_active_id ( GTK_COMBO_BOX ( window - > PasswordHashCombo ) ) ;
char * hash = ( char * ) gtk_combo_box_get_active_id ( GTK_COMBO_BOX ( window - > PasswordHashCombo ) ) ;
if ( ! yon_char_is_empty ( hash ) ) {
if ( ! yon_char_is_empty ( hash ) ) {
yon_config_register ( " HASHPASSWD " , " users " , hash ) ;
yon_config_register ( HASHPASSWD_parameter , " users " , hash ) ;
}
}
} else {
} else {
yon_config_remove_by_key ( " HASHPASSWD " ) ;
yon_config_remove_by_key ( HASHPASSWD_parameter ) ;
}
}
}
}
@ -974,27 +984,27 @@ void on_expiration_clicked(GtkWidget *self, ubl_settings_usergroups_user_window
void on_users_boot_toggled ( GtkToggleButton * self ) {
void on_users_boot_toggled ( GtkToggleButton * self ) {
if ( gtk_toggle_button_get_active ( self ) ) {
if ( gtk_toggle_button_get_active ( self ) ) {
char * parameter = yon_config_get_by_key ( " USERADD_SYNC " ) ;
char * parameter = yon_config_get_by_key ( USERADD_SYNC_parameter ) ;
if ( ! parameter ) {
if ( ! parameter ) {
yon_config_register ( " USERADD_SYNC " , " users " , " boot " ) ;
yon_config_register ( USERADD_SYNC_parameter , " users " , " boot " ) ;
} else {
} else {
yon_config_append ( " USERADD_SYNC " , " boot " , " , " ) ;
yon_config_append ( USERADD_SYNC_parameter , " boot " , " , " ) ;
}
}
} else {
} else {
yon_config_remove_element ( " USERADD_SYNC " , " boot " , " , " ) ;
yon_config_remove_element ( USERADD_SYNC_parameter , " boot " , " , " ) ;
}
}
}
}
void on_users_shutdown_toggled ( GtkToggleButton * self ) {
void on_users_shutdown_toggled ( GtkToggleButton * self ) {
if ( gtk_toggle_button_get_active ( self ) ) {
if ( gtk_toggle_button_get_active ( self ) ) {
char * parameter = yon_config_get_by_key ( " USERADD_SYNC " ) ;
char * parameter = yon_config_get_by_key ( USERADD_SYNC_parameter ) ;
if ( ! parameter ) {
if ( ! parameter ) {
yon_config_register ( " USERADD_SYNC " , " users " , " shutdown " ) ;
yon_config_register ( USERADD_SYNC_parameter , " users " , " shutdown " ) ;
} else {
} else {
yon_config_append ( " USERADD_SYNC " , " shutdown " , " , " ) ;
yon_config_append ( USERADD_SYNC_parameter , " shutdown " , " , " ) ;
}
}
} else {
} else {
yon_config_remove_element ( " USERADD_SYNC " , " shutdown " , " , " ) ;
yon_config_remove_element ( USERADD_SYNC_parameter , " shutdown " , " , " ) ;
}
}
}
}
@ -1020,7 +1030,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
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 " ) ;
char * sync_parameters = yon_config_get_by_key ( USERADD_SYNC_parameter ) ;
if ( sync_parameters ) {
if ( sync_parameters ) {
if ( strstr ( sync_parameters , " boot " ) ) {
if ( strstr ( sync_parameters , " boot " ) ) {
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( window - > UsersBootCheck ) , 1 ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( window - > UsersBootCheck ) , 1 ) ;
@ -1065,30 +1075,30 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
}
}
yon_char_parsed_free ( hash_algos , hash_size ) ;
yon_char_parsed_free ( hash_algos , hash_size ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > PasswordHashCombo ) , 0 ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > PasswordHashCombo ) , 0 ) ;
char * default_user = yon_config_get_by_key ( " DEFAULTUSER " ) ;
char * default_user = yon_config_get_by_key ( DEFAULTUSER_parameter ) ;
if ( ! yon_char_is_empty ( default_user ) )
if ( ! yon_char_is_empty ( default_user ) )
gtk_entry_set_text ( GTK_ENTRY ( window - > DefaultUserNameEntry ) , default_user ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > DefaultUserNameEntry ) , default_user ) ;
g_signal_connect ( G_OBJECT ( window - > RootPasswordCombo ) , " changed " , G_CALLBACK ( on_password_combo_changed ) , window - > RootPasswordButton ) ;
g_signal_connect ( G_OBJECT ( window - > RootPasswordCombo ) , " changed " , G_CALLBACK ( on_password_combo_changed ) , window - > RootPasswordButton ) ;
g_signal_connect ( G_OBJECT ( window - > DefaultPasswordCombo ) , " changed " , G_CALLBACK ( on_password_combo_changed ) , window - > DefaultPasswordButton ) ;
g_signal_connect ( G_OBJECT ( window - > DefaultPasswordCombo ) , " changed " , G_CALLBACK ( on_password_combo_changed ) , window - > DefaultPasswordButton ) ;
char * default_password = yon_config_get_by_key ( " DEFAULTPASSWD " ) ;
char * default_password = yon_config_get_by_key ( DEFAULTPASSWD_parameter ) ;
if ( ! yon_char_is_empty ( default_password ) ) {
if ( ! yon_char_is_empty ( default_password ) ) {
gtk_entry_set_text ( GTK_ENTRY ( window - > DefaultPasswordEntry ) , default_password ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > DefaultPasswordEntry ) , default_password ) ;
if ( ! yon_config_check_ignore ( " DEFAULTPASSWD " ) )
if ( ! yon_config_check_ignore ( DEFAULTPASSWD_parameter ) )
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > DefaultPasswordCombo ) , 2 ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > DefaultPasswordCombo ) , 2 ) ;
}
}
char * root_password = yon_config_get_by_key ( " DEFAULTROOTPASSWD " ) ;
char * root_password = yon_config_get_by_key ( DEFAULTROOTPASSWD_parameter ) ;
if ( ! yon_char_is_empty ( root_password ) ) {
if ( ! yon_char_is_empty ( root_password ) ) {
gtk_entry_set_text ( GTK_ENTRY ( window - > RootPasswordEntry ) , root_password ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > RootPasswordEntry ) , root_password ) ;
if ( ! yon_config_check_ignore ( " DEFAULTROOTPASSWD " ) )
if ( ! yon_config_check_ignore ( DEFAULTROOTPASSWD_parameter ) )
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > RootPasswordCombo ) , 2 ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( window - > RootPasswordCombo ) , 2 ) ;
}
}
char * is_k_admin = yon_config_get_by_key ( " ADDADM " ) ;
char * is_k_admin = yon_config_get_by_key ( ADDADM_parameter ) ;
if ( ! yon_char_is_empty ( is_k_admin ) )
if ( ! yon_char_is_empty ( is_k_admin ) )
if ( ! strcmp ( is_k_admin , " yes " ) )
if ( ! strcmp ( is_k_admin , " yes " ) )
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( window - > DefaultUserAdministratorCheck ) , 1 ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( window - > DefaultUserAdministratorCheck ) , 1 ) ;
char * hash = yon_config_get_by_key ( " HASHPASSWD " ) ;
char * hash = yon_config_get_by_key ( HASHPASSWD_parameter ) ;
if ( ! yon_char_is_empty ( hash ) ) {
if ( ! yon_char_is_empty ( hash ) ) {
gtk_combo_box_set_active_id ( GTK_COMBO_BOX ( window - > PasswordHashCombo ) , hash ) ;
gtk_combo_box_set_active_id ( GTK_COMBO_BOX ( window - > PasswordHashCombo ) , hash ) ;
}
}
@ -1179,7 +1189,7 @@ void on_GID_update(GtkWidget *self, ubl_settings_usergroups_group_creation_windo
if ( ! gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userUIDAutoCheck ) ) ) {
if ( ! gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userUIDAutoCheck ) ) ) {
int config_size = 0 ;
int config_size = 0 ;
int final_size = 0 ;
int final_size = 0 ;
config_str config_groups = yon_config_get_all_by_key ( " GROUPADD " , & config_size ) ;
config_str config_groups = yon_config_get_all_by_key ( GROUPADD_parameter , & config_size ) ;
yon_char_parsed_prepend_strings ( config_groups , config_size , " : " ) ;
yon_char_parsed_prepend_strings ( config_groups , config_size , " : " ) ;
config_str final = yon_char_parsed_merge ( main_config . groups , main_config . groups_size , config_groups , config_size , & final_size ) ;
config_str final = yon_char_parsed_merge ( main_config . groups , main_config . groups_size , config_groups , config_size , & final_size ) ;
long prev_busy = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > SystemGroupCheck ) ) ? 0 : main_config . MINGID ;
long prev_busy = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > SystemGroupCheck ) ) ? 0 : main_config . MINGID ;
@ -1260,7 +1270,8 @@ void on_group_save(GtkWidget *self, dictionary *dict){
int shutdown_sync_active = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > GroupaddShutdownCheck ) ) ;
int shutdown_sync_active = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > GroupaddShutdownCheck ) ) ;
if ( shutdown_sync_active ) {
if ( shutdown_sync_active ) {
yon_config_register ( GROUPADD_SYNC ( group_name ) , " users " , " shutdown " ) ;
char * final_command = yon_config_parameter_prepare_command ( dull_parameter_get_command , NULL , " users " , GROUPADD_SYNC ( group_name ) ) ;
yon_config_register ( GROUPADD_SYNC ( group_name ) , final_command , " shutdown " ) ;
} else {
} else {
yon_config_remove_by_key ( GROUPADD_SYNC ( group_name ) ) ;
yon_config_remove_by_key ( GROUPADD_SYNC ( group_name ) ) ;
}
}
@ -1273,7 +1284,8 @@ void on_group_save(GtkWidget *self, dictionary *dict){
" : " , yon_char_return_if_exist ( admins , " x " ) ,
" : " , yon_char_return_if_exist ( admins , " x " ) ,
" : " , yon_char_return_if_exist ( password , " x " ) ,
" : " , yon_char_return_if_exist ( password , " x " ) ,
NULL ) ;
NULL ) ;
yon_config_register ( GROUPADD ( group_name ) , " users " , final_string ) ;
char * final_command = yon_config_parameter_prepare_command ( dull_parameter_get_command , NULL , " users " , GROUPADD_SYNC ( group_name ) ) ;
yon_config_register ( GROUPADD ( group_name ) , final_command , final_string ) ;
GtkTreeIter iter ;
GtkTreeIter iter ;
GtkTreeModel * model = GTK_TREE_MODEL ( widgets - > GroupsList ) ;
GtkTreeModel * 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 ) )
@ -1418,7 +1430,7 @@ void on_standard_groups_accept(GtkWidget *self, ubl_settings_usergroups_group_wi
standard_groups = extend_groups ;
standard_groups = extend_groups ;
}
}
}
}
yon_config_register ( " USERGROUPS " , " users " , standard_groups ) ;
yon_config_register ( USERGROUPS_parameter , USERGROUPS_get_command , standard_groups ) ;
on_subwindow_close ( self ) ;
on_subwindow_close ( self ) ;
}
}
@ -1447,7 +1459,7 @@ void on_standard_groups_open(GtkWidget *self, main_window *widgets){
}
}
g_signal_connect ( G_OBJECT ( window - > GroupsOkButton ) , " clicked " , G_CALLBACK ( on_standard_groups_accept ) , window ) ;
g_signal_connect ( G_OBJECT ( window - > GroupsOkButton ) , " clicked " , G_CALLBACK ( on_standard_groups_accept ) , window ) ;
gtk_window_set_transient_for ( GTK_WINDOW ( window - > GroupsWindow ) , GTK_WINDOW ( widgets - > Window ) ) ;
gtk_window_set_transient_for ( GTK_WINDOW ( window - > GroupsWindow ) , GTK_WINDOW ( widgets - > Window ) ) ;
char * groups = yon_config_get_by_key ( " USERGROUPS " ) ;
char * groups = yon_config_get_by_key ( USERGROUPS_parameter ) ;
if ( ! yon_char_is_empty ( groups ) ) {
if ( ! yon_char_is_empty ( groups ) ) {
GtkTreeIter iter ;
GtkTreeIter iter ;
int size ;
int size ;
@ -1703,7 +1715,7 @@ void on_UID_update(GtkWidget *self, ubl_settings_usergroups_user_window *window)
if ( ! gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userUIDAutoCheck ) ) ) {
if ( ! gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userUIDAutoCheck ) ) ) {
int config_size = 0 ;
int config_size = 0 ;
int final_size = 0 ;
int final_size = 0 ;
config_str config_users = yon_config_get_all_by_key ( " USERADD[ " , & config_size ) ;
config_str config_users = yon_config_get_all_by_key ( USERADD_SEARCH_macro , & config_size ) ;
yon_char_parsed_prepend_strings ( config_users , config_size , " : " ) ;
yon_char_parsed_prepend_strings ( config_users , config_size , " : " ) ;
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 ) ;
long prev_busy = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userCreateSystemCheck ) ) ? 0 : main_config . MINGID ;
long prev_busy = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( window - > userCreateSystemCheck ) ) ? 0 : main_config . MINGID ;
@ -1852,7 +1864,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
}
}
additional_groups = ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > userAdditionalGroupsEntry ) ) ;
additional_groups = ( char * ) gtk_entry_get_text ( GTK_ENTRY ( window - > userAdditionalGroupsEntry ) ) ;
char * default_groups = yon_config_get_by_key ( " USERGROUPS " ) ;
char * default_groups = yon_config_get_by_key ( USERGROUPS_parameter ) ;
if ( ! yon_char_is_empty ( default_groups ) & & ! strcmp ( default_groups , additional_groups ) ) {
if ( ! yon_char_is_empty ( default_groups ) & & ! strcmp ( default_groups , additional_groups ) ) {
additional_groups = " " ;
additional_groups = " " ;
}
}
@ -1969,11 +1981,13 @@ void on_user_save(GtkWidget *self, dictionary *dict){
" : " , yon_char_return_if_exist ( password , " " ) ,
" : " , yon_char_return_if_exist ( password , " " ) ,
NULL ) ;
NULL ) ;
yon_config_register ( USERADD ( login ) , " users " , final_user ) ;
char * final_command = yon_config_parameter_prepare_command ( dull_parameter_get_command , NULL , " users " , USERADD ( login ) ) ;
yon_config_register ( USERADD ( login ) , final_command , final_user ) ;
if ( ! yon_char_is_empty ( window - > old_username ) & & strcmp ( window - > old_username , login ) ) {
if ( ! yon_char_is_empty ( window - > old_username ) & & strcmp ( window - > old_username , login ) ) {
yon_config_remove_by_key ( USERADD ( window - > old_username ) ) ;
yon_config_remove_by_key ( USERADD ( window - > old_username ) ) ;
}
}
yon_config_register ( USERSHADOW ( login ) , " users " , shadow_string ) ;
final_command = yon_config_parameter_prepare_command ( dull_parameter_get_command , NULL , " users " , USERSHADOW ( login ) ) ;
yon_config_register ( USERSHADOW ( login ) , final_command , shadow_string ) ;
if ( ! yon_char_is_empty ( window - > old_username ) & & strcmp ( window - > old_username , login ) ) {
if ( ! yon_char_is_empty ( window - > old_username ) & & strcmp ( window - > old_username , login ) ) {
yon_config_remove_by_key ( USERSHADOW ( window - > old_username ) ) ;
yon_config_remove_by_key ( USERSHADOW ( window - > old_username ) ) ;
}
}
@ -1983,14 +1997,16 @@ void on_user_save(GtkWidget *self, dictionary *dict){
}
}
if ( ! yon_char_is_empty ( useradd_sync_string ) ) {
if ( ! yon_char_is_empty ( useradd_sync_string ) ) {
yon_config_register ( USERADD_SYNC ( login ) , " users " , useradd_sync_string ) ;
final_command = yon_config_parameter_prepare_command ( dull_parameter_get_command , NULL , " users " , USERADD_SYNC ( login ) ) ;
yon_config_register ( USERADD_SYNC ( login ) , final_command , useradd_sync_string ) ;
if ( ! yon_char_is_empty ( window - > old_username ) & & strcmp ( window - > old_username , login ) ) {
if ( ! yon_char_is_empty ( window - > old_username ) & & strcmp ( window - > old_username , login ) ) {
yon_config_remove_by_key ( USERADD_SYNC ( window - > old_username ) ) ;
yon_config_remove_by_key ( USERADD_SYNC ( window - > old_username ) ) ;
}
}
}
}
if ( ! yon_char_is_empty ( usershadow_sync_string ) ) {
if ( ! yon_char_is_empty ( usershadow_sync_string ) ) {
yon_config_register ( USERSHADOW_SYNC ( login ) , " users " , usershadow_sync_string ) ;
final_command = yon_config_parameter_prepare_command ( dull_parameter_get_command , NULL , " users " , USERSHADOW_SYNC ( login ) ) ;
yon_config_register ( USERSHADOW_SYNC ( login ) , final_command , usershadow_sync_string ) ;
if ( ! yon_char_is_empty ( window - > old_username ) & & strcmp ( window - > old_username , login ) ) {
if ( ! yon_char_is_empty ( window - > old_username ) & & strcmp ( window - > old_username , login ) ) {
yon_config_remove_by_key ( USERSHADOW_SYNC ( window - > old_username ) ) ;
yon_config_remove_by_key ( USERSHADOW_SYNC ( window - > old_username ) ) ;
}
}
@ -2010,7 +2026,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
2 , yon_char_return_if_exist ( login , " " ) ,
2 , yon_char_return_if_exist ( login , " " ) ,
3 , yon_char_return_if_exist ( username , " " ) ,
3 , yon_char_return_if_exist ( username , " " ) ,
4 , yon_char_return_if_exist ( main_group , login ) ,
4 , yon_char_return_if_exist ( main_group , login ) ,
5 , yon_char_return_if_exist ( additional_groups , yon_config_get_by_key ( " USERGROUPS " ) ) ,
5 , yon_char_return_if_exist ( additional_groups , yon_config_get_by_key ( USERGROUPS_parameter ) ) ,
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 ) ,
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 , password_status ,
7 , password_status ,
- 1 ) ;
- 1 ) ;
@ -2301,7 +2317,7 @@ void on_main_add(GtkWidget *self, main_window *widgets){
ubl_settings_usergroups_user_window * window = yon_ubl_settings_usergroups_user_new ( ) ;
ubl_settings_usergroups_user_window * window = yon_ubl_settings_usergroups_user_new ( ) ;
gtk_window_set_title ( GTK_WINDOW ( window - > CreateUserWindow ) , ADD_USER_TITLE_LABEL ) ;
gtk_window_set_title ( GTK_WINDOW ( window - > CreateUserWindow ) , ADD_USER_TITLE_LABEL ) ;
gtk_label_set_text ( GTK_LABEL ( window - > userTitleNameLabel ) , ADD_USER_TITLE_LABEL ) ;
gtk_label_set_text ( GTK_LABEL ( window - > userTitleNameLabel ) , ADD_USER_TITLE_LABEL ) ;
char * default_groups = yon_config_get_by_key ( " USERGROUPS " ) ;
char * default_groups = yon_config_get_by_key ( USERGROUPS_parameter ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > userAdditionalGroupsEntry ) , default_groups ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > userAdditionalGroupsEntry ) , default_groups ) ;
dictionary * dict = 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 , " widgets " , widgets ) ;
@ -2371,7 +2387,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){
if ( strcmp ( parameters [ 3 ] , " x " ) ) {
if ( strcmp ( parameters [ 3 ] , " x " ) ) {
gtk_entry_set_text ( GTK_ENTRY ( window - > userAdditionalGroupsEntry ) , parameters [ 3 ] ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > userAdditionalGroupsEntry ) , parameters [ 3 ] ) ;
} else {
} else {
char * default_groups = yon_config_get_by_key ( " USERGROUPS " ) ;
char * default_groups = yon_config_get_by_key ( USERGROUPS_parameter ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > userAdditionalGroupsEntry ) , default_groups ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > userAdditionalGroupsEntry ) , default_groups ) ;
}
}