Default home directory loads from '/etc/default/useradd'

pull/116/head
parent 2961224c4b
commit 7968d41876

@ -1528,7 +1528,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){
if (user_home_active==2){
user_home=yon_char_unite(" --home-dir ",(char*)gtk_entry_get_text(GTK_ENTRY(window->userHomeEntry)),NULL);
} else if (user_home_active==0){
user_home=yon_char_unite(" --home-dir /home/",login,NULL);
user_home=yon_char_unite(" --home-dir ",main_config.default_home,"/",login,NULL);
} else if (user_home_active==1){
user_home="--no-create-home";
} else user_home = "";
@ -2163,6 +2163,18 @@ void config_init(){
}
}
yon_char_parsed_free(login_defs,login_size);
int size=0;
main_config.default_home = NULL;
config_str file_output = yon_file_open(default_home_initiator_path,&size);
for (int i=0;i<size;i++){
char *parameter = yon_char_divide_search(file_output[i],"=",-1);
if (!strcmp(parameter,"HOME")){
if (file_output[i][strlen(file_output[i])-1]=='\n') file_output[i][strlen(file_output[i])-1]='\0';
main_config.default_home=yon_char_new(file_output[i]);
}
free(parameter);
}
// yon_char_parsed_free(file_output,size);
}
void on_selection_changed(GtkWidget *self, main_window *widgets){

@ -53,6 +53,7 @@
#define password_limits_path "/etc/security/pwquiality.conf"
#define get_home_command "getent passwd "$USER" | cut -d: -f6"
#define remove_home_dirs_command(users_string) yon_char_append("/usr/lib/ublinux/functions remove_userhome ", users_string)
#define default_home_initiator_path "/etc/default/useradd"
#define hash_list_path "/usr/share/ubl-settings-usergroups/csv/hash_list.csv"
#define shell_list_path "/usr/share/ubl-settings-usergroups/csv/shell_list.csv"
@ -108,6 +109,7 @@ typedef struct {
int sync_size;
config_str remove_homes;
int homes_size;
char *default_home;
} config;
typedef struct {

Loading…
Cancel
Save