Test Prompt for root password if configuration file is created in a directory not owned by the user

pull/300/head
parent 85a5ba6e78
commit dde99ecb56

@ -26,9 +26,17 @@ int yon_configuration_path_check(const char *path){
data->action_text = homedir_create?CREATE_CONFIG_DIALOG_LABEL_HOMEDIR:CREATE_CONFIG_DIALOG_LABEL; data->action_text = homedir_create?CREATE_CONFIG_DIALOG_LABEL_HOMEDIR:CREATE_CONFIG_DIALOG_LABEL;
data->title = WARNING_TITLE_LABEL; data->title = WARNING_TITLE_LABEL;
if (yon_confirmation_dialog_call(NULL,data)==GTK_RESPONSE_ACCEPT){ if (yon_confirmation_dialog_call(NULL,data)==GTK_RESPONSE_ACCEPT){
char *dir_path = yon_file_get_parent(full_path);
if (access(full_path,F_OK)&&(access(dir_path,W_OK)||access(dir_path,R_OK))){
if (system(ubconfig_file_create_pkexec(full_path))){
return 0;
}
} else if (access(full_path,F_OK)){
yon_launch(ubconfig_file_create(full_path)); yon_launch(ubconfig_file_create(full_path));
struct passwd *user = getpwnam(yon_ubl_root_user_get()); struct passwd *user = getpwnam(yon_ubl_root_user_get());
if (chown(full_path,user->pw_uid,user->pw_gid)){}; if (chown(full_path,user->pw_uid,user->pw_gid)){};
}
} else { } else {
return 0; return 0;

@ -294,6 +294,7 @@ layout && /description:/ {\
#define get_devices_command "ubinstall show --lsdevices" #define get_devices_command "ubinstall show --lsdevices"
#define get_parts_for_device_command "ubinstall show --lsparts" #define get_parts_for_device_command "ubinstall show --lsparts"
#define get_modules_command "ubinstall show --lsmodules" #define get_modules_command "ubinstall show --lsmodules"
#define ubconfig_file_create_pkexec(target) yon_char_unite("pkexec ubconfig --target \"",target,"\" create",NULL)
#define config_get_command(target) yon_char_unite("ubconfig -ea --conarg --source ", target, " get [autoinstall] AUTOINSTALL[*] -- get [locale] LANG", NULL) #define config_get_command(target) yon_char_unite("ubconfig -ea --conarg --source ", target, " get [autoinstall] AUTOINSTALL[*] -- get [locale] LANG", NULL)

Loading…
Cancel
Save