This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
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;
/* Call rpc function */
- if (!(cli = open_pipe_creds(server, creds, PIPE_SPOOLSS, &errstr))) {
+ if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) {
PyErr_SetString(spoolss_error, errstr);
free(errstr);
goto done;
}
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("spoolss_enumprinterdrivers"))) {
PyErr_SetString(
spoolss_error, "unable to init talloc context\n");
goto done;
}
- werror = cli_spoolss_enumprinterdrivers(
- cli, mem_ctx, 0, &needed, level, arch,
+ werror = rpccli_spoolss_enumprinterdrivers(
+ cli->pipe_list, 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;
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};
/* Parse parameters */
/* Call rpc function */
- werror = cli_spoolss_getprinterdriver(
- hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, level,
- arch, &ctr);
-
- if (W_ERROR_V(werror) == ERRinsufficientbuffer)
- werror = cli_spoolss_getprinterdriver(
- hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
- level, arch, &ctr);
+ werror = rpccli_spoolss_getprinterdriver(
+ hnd->cli, hnd->mem_ctx, &hnd->pol, level, arch, version, &ctr);
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
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;
/* Call rpc function */
- if (!(cli = open_pipe_creds(server, creds, PIPE_SPOOLSS, &errstr))) {
+ if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) {
PyErr_SetString(spoolss_error, errstr);
free(errstr);
goto done;
}
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("spoolss_getprinterdriverdir"))) {
PyErr_SetString(
spoolss_error, "unable to init talloc context\n");
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 = rpccli_spoolss_getprinterdriverdir(
+ cli->pipe_list, mem_ctx, level, arch, &ctr);
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
return NULL;
}
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("spoolss_addprinterdriver"))) {
PyErr_SetString(
spoolss_error, "unable to init talloc context\n");
return NULL;
}
- if (!(cli = open_pipe_creds(server, creds, PIPE_SPOOLSS, &errstr))) {
+ if (!(cli = open_pipe_creds(server, creds, PI_SPOOLSS, &errstr))) {
PyErr_SetString(spoolss_error, errstr);
free(errstr);
goto done;
case 3:
ctr.info3 = &dinfo.driver_3;
- if (!py_to_DRIVER_INFO_3(&dinfo.driver_3, info)) {
+ if (!py_to_DRIVER_INFO_3(&dinfo.driver_3, info, mem_ctx)) {
PyErr_SetString(spoolss_error,
"error converting to driver info 3");
goto done;
goto done;
}
- werror = cli_spoolss_addprinterdriver(cli, mem_ctx, level, &ctr);
+ werror = rpccli_spoolss_addprinterdriver(cli->pipe_list, mem_ctx, level, &ctr);
if (!W_ERROR_IS_OK(werror)) {
PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));