diff options
author | Günther Deschner <gd@samba.org> | 2009-02-19 10:26:00 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-02-19 19:21:48 +0100 |
commit | 8c569b59f0c8ed1d1d65fd49561201d035f20fb5 (patch) | |
tree | a5094b18b24f8458534f39b7d79e33905e0025e3 | |
parent | e9c42e3c21cdc1fa25a05ef0f2edc4ca9b0b486e (diff) | |
download | samba-8c569b59f0c8ed1d1d65fd49561201d035f20fb5.tar.gz samba-8c569b59f0c8ed1d1d65fd49561201d035f20fb5.tar.bz2 samba-8c569b59f0c8ed1d1d65fd49561201d035f20fb5.zip |
s3-rpcclient: use rpccli_spoolss_GetPrintProcessorDirectory in rpcclient.
Guenther
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 90995ffaaa..944bac7731 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -1661,8 +1661,12 @@ static WERROR cmd_spoolss_getprintprocdir(struct rpc_pipe_client *cli, int argc, const char **argv) { WERROR result; - char *environment = NULL; - fstring procdir; + NTSTATUS status; + const char *environment = SPOOLSS_ARCHITECTURE_NT_X86; + DATA_BLOB buffer; + uint32_t offered; + union spoolss_PrintProcessorDirectoryInfo info; + uint32_t needed; /* parse the command arguments */ if (argc > 2) { @@ -1670,18 +1674,37 @@ static WERROR cmd_spoolss_getprintprocdir(struct rpc_pipe_client *cli, return WERR_OK; } - if (asprintf(&environment, "%s", (argc == 2) ? argv[1] : - PRINTER_DRIVER_ARCHITECTURE) < 0) { - return WERR_NOMEM; - } - - result = rpccli_spoolss_getprintprocessordirectory( - cli, mem_ctx, cli->srv_name_slash, environment, procdir); + if (argc == 2) { + environment = argv[1]; + } + + status = rpccli_spoolss_GetPrintProcessorDirectory(cli, mem_ctx, + cli->srv_name_slash, + environment, + 1, + NULL, /* buffer */ + 0, /* offered */ + NULL, /* info */ + &needed, + &result); + if (W_ERROR_EQUAL(result, WERR_INSUFFICIENT_BUFFER)) { + offered = needed; + buffer = data_blob_talloc_zero(mem_ctx, needed); - if (W_ERROR_IS_OK(result)) - printf("%s\n", procdir); + status = rpccli_spoolss_GetPrintProcessorDirectory(cli, mem_ctx, + cli->srv_name_slash, + environment, + 1, + &buffer, + offered, + &info, + &needed, + &result); + } - SAFE_FREE(environment); + if (W_ERROR_IS_OK(result)) { + printf("%s\n", info.info1.directory_name); + } return result; } |