summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-08-04 19:56:08 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-10-26 10:29:38 -0400
commitb30701edb4b543bf6432d5ae3a801574ecc83b0c (patch)
treeaff216bd9e115e3577460d38bad0016e8199ec60
parent5a8352b2a05b3a59d737635bffb7a0ef2fca137f (diff)
downloadsssd-b30701edb4b543bf6432d5ae3a801574ecc83b0c.tar.gz
sssd-b30701edb4b543bf6432d5ae3a801574ecc83b0c.tar.xz
sssd-b30701edb4b543bf6432d5ae3a801574ecc83b0c.zip
pyhbac: Do not convert int to bool
-rw-r--r--src/python/pyhbac.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/python/pyhbac.c b/src/python/pyhbac.c
index 230b9316a..698becaa6 100644
--- a/src/python/pyhbac.c
+++ b/src/python/pyhbac.c
@@ -710,6 +710,8 @@ HbacRule_traverse(HbacRuleObject *self, visitproc visit, void *arg)
}
static int
+hbac_rule_set_enabled(HbacRuleObject *self, PyObject *enabled, void *closure);
+static int
hbac_rule_set_name(HbacRuleObject *self, PyObject *name, void *closure);
static int
@@ -718,14 +720,21 @@ HbacRule_init(HbacRuleObject *self, PyObject *args, PyObject *kwargs)
const char * const kwlist[] = { "name", "enabled", NULL };
PyObject *name = NULL;
PyObject *empty_tuple = NULL;
+ PyObject *enabled=NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- sss_py_const_p(char, "O|i"),
+ sss_py_const_p(char, "O|O"),
discard_const_p(char *, kwlist),
- &name, &self->enabled)) {
+ &name, &enabled)) {
return -1;
}
+ if (enabled) {
+ if (hbac_rule_set_enabled(self, enabled, NULL) == -1) {
+ return -1;
+ }
+ }
+
if (hbac_rule_set_name(self, name, NULL) == -1) {
return -1;
}