diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-10-23 10:05:15 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-10-23 10:05:15 +0100 |
commit | 0dba100da61528c1d36844a00ba2676b4712aa67 (patch) | |
tree | 82a83ca3db2728185d0c1636d04cba3e47bf261b /tools/flask/libflask | |
parent | 545a227dfc099af8b17b6842e097196192658c3e (diff) | |
download | xen-0dba100da61528c1d36844a00ba2676b4712aa67.tar.gz xen-0dba100da61528c1d36844a00ba2676b4712aa67.tar.bz2 xen-0dba100da61528c1d36844a00ba2676b4712aa67.zip |
xsm: Add getenforce and setenforce functionality to tools
This patch exposes the getenforce and setenforce functionality for the
Flask XSM module.
Signed-off-by : Machon Gregory <mbgrego@tycho.ncsc.mil>
Signed-off-by : George S. Coker, II <gscoker@alpha.ncsc.mil>
Diffstat (limited to 'tools/flask/libflask')
-rw-r--r-- | tools/flask/libflask/flask_op.c | 39 | ||||
-rw-r--r-- | tools/flask/libflask/include/flask.h | 2 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tools/flask/libflask/flask_op.c b/tools/flask/libflask/flask_op.c index 396c0814a8..579be20d96 100644 --- a/tools/flask/libflask/flask_op.c +++ b/tools/flask/libflask/flask_op.c @@ -70,3 +70,42 @@ int flask_sid_to_context(int xc_handle, int sid, char *buf, uint32_t size) return 0; } + +int flask_getenforce(int xc_handle) +{ + int err; + flask_op_t op; + char buf[20]; + int size = 20; + int mode; + + op.cmd = FLASK_GETENFORCE; + op.buf = buf; + op.size = size; + + if ( (err = xc_flask_op(xc_handle, &op)) != 0 ) + return err; + + sscanf(buf, "%i", &mode); + + return mode; +} + +int flask_setenforce(int xc_handle, int mode) +{ + int err; + flask_op_t op; + char buf[20]; + int size = 20; + + op.cmd = FLASK_SETENFORCE; + op.buf = buf; + op.size = size; + + snprintf(buf, size, "%i", mode); + + if ( (err = xc_flask_op(xc_handle, &op)) != 0 ) + return err; + + return 0; +} diff --git a/tools/flask/libflask/include/flask.h b/tools/flask/libflask/include/flask.h index 5241f7a2a0..31f6263404 100644 --- a/tools/flask/libflask/include/flask.h +++ b/tools/flask/libflask/include/flask.h @@ -18,5 +18,7 @@ int flask_load(int xc_handle, char *buf, uint32_t size); int flask_context_to_sid(int xc_handle, char *buf, uint32_t size, uint32_t *sid); int flask_sid_to_context(int xc_handle, int sid, char *buf, uint32_t size); +int flask_getenforce(int xc_handle); +int flask_setenforce(int xc_handle, int mode); #endif /* __FLASK_H__ */ |