2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-04 08:15:21 +00:00

Fix apparmor_parser when removing a profile from an alternate namespace

The module interface calls for names with namespaces to be in the format of

  :namespace:profile or :namespace://profile

but the parser was generating
  namespace:profile

causing profile lookup to fail, or removal of the wrong profile as it was
done against the current namespace, instead of the specified namespace

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
This commit is contained in:
John Johansen
2012-01-02 15:35:21 -08:00
parent f0f520eeff
commit c259deb5b2

View File

@@ -763,10 +763,10 @@ int sd_serialize_codomain(int option, struct codomain *cod)
int len = 0;
if (profile_namespace) {
len += strlen(profile_namespace) + 1;
len += strlen(profile_namespace) + 2;
ns = profile_namespace;
} else if (cod->namespace) {
len += strlen(cod->namespace) + 1;
len += strlen(cod->namespace) + 2;
ns = cod->namespace;
}
if (cod->parent) {
@@ -778,7 +778,7 @@ int sd_serialize_codomain(int option, struct codomain *cod)
goto exit;
}
if (ns)
sprintf(name, "%s:%s//%s", ns,
sprintf(name, ":%s:%s//%s", ns,
cod->parent->name, cod->name);
else
sprintf(name, "%s//%s", cod->parent->name,
@@ -790,7 +790,7 @@ int sd_serialize_codomain(int option, struct codomain *cod)
error = -errno;
goto exit;
}
sprintf(name, "%s:%s", ns, cod->name);
sprintf(name, ":%s:%s", ns, cod->name);
} else {
name = cod->name;
}