summaryrefslogtreecommitdiff
path: root/python/rpmsmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'python/rpmsmodule.c')
-rw-r--r--python/rpmsmodule.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/python/rpmsmodule.c b/python/rpmsmodule.c
index a8289b5f6..72465221d 100644
--- a/python/rpmsmodule.c
+++ b/python/rpmsmodule.c
@@ -5,33 +5,36 @@
static char rpms__doc__[] =
"";
+static int parseSignArgs(PyObject * args, PyObject *kwds,
+ const char **path, struct rpmSignArgs *sargs)
+{
+ char * kwlist[] = { "path", "keyid", "hashalgo", NULL };
+
+ memset(sargs, 0, sizeof(*sargs));
+ return PyArg_ParseTupleAndKeywords(args, kwds, "s|si", kwlist,
+ path, &sargs->keyid, &sargs->hashalgo);
+}
+
static PyObject * addSign(PyObject * self, PyObject * args, PyObject *kwds)
{
const char *path = NULL;
- const char *passPhrase = NULL;
- char * kwlist[] = { "path", "passPhrase", "keyid", "hashalgo", NULL };
- struct rpmSignArgs sig, *sigp = NULL;
+ struct rpmSignArgs sargs;
- memset(&sig, 0, sizeof(sig));
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss|si", kwlist,
- &path, &passPhrase, &sig.keyid, &sig.hashalgo))
+ if (parseSignArgs(args, kwds, &path, &sargs))
return NULL;
- if (sig.keyid || sig.hashalgo)
- sigp = &sig;
-
- return PyBool_FromLong(rpmPkgSign(path, sigp, passPhrase) == 0);
+ return PyBool_FromLong(rpmPkgSign(path, &sargs) == 0);
}
static PyObject * delSign(PyObject * self, PyObject * args, PyObject *kwds)
{
const char *path = NULL;
- char * kwlist[] = { "path", NULL };
+ struct rpmSignArgs sargs;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &path))
+ if (parseSignArgs(args, kwds, &path, &sargs))
return NULL;
- return PyBool_FromLong(rpmPkgDelSign(path) == 0);
+ return PyBool_FromLong(rpmPkgDelSign(path, &sargs) == 0);
}
/*