[libvirt] [PATCH v2 3/5] Extend nwfilter schema to accept comment attributes

Eric Blake eblake at redhat.com
Mon Sep 27 21:07:47 UTC 2010


On 09/27/2010 12:40 PM, Stefan Berger wrote:
> Extend the nwfilter.rng schema to accept comment attributes for all protocol
> types.
>
> Signed-off-by: Stefan Berger <stefanb at us.ibm.com>
>
>
> +  <define name="comment-attribute">
> +    <interleave>
> +      <optional>
> +        <attribute name="comment">
> +          <ref name="comment-type"/>
> +        </attribute>
> +      </optional>
> +    </interleave>
> +  </define>

Maybe I'm not understanding rng, but what is being interleaved here?  Do 
things still validate if "comment-attribute" does not contain an 
<interleave>?

> +
> +  <define name='comment-type'>
> +    <data type="string">
> +      <param name="pattern">[a-zA-Z0-9`~\^!@#$%\-_+=|\\:";,./ \(\)\[\]\{\}"&<>']*</param>

Since we are enforcing a maximum comment length of 256, would it make 
sense to use {0,256} rather than * (or is it \{0,256\} for this flavor 
of regular expression)?  This explicitly leaves out tabs; I guess that's 
okay.  It also leaves out 8-bit bytes - could that be a problem for i18n 
where people want comments with native-language accented characters? 
That is, are we being too strict here?  Maybe a better pattern would be 
to reject specific non-printing ASCII bytes we want to avoid, assuing 
you can use escape sequences like [^\001]?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list