esound, native: Pass an absolute path to pa_authkey_load() when using a file in the home directory

If a relative path is passed to pa_authkey_load(), it will interpret
the path as relative to the home directory. This is wrong, because
relative paths should be interpreted to be relative to the config home
directory. Before fixing pa_authkey_load(), this patch prepares for
the change by using absolute paths when the file actually needs to be
in the home directory (i.e. the fallback cookie path for the native
protocol and the default cookie path for the esound protocol).
This commit is contained in:
Tanu Kaskinen 2014-06-08 16:32:58 +03:00
parent 50042da434
commit 14845b2c8e
4 changed files with 35 additions and 10 deletions

View file

@ -5303,7 +5303,12 @@ int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) {
else {
o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE, false, PA_NATIVE_COOKIE_LENGTH);
if (!o->auth_cookie) {
o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE_FALLBACK, false, PA_NATIVE_COOKIE_LENGTH);
char *fallback_path;
if (pa_append_to_home_dir(PA_NATIVE_COOKIE_FILE_FALLBACK, &fallback_path) >= 0) {
o->auth_cookie = pa_auth_cookie_get(c, fallback_path, false, PA_NATIVE_COOKIE_LENGTH);
pa_xfree(fallback_path);
}
if (!o->auth_cookie)
o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE, true, PA_NATIVE_COOKIE_LENGTH);