diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-03-08 17:05:40 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-03-08 17:05:40 +0100 |
commit | f5cfd405b1d731e5b8582c66a3b5006c9d0209ce (patch) | |
tree | 7f253dffc8924a79bdc20e4e6e2c2d13d5f96555 | |
parent | 49c4d673661e968831390fabfe0ce69716e5e1c7 (diff) |
Err if fail to get valid path to use for kms-server-proxy
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | main.c | 12 |
2 files changed, 10 insertions, 4 deletions
@@ -0,0 +1,2 @@ +Instead of checking if $HOME and / has permissions, check if ~/.local/share/gpu-screen-recorder has permission by going up the tree, + checking ~/.local/share/gpu-screen-recorder and then ~/.local/share and so on, until /.
\ No newline at end of file @@ -286,7 +286,8 @@ static int setup_gsr_ui(const char *user_homepath) { } char kms_server_proxy_local_filepath[PATH_MAX]; - get_local_kms_server_proxy_filepath(kms_server_proxy_local_filepath, sizeof(kms_server_proxy_local_filepath), user_homepath); + if(!get_local_kms_server_proxy_filepath(kms_server_proxy_local_filepath, sizeof(kms_server_proxy_local_filepath), user_homepath)) + return 1; /* Weird-ass distros like openSUSE only allow pkexec for files in $HOME!!! */ char kms_server_proxy_home[PATH_MAX]; @@ -324,7 +325,8 @@ static bool is_setup(const char *user_homepath) { } char kms_server_proxy_local_filepath[PATH_MAX]; - get_local_kms_server_proxy_filepath(kms_server_proxy_local_filepath, sizeof(kms_server_proxy_local_filepath), user_homepath); + if(!get_local_kms_server_proxy_filepath(kms_server_proxy_local_filepath, sizeof(kms_server_proxy_local_filepath), user_homepath)) + return false; if(!file_has_capabilities(kms_server_proxy_local_filepath, (const cap_value_t[]){ CAP_SYS_ADMIN, CAP_SETUID }, 2)) { fprintf(stderr, "Error: kms-server-proxy (%s) is either not installed or is missing capabilities\n", kms_server_proxy_local_filepath); @@ -342,7 +344,8 @@ static int launch_gsr_kms_server(const char *initial_socket_path, const char *ca } char kms_server_proxy_local_filepath[PATH_MAX]; - get_local_kms_server_proxy_filepath(kms_server_proxy_local_filepath, sizeof(kms_server_proxy_local_filepath), user_homepath); + if(!get_local_kms_server_proxy_filepath(kms_server_proxy_local_filepath, sizeof(kms_server_proxy_local_filepath), user_homepath)) + return 1; /* Weird-ass distros like openSUSE only allow pkexec for files in $HOME!!! */ char kms_server_proxy_home[PATH_MAX]; @@ -407,7 +410,8 @@ static int launch_gsr_global_hotkeys(char **argv) { const char *user_homepath = argv[2]; char kms_server_proxy_local_filepath[PATH_MAX]; - get_local_kms_server_proxy_filepath(kms_server_proxy_local_filepath, sizeof(kms_server_proxy_local_filepath), user_homepath); + if(!get_local_kms_server_proxy_filepath(kms_server_proxy_local_filepath, sizeof(kms_server_proxy_local_filepath), user_homepath)) + return 1; if(!file_has_capabilities(kms_server_proxy_local_filepath, (const cap_value_t[]){ CAP_SETUID }, 1)) { fprintf(stderr, "Error: kms-server-proxy (%s) is either not installed or is missing capabilities\n", kms_server_proxy_local_filepath); |