summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-10-15 14:11:01 -0400
committerSimo Sorce <ssorce@redhat.com>2009-10-15 18:19:49 -0400
commit02bf83eaf9eb9733536c6c56afcbc70e312b3cd6 (patch)
tree969d468391f50b3d013bcec2f793c701501fb58d
parent66e96fc32e09b24ade6594c1f82e309c728ba7f4 (diff)
downloadsssd-02bf83eaf9eb9733536c6c56afcbc70e312b3cd6.tar.gz
sssd-02bf83eaf9eb9733536c6c56afcbc70e312b3cd6.tar.bz2
sssd-02bf83eaf9eb9733536c6c56afcbc70e312b3cd6.zip
Clean up warnings in pysss.c
On older versions of the python headers, some arguments used 'char *' instead of 'const char *', which means that assigning a constant string such as "adduser" threw a warning about discarding qualifiers. This patch cleans up most of these warnings in this file. There remain several warnings in the sss_local_methods initialization that I do not know how to fix.
-rw-r--r--server/python/pysss.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/server/python/pysss.c b/server/python/pysss.c
index 9ce082ba..a9a949ef 100644
--- a/server/python/pysss.c
+++ b/server/python/pysss.c
@@ -176,7 +176,8 @@ static PyObject *py_sss_useradd(PySssLocalObject *self,
PyObject *py_groups = Py_None;
/* parse arguments */
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|kksssO!",
+ if (!PyArg_ParseTupleAndKeywords(args, kwds,
+ discard_const_p(char, "s|kksssO!"),
discard_const_p(char *, kwlist),
&username,
&uid,
@@ -264,7 +265,7 @@ static PyObject *py_sss_userdel(PySssLocalObject *self,
char *username = NULL;
int ret;
- if(!PyArg_ParseTuple(args, "s", &username)) {
+ if(!PyArg_ParseTuple(args, discard_const_p(char, "s"), &username)) {
goto fail;
}
@@ -345,7 +346,8 @@ static PyObject *py_sss_usermod(PySssLocalObject *self,
"addgroups", "rmgroups", NULL };
/* parse arguments */
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|kkksssO!O!",
+ if (!PyArg_ParseTupleAndKeywords(args, kwds,
+ discard_const_p(char, "s|kkksssO!O!"),
discard_const_p(char *, kwlist),
&username,
&uid,
@@ -453,7 +455,8 @@ static PyObject *py_sss_groupadd(PySssLocalObject *self,
const char * const kwlist[] = { "groupname", "gid", NULL };
/* parse arguments */
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|k",
+ if (!PyArg_ParseTupleAndKeywords(args, kwds,
+ discard_const_p(char, "s|k"),
discard_const_p(char *, kwlist),
&groupname,
&gid)) {
@@ -517,7 +520,7 @@ static PyObject *py_sss_groupdel(PySssLocalObject *self,
char *groupname = NULL;
int ret;
- if(!PyArg_ParseTuple(args, "s", &groupname)) {
+ if(!PyArg_ParseTuple(args, discard_const_p(char, "s"), &groupname)) {
goto fail;
}
@@ -588,7 +591,8 @@ static PyObject *py_sss_groupmod(PySssLocalObject *self,
"rmgroups", NULL };
/* parse arguments */
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|kO!O!",
+ if (!PyArg_ParseTupleAndKeywords(args, kwds,
+ discard_const_p(char, "s|kO!O!"),
discard_const_p(char *, kwlist),
&groupname,
&gid,
@@ -808,11 +812,11 @@ initpysss(void)
if (PyType_Ready(&pysss_local_type) < 0)
return;
- m = Py_InitModule("pysss", module_methods);
+ m = Py_InitModule(discard_const_p(char, "pysss"), module_methods);
if (m == NULL)
return;
Py_INCREF(&pysss_local_type);
- PyModule_AddObject(m, "local", (PyObject *)&pysss_local_type);
+ PyModule_AddObject(m, discard_const_p(char, "local"), (PyObject *)&pysss_local_type);
}