* [PATCH][ACM] Add type check and conversion to get_decision
@ 2006-05-31 13:34 Bryan D. Payne
0 siblings, 0 replies; only message in thread
From: Bryan D. Payne @ 2006-05-31 13:34 UTC (permalink / raw)
To: xen-devel; +Cc: Bryan D. Payne, Reiner Sailer
This patch allows 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>
---
tools/python/xen/util/security.py | 9 +++++++++
1 file changed, 9 insertions(+)
Index: xen-unstable.hg-shype/tools/python/xen/util/security.py
===================================================================
--- xen-unstable.hg-shype.orig/tools/python/xen/util/security.py
+++ xen-unstable.hg-shype/tools/python/xen/util/security.py
@@ -429,6 +429,15 @@ def get_decision(arg1, arg2):
err("Argument type not supported.")
ssidref = label2ssidref(arg2[2][1], arg2[1][1])
arg2 = ['ssidref', str(ssidref)]
+
+ # accept only int or string types for domid and ssidref
+ if isinstance(arg1[1], int):
+ arg1[1] = str(arg1[1])
+ if isinstance(arg2[1], int):
+ arg2[1] = str(arg2[1])
+ if not isinstance(arg1[1], str) or not isinstance(arg2[1], str):
+ err("Invalid id or ssidref type, string or int required")
+
try:
decision = acm.getdecision(arg1[0], arg1[1], arg2[0], arg2[1])
except:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-05-31 13:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-31 13:34 [PATCH][ACM] Add type check and conversion to get_decision Bryan D. Payne
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.