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 <[email protected]>
---
 parser/parser_interface.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/parser/parser_interface.c b/parser/parser_interface.c
index 54b2504..cc291a7 100644
--- a/parser/parser_interface.c
+++ b/parser/parser_interface.c
@@ -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;
                }
-- 
1.7.7.3


-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to