summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-04-13 15:31:52 +0200
committerGünther Deschner <gd@samba.org>2009-04-13 16:12:42 +0200
commitf325c342031d11d6133d417bdf57d918f4f10981 (patch)
treefd2c18c6e5c0d13013685da9b45affc43b46bca0 /source3
parent0393c99302dc12f18f06db83201f096624682ea2 (diff)
downloadsamba-f325c342031d11d6133d417bdf57d918f4f10981.tar.gz
samba-f325c342031d11d6133d417bdf57d918f4f10981.tar.bz2
samba-f325c342031d11d6133d417bdf57d918f4f10981.zip
s3-spoolss: use enumprinterdrivers_level() for level 1 enum.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c74
1 files changed, 7 insertions, 67 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 4102a1c894..e90b1b9116 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -6664,6 +6664,11 @@ static WERROR enumprinterdrivers_level(TALLOC_CTX *mem_ctx,
}
switch (level) {
+ case 1:
+ result = fill_printer_driver_info1(info, &info[count+i].info1,
+ &driver, servername,
+ architecture);
+ break;
default:
result = WERR_UNKNOWN_LEVEL;
break;
@@ -6704,73 +6709,8 @@ static WERROR enumprinterdrivers_level1(TALLOC_CTX *mem_ctx,
union spoolss_DriverInfo **info_p,
uint32_t *count)
{
- int i;
- int ndrivers;
- uint32_t version;
- fstring *list = NULL;
- NT_PRINTER_DRIVER_INFO_LEVEL driver;
- union spoolss_DriverInfo *info = NULL;
- WERROR result = WERR_OK;
-
- *count = 0;
-
- for (version=0; version<DRIVER_MAX_VERSION; version++) {
- list = NULL;
- ndrivers = get_ntdrivers(&list, architecture, version);
- DEBUGADD(4,("we have:[%d] drivers in environment [%s] and version [%d]\n",
- ndrivers, architecture, version));
-
- if (ndrivers == -1) {
- result = WERR_NOMEM;
- goto out;
- }
-
- if (ndrivers != 0) {
- info = TALLOC_REALLOC_ARRAY(mem_ctx, info,
- union spoolss_DriverInfo,
- *count + ndrivers);
- if (!info) {
- DEBUG(0,("enumprinterdrivers_level1: "
- "failed to enlarge driver info buffer!\n"));
- result = WERR_NOMEM;
- goto out;
- }
- }
-
- for (i=0; i<ndrivers; i++) {
- DEBUGADD(5,("\tdriver: [%s]\n", list[i]));
- ZERO_STRUCT(driver);
- result = get_a_printer_driver(&driver, 3, list[i],
- architecture, version);
- if (!W_ERROR_IS_OK(result)) {
- goto out;
- }
- result = fill_printer_driver_info1(info, &info[*count+i].info1,
- &driver, servername,
- architecture);
- if (!W_ERROR_IS_OK(result)) {
- free_a_printer_driver(driver, 3);
- goto out;
- }
- free_a_printer_driver(driver, 3);
- }
-
- *count += ndrivers;
- SAFE_FREE(list);
- }
-
- out:
- SAFE_FREE(list);
-
- if (!W_ERROR_IS_OK(result)) {
- TALLOC_FREE(info);
- *count = 0;
- return result;
- }
-
- *info_p = info;
-
- return WERR_OK;
+ return enumprinterdrivers_level(mem_ctx, servername, architecture, 1,
+ info_p, count);
}
/****************************************************************************