summaryrefslogtreecommitdiff
path: root/src/python
diff options
context:
space:
mode:
Diffstat (limited to 'src/python')
-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 230b9316..698becaa 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;
}