The branch, master has been updated via 17e692a9fa6 s3-rpcclient: add clusapi_resume_node command. via c9077f16283 s3-rpcclient: add clusapi_pause_node command. via 94157af2610 s3-rpcclient: give slightly better descriptions to clusapi commands via c433dac5981 librpc: pidlify spoolss_EnumPerMachineConnections via c9bebbcc464 librpc/ndr: provide infrastructure for NDR_SPOOLSS_{PUSH|PULL}_ENUM macros via 1038613878b librpc: better naming for NDR_SPOOLSS_{PUSH|PULL}_ENUM variants via 210a8f35b66 s4-torture: add test for spoolss_EnumPerMachineConnections via 0a76a7c3c25 s4-torture: add test for spoolss AddPerMachineConnection via d642c9a2a8d s3-rpcclient: add delpermachineconnection command via d3c2833f1bb s3-rpcclient: add addpermachineconnection command via ce00972afc2 s3-rpcclient: add enumpermachineconnections command via a340aecdd02 s3-rpcclient: properly check and initialize buffers in getdriverpackagepath via 479cf553970 librpc: add IDL for spoolss_EnumPerMachineConnections via 8ceddba1f3b s3-rpcclient: add cmd_spoolss_get_core_printer_drivers via e17c8e1b405 librpc: fix IDL for spoolss_GetCorePrinterDrivers() from ba53e284e68 s3: lib: dbwrap: Set rec->value_valid to avoid backtrace in `smbstatus`
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 17e692a9fa6b1475855aef5e425c4e4d6b1fd3bc Author: Günther Deschner <g...@samba.org> Date: Mon May 9 12:10:22 2016 +0200 s3-rpcclient: add clusapi_resume_node command. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Thu Jan 9 01:15:34 UTC 2020 on sn-devel-184 commit c9077f16283bdc04068ee669baa99baca8238532 Author: Günther Deschner <g...@samba.org> Date: Mon May 9 12:07:47 2016 +0200 s3-rpcclient: add clusapi_pause_node command. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 94157af26107fc12af5c10bedb4ca5af6eeed73e Author: Günther Deschner <g...@samba.org> Date: Wed Jan 8 17:25:13 2020 +0100 s3-rpcclient: give slightly better descriptions to clusapi commands Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c433dac59818d580bdccb0d0e0daac71ccf01ee2 Author: Günther Deschner <g...@samba.org> Date: Mon Dec 23 16:53:37 2019 +0100 librpc: pidlify spoolss_EnumPerMachineConnections Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit c9bebbcc464e98abeeb008551657532a1831a96f Author: Günther Deschner <g...@samba.org> Date: Tue Jan 7 14:58:15 2020 +0100 librpc/ndr: provide infrastructure for NDR_SPOOLSS_{PUSH|PULL}_ENUM macros The new macros allow the same macro convenience for enum functions without level discriminator. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 1038613878b7c40d4d313697cc0e4e527582afdb Author: Günther Deschner <g...@samba.org> Date: Mon Dec 23 16:50:28 2019 +0100 librpc: better naming for NDR_SPOOLSS_{PUSH|PULL}_ENUM variants Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 210a8f35b66326263e8466a5b58dffa6e0405c56 Author: Günther Deschner <g...@samba.org> Date: Fri Dec 20 13:43:25 2019 +0100 s4-torture: add test for spoolss_EnumPerMachineConnections Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 0a76a7c3c258aa84fab96d03347f8e6e8d067fa8 Author: Günther Deschner <g...@samba.org> Date: Sun Sep 22 03:34:56 2019 +0200 s4-torture: add test for spoolss AddPerMachineConnection Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d642c9a2a8df3002c30d420f3cd34b447a711212 Author: Günther Deschner <g...@samba.org> Date: Sun Sep 22 03:34:27 2019 +0200 s3-rpcclient: add delpermachineconnection command Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d3c2833f1bb5622c438ec1c7b287e53fce83a6c2 Author: Günther Deschner <g...@samba.org> Date: Mon Dec 23 12:42:53 2019 +0100 s3-rpcclient: add addpermachineconnection command Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ce00972afc205af4f93cde5c3e30a07ec222670c Author: Günther Deschner <g...@samba.org> Date: Thu Dec 1 21:32:18 2016 +0100 s3-rpcclient: add enumpermachineconnections command Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a340aecdd025352bd0cefc1be1aac7526dfe1748 Author: Günther Deschner <g...@samba.org> Date: Thu Dec 19 13:49:53 2019 +0100 s3-rpcclient: properly check and initialize buffers in getdriverpackagepath Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 479cf55397062cf38d16d08e4c48b2d1e26ceb99 Author: Günther Deschner <g...@samba.org> Date: Thu Dec 1 21:31:52 2016 +0100 librpc: add IDL for spoolss_EnumPerMachineConnections Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8ceddba1f3b1aad4c2935e5a1207277f591cace8 Author: Günther Deschner <g...@samba.org> Date: Mon Sep 19 17:03:44 2016 +0200 s3-rpcclient: add cmd_spoolss_get_core_printer_drivers Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e17c8e1b405690d7d38443c8f18c489fc98c1011 Author: Günther Deschner <g...@samba.org> Date: Tue Jan 7 15:52:40 2020 +0100 librpc: fix IDL for spoolss_GetCorePrinterDrivers() The charset determination makes it more difficult to deal with the real REG_MULTI_SZ nature of that element. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: librpc/idl/spoolss.idl | 22 +++- librpc/ndr/ndr_spoolss_buf.c | 184 +++++++++++++++++++++++++---- librpc/ndr/ndr_spoolss_buf.h | 1 + selftest/knownfail | 1 + source3/rpcclient/cmd_clusapi.c | 152 ++++++++++++++++++++++-- source3/rpcclient/cmd_spoolss.c | 253 +++++++++++++++++++++++++++++++++++++++- source4/torture/rpc/spoolss.c | 213 ++++++++++++++++++++++++++++++++- 7 files changed, 782 insertions(+), 44 deletions(-) Changeset truncated at 500 lines: diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl index 9d294969a0a..afe60d2faf0 100644 --- a/librpc/idl/spoolss.idl +++ b/librpc/idl/spoolss.idl @@ -3066,7 +3066,25 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") /******************/ /* Function: 0x57 */ - [todo] WERROR spoolss_EnumPerMachineConnections( + [public,noopnum,noprint] WERROR _spoolss_EnumPerMachineConnections( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumPerMachineConnections( + [in] uint32 count, + [out] spoolss_PrinterInfo4 info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPerMachineConnections( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,size_is(,*count)] spoolss_PrinterInfo4 **info, + [out,ref] uint32 *needed ); /******************/ @@ -3296,7 +3314,7 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor") [in,unique] [string,charset(UTF16)] uint16 *servername, [in,ref] [string,charset(UTF16)] uint16 *architecture, [in] uint32 core_driver_size, - [in,size_is(core_driver_size)] [charset(UTF16)] uint16 *core_driver_dependencies, + [in,size_is(core_driver_size)] uint16 *core_driver_dependencies, [in] uint32 core_printer_driver_count, [out,size_is(core_printer_driver_count)] spoolss_CorePrinterDriver *core_printer_drivers ); diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c index a57f578fd45..393d7addeb5 100644 --- a/librpc/ndr/ndr_spoolss_buf.c +++ b/librpc/ndr/ndr_spoolss_buf.c @@ -36,13 +36,17 @@ "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\ (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\ }\ - _r.in.level = r->in.level;\ _r.in.buffer = r->in.buffer;\ _r.in.offered = r->in.offered;\ NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\ } while(0) -#define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \ +#define NDR_SPOOLSS_PUSH_ENUM_IN_LEVEL(fn) do { \ + _r.in.level = r->in.level;\ + NDR_SPOOLSS_PUSH_ENUM_IN(fn);\ +} while(0) + +#define NDR_SPOOLSS_PUSH_ENUM_OUT_LEVEL(fn) do { \ DATA_BLOB _data_blob_info = data_blob_null;\ struct ndr_push *_ndr_info = NULL;\ _r.in.level = r->in.level;\ @@ -84,6 +88,58 @@ NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\ } while(0) +#define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \ + DATA_BLOB _data_blob_info = data_blob_null;\ + struct ndr_push *_ndr_info = NULL;\ + _r.in.buffer = r->in.buffer;\ + _r.in.offered = r->in.offered;\ + _r.out.info = NULL;\ + _r.out.needed = r->out.needed;\ + _r.out.count = r->out.count;\ + _r.out.result = r->out.result;\ + if (r->out.info && *r->out.info && !r->in.buffer) {\ + return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\ + "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\ + }\ + if (r->in.buffer) {\ + _ndr_info = ndr_push_init_ctx(ndr);\ + NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\ + _ndr_info->flags= ndr->flags;\ + if (r->out.info) {\ + struct ndr_push *_subndr_info;\ + struct __##fn __r;\ + __r.in.count = *r->out.count;\ + __r.out.info = *r->out.info;\ + NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\ + NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \ + NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\ + }\ + if (r->in.offered > _ndr_info->offset) {\ + uint32_t _padding_len = r->in.offered - _ndr_info->offset;\ + NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\ + } else if (r->in.offered < _ndr_info->offset) {\ + return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\ + "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\ + (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\ + }\ + _data_blob_info = ndr_push_blob(_ndr_info);\ + _r.out.info = &_data_blob_info;\ + }\ + NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\ +} while(0) + +#define NDR_SPOOLSS_PUSH_ENUM_LEVEL(fn,in,out) do { \ + struct _##fn _r;\ + if (flags & NDR_IN) {\ + in;\ + NDR_SPOOLSS_PUSH_ENUM_IN_LEVEL(fn);\ + }\ + if (flags & NDR_OUT) {\ + out;\ + NDR_SPOOLSS_PUSH_ENUM_OUT_LEVEL(fn);\ + }\ +} while(0) + #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \ struct _##fn _r;\ if (flags & NDR_IN) {\ @@ -96,10 +152,8 @@ }\ } while(0) -#define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \ +#define NDR_SPOOLSS_PULL_ENUM_IN_COMMON(fn) do { \ ZERO_STRUCT(r->out);\ - NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\ - r->in.level = _r.in.level;\ r->in.buffer = _r.in.buffer;\ r->in.offered = _r.in.offered;\ r->out.needed = _r.out.needed;\ @@ -117,7 +171,18 @@ ZERO_STRUCTP(r->out.info);\ } while(0) -#define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \ +#define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \ + NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\ + NDR_SPOOLSS_PULL_ENUM_IN_COMMON(fn); \ +} while(0) + +#define NDR_SPOOLSS_PULL_ENUM_IN_LEVEL(fn) do { \ + NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\ + r->in.level = _r.in.level;\ + NDR_SPOOLSS_PULL_ENUM_IN_COMMON(fn); \ +} while(0) + +#define NDR_SPOOLSS_PULL_ENUM_OUT_LEVEL(fn) do { \ _r.in.level = r->in.level;\ _r.in.buffer = r->in.buffer;\ _r.in.offered = r->in.offered;\ @@ -153,6 +218,53 @@ }\ } while(0) +#define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \ + _r.in.buffer = r->in.buffer;\ + _r.in.offered = r->in.offered;\ + _r.out.needed = r->out.needed;\ + _r.out.count = r->out.count;\ + NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\ + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\ + NDR_PULL_ALLOC(ndr, r->out.info);\ + }\ + *r->out.info = NULL;\ + r->out.needed = _r.out.needed;\ + r->out.count = _r.out.count;\ + r->out.result = _r.out.result;\ + if (_r.out.info) {\ + struct ndr_pull *_ndr_info;\ + NDR_PULL_ALLOC(ndr, *r->out.info);\ + _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info);\ + NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\ + _ndr_info->flags= ndr->flags;\ + if (r->in.offered != _ndr_info->data_size) {\ + return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\ + "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\ + (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\ + }\ + if (*r->out.needed <= _ndr_info->data_size) {\ + struct __##fn __r;\ + __r.in.count = *r->out.count;\ + __r.out.info = NULL;\ + NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\ + *r->out.info = __r.out.info;\ + }\ + }\ +} while(0) + +#define NDR_SPOOLSS_PULL_ENUM_LEVEL(fn,in,out) do { \ + struct _##fn _r;\ + if (flags & NDR_IN) {\ + out;\ + NDR_SPOOLSS_PULL_ENUM_IN_LEVEL(fn);\ + in;\ + }\ + if (flags & NDR_OUT) {\ + out;\ + NDR_SPOOLSS_PULL_ENUM_OUT_LEVEL(fn);\ + }\ +} while(0) + #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \ struct _##fn _r;\ if (flags & NDR_IN) {\ @@ -209,7 +321,7 @@ */ enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r) { - NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{ + NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrinters,{ _r.in.flags = r->in.flags; _r.in.server = r->in.server; },{ @@ -221,7 +333,7 @@ enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r) { - NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{ + NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrinters,{ r->in.flags = _r.in.flags; r->in.server = _r.in.server; },{ @@ -241,7 +353,7 @@ uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, uint32_t level, */ enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r) { - NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{ + NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumJobs,{ _r.in.handle = r->in.handle; _r.in.firstjob = r->in.firstjob; _r.in.numjobs = r->in.numjobs; @@ -255,7 +367,7 @@ enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, con enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r) { - NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{ + NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumJobs,{ r->in.handle = _r.in.handle; r->in.firstjob = _r.in.firstjob; r->in.numjobs = _r.in.numjobs; @@ -277,7 +389,7 @@ uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, uint32_t level, uin */ enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r) { - NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{ + NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrinterDrivers,{ _r.in.server = r->in.server; _r.in.environment = r->in.environment; },{ @@ -289,7 +401,7 @@ enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r) { - NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{ + NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrinterDrivers,{ r->in.server = _r.in.server; r->in.environment = _r.in.environment; },{ @@ -309,7 +421,7 @@ uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, uint32_t */ enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r) { - NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{ + NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumForms,{ _r.in.handle = r->in.handle; },{ _r.in.handle = r->in.handle; @@ -319,7 +431,7 @@ enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, co enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r) { - NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{ + NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumForms,{ r->in.handle = _r.in.handle; },{ _r.in.handle = r->in.handle; @@ -337,7 +449,7 @@ uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, uint32_t level, ui */ enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r) { - NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{ + NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPorts,{ _r.in.servername= r->in.servername; },{ _r.in.servername= r->in.servername; @@ -347,7 +459,7 @@ enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, co enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r) { - NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{ + NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPorts,{ r->in.servername= _r.in.servername; },{ _r.in.servername= r->in.servername; @@ -365,7 +477,7 @@ uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, uint32_t level, ui */ enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r) { - NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{ + NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumMonitors,{ _r.in.servername= r->in.servername; },{ _r.in.servername= r->in.servername; @@ -375,7 +487,7 @@ enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r) { - NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{ + NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumMonitors,{ r->in.servername= _r.in.servername; },{ _r.in.servername= r->in.servername; @@ -393,7 +505,7 @@ uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, uint32_t level, */ enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r) { - NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{ + NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrintProcessors,{ _r.in.servername = r->in.servername; _r.in.environment = r->in.environment; },{ @@ -405,7 +517,7 @@ enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r) { - NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{ + NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrintProcessors,{ r->in.servername = _r.in.servername; r->in.environment = _r.in.environment; },{ @@ -426,7 +538,7 @@ uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx, */ enum ndr_err_code ndr_push_spoolss_EnumPrintProcessorDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessorDataTypes *r) { - NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessorDataTypes,{ + NDR_SPOOLSS_PUSH_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes,{ _r.in.servername = r->in.servername; _r.in.print_processor_name = r->in.print_processor_name; },{ @@ -438,7 +550,7 @@ enum ndr_err_code ndr_push_spoolss_EnumPrintProcessorDataTypes(struct ndr_push * enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessorDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessorDataTypes *r) { - NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessorDataTypes,{ + NDR_SPOOLSS_PULL_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes,{ r->in.servername = _r.in.servername; r->in.print_processor_name = _r.in.print_processor_name; },{ @@ -454,6 +566,34 @@ uint32_t ndr_size_spoolss_EnumPrintProcessorDataTypes_info(TALLOC_CTX *mem_ctx, NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessorDataTypes); } +/* + spoolss_EnumPerMachineConnections +*/ +enum ndr_err_code ndr_push_spoolss_EnumPerMachineConnections(struct ndr_push *ndr, int flags, const struct spoolss_EnumPerMachineConnections *r) +{ + NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPerMachineConnections,{ + _r.in.server = r->in.server; + },{ + _r.in.server = r->in.server; + }); + return NDR_ERR_SUCCESS; +} + +enum ndr_err_code ndr_pull_spoolss_EnumPerMachineConnections(struct ndr_pull *ndr, int flags, struct spoolss_EnumPerMachineConnections *r) +{ + NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPerMachineConnections,{ + r->in.server = _r.in.server; + },{ + _r.in.server = r->in.server; + }); + return NDR_ERR_SUCCESS; +} + +uint32_t ndr_size_spoolss_EnumPerMachineConnections_info(TALLOC_CTX *mem_ctx, uint32_t count, struct spoolss_PrinterInfo4 *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPerMachineConnections); +} + /* spoolss_EnumPrinterDataEx */ diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h index b0fde305c3e..2ede07ac79f 100644 --- a/librpc/ndr/ndr_spoolss_buf.h +++ b/librpc/ndr/ndr_spoolss_buf.h @@ -77,6 +77,7 @@ enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r); _PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type); +uint32_t ndr_size_spoolss_EnumPerMachineConnections_info(TALLOC_CTX *mem_ctx, uint32_t count, struct spoolss_PrinterInfo4 *info); #undef _PRINTF_ATTRIBUTE #define _PRINTF_ATTRIBUTE(a1, a2) diff --git a/selftest/knownfail b/selftest/knownfail index 6a776b12ae9..c9ef0851172 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -216,6 +216,7 @@ ^samba3.rpc.spoolss.printer.addprinterex.driver_info_winreg # knownfail or flapping? ^samba3.rpc.spoolss.printer.*.publish_toggle\(.*\)$ # needs spoolss AD member env ^samba3.rpc.spoolss.printer.*.log_jobinfo\(.*\)$ # not implemented yet +^samba3.rpc.spoolss.printserver.*.addpermachineconnection\(.*\)$ # not implemented yet ^samba3.rpc.spoolss.printserver.*.add_processor\(.*\)$ ^samba3.rpc.spoolss.printserver.*.get_core_printer_drivers\(.*\)$ ^samba3.rpc.spoolss.printserver.*.get_printer_driver_package_path\(.*\)$ diff --git a/source3/rpcclient/cmd_clusapi.c b/source3/rpcclient/cmd_clusapi.c index 33d3a1c016e..7f208a1ca1a 100644 --- a/source3/rpcclient/cmd_clusapi.c +++ b/source3/rpcclient/cmd_clusapi.c @@ -501,6 +501,116 @@ static WERROR cmd_clusapi_get_cluster_version2(struct rpc_pipe_client *cli, return WERR_OK; } +static WERROR cmd_clusapi_pause_node(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + struct dcerpc_binding_handle *b = cli->binding_handle; + NTSTATUS status; + const char *lpszNodeName = "CTDB_NODE_0"; + WERROR Status; + struct policy_handle hNode; + WERROR rpc_status; + WERROR result, ignore; + + if (argc >= 2) { + lpszNodeName = argv[1]; + } + + status = dcerpc_clusapi_OpenNode(b, mem_ctx, + lpszNodeName, + &Status, + &rpc_status, + &hNode); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + if (!W_ERROR_IS_OK(Status)) { + printf("Failed to open node %s\n", lpszNodeName); + printf("Status: %s\n", win_errstr(Status)); + return Status; + } + + status = dcerpc_clusapi_PauseNode(b, mem_ctx, + hNode, + &rpc_status, + &result); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + if (!W_ERROR_IS_OK(result)) { + printf("Failed to pause node %s\n", lpszNodeName); + printf("Status: %s\n", win_errstr(result)); + return result; + } + + dcerpc_clusapi_CloseNode(b, mem_ctx, + &hNode, + &ignore); + + printf("Cluster node %s has been paused\n", lpszNodeName); + printf("rpc_status: %s\n", win_errstr(rpc_status)); + + return WERR_OK; +} + +static WERROR cmd_clusapi_resume_node(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + struct dcerpc_binding_handle *b = cli->binding_handle; + NTSTATUS status; + const char *lpszNodeName = "CTDB_NODE_0"; + WERROR Status; + struct policy_handle hNode; + WERROR rpc_status; + WERROR result, ignore; + + if (argc >= 2) { + lpszNodeName = argv[1]; + } + + status = dcerpc_clusapi_OpenNode(b, mem_ctx, + lpszNodeName, + &Status, + &rpc_status, + &hNode); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } -- Samba Shared Repository