summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-02-19 01:06:55 +0000
committerTim Potter <tpot@samba.org>2002-02-19 01:06:55 +0000
commit9a0a35d09af05d02c54eeca21c4b4afcdc2f91a2 (patch)
tree8bd90e61fad07c2750e5273a2547646d3f88d25e
parente13465b19aaa1df7ab0f18a23c5ad1118975d46f (diff)
downloadsamba-9a0a35d09af05d02c54eeca21c4b4afcdc2f91a2.tar.gz
samba-9a0a35d09af05d02c54eeca21c4b4afcdc2f91a2.tar.bz2
samba-9a0a35d09af05d02c54eeca21c4b4afcdc2f91a2.zip
Converted cmd_spoolss_enumprinterdrivers() to use new
cli_spoolss_enumprinterdrivers() function. (This used to be commit ae38fcf62c4b9503d4df02761dadb1bb7d166a9c)
-rw-r--r--source3/rpcclient/cmd_spoolss.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index fa259b3502..49d8b3e6b6 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -724,10 +724,9 @@ static NTSTATUS cmd_spoolss_enum_drivers(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, char **argv)
{
- NTSTATUS result = NT_STATUS_OK;
+ WERROR werror;
uint32 info_level = 1;
PRINTER_DRIVER_CTR ctr;
- fstring servername;
uint32 i, j,
returned;
@@ -737,9 +736,6 @@ static NTSTATUS cmd_spoolss_enum_drivers(struct cli_state *cli,
return NT_STATUS_OK;
}
- /* get the arguments need to open the printer handle */
- slprintf (servername, sizeof(fstring)-1, "\\\\%s", cli->desthost);
- strupper (servername);
if (argc == 2)
info_level = atoi(argv[1]);
@@ -747,18 +743,23 @@ static NTSTATUS cmd_spoolss_enum_drivers(struct cli_state *cli,
/* loop through and print driver info level for each architecture */
for (i=0; archi_table[i].long_archi!=NULL; i++)
{
- returned = 0;
- result = cli_spoolss_enumprinterdrivers (cli, mem_ctx, info_level,
+ uint32 needed;
+
+ werror = cli_spoolss_enumprinterdrivers(
+ cli, mem_ctx, 0, &needed, info_level,
+ archi_table[i].long_archi, &returned, &ctr);
+
+ if (W_ERROR_V(werror) == ERRinsufficientbuffer)
+ werror = cli_spoolss_enumprinterdrivers(
+ cli, mem_ctx, needed, NULL, info_level,
archi_table[i].long_archi, &returned, &ctr);
if (returned == 0)
continue;
-
- if (!NT_STATUS_IS_OK(result))
- {
- printf ("Error getting driver for environment [%s] - %s\n",
- archi_table[i].long_archi, get_nt_error_msg(result));
+ if (!W_ERROR_IS_OK(werror)) {
+ printf ("Error getting driver for environment [%s] - %d\n",
+ archi_table[i].long_archi, W_ERROR_V(werror));
continue;
}
@@ -787,7 +788,7 @@ static NTSTATUS cmd_spoolss_enum_drivers(struct cli_state *cli,
}
}
- return result;
+ return W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
}
/****************************************************************************