summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-07-20 15:35:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:00:14 -0500
commitecafd3754f35a2109a3a1eecbbdd72ade06b8502 (patch)
treed442ae80d7f93acd21ae2a4d35fcfc3c0f80f3e6 /source3/python
parentb0f1c8df1641bf0e1c53750f4cc126d7b1e21159 (diff)
downloadsamba-ecafd3754f35a2109a3a1eecbbdd72ade06b8502.tar.gz
samba-ecafd3754f35a2109a3a1eecbbdd72ade06b8502.tar.bz2
samba-ecafd3754f35a2109a3a1eecbbdd72ade06b8502.zip
r8654: merging cli_spoolss_XX() updates from trunk
(This used to be commit cd961e50a3029898868d21263ccacb7d5f1f07b9)
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_spoolss_drivers.c27
-rw-r--r--source3/python/py_spoolss_forms.c16
-rw-r--r--source3/python/py_spoolss_jobs.c18
-rw-r--r--source3/python/py_spoolss_ports.c8
-rw-r--r--source3/python/py_spoolss_printerdata.c35
-rw-r--r--source3/python/py_spoolss_printers.c18
6 files changed, 22 insertions, 100 deletions
diff --git a/source3/python/py_spoolss_drivers.c b/source3/python/py_spoolss_drivers.c
index 310f978188..abc9a4ba9c 100644
--- a/source3/python/py_spoolss_drivers.c
+++ b/source3/python/py_spoolss_drivers.c
@@ -29,7 +29,7 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
PyObject *result = NULL, *creds = NULL;
PRINTER_DRIVER_CTR ctr;
int level = 1, i;
- uint32 needed, num_drivers;
+ uint32 num_drivers;
char *arch = "Windows NT x86", *server, *errstr;
static char *kwlist[] = {"server", "level", "creds", "arch", NULL};
struct cli_state *cli = NULL;
@@ -70,14 +70,9 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
}
werror = cli_spoolss_enumprinterdrivers(
- cli, mem_ctx, 0, &needed, level, arch,
+ cli, mem_ctx, level, arch,
&num_drivers, &ctr);
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_enumprinterdrivers(
- cli, mem_ctx, needed, NULL, level, arch,
- &num_drivers, &ctr);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
goto done;
@@ -175,7 +170,6 @@ PyObject *spoolss_hnd_getprinterdriver(PyObject *self, PyObject *args,
PyObject *result = Py_None;
PRINTER_DRIVER_CTR ctr;
int level = 1;
- uint32 needed;
char *arch = "Windows NT x86";
int version = 2;
static char *kwlist[] = {"level", "arch", NULL};
@@ -188,15 +182,9 @@ PyObject *spoolss_hnd_getprinterdriver(PyObject *self, PyObject *args,
/* Call rpc function */
- werror = cli_spoolss_getprinterdriver(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, level,
+ werror = cli_spoolss_getprinterdriver(hnd->cli, hnd->mem_ctx, &hnd->pol, level,
arch, version, &ctr);
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_getprinterdriver(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
- level, arch, version, &ctr);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
return NULL;
@@ -234,7 +222,7 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
WERROR werror;
PyObject *result = NULL, *creds = NULL;
DRIVER_DIRECTORY_CTR ctr;
- uint32 needed, level = 1;
+ uint32 level = 1;
char *arch = "Windows NT x86", *server, *errstr;
static char *kwlist[] = {"server", "level", "arch", "creds", NULL};
struct cli_state *cli = NULL;
@@ -274,12 +262,7 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
goto done;
}
- werror = cli_spoolss_getprinterdriverdir(
- cli, mem_ctx, 0, &needed, level, arch, &ctr);
-
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_getprinterdriverdir(
- cli, mem_ctx, needed, NULL, level, arch, &ctr);
+ werror = cli_spoolss_getprinterdriverdir(cli, mem_ctx, level, arch, &ctr);
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
diff --git a/source3/python/py_spoolss_forms.c b/source3/python/py_spoolss_forms.c
index 66a6540e07..00c5b18e18 100644
--- a/source3/python/py_spoolss_forms.c
+++ b/source3/python/py_spoolss_forms.c
@@ -101,14 +101,9 @@ PyObject *spoolss_hnd_getform(PyObject *self, PyObject *args, PyObject *kw)
/* Call rpc function */
- werror = cli_spoolss_getform(hnd->cli, hnd->mem_ctx, 0, &needed,
+ werror = cli_spoolss_getform(hnd->cli, hnd->mem_ctx,
&hnd->pol, form_name, level, &form);
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_getform(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
- form_name, 1, &form);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
return NULL;
@@ -211,7 +206,7 @@ PyObject *spoolss_hnd_enumforms(PyObject *self, PyObject *args, PyObject *kw)
PyObject *result;
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
WERROR werror;
- uint32 level = 1, num_forms, needed, i;
+ uint32 level = 1, num_forms, i;
static char *kwlist[] = {"level", NULL};
FORM_1 *forms;
@@ -224,14 +219,9 @@ PyObject *spoolss_hnd_enumforms(PyObject *self, PyObject *args, PyObject *kw)
/* Call rpc function */
werror = cli_spoolss_enumforms(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, level,
+ hnd->cli, hnd->mem_ctx, &hnd->pol, level,
&num_forms, &forms);
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_enumforms(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol, level,
- &num_forms, &forms);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
return NULL;
diff --git a/source3/python/py_spoolss_jobs.c b/source3/python/py_spoolss_jobs.c
index 59754bd36d..8ea0ebc073 100644
--- a/source3/python/py_spoolss_jobs.c
+++ b/source3/python/py_spoolss_jobs.c
@@ -28,7 +28,7 @@ PyObject *spoolss_hnd_enumjobs(PyObject *self, PyObject *args, PyObject *kw)
WERROR werror;
PyObject *result;
int level = 1;
- uint32 i, needed, num_jobs;
+ uint32 i, num_jobs;
static char *kwlist[] = {"level", NULL};
JOB_INFO_CTR ctr;
@@ -40,14 +40,9 @@ PyObject *spoolss_hnd_enumjobs(PyObject *self, PyObject *args, PyObject *kw)
/* Call rpc function */
werror = cli_spoolss_enumjobs(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, level, 0,
+ hnd->cli, hnd->mem_ctx, &hnd->pol, level, 0,
1000, &num_jobs, &ctr);
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_enumjobs(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
- level, 0, 1000, &num_jobs, &ctr);
-
/* Return value */
result = Py_None;
@@ -123,7 +118,7 @@ PyObject *spoolss_hnd_getjob(PyObject *self, PyObject *args, PyObject *kw)
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
WERROR werror;
PyObject *result;
- uint32 level = 1, jobid, needed;
+ uint32 level = 1, jobid;
static char *kwlist[] = {"jobid", "level", NULL};
JOB_INFO_CTR ctr;
@@ -135,14 +130,9 @@ PyObject *spoolss_hnd_getjob(PyObject *self, PyObject *args, PyObject *kw)
/* Call rpc function */
- werror = cli_spoolss_getjob(hnd->cli, hnd->mem_ctx, 0, &needed,
+ werror = cli_spoolss_getjob(hnd->cli, hnd->mem_ctx,
&hnd->pol, jobid, level, &ctr);
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_getjob(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
- jobid, level, &ctr);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
return NULL;
diff --git a/source3/python/py_spoolss_ports.c b/source3/python/py_spoolss_ports.c
index ddc8868f0f..11a4615bbd 100644
--- a/source3/python/py_spoolss_ports.c
+++ b/source3/python/py_spoolss_ports.c
@@ -67,13 +67,7 @@ PyObject *spoolss_enumports(PyObject *self, PyObject *args, PyObject *kw)
/* Call rpc function */
- werror = cli_spoolss_enum_ports(
- cli, mem_ctx, 0, &needed, level, &num_ports, &ctr);
-
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_enum_ports(
- cli, mem_ctx, needed, NULL, level,
- &num_ports, &ctr);
+ werror = cli_spoolss_enum_ports( cli, mem_ctx, level, &num_ports, &ctr);
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
diff --git a/source3/python/py_spoolss_printerdata.c b/source3/python/py_spoolss_printerdata.c
index f165475b08..6fc4227ad2 100644
--- a/source3/python/py_spoolss_printerdata.c
+++ b/source3/python/py_spoolss_printerdata.c
@@ -112,7 +112,6 @@ PyObject *spoolss_hnd_getprinterdata(PyObject *self, PyObject *args, PyObject *k
static char *kwlist[] = { "value", NULL };
char *valuename;
WERROR werror;
- uint32 needed;
PyObject *result;
REGISTRY_VALUE value;
@@ -124,14 +123,9 @@ PyObject *spoolss_hnd_getprinterdata(PyObject *self, PyObject *args, PyObject *k
/* Call rpc function */
werror = cli_spoolss_getprinterdata(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, valuename,
+ hnd->cli, hnd->mem_ctx, &hnd->pol, valuename,
&value);
- if (W_ERROR_V(werror) == ERRmoredata)
- werror = cli_spoolss_getprinterdata(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
- valuename, &value);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
return NULL;
@@ -255,7 +249,6 @@ PyObject *spoolss_hnd_getprinterdataex(PyObject *self, PyObject *args, PyObject
static char *kwlist[] = { "key", "value", NULL };
char *key, *valuename;
WERROR werror;
- uint32 needed;
PyObject *result;
REGISTRY_VALUE value;
@@ -267,14 +260,9 @@ PyObject *spoolss_hnd_getprinterdataex(PyObject *self, PyObject *args, PyObject
/* Call rpc function */
werror = cli_spoolss_getprinterdataex(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, key,
+ hnd->cli, hnd->mem_ctx, &hnd->pol, key,
valuename, &value);
- if (W_ERROR_V(werror) == ERRmoredata)
- werror = cli_spoolss_getprinterdataex(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol, key,
- valuename, &value);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
return NULL;
@@ -323,7 +311,7 @@ PyObject *spoolss_hnd_enumprinterdataex(PyObject *self, PyObject *args, PyObject
{
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
static char *kwlist[] = { "key", NULL };
- uint32 needed, i;
+ uint32 i;
char *key;
WERROR werror;
PyObject *result;
@@ -334,13 +322,7 @@ PyObject *spoolss_hnd_enumprinterdataex(PyObject *self, PyObject *args, PyObject
/* Get max buffer sizes for value and data */
- werror = cli_spoolss_enumprinterdataex(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, key, &ctr);
-
- if (W_ERROR_V(werror) == ERRmoredata)
- werror = cli_spoolss_enumprinterdataex(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol, key,
- &ctr);
+ werror = cli_spoolss_enumprinterdataex(hnd->cli, hnd->mem_ctx, &hnd->pol, key, &ctr);
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
@@ -400,7 +382,7 @@ PyObject *spoolss_hnd_enumprinterkey(PyObject *self, PyObject *args,
static char *kwlist[] = { "key", NULL };
char *keyname;
WERROR werror;
- uint32 needed, keylist_len;
+ uint32 keylist_len;
uint16 *keylist;
PyObject *result;
@@ -412,14 +394,9 @@ PyObject *spoolss_hnd_enumprinterkey(PyObject *self, PyObject *args,
/* Call rpc function */
werror = cli_spoolss_enumprinterkey(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol,
+ hnd->cli, hnd->mem_ctx, &hnd->pol,
keyname, &keylist, &keylist_len);
- if (W_ERROR_V(werror) == ERRmoredata)
- werror = cli_spoolss_enumprinterkey(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
- keyname, &keylist, &keylist_len);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
return NULL;
diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c
index 7446e2d282..aab2d634a3 100644
--- a/source3/python/py_spoolss_printers.c
+++ b/source3/python/py_spoolss_printers.c
@@ -127,7 +127,6 @@ PyObject *spoolss_hnd_getprinter(PyObject *self, PyObject *args, PyObject *kw)
PyObject *result = NULL;
PRINTER_INFO_CTR ctr;
int level = 1;
- uint32 needed;
static char *kwlist[] = {"level", NULL};
/* Parse parameters */
@@ -140,12 +139,7 @@ PyObject *spoolss_hnd_getprinter(PyObject *self, PyObject *args, PyObject *kw)
/* Call rpc function */
werror = cli_spoolss_getprinter(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, level, &ctr);
-
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_getprinter(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
- level, &ctr);
+ hnd->cli, hnd->mem_ctx, &hnd->pol, level, &ctr);
/* Return value */
@@ -277,7 +271,7 @@ PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw)
PyObject *result = NULL, *creds = NULL;
PRINTER_INFO_CTR ctr;
int level = 1, flags = PRINTER_ENUM_LOCAL, i;
- uint32 needed, num_printers;
+ uint32 num_printers;
static char *kwlist[] = {"server", "name", "level", "flags",
"creds", NULL};
TALLOC_CTX *mem_ctx = NULL;
@@ -331,15 +325,9 @@ PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw)
/* Call rpc function */
- werror = cli_spoolss_enum_printers(
- cli, mem_ctx, 0, &needed, name, flags, level,
+ werror = cli_spoolss_enum_printers(cli, mem_ctx, name, flags, level,
&num_printers, &ctr);
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_enum_printers(
- cli, mem_ctx, needed, NULL, name, flags,
- level, &num_printers, &ctr);
-
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
goto done;