mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
aa-exec: Clarify ENOENT and EACCES errors when changing profiles
The aa-exec tool was indicating, in an error message, that a profile didn't exist in cases where aa_change_profile() failed with errno set to ENOENT or EACCES. However, the EACCES error means that changing to the target profile is not allowed. This patch fixes the error message in the cause of EACCES: $ ./aa-exec -p dne -- true aa-exec: ERROR: profile 'dne' does not exist $ ./aa-exec -p /usr/sbin/tcpdump -- ./aa-exec -p unconfined -- true aa-exec: ERROR: insufficient permissions to change to the profile 'unconfined' Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
This commit is contained in:
parent
652dac0cec
commit
95286bb9e7
@ -201,9 +201,12 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (rc) {
|
||||
if (errno == ENOENT || errno == EACCES) {
|
||||
if (errno == ENOENT) {
|
||||
error("%s '%s' does not exist",
|
||||
opt_profile ? "profile" : "namespace", name);
|
||||
} else if (errno == EACCES) {
|
||||
error("insufficient permissions to change to the %s '%s'",
|
||||
opt_profile ? "profile" : "namespace", name);
|
||||
} else if (errno == EINVAL) {
|
||||
error("AppArmor interface not available");
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user