summaryrefslogtreecommitdiff
path: root/src/python
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-08-04 19:56:08 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-08-04 14:15:13 -0400
commit8b6801a0b180ef87118e8f071eb2eeea4607baf1 (patch)
treea7fd2aa3f34cf0ae11bb7feade444df79c51cb8e /src/python
parentda9ccebbba19c8fd9851d155f9de0c16bba56f47 (diff)
downloadsssd-8b6801a0b180ef87118e8f071eb2eeea4607baf1.tar.gz
sssd-8b6801a0b180ef87118e8f071eb2eeea4607baf1.tar.bz2
sssd-8b6801a0b180ef87118e8f071eb2eeea4607baf1.zip
pyhbac: Do not convert int to bool
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;
}