From ecafd3754f35a2109a3a1eecbbdd72ade06b8502 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 20 Jul 2005 15:35:29 +0000 Subject: r8654: merging cli_spoolss_XX() updates from trunk (This used to be commit cd961e50a3029898868d21263ccacb7d5f1f07b9) --- source3/python/py_spoolss_drivers.c | 27 +++++-------------------- source3/python/py_spoolss_forms.c | 16 +++------------ source3/python/py_spoolss_jobs.c | 18 ++++------------- source3/python/py_spoolss_ports.c | 8 +------- source3/python/py_spoolss_printerdata.c | 35 ++++++--------------------------- source3/python/py_spoolss_printers.c | 18 +++-------------- 6 files changed, 22 insertions(+), 100 deletions(-) (limited to 'source3/python') 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; -- cgit