On Fri, Jan 25, 2013 at 11:50:20PM -0800, John Johansen wrote:
> >> +  if (unpack_str(e, &name, "namespace")) {
> >> +          if (*ns && strcmp(*ns, name)) {
> >> +                  audit_iface(NULL, NULL, "invalide ns change", e, error);
> >> +          } else if (!*ns)
> >> +                  *ns = name;

> the ns from the pack stream is only set if the policy being loaded
> specifies one. We only get into the conditional block setting it if
> 
> +     if (unpack_str(e, &name, "namespace")) {
> 
> succeeds.
> 
> If its not specified then it should be, but isn't, set to null *sigh*

Okay, so the first branch (*ns && strcmp(*ns, name)) is aimed primarily
at a future use where the kernel loading code _expects_ a namespace in
the packed stream (LXC?) and the "else if (!*ns)" is the code path that
you _wanted_ to be default when the packed stream sets a namespace, but
because the = NULL is missing in aa_replace_profiles(), is accidentally
skipped?

Is that about right?

Where else might eventually call aa_unpack _without_ wanting to know the
namespace set in a stream? Could the if(!*ns) go away and just write
into *ns regardless? It feels like it'll always be needed.

Thanks John

Attachment: signature.asc
Description: Digital signature

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

Reply via email to