diff options
author | Gerald Carter <jerry@samba.org> | 2000-08-08 06:57:48 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2000-08-08 06:57:48 +0000 |
commit | f296a8d087be261fee51a3a4664685bab1fb5ab1 (patch) | |
tree | e8379a6072076c165d40e75d593c09da00c0b379 /source3/rpc_client | |
parent | 8705fbc42cb3d93a7a56f2673e6e1a19d346abee (diff) | |
download | samba-f296a8d087be261fee51a3a4664685bab1fb5ab1.tar.gz samba-f296a8d087be261fee51a3a4664685bab1fb5ab1.tar.bz2 samba-f296a8d087be261fee51a3a4664685bab1fb5ab1.zip |
All changes related to rpcclient...
- cleaned up some code
- Fixed a few memory leaks of my own making
- Add AddPrinterDriver(); I'm missing some of the semantics
here as the call is done correctly, but I'm not getting all
the information right in the DRIVER_INFO_3 struct I think.
Will work on it tomorrow some more...
--jerry
(This used to be commit 3bf9a29f34ee4ade5180c5a0b0b9ff4aca7f0f08)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_connect.c | 2 | ||||
-rw-r--r-- | source3/rpc_client/cli_spoolss.c | 52 |
2 files changed, 53 insertions, 1 deletions
diff --git a/source3/rpc_client/cli_connect.c b/source3/rpc_client/cli_connect.c index 16279488e8..6dcf92c57d 100644 --- a/source3/rpc_client/cli_connect.c +++ b/source3/rpc_client/cli_connect.c @@ -108,7 +108,7 @@ void free_connections(void) } static struct cli_connection *cli_con_get(const char *srv_name, - const char *pipe_name, + char *pipe_name, cli_auth_fns * auth, void *auth_creds, BOOL reuse) { diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c index 21e87b5799..1bfdf6a468 100644 --- a/source3/rpc_client/cli_spoolss.c +++ b/source3/rpc_client/cli_spoolss.c @@ -613,6 +613,7 @@ BOOL spoolss_addprinterex(POLICY_HND *hnd, const char* srv_name, PRINTER_INFO_2 prs_mem_free(&rbuf); prs_mem_free(&buf ); + free_spoolss_q_addprinterex(&q_o); if (mem_ctx) talloc_destroy(mem_ctx); @@ -804,4 +805,55 @@ uint32 spoolss_getprinterdriverdir(fstring srv_name, fstring env_name, uint32 le return r_o.status; } +/****************************************************************************** + AddPrinterDriver() + *****************************************************************************/ +uint32 spoolss_addprinterdriver(const char *srv_name, uint32 level, PRINTER_DRIVER_CTR *info) +{ + prs_struct rbuf; + prs_struct buf; + SPOOL_Q_ADDPRINTERDRIVER q_o; + SPOOL_R_ADDPRINTERDRIVER r_o; + TALLOC_CTX *mem_ctx = NULL; + struct cli_connection *con = NULL; + + if (!cli_connection_init(srv_name, PIPE_SPOOLSS, &con)) + return False; + + if ((mem_ctx=talloc_init()) == NULL) + { + DEBUG(0,("msrpc_spoolss_enum_jobs: talloc_init failed!\n")); + return False; + } + prs_init(&buf , MAX_PDU_FRAG_LEN, 4, mem_ctx, MARSHALL); + prs_init(&rbuf, 0, 4, mem_ctx, UNMARSHALL); + + /* make the ADDPRINTERDRIVER PDU */ + make_spoolss_q_addprinterdriver(&q_o, srv_name, level, info); + + /* turn the data into an io stream */ + if (spoolss_io_q_addprinterdriver("", &q_o, &buf, 0) && + rpc_con_pipe_req(con, SPOOLSS_ADDPRINTERDRIVER, &buf, &rbuf)) + { + ZERO_STRUCT(r_o); + + if(!spoolss_io_r_addprinterdriver("", &r_o, &rbuf, 0)) + { + /* report error code */ + DEBUG(5,("SPOOLSS_ADDPRINTEREX: %s\n", get_nt_error_msg(r_o.status))); + } + } + + + prs_mem_free(&rbuf); + prs_mem_free(&buf ); + free_spool_driver_info_3(q_o.info.info_3); + + if (mem_ctx) + talloc_destroy(mem_ctx); + + return r_o.status; + +} + |