summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-04-09 04:23:52 +0000
committerTim Potter <tpot@samba.org>2002-04-09 04:23:52 +0000
commit07a65b3f078733b198ede49e3f4828ba6b82b93e (patch)
treec15840a3e46224db31137274e602f893d9da88d0 /source3
parentcc29c33fbe604bf2d750926df6fbd6b88e7a0be1 (diff)
downloadsamba-07a65b3f078733b198ede49e3f4828ba6b82b93e.tar.gz
samba-07a65b3f078733b198ede49e3f4828ba6b82b93e.tar.bz2
samba-07a65b3f078733b198ede49e3f4828ba6b82b93e.zip
Fixed setform and addform functions.
(This used to be commit ecba275cf75be3152c917329ba16d77bf4490259)
Diffstat (limited to 'source3')
-rw-r--r--source3/python/py_spoolss_forms.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/source3/python/py_spoolss_forms.c b/source3/python/py_spoolss_forms.c
index f7b80d0f33..9f8a49bd52 100644
--- a/source3/python/py_spoolss_forms.c
+++ b/source3/python/py_spoolss_forms.c
@@ -26,7 +26,8 @@ PyObject *spoolss_addform(PyObject *self, PyObject *args, PyObject *kw)
{
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
WERROR werror;
- PyObject *py_form;
+ PyObject *py_form, *py_form_name;
+ char *form_name;
FORM form;
int level = 1;
static char *kwlist[] = {"form", "level", NULL};
@@ -39,23 +40,17 @@ PyObject *spoolss_addform(PyObject *self, PyObject *args, PyObject *kw)
/* Call rpc function */
- switch (level) {
- case 1: {
- PyObject *py_form_name;
- char *form_name;
-
- if (!py_to_FORM(&form, py_form)) {
- PyErr_SetString(spoolss_error, "invalid form");
- return NULL;
- }
-
- py_form_name = PyDict_GetItemString(py_form, "name");
- form_name = PyString_AsString(py_form_name);
+ if (!py_to_FORM(&form, py_form) ||
+ !(py_form_name = PyDict_GetItemString(py_form, "name")) ||
+ !(form_name = PyString_AsString(py_form_name))) {
+ PyErr_SetString(spoolss_error, "invalid form");
+ return NULL;
+ }
+ switch (level) {
+ case 1:
init_unistr2(&form.name, form_name, strlen(form_name) + 1);
-
break;
- }
default:
PyErr_SetString(spoolss_error, "unsupported info level");
return NULL;
@@ -126,22 +121,23 @@ PyObject *spoolss_setform(PyObject *self, PyObject *args, PyObject *kw)
{
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
WERROR werror;
- PyObject *py_form;
+ PyObject *py_form, *py_form_name;
int level = 1;
- static char *kwlist[] = {"form_name", "form", "level", NULL};
+ static char *kwlist[] = {"form", "level", NULL};
char *form_name;
FORM form;
/* Parse parameters */
- if (!PyArg_ParseTupleAndKeywords(args, kw, "sO!|i", kwlist,
- &form_name, &PyDict_Type, &py_form,
- &level))
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "O!|i", kwlist,
+ &PyDict_Type, &py_form, &level))
return NULL;
/* Call rpc function */
- if (!py_to_FORM(&form, py_form)) {
+ if (!py_to_FORM(&form, py_form) ||
+ !(py_form_name = PyDict_GetItemString(py_form, "name")) ||
+ !(form_name = PyString_AsString(py_form_name))) {
PyErr_SetString(spoolss_error, "invalid form");
return NULL;
}