summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-16 05:16:06 +0000
committerTim Potter <tpot@samba.org>2002-05-16 05:16:06 +0000
commitce8990949343899f07ac98205cd8d4fa622c542a (patch)
tree518d39406941aa3694afac8b9726e637294489f9
parent70da1dec973e1736a6ec9f12a1598a077f36e274 (diff)
downloadsamba-ce8990949343899f07ac98205cd8d4fa622c542a.tar.gz
samba-ce8990949343899f07ac98205cd8d4fa622c542a.tar.bz2
samba-ce8990949343899f07ac98205cd8d4fa622c542a.zip
Fix return value for enumprinterdrivers(), getprinterdriverdir().
Set info level key in getprinterdriverdir() return info. (This used to be commit cb4bfd39eb83efddb29b3a3bc70c2a8713f80ef2)
-rw-r--r--source3/python/py_spoolss_drivers.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/source3/python/py_spoolss_drivers.c b/source3/python/py_spoolss_drivers.c
index 64d3a37afa..ec85f9dd6f 100644
--- a/source3/python/py_spoolss_drivers.c
+++ b/source3/python/py_spoolss_drivers.c
@@ -26,20 +26,20 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
PyObject *kw)
{
WERROR werror;
- PyObject *result = Py_None, *creds = NULL;
+ PyObject *result = NULL, *creds = NULL;
PRINTER_DRIVER_CTR ctr;
int level = 1, i;
uint32 needed, num_drivers;
char *arch = "Windows NT x86", *server, *errstr;
- static char *kwlist[] = {"server", "creds", "level", "arch", NULL};
+ static char *kwlist[] = {"server", "level", "creds", "arch", NULL};
struct cli_state *cli = NULL;
TALLOC_CTX *mem_ctx = NULL;
/* Parse parameters */
if (!PyArg_ParseTupleAndKeywords(
- args, kw, "s|O!is", kwlist, &server, &PyDict_Type,
- &creds, &level, &arch))
+ args, kw, "s|iO!s", kwlist, &server, &level, &PyDict_Type,
+ &creds, &arch))
return NULL;
/* Call rpc function */
@@ -53,7 +53,7 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
if (!(mem_ctx = talloc_init())) {
PyErr_SetString(
- spoolss_error, "unable to initialise talloc context\n");
+ spoolss_error, "unable to init talloc context\n");
goto done;
}
@@ -72,7 +72,7 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
}
/* Return value */
-
+
switch (level) {
case 1:
result = PyDict_New();
@@ -151,9 +151,8 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
break;
default:
- PyErr_SetString(spoolss_error, "unknown info level returned");
- result = NULL;
- break;
+ PyErr_SetString(spoolss_error, "unknown info level");
+ goto done;
}
done:
@@ -163,7 +162,6 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
if (mem_ctx)
talloc_destroy(mem_ctx);
- Py_INCREF(result);
return result;
}
@@ -229,9 +227,9 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
PyObject *kw)
{
WERROR werror;
- PyObject *result = Py_None, *creds = NULL;
+ PyObject *result = NULL, *creds = NULL;
DRIVER_DIRECTORY_CTR ctr;
- uint32 needed, level;
+ uint32 needed, level = 1;
char *arch = "Windows NT x86", *server, *errstr;
static char *kwlist[] = {"server", "level", "arch", "creds", NULL};
struct cli_state *cli = NULL;
@@ -255,7 +253,7 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
if (!(mem_ctx = talloc_init())) {
PyErr_SetString(
- spoolss_error, "unable to initialise talloc context\n");
+ spoolss_error, "unable to init talloc context\n");
goto done;
}
@@ -268,7 +266,7 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
- return NULL;
+ goto done;
}
/* Return value */
@@ -276,7 +274,12 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
switch (level) {
case 1:
py_from_DRIVER_DIRECTORY_1(&result, ctr.info1);
+ PyDict_SetItemString(
+ result, "level", PyInt_FromLong(1));
break;
+ default:
+ PyErr_SetString(spoolss_error, "unknown info level");
+ goto done;
}
done:
@@ -286,7 +289,6 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
if (mem_ctx)
talloc_destroy(mem_ctx);
- Py_INCREF(result);
return result;
}
@@ -315,7 +317,7 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
if (!(mem_ctx = talloc_init())) {
PyErr_SetString(
- spoolss_error, "unable to initialise talloc context\n");
+ spoolss_error, "unable to init talloc context\n");
return NULL;
}