ia64/xen-unstable

changeset 10283:bcfbbca9cf08

[SECURITY] Allow domid and ssidref args to get_decision in
util/security.py to be either strings or ints (previously only strings
would work due to the underlying call to lowlevel.acm).

Signed-off-by: Bryan D. Payne <bdpayne@us.ibm.com>
Signed-off-by: Reiner Sailer <sailer@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 01 18:30:28 2006 +0100 (2006-06-01)
parents 0f5b8f1b0eac
children 61e2ea81bd65
files tools/python/xen/util/security.py
line diff
     1.1 --- a/tools/python/xen/util/security.py	Thu Jun 01 18:29:23 2006 +0100
     1.2 +++ b/tools/python/xen/util/security.py	Thu Jun 01 18:30:28 2006 +0100
     1.3 @@ -426,6 +426,15 @@ def get_decision(arg1, arg2):
     1.4              err("Argument type not supported.")
     1.5          ssidref = label2ssidref(arg2[2][1], arg2[1][1])
     1.6          arg2 = ['ssidref', str(ssidref)]
     1.7 +
     1.8 +    # accept only int or string types for domid and ssidref
     1.9 +    if isinstance(arg1[1], int):
    1.10 +        arg1[1] = str(arg1[1])
    1.11 +    if isinstance(arg2[1], int):
    1.12 +        arg2[1] = str(arg2[1])
    1.13 +    if not isinstance(arg1[1], str) or not isinstance(arg2[1], str):
    1.14 +        err("Invalid id or ssidref type, string or int required")
    1.15 +
    1.16      try:
    1.17          decision = acm.getdecision(arg1[0], arg1[1], arg2[0], arg2[1])
    1.18      except: