ia64/xen-unstable

changeset 18535:fd3f54eb23e1

acm, xend: Catch bad vlan identifiers

Add code to intercept badly formatted VLAN identifiers or
those that are out of range.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Sep 23 12:30:42 2008 +0100 (2008-09-23)
parents df6f9fe48f11
children f4552d9f6afb
files tools/python/xen/util/xsm/acm/acm.py
line diff
     1.1 --- a/tools/python/xen/util/xsm/acm/acm.py	Mon Sep 22 16:10:25 2008 +0100
     1.2 +++ b/tools/python/xen/util/xsm/acm/acm.py	Tue Sep 23 12:30:42 2008 +0100
     1.3 @@ -862,6 +862,15 @@ def unify_resname(resource, mustexist=Tr
     1.4          if mustexist and not os.path.isfile(resfile):
     1.5              err("Invalid resource")
     1.6  
     1.7 +    if typ == "vlan":
     1.8 +        try:
     1.9 +            vlan = int(resfile)
    1.10 +            if vlan < 1 or vlan > 4095:
    1.11 +                err("VLAN ID %d out of range." % vlan)
    1.12 +        except Exception, e:
    1.13 +            err("Invalid VLAN : %s" % resfile)
    1.14 +
    1.15 +
    1.16      #file: resources must be specified with absolute path
    1.17      #vlan resources don't start with '/'
    1.18      if typ != "vlan":