diff options
-rw-r--r-- | librpc/idl/srvsvc.idl (renamed from source3/librpc/idl/srvsvc.idl) | 51 | ||||
-rw-r--r-- | source3/Makefile.in | 2 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_srvsvc.c | 33 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_srvsvc.h | 15 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_srvsvc.c | 405 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_srvsvc.h | 3 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_srvsvc.c | 9 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srvsvc.h | 45 | ||||
-rw-r--r-- | source4/client/client.c | 17 | ||||
-rw-r--r-- | source4/libnet/libnet_share.c | 29 | ||||
-rw-r--r-- | source4/libnet/libnet_time.c | 16 | ||||
-rw-r--r-- | source4/librpc/idl/srvsvc.idl | 103 | ||||
-rw-r--r-- | source4/rpc_server/common/share_info.c | 6 | ||||
-rw-r--r-- | source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 463 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_share.c | 9 | ||||
-rw-r--r-- | source4/torture/rpc/bench.c | 43 | ||||
-rw-r--r-- | source4/torture/rpc/samba3rpc.c | 109 | ||||
-rw-r--r-- | source4/torture/rpc/srvsvc.c | 453 |
18 files changed, 1079 insertions, 732 deletions
diff --git a/source3/librpc/idl/srvsvc.idl b/librpc/idl/srvsvc.idl index 39d72b73da..dcdd1ac546 100644 --- a/source3/librpc/idl/srvsvc.idl +++ b/librpc/idl/srvsvc.idl @@ -51,12 +51,16 @@ import "security.idl", "svcctl.idl"; [default] ; } srvsvc_NetCharDevCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetCharDevCtr ctr; + } srvsvc_NetCharDevInfoCtr; + /******************/ /* Function: 0x00 */ WERROR srvsvc_NetCharDevEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,out,ref] uint32 *level, - [in,out,ref,switch_is(*level)] srvsvc_NetCharDevCtr *ctr, + [in,out,ref] srvsvc_NetCharDevInfoCtr *info_ctr, [in] uint32 max_buffer, [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle @@ -116,13 +120,17 @@ import "security.idl", "svcctl.idl"; [default] ; } srvsvc_NetCharDevQCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetCharDevQCtr ctr; + } srvsvc_NetCharDevQInfoCtr; + /******************/ /* Function: 0x03 */ WERROR srvsvc_NetCharDevQEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in,unique] [string,charset(UTF16)] uint16 *user, - [in,out,ref] uint32 *level, - [in,out,switch_is(*level),ref] srvsvc_NetCharDevQCtr *ctr, + [in,out,ref] srvsvc_NetCharDevQInfoCtr *info_ctr, [in] uint32 max_buffer, [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle @@ -279,7 +287,7 @@ import "security.idl", "svcctl.idl"; /* Function: 0x0b */ WERROR srvsvc_NetFileClose( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 fid + [in] uint32 fid ); /**************************/ @@ -487,7 +495,7 @@ import "security.idl", "svcctl.idl"; SHARE_1005_IN_DFS = 0x00000001, SHARE_1005_DFS_ROOT = 0x00000002 } NetShareInfo1005Flags; - + const uint32 SHARE_1005_CSC_POLICY_MASK = 0x00000030; const uint32 SHARE_1005_CSC_POLICY_SHIFT = 4; @@ -610,7 +618,7 @@ import "security.idl", "svcctl.idl"; [in] [string,charset(UTF16)] uint16 share_name[], [in] uint32 reserved ); - + /******************/ /* Function: 0x14 */ WERROR srvsvc_NetShareCheck( @@ -680,6 +688,7 @@ import "security.idl", "svcctl.idl"; uint32 sessreqs; uint32 opensearch; uint32 activelocks; + uint32 numreqbufs; uint32 sizereqbufs; uint32 numbigbufs; uint32 numfiletasks; @@ -713,6 +722,7 @@ import "security.idl", "svcctl.idl"; uint32 sessreqs; uint32 opensearch; uint32 activelocks; + uint32 numreqbufs; uint32 sizereqbufs; uint32 numbigbufs; uint32 numfiletasks; @@ -1142,7 +1152,16 @@ import "security.idl", "svcctl.idl"; /* srvsvc_NetDisk */ /**************************/ typedef struct { - [flag(STR_LEN4)] string disk; + /* + * In theory this should be: + * [charset(UTF16),string] uint16 annotation[3] + * But midl treats this as: + * [charset(UTF16),string] uint16 annotation[] + * and pidl doesn't support this yet + */ + [value(0)] uint32 __disk_offset; + [value(strlen(disk)+1)] uint32 __disk_length; + [charset(UTF16)] uint16 disk[__disk_length]; } srvsvc_NetDiskInfo0; typedef struct { @@ -1191,7 +1210,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *service, [in] uint32 level, [in] uint32 options, - [out,ref] srvsvc_Statistics *stats + [out,ref] srvsvc_Statistics **stats ); /**************************/ @@ -1272,12 +1291,16 @@ import "security.idl", "svcctl.idl"; [default]; } srvsvc_NetTransportCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetTransportCtr ctr; + } srvsvc_NetTransportInfoCtr; + /******************/ /* Function: 0x1a */ WERROR srvsvc_NetTransportEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,out,ref] uint32 *level, - [in,out,ref,switch_is(*level)] srvsvc_NetTransportCtr *transports, + [in,out,ref] srvsvc_NetTransportInfoCtr *transports, [in] uint32 max_buffer, [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle @@ -1287,8 +1310,8 @@ import "security.idl", "svcctl.idl"; /* Function: 0x1b */ WERROR srvsvc_NetTransportDel( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 unknown, - [in] srvsvc_NetTransportInfo0 transport + [in] uint32 level, + [in] srvsvc_NetTransportInfo0 *info0 ); /**************************/ @@ -1394,7 +1417,7 @@ import "security.idl", "svcctl.idl"; /**************************/ /******************/ /* Function: 0x24 */ - /* Note, there must be some way to return entries read vs + /* Note, there must be some way to return entries read vs total entries ... */ WERROR srvsvc_NetShareEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, diff --git a/source3/Makefile.in b/source3/Makefile.in index 6bd72f8f0a..eae7dad7a6 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1216,7 +1216,7 @@ samba3-idl:: @PIDL_ARGS="$(PIDL_ARGS)" CPP="$(CPP)" PIDL="../pidl/pidl" \ srcdir="$(srcdir)" $(srcdir)/script/build_idl.sh ../librpc/idl/lsa.idl \ ../librpc/idl/dfs.idl ../librpc/idl/echo.idl ../librpc/idl/winreg.idl \ - ../librpc/idl/initshutdown.idl librpc/idl/srvsvc.idl ../librpc/idl/svcctl.idl \ + ../librpc/idl/initshutdown.idl ../librpc/idl/srvsvc.idl ../librpc/idl/svcctl.idl \ ../librpc/idl/eventlog.idl ../librpc/idl/wkssvc.idl ../librpc/idl/netlogon.idl \ ../librpc/idl/notify.idl ../librpc/idl/epmapper.idl librpc/idl/messaging.idl \ ../librpc/idl/xattr.idl ../librpc/idl/misc.idl librpc/idl/samr.idl \ diff --git a/source3/librpc/gen_ndr/cli_srvsvc.c b/source3/librpc/gen_ndr/cli_srvsvc.c index fbf981365c..eb81652a1d 100644 --- a/source3/librpc/gen_ndr/cli_srvsvc.c +++ b/source3/librpc/gen_ndr/cli_srvsvc.c @@ -9,8 +9,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc /* [in] [unique,charset(UTF16)] */, - uint32_t *level /* [in,out] [ref] */, - union srvsvc_NetCharDevCtr *ctr /* [in,out] [ref,switch_is(*level)] */, + struct srvsvc_NetCharDevInfoCtr *info_ctr /* [in,out] [ref] */, uint32_t max_buffer /* [in] */, uint32_t *totalentries /* [out] [ref] */, uint32_t *resume_handle /* [in,out] [unique] */, @@ -21,8 +20,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, /* In parameters */ r.in.server_unc = server_unc; - r.in.level = level; - r.in.ctr = ctr; + r.in.info_ctr = info_ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; @@ -49,8 +47,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, } /* Return variables */ - *level = *r.out.level; - *ctr = *r.out.ctr; + *info_ctr = *r.out.info_ctr; *totalentries = *r.out.totalentries; if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; @@ -164,8 +161,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc /* [in] [unique,charset(UTF16)] */, const char *user /* [in] [unique,charset(UTF16)] */, - uint32_t *level /* [in,out] [ref] */, - union srvsvc_NetCharDevQCtr *ctr /* [in,out] [ref,switch_is(*level)] */, + struct srvsvc_NetCharDevQInfoCtr *info_ctr /* [in,out] [ref] */, uint32_t max_buffer /* [in] */, uint32_t *totalentries /* [out] [ref] */, uint32_t *resume_handle /* [in,out] [unique] */, @@ -177,8 +173,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, /* In parameters */ r.in.server_unc = server_unc; r.in.user = user; - r.in.level = level; - r.in.ctr = ctr; + r.in.info_ctr = info_ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; @@ -205,8 +200,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, } /* Return variables */ - *level = *r.out.level; - *ctr = *r.out.ctr; + *info_ctr = *r.out.info_ctr; *totalentries = *r.out.totalentries; if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; @@ -1246,7 +1240,7 @@ NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, const char *service /* [in] [unique,charset(UTF16)] */, uint32_t level /* [in] */, uint32_t options /* [in] */, - struct srvsvc_Statistics *stats /* [out] [ref] */, + struct srvsvc_Statistics **stats /* [out] [ref] */, WERROR *werror) { struct srvsvc_NetServerStatisticsGet r; @@ -1341,8 +1335,7 @@ NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc /* [in] [unique,charset(UTF16)] */, - uint32_t *level /* [in,out] [ref] */, - union srvsvc_NetTransportCtr *transports /* [in,out] [ref,switch_is(*level)] */, + struct srvsvc_NetTransportInfoCtr *transports /* [in,out] [ref] */, uint32_t max_buffer /* [in] */, uint32_t *totalentries /* [out] [ref] */, uint32_t *resume_handle /* [in,out] [unique] */, @@ -1353,7 +1346,6 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, /* In parameters */ r.in.server_unc = server_unc; - r.in.level = level; r.in.transports = transports; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; @@ -1381,7 +1373,6 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, } /* Return variables */ - *level = *r.out.level; *transports = *r.out.transports; *totalentries = *r.out.totalentries; if (resume_handle && r.out.resume_handle) { @@ -1399,8 +1390,8 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc /* [in] [unique,charset(UTF16)] */, - uint32_t unknown /* [in] */, - struct srvsvc_NetTransportInfo0 transport /* [in] */, + uint32_t level /* [in] */, + struct srvsvc_NetTransportInfo0 *info0 /* [in] [ref] */, WERROR *werror) { struct srvsvc_NetTransportDel r; @@ -1408,8 +1399,8 @@ NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, /* In parameters */ r.in.server_unc = server_unc; - r.in.unknown = unknown; - r.in.transport = transport; + r.in.level = level; + r.in.info0 = info0; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetTransportDel, &r); diff --git a/source3/librpc/gen_ndr/cli_srvsvc.h b/source3/librpc/gen_ndr/cli_srvsvc.h index 4ab4734de5..44b50e7d19 100644 --- a/source3/librpc/gen_ndr/cli_srvsvc.h +++ b/source3/librpc/gen_ndr/cli_srvsvc.h @@ -4,8 +4,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc /* [in] [unique,charset(UTF16)] */, - uint32_t *level /* [in,out] [ref] */, - union srvsvc_NetCharDevCtr *ctr /* [in,out] [ref,switch_is(*level)] */, + struct srvsvc_NetCharDevInfoCtr *info_ctr /* [in,out] [ref] */, uint32_t max_buffer /* [in] */, uint32_t *totalentries /* [out] [ref] */, uint32_t *resume_handle /* [in,out] [unique] */, @@ -27,8 +26,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc /* [in] [unique,charset(UTF16)] */, const char *user /* [in] [unique,charset(UTF16)] */, - uint32_t *level /* [in,out] [ref] */, - union srvsvc_NetCharDevQCtr *ctr /* [in,out] [ref,switch_is(*level)] */, + struct srvsvc_NetCharDevQInfoCtr *info_ctr /* [in,out] [ref] */, uint32_t max_buffer /* [in] */, uint32_t *totalentries /* [out] [ref] */, uint32_t *resume_handle /* [in,out] [unique] */, @@ -183,7 +181,7 @@ NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, const char *service /* [in] [unique,charset(UTF16)] */, uint32_t level /* [in] */, uint32_t options /* [in] */, - struct srvsvc_Statistics *stats /* [out] [ref] */, + struct srvsvc_Statistics **stats /* [out] [ref] */, WERROR *werror); NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -194,8 +192,7 @@ NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc /* [in] [unique,charset(UTF16)] */, - uint32_t *level /* [in,out] [ref] */, - union srvsvc_NetTransportCtr *transports /* [in,out] [ref,switch_is(*level)] */, + struct srvsvc_NetTransportInfoCtr *transports /* [in,out] [ref] */, uint32_t max_buffer /* [in] */, uint32_t *totalentries /* [out] [ref] */, uint32_t *resume_handle /* [in,out] [unique] */, @@ -203,8 +200,8 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc /* [in] [unique,charset(UTF16)] */, - uint32_t unknown /* [in] */, - struct srvsvc_NetTransportInfo0 transport /* [in] */, + uint32_t level /* [in] */, + struct srvsvc_NetTransportInfo0 *info0 /* [in] [ref] */, WERROR *werror); NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/librpc/gen_ndr/ndr_srvsvc.c b/source3/librpc/gen_ndr/ndr_srvsvc.c index 36c3dbe256..6017202133 100644 --- a/source3/librpc/gen_ndr/ndr_srvsvc.c +++ b/source3/librpc/gen_ndr/ndr_srvsvc.c @@ -612,6 +612,44 @@ _PUBLIC_ void ndr_print_srvsvc_NetCharDevCtr(struct ndr_print *ndr, const char * } } +static enum ndr_err_code ndr_push_srvsvc_NetCharDevInfoCtr(struct ndr_push *ndr, int ndr_flags, const struct srvsvc_NetCharDevInfoCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->level)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->level)); + NDR_CHECK(ndr_push_srvsvc_NetCharDevCtr(ndr, NDR_SCALARS, &r->ctr)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_srvsvc_NetCharDevCtr(ndr, NDR_BUFFERS, &r->ctr)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_srvsvc_NetCharDevInfoCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetCharDevInfoCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->level)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->ctr, r->level)); + NDR_CHECK(ndr_pull_srvsvc_NetCharDevCtr(ndr, NDR_SCALARS, &r->ctr)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_srvsvc_NetCharDevCtr(ndr, NDR_BUFFERS, &r->ctr)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_srvsvc_NetCharDevInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevInfoCtr *r) +{ + ndr_print_struct(ndr, name, "srvsvc_NetCharDevInfoCtr"); + ndr->depth++; + ndr_print_uint32(ndr, "level", r->level); + ndr_print_set_switch_value(ndr, &r->ctr, r->level); + ndr_print_srvsvc_NetCharDevCtr(ndr, "ctr", &r->ctr); + ndr->depth--; +} + static enum ndr_err_code ndr_push_srvsvc_NetCharDevQInfo0(struct ndr_push *ndr, int ndr_flags, const struct srvsvc_NetCharDevQInfo0 *r) { if (ndr_flags & NDR_SCALARS) { @@ -1222,6 +1260,44 @@ _PUBLIC_ void ndr_print_srvsvc_NetCharDevQCtr(struct ndr_print *ndr, const char } } +static enum ndr_err_code ndr_push_srvsvc_NetCharDevQInfoCtr(struct ndr_push *ndr, int ndr_flags, const struct srvsvc_NetCharDevQInfoCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->level)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->level)); + NDR_CHECK(ndr_push_srvsvc_NetCharDevQCtr(ndr, NDR_SCALARS, &r->ctr)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_srvsvc_NetCharDevQCtr(ndr, NDR_BUFFERS, &r->ctr)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_srvsvc_NetCharDevQInfoCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetCharDevQInfoCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->level)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->ctr, r->level)); + NDR_CHECK(ndr_pull_srvsvc_NetCharDevQCtr(ndr, NDR_SCALARS, &r->ctr)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_srvsvc_NetCharDevQCtr(ndr, NDR_BUFFERS, &r->ctr)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQInfoCtr *r) +{ + ndr_print_struct(ndr, name, "srvsvc_NetCharDevQInfoCtr"); + ndr->depth++; + ndr_print_uint32(ndr, "level", r->level); + ndr_print_set_switch_value(ndr, &r->ctr, r->level); + ndr_print_srvsvc_NetCharDevQCtr(ndr, "ctr", &r->ctr); + ndr->depth--; +} + static enum ndr_err_code ndr_push_srvsvc_NetConnInfo0(struct ndr_push *ndr, int ndr_flags, const struct srvsvc_NetConnInfo0 *r) { if (ndr_flags & NDR_SCALARS) { @@ -6629,6 +6705,7 @@ static enum ndr_err_code ndr_push_srvsvc_NetSrvInfo402(struct ndr_push *ndr, int NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sessreqs)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->opensearch)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->activelocks)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->numreqbufs)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sizereqbufs)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->numbigbufs)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->numfiletasks)); @@ -6703,6 +6780,7 @@ static enum ndr_err_code ndr_pull_srvsvc_NetSrvInfo402(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sessreqs)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->opensearch)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->activelocks)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->numreqbufs)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sizereqbufs)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->numbigbufs)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->numfiletasks)); @@ -6794,6 +6872,7 @@ _PUBLIC_ void ndr_print_srvsvc_NetSrvInfo402(struct ndr_print *ndr, const char * ndr_print_uint32(ndr, "sessreqs", r->sessreqs); ndr_print_uint32(ndr, "opensearch", r->opensearch); ndr_print_uint32(ndr, "activelocks", r->activelocks); + ndr_print_uint32(ndr, "numreqbufs", r->numreqbufs); ndr_print_uint32(ndr, "sizereqbufs", r->sizereqbufs); ndr_print_uint32(ndr, "numbigbufs", r->numbigbufs); ndr_print_uint32(ndr, "numfiletasks", r->numfiletasks); @@ -6836,6 +6915,7 @@ static enum ndr_err_code ndr_push_srvsvc_NetSrvInfo403(struct ndr_push *ndr, int NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sessreqs)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->opensearch)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->activelocks)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->numreqbufs)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sizereqbufs)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->numbigbufs)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->numfiletasks)); @@ -6921,6 +7001,7 @@ static enum ndr_err_code ndr_pull_srvsvc_NetSrvInfo403(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sessreqs)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->opensearch)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->activelocks)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->numreqbufs)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sizereqbufs)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->numbigbufs)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->numfiletasks)); @@ -7032,6 +7113,7 @@ _PUBLIC_ void ndr_print_srvsvc_NetSrvInfo403(struct ndr_print *ndr, const char * ndr_print_uint32(ndr, "sessreqs", r->sessreqs); ndr_print_uint32(ndr, "opensearch", r->opensearch); ndr_print_uint32(ndr, "activelocks", r->activelocks); + ndr_print_uint32(ndr, "numreqbufs", r->numreqbufs); ndr_print_uint32(ndr, "sizereqbufs", r->sizereqbufs); ndr_print_uint32(ndr, "numbigbufs", r->numbigbufs); ndr_print_uint32(ndr, "numfiletasks", r->numfiletasks); @@ -11470,12 +11552,9 @@ static enum ndr_err_code ndr_push_srvsvc_NetDiskInfo0(struct ndr_push *ndr, int { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - { - uint32_t _flags_save_string = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_LEN4); - NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->disk)); - ndr->flags = _flags_save_string; - } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen(r->disk) + 1)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->disk, strlen(r->disk) + 1, sizeof(uint16_t), CH_UTF16)); } if (ndr_flags & NDR_BUFFERS) { } @@ -11486,12 +11565,9 @@ static enum ndr_err_code ndr_pull_srvsvc_NetDiskInfo0(struct ndr_pull *ndr, int { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); - { - uint32_t _flags_save_string = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_LEN4); - NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->disk)); - ndr->flags = _flags_save_string; - } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__disk_offset)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__disk_length)); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->disk, r->__disk_length, sizeof(uint16_t), CH_UTF16)); } if (ndr_flags & NDR_BUFFERS) { } @@ -11502,6 +11578,8 @@ _PUBLIC_ void ndr_print_srvsvc_NetDiskInfo0(struct ndr_print *ndr, const char *n { ndr_print_struct(ndr, name, "srvsvc_NetDiskInfo0"); ndr->depth++; + ndr_print_uint32(ndr, "__disk_offset", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->__disk_offset); + ndr_print_uint32(ndr, "__disk_length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->disk) + 1:r->__disk_length); ndr_print_string(ndr, "disk", r->disk); ndr->depth--; } @@ -12860,6 +12938,44 @@ _PUBLIC_ void ndr_print_srvsvc_NetTransportCtr(struct ndr_print *ndr, const char } } +static enum ndr_err_code ndr_push_srvsvc_NetTransportInfoCtr(struct ndr_push *ndr, int ndr_flags, const struct srvsvc_NetTransportInfoCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->level)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->level)); + NDR_CHECK(ndr_push_srvsvc_NetTransportCtr(ndr, NDR_SCALARS, &r->ctr)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_srvsvc_NetTransportCtr(ndr, NDR_BUFFERS, &r->ctr)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_srvsvc_NetTransportInfoCtr(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetTransportInfoCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->level)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->ctr, r->level)); + NDR_CHECK(ndr_pull_srvsvc_NetTransportCtr(ndr, NDR_SCALARS, &r->ctr)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_srvsvc_NetTransportCtr(ndr, NDR_BUFFERS, &r->ctr)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_srvsvc_NetTransportInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfoCtr *r) +{ + ndr_print_struct(ndr, name, "srvsvc_NetTransportInfoCtr"); + ndr->depth++; + ndr_print_uint32(ndr, "level", r->level); + ndr_print_set_switch_value(ndr, &r->ctr, r->level); + ndr_print_srvsvc_NetTransportCtr(ndr, "ctr", &r->ctr); + ndr->depth--; +} + static enum ndr_err_code ndr_push_srvsvc_NetRemoteTODInfo(struct ndr_push *ndr, int ndr_flags, const struct srvsvc_NetRemoteTODInfo *r) { if (ndr_flags & NDR_SCALARS) { @@ -13068,15 +13184,10 @@ static enum ndr_err_code ndr_push_srvsvc_NetCharDevEnum(struct ndr_push *ndr, in NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_unc, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_unc, ndr_charset_length(r->in.server_unc, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - if (r->in.level == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.level)); - if (r->in.ctr == NULL) { + if (r->in.info_ctr == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.ctr, *r->in.level)); - NDR_CHECK(ndr_push_srvsvc_NetCharDevCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.ctr)); + NDR_CHECK(ndr_push_srvsvc_NetCharDevInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info_ctr)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_buffer)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.resume_handle)); if (r->in.resume_handle) { @@ -13084,15 +13195,10 @@ static enum ndr_err_code ndr_push_srvsvc_NetCharDevEnum(struct ndr_push *ndr, in } } if (flags & NDR_OUT) { - if (r->out.level == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.level)); - if (r->out.ctr == NULL) { + if (r->out.info_ctr == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.ctr, *r->out.level)); - NDR_CHECK(ndr_push_srvsvc_NetCharDevCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr)); + NDR_CHECK(ndr_push_srvsvc_NetCharDevInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info_ctr)); if (r->out.totalentries == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -13111,8 +13217,7 @@ static enum ndr_err_code ndr_pull_srvsvc_NetCharDevEnum(struct ndr_pull *ndr, in uint32_t _ptr_server_unc; uint32_t _ptr_resume_handle; TALLOC_CTX *_mem_save_server_unc_0; - TALLOC_CTX *_mem_save_level_0; - TALLOC_CTX *_mem_save_ctr_0; + TALLOC_CTX *_mem_save_info_ctr_0; TALLOC_CTX *_mem_save_totalentries_0; TALLOC_CTX *_mem_save_resume_handle_0; if (flags & NDR_IN) { @@ -13137,20 +13242,12 @@ static enum ndr_err_code ndr_pull_srvsvc_NetCharDevEnum(struct ndr_pull *ndr, in NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_unc_0, 0); } if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->in.level); - } - _mem_save_level_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.level, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.level)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_level_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->in.ctr); + NDR_PULL_ALLOC(ndr, r->in.info_ctr); } - _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.ctr, *r->in.level)); - NDR_CHECK(ndr_pull_srvsvc_NetCharDevCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.ctr)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); + _mem_save_info_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info_ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_srvsvc_NetCharDevInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info_ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_ctr_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_buffer)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_resume_handle)); if (_ptr_resume_handle) { @@ -13164,29 +13261,19 @@ static enum ndr_err_code ndr_pull_srvsvc_NetCharDevEnum(struct ndr_pull *ndr, in NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, 0); } - NDR_PULL_ALLOC(ndr, r->out.level); - *r->out.level = *r->in.level; - NDR_PULL_ALLOC(ndr, r->out.ctr); - *r->out.ctr = *r->in.ctr; + NDR_PULL_ALLOC(ndr, r->out.info_ctr); + *r->out.info_ctr = *r->in.info_ctr; NDR_PULL_ALLOC(ndr, r->out.totalentries); ZERO_STRUCTP(r->out.totalentries); } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.level); - } - _mem_save_level_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.level, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.level)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_level_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.ctr); + NDR_PULL_ALLOC(ndr, r->out.info_ctr); } - _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.ctr, *r->out.level)); - NDR_CHECK(ndr_pull_srvsvc_NetCharDevCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); + _mem_save_info_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info_ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_srvsvc_NetCharDevInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info_ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_ctr_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.totalentries); } @@ -13227,14 +13314,9 @@ _PUBLIC_ void ndr_print_srvsvc_NetCharDevEnum(struct ndr_print *ndr, const char ndr_print_string(ndr, "server_unc", r->in.server_unc); } ndr->depth--; - ndr_print_ptr(ndr, "level", r->in.level); - ndr->depth++; - ndr_print_uint32(ndr, "level", *r->in.level); - ndr->depth--; - ndr_print_ptr(ndr, "ctr", r->in.ctr); + ndr_print_ptr(ndr, "info_ctr", r->in.info_ctr); ndr->depth++; - ndr_print_set_switch_value(ndr, r->in.ctr, *r->in.level); - ndr_print_srvsvc_NetCharDevCtr(ndr, "ctr", r->in.ctr); + ndr_print_srvsvc_NetCharDevInfoCtr(ndr, "info_ctr", r->in.info_ctr); ndr->depth--; ndr_print_uint32(ndr, "max_buffer", r->in.max_buffer); ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle); @@ -13248,14 +13330,9 @@ _PUBLIC_ void ndr_print_srvsvc_NetCharDevEnum(struct ndr_print *ndr, const char if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetCharDevEnum"); ndr->depth++; - ndr_print_ptr(ndr, "level", r->out.level); - ndr->depth++; - ndr_print_uint32(ndr, "level", *r->out.level); - ndr->depth--; - ndr_print_ptr(ndr, "ctr", r->out.ctr); + ndr_print_ptr(ndr, "info_ctr", r->out.info_ctr); ndr->depth++; - ndr_print_set_switch_value(ndr, r->out.ctr, *r->out.level); - ndr_print_srvsvc_NetCharDevCtr(ndr, "ctr", r->out.ctr); + ndr_print_srvsvc_NetCharDevInfoCtr(ndr, "info_ctr", r->out.info_ctr); ndr->depth--; ndr_print_ptr(ndr, "totalentries", r->out.totalentries); ndr->depth++; @@ -13491,15 +13568,10 @@ static enum ndr_err_code ndr_push_srvsvc_NetCharDevQEnum(struct ndr_push *ndr, i NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.user, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.user, ndr_charset_length(r->in.user, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - if (r->in.level == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.level)); - if (r->in.ctr == NULL) { + if (r->in.info_ctr == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.ctr, *r->in.level)); - NDR_CHECK(ndr_push_srvsvc_NetCharDevQCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.ctr)); + NDR_CHECK(ndr_push_srvsvc_NetCharDevQInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info_ctr)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_buffer)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.resume_handle)); if (r->in.resume_handle) { @@ -13507,15 +13579,10 @@ static enum ndr_err_code ndr_push_srvsvc_NetCharDevQEnum(struct ndr_push *ndr, i } } if (flags & NDR_OUT) { - if (r->out.level == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.level)); - if (r->out.ctr == NULL) { + if (r->out.info_ctr == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.ctr, *r->out.level)); - NDR_CHECK(ndr_push_srvsvc_NetCharDevQCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr)); + NDR_CHECK(ndr_push_srvsvc_NetCharDevQInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info_ctr)); if (r->out.totalentries == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -13536,8 +13603,7 @@ static enum ndr_err_code ndr_pull_srvsvc_NetCharDevQEnum(struct ndr_pull *ndr, i uint32_t _ptr_resume_handle; TALLOC_CTX *_mem_save_server_unc_0; TALLOC_CTX *_mem_save_user_0; - TALLOC_CTX *_mem_save_level_0; - TALLOC_CTX *_mem_save_ctr_0; + TALLOC_CTX *_mem_save_info_ctr_0; TALLOC_CTX *_mem_save_totalentries_0; TALLOC_CTX *_mem_save_resume_handle_0; if (flags & NDR_IN) { @@ -13580,20 +13646,12 @@ static enum ndr_err_code ndr_pull_srvsvc_NetCharDevQEnum(struct ndr_pull *ndr, i NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_0, 0); } if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->in.level); - } - _mem_save_level_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.level, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.level)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_level_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->in.ctr); + NDR_PULL_ALLOC(ndr, r->in.info_ctr); } - _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.ctr, *r->in.level)); - NDR_CHECK(ndr_pull_srvsvc_NetCharDevQCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.ctr)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); + _mem_save_info_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info_ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_srvsvc_NetCharDevQInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info_ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_ctr_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_buffer)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_resume_handle)); if (_ptr_resume_handle) { @@ -13607,29 +13665,19 @@ static enum ndr_err_code ndr_pull_srvsvc_NetCharDevQEnum(struct ndr_pull *ndr, i NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, 0); } - NDR_PULL_ALLOC(ndr, r->out.level); - *r->out.level = *r->in.level; - NDR_PULL_ALLOC(ndr, r->out.ctr); - *r->out.ctr = *r->in.ctr; + NDR_PULL_ALLOC(ndr, r->out.info_ctr); + *r->out.info_ctr = *r->in.info_ctr; NDR_PULL_ALLOC(ndr, r->out.totalentries); ZERO_STRUCTP(r->out.totalentries); } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.level); - } - _mem_save_level_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.level, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.level)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_level_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.ctr); + NDR_PULL_ALLOC(ndr, r->out.info_ctr); } - _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.ctr, *r->out.level)); - NDR_CHECK(ndr_pull_srvsvc_NetCharDevQCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); + _mem_save_info_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info_ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_srvsvc_NetCharDevQInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info_ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_ctr_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.totalentries); } @@ -13676,14 +13724,9 @@ _PUBLIC_ void ndr_print_srvsvc_NetCharDevQEnum(struct ndr_print *ndr, const char ndr_print_string(ndr, "user", r->in.user); } ndr->depth--; - ndr_print_ptr(ndr, "level", r->in.level); - ndr->depth++; - ndr_print_uint32(ndr, "level", *r->in.level); - ndr->depth--; - ndr_print_ptr(ndr, "ctr", r->in.ctr); + ndr_print_ptr(ndr, "info_ctr", r->in.info_ctr); ndr->depth++; - ndr_print_set_switch_value(ndr, r->in.ctr, *r->in.level); - ndr_print_srvsvc_NetCharDevQCtr(ndr, "ctr", r->in.ctr); + ndr_print_srvsvc_NetCharDevQInfoCtr(ndr, "info_ctr", r->in.info_ctr); ndr->depth--; ndr_print_uint32(ndr, "max_buffer", r->in.max_buffer); ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle); @@ -13697,14 +13740,9 @@ _PUBLIC_ void ndr_print_srvsvc_NetCharDevQEnum(struct ndr_print *ndr, const char if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetCharDevQEnum"); ndr->depth++; - ndr_print_ptr(ndr, "level", r->out.level); - ndr->depth++; - ndr_print_uint32(ndr, "level", *r->out.level); - ndr->depth--; - ndr_print_ptr(ndr, "ctr", r->out.ctr); + ndr_print_ptr(ndr, "info_ctr", r->out.info_ctr); ndr->depth++; - ndr_print_set_switch_value(ndr, r->out.ctr, *r->out.level); - ndr_print_srvsvc_NetCharDevQCtr(ndr, "ctr", r->out.ctr); + ndr_print_srvsvc_NetCharDevQInfoCtr(ndr, "info_ctr", r->out.info_ctr); ndr->depth--; ndr_print_ptr(ndr, "totalentries", r->out.totalentries); ndr->depth++; @@ -16505,7 +16543,10 @@ static enum ndr_err_code ndr_push_srvsvc_NetServerStatisticsGet(struct ndr_push if (r->out.stats == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_srvsvc_Statistics(ndr, NDR_SCALARS, r->out.stats)); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.stats)); + if (*r->out.stats) { + NDR_CHECK(ndr_push_srvsvc_Statistics(ndr, NDR_SCALARS, *r->out.stats)); + } NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -16515,9 +16556,11 @@ static enum ndr_err_code ndr_pull_srvsvc_NetServerStatisticsGet(struct ndr_pull { uint32_t _ptr_server_unc; uint32_t _ptr_service; + uint32_t _ptr_stats; TALLOC_CTX *_mem_save_server_unc_0; TALLOC_CTX *_mem_save_service_0; TALLOC_CTX *_mem_save_stats_0; + TALLOC_CTX *_mem_save_stats_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -16568,7 +16611,18 @@ static enum ndr_err_code ndr_pull_srvsvc_NetServerStatisticsGet(struct ndr_pull } _mem_save_stats_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.stats, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_srvsvc_Statistics(ndr, NDR_SCALARS, r->out.stats)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_stats)); + if (_ptr_stats) { + NDR_PULL_ALLOC(ndr, *r->out.stats); + } else { + *r->out.stats = NULL; + } + if (*r->out.stats) { + _mem_save_stats_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.stats, 0); + NDR_CHECK(ndr_pull_srvsvc_Statistics(ndr, NDR_SCALARS, *r->out.stats)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_stats_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_stats_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -16606,7 +16660,12 @@ _PUBLIC_ void ndr_print_srvsvc_NetServerStatisticsGet(struct ndr_print *ndr, con ndr->depth++; ndr_print_ptr(ndr, "stats", r->out.stats); ndr->depth++; - ndr_print_srvsvc_Statistics(ndr, "stats", r->out.stats); + ndr_print_ptr(ndr, "stats", *r->out.stats); + ndr->depth++; + if (*r->out.stats) { + ndr_print_srvsvc_Statistics(ndr, "stats", *r->out.stats); + } + ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -16707,15 +16766,10 @@ static enum ndr_err_code ndr_push_srvsvc_NetTransportEnum(struct ndr_push *ndr, NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_unc, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_unc, ndr_charset_length(r->in.server_unc, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - if (r->in.level == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.level)); if (r->in.transports == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.transports, *r->in.level)); - NDR_CHECK(ndr_push_srvsvc_NetTransportCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.transports)); + NDR_CHECK(ndr_push_srvsvc_NetTransportInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.transports)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_buffer)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.resume_handle)); if (r->in.resume_handle) { @@ -16723,15 +16777,10 @@ static enum ndr_err_code ndr_push_srvsvc_NetTransportEnum(struct ndr_push *ndr, } } if (flags & NDR_OUT) { - if (r->out.level == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.level)); if (r->out.transports == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.transports, *r->out.level)); - NDR_CHECK(ndr_push_srvsvc_NetTransportCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.transports)); + NDR_CHECK(ndr_push_srvsvc_NetTransportInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.transports)); if (r->out.totalentries == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -16750,7 +16799,6 @@ static enum ndr_err_code ndr_pull_srvsvc_NetTransportEnum(struct ndr_pull *ndr, uint32_t _ptr_server_unc; uint32_t _ptr_resume_handle; TALLOC_CTX *_mem_save_server_unc_0; - TALLOC_CTX *_mem_save_level_0; TALLOC_CTX *_mem_save_transports_0; TALLOC_CTX *_mem_save_totalentries_0; TALLOC_CTX *_mem_save_resume_handle_0; @@ -16776,19 +16824,11 @@ static enum ndr_err_code ndr_pull_srvsvc_NetTransportEnum(struct ndr_pull *ndr, NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_unc_0, 0); } if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->in.level); - } - _mem_save_level_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.level, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.level)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_level_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.transports); } _mem_save_transports_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->in.transports, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.transports, *r->in.level)); - NDR_CHECK(ndr_pull_srvsvc_NetTransportCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.transports)); + NDR_CHECK(ndr_pull_srvsvc_NetTransportInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.transports)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_transports_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_buffer)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_resume_handle)); @@ -16803,8 +16843,6 @@ static enum ndr_err_code ndr_pull_srvsvc_NetTransportEnum(struct ndr_pull *ndr, NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, 0); } - NDR_PULL_ALLOC(ndr, r->out.level); - *r->out.level = *r->in.level; NDR_PULL_ALLOC(ndr, r->out.transports); *r->out.transports = *r->in.transports; NDR_PULL_ALLOC(ndr, r->out.totalentries); @@ -16812,19 +16850,11 @@ static enum ndr_err_code ndr_pull_srvsvc_NetTransportEnum(struct ndr_pull *ndr, } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.level); - } - _mem_save_level_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.level, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.level)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_level_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.transports); } _mem_save_transports_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.transports, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.transports, *r->out.level)); - NDR_CHECK(ndr_pull_srvsvc_NetTransportCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.transports)); + NDR_CHECK(ndr_pull_srvsvc_NetTransportInfoCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.transports)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_transports_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.totalentries); @@ -16866,14 +16896,9 @@ _PUBLIC_ void ndr_print_srvsvc_NetTransportEnum(struct ndr_print *ndr, const cha ndr_print_string(ndr, "server_unc", r->in.server_unc); } ndr->depth--; - ndr_print_ptr(ndr, "level", r->in.level); - ndr->depth++; - ndr_print_uint32(ndr, "level", *r->in.level); - ndr->depth--; ndr_print_ptr(ndr, "transports", r->in.transports); ndr->depth++; - ndr_print_set_switch_value(ndr, r->in.transports, *r->in.level); - ndr_print_srvsvc_NetTransportCtr(ndr, "transports", r->in.transports); + ndr_print_srvsvc_NetTransportInfoCtr(ndr, "transports", r->in.transports); ndr->depth--; ndr_print_uint32(ndr, "max_buffer", r->in.max_buffer); ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle); @@ -16887,14 +16912,9 @@ _PUBLIC_ void ndr_print_srvsvc_NetTransportEnum(struct ndr_print *ndr, const cha if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "srvsvc_NetTransportEnum"); ndr->depth++; - ndr_print_ptr(ndr, "level", r->out.level); - ndr->depth++; - ndr_print_uint32(ndr, "level", *r->out.level); - ndr->depth--; ndr_print_ptr(ndr, "transports", r->out.transports); ndr->depth++; - ndr_print_set_switch_value(ndr, r->out.transports, *r->out.level); - ndr_print_srvsvc_NetTransportCtr(ndr, "transports", r->out.transports); + ndr_print_srvsvc_NetTransportInfoCtr(ndr, "transports", r->out.transports); ndr->depth--; ndr_print_ptr(ndr, "totalentries", r->out.totalentries); ndr->depth++; @@ -16922,8 +16942,11 @@ static enum ndr_err_code ndr_push_srvsvc_NetTransportDel(struct ndr_push *ndr, i NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_unc, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_unc, ndr_charset_length(r->in.server_unc, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown)); - NDR_CHECK(ndr_push_srvsvc_NetTransportInfo0(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.transport)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.level)); + if (r->in.info0 == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_srvsvc_NetTransportInfo0(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info0)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); @@ -16935,6 +16958,7 @@ static enum ndr_err_code ndr_pull_srvsvc_NetTransportDel(struct ndr_pull *ndr, i { uint32_t _ptr_server_unc; TALLOC_CTX *_mem_save_server_unc_0; + TALLOC_CTX *_mem_save_info0_0; if (flags & NDR_IN) { NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_unc)); if (_ptr_server_unc) { @@ -16954,8 +16978,14 @@ static enum ndr_err_code ndr_pull_srvsvc_NetTransportDel(struct ndr_pull *ndr, i NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_unc, ndr_get_array_length(ndr, &r->in.server_unc), sizeof(uint16_t), CH_UTF16)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_unc_0, 0); } - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown)); - NDR_CHECK(ndr_pull_srvsvc_NetTransportInfo0(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.transport)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.level)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info0); + } + _mem_save_info0_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_srvsvc_NetTransportInfo0(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info0)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info0_0, LIBNDR_FLAG_REF_ALLOC); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); @@ -16979,8 +17009,11 @@ _PUBLIC_ void ndr_print_srvsvc_NetTransportDel(struct ndr_print *ndr, const char ndr_print_string(ndr, "server_unc", r->in.server_unc); } ndr->depth--; - ndr_print_uint32(ndr, "unknown", r->in.unknown); - ndr_print_srvsvc_NetTransportInfo0(ndr, "transport", &r->in.transport); + ndr_print_uint32(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "info0", r->in.info0); + ndr->depth++; + ndr_print_srvsvc_NetTransportInfo0(ndr, "info0", r->in.info0); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { diff --git a/source3/librpc/gen_ndr/ndr_srvsvc.h b/source3/librpc/gen_ndr/ndr_srvsvc.h index 8a29469ec5..33569d1870 100644 --- a/source3/librpc/gen_ndr/ndr_srvsvc.h +++ b/source3/librpc/gen_ndr/ndr_srvsvc.h @@ -126,12 +126,14 @@ void ndr_print_srvsvc_NetCharDevInfo1(struct ndr_print *ndr, const char *name, c void ndr_print_srvsvc_NetCharDevCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevCtr1 *r); void ndr_print_srvsvc_NetCharDevInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevInfo *r); void ndr_print_srvsvc_NetCharDevCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevCtr *r); +void ndr_print_srvsvc_NetCharDevInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevInfoCtr *r); void ndr_print_srvsvc_NetCharDevQInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQInfo0 *r); void ndr_print_srvsvc_NetCharDevQCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQCtr0 *r); void ndr_print_srvsvc_NetCharDevQInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQInfo1 *r); void ndr_print_srvsvc_NetCharDevQCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQCtr1 *r); void ndr_print_srvsvc_NetCharDevQInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevQInfo *r); void ndr_print_srvsvc_NetCharDevQCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevQCtr *r); +void ndr_print_srvsvc_NetCharDevQInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQInfoCtr *r); void ndr_print_srvsvc_NetConnInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnInfo0 *r); void ndr_print_srvsvc_NetConnCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnCtr0 *r); void ndr_print_srvsvc_NetConnInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnInfo1 *r); @@ -256,6 +258,7 @@ void ndr_print_srvsvc_NetTransportCtr2(struct ndr_print *ndr, const char *name, void ndr_print_srvsvc_NetTransportInfo3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo3 *r); void ndr_print_srvsvc_NetTransportCtr3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr3 *r); void ndr_print_srvsvc_NetTransportCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetTransportCtr *r); +void ndr_print_srvsvc_NetTransportInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfoCtr *r); void ndr_print_srvsvc_NetRemoteTODInfo(struct ndr_print *ndr, const char *name, const struct srvsvc_NetRemoteTODInfo *r); void ndr_print_srvsvc_NetTransportInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetTransportInfo *r); void ndr_print_srvsvc_NetCharDevEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevEnum *r); diff --git a/source3/librpc/gen_ndr/srv_srvsvc.c b/source3/librpc/gen_ndr/srv_srvsvc.c index 57d5239971..f995930b89 100644 --- a/source3/librpc/gen_ndr/srv_srvsvc.c +++ b/source3/librpc/gen_ndr/srv_srvsvc.c @@ -45,8 +45,7 @@ static bool api_srvsvc_NetCharDevEnum(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.level = r->in.level; - r->out.ctr = r->in.ctr; + r->out.info_ctr = r->in.info_ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); @@ -281,8 +280,7 @@ static bool api_srvsvc_NetCharDevQEnum(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.level = r->in.level; - r->out.ctr = r->in.ctr; + r->out.info_ctr = r->in.info_ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); @@ -1912,7 +1910,7 @@ static bool api_srvsvc_NetServerStatisticsGet(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.stats = talloc_zero(r, struct srvsvc_Statistics); + r->out.stats = talloc_zero(r, struct srvsvc_Statistics *); if (r->out.stats == NULL) { talloc_free(r); return false; @@ -2065,7 +2063,6 @@ static bool api_srvsvc_NetTransportEnum(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.level = r->in.level; r->out.transports = r->in.transports; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { diff --git a/source3/librpc/gen_ndr/srvsvc.h b/source3/librpc/gen_ndr/srvsvc.h index 8a2bbfb0a7..9125d0ae70 100644 --- a/source3/librpc/gen_ndr/srvsvc.h +++ b/source3/librpc/gen_ndr/srvsvc.h @@ -42,6 +42,11 @@ union srvsvc_NetCharDevCtr { struct srvsvc_NetCharDevCtr1 *ctr1;/* [unique,case] */ }; +struct srvsvc_NetCharDevInfoCtr { + uint32_t level; + union srvsvc_NetCharDevCtr ctr;/* [switch_is(level)] */ +}; + struct srvsvc_NetCharDevQInfo0 { const char *device;/* [unique,charset(UTF16)] */ }; @@ -74,6 +79,11 @@ union srvsvc_NetCharDevQCtr { struct srvsvc_NetCharDevQCtr1 *ctr1;/* [unique,case] */ }; +struct srvsvc_NetCharDevQInfoCtr { + uint32_t level; + union srvsvc_NetCharDevQCtr ctr;/* [switch_is(level)] */ +}; + struct srvsvc_NetConnInfo0 { uint32_t conn_id; }; @@ -468,6 +478,7 @@ struct srvsvc_NetSrvInfo402 { uint32_t sessreqs; uint32_t opensearch; uint32_t activelocks; + uint32_t numreqbufs; uint32_t sizereqbufs; uint32_t numbigbufs; uint32_t numfiletasks; @@ -501,6 +512,7 @@ struct srvsvc_NetSrvInfo403 { uint32_t sessreqs; uint32_t opensearch; uint32_t activelocks; + uint32_t numreqbufs; uint32_t sizereqbufs; uint32_t numbigbufs; uint32_t numfiletasks; @@ -908,7 +920,9 @@ union srvsvc_NetSrvInfo { }; struct srvsvc_NetDiskInfo0 { - const char * disk;/* [flag(LIBNDR_FLAG_STR_LEN4)] */ + uint32_t __disk_offset;/* [value(0)] */ + uint32_t __disk_length;/* [value(strlen(disk)+1)] */ + const char *disk;/* [charset(UTF16)] */ }; struct srvsvc_NetDiskInfo { @@ -1002,6 +1016,11 @@ union srvsvc_NetTransportCtr { struct srvsvc_NetTransportCtr3 *ctr3;/* [unique,case(3)] */ }; +struct srvsvc_NetTransportInfoCtr { + uint32_t level; + union srvsvc_NetTransportCtr ctr;/* [switch_is(level)] */ +}; + struct srvsvc_NetRemoteTODInfo { uint32_t elapsed; uint32_t msecs; @@ -1029,15 +1048,13 @@ struct srvsvc_NetCharDevEnum { struct { const char *server_unc;/* [unique,charset(UTF16)] */ uint32_t max_buffer; - uint32_t *level;/* [ref] */ - union srvsvc_NetCharDevCtr *ctr;/* [ref,switch_is(*level)] */ + struct srvsvc_NetCharDevInfoCtr *info_ctr;/* [ref] */ uint32_t *resume_handle;/* [unique] */ } in; struct { uint32_t *totalentries;/* [ref] */ - uint32_t *level;/* [ref] */ - union srvsvc_NetCharDevCtr *ctr;/* [ref,switch_is(*level)] */ + struct srvsvc_NetCharDevInfoCtr *info_ctr;/* [ref] */ uint32_t *resume_handle;/* [unique] */ WERROR result; } out; @@ -1079,15 +1096,13 @@ struct srvsvc_NetCharDevQEnum { const char *server_unc;/* [unique,charset(UTF16)] */ const char *user;/* [unique,charset(UTF16)] */ uint32_t max_buffer; - uint32_t *level;/* [ref] */ - union srvsvc_NetCharDevQCtr *ctr;/* [ref,switch_is(*level)] */ + struct srvsvc_NetCharDevQInfoCtr *info_ctr;/* [ref] */ uint32_t *resume_handle;/* [unique] */ } in; struct { uint32_t *totalentries;/* [ref] */ - uint32_t *level;/* [ref] */ - union srvsvc_NetCharDevQCtr *ctr;/* [ref,switch_is(*level)] */ + struct srvsvc_NetCharDevQInfoCtr *info_ctr;/* [ref] */ uint32_t *resume_handle;/* [unique] */ WERROR result; } out; @@ -1422,7 +1437,7 @@ struct srvsvc_NetServerStatisticsGet { } in; struct { - struct srvsvc_Statistics *stats;/* [ref] */ + struct srvsvc_Statistics **stats;/* [ref] */ WERROR result; } out; @@ -1447,15 +1462,13 @@ struct srvsvc_NetTransportEnum { struct { const char *server_unc;/* [unique,charset(UTF16)] */ uint32_t max_buffer; - uint32_t *level;/* [ref] */ - union srvsvc_NetTransportCtr *transports;/* [ref,switch_is(*level)] */ + struct srvsvc_NetTransportInfoCtr *transports;/* [ref] */ uint32_t *resume_handle;/* [unique] */ } in; struct { uint32_t *totalentries;/* [ref] */ - uint32_t *level;/* [ref] */ - union srvsvc_NetTransportCtr *transports;/* [ref,switch_is(*level)] */ + struct srvsvc_NetTransportInfoCtr *transports;/* [ref] */ uint32_t *resume_handle;/* [unique] */ WERROR result; } out; @@ -1466,8 +1479,8 @@ struct srvsvc_NetTransportEnum { struct srvsvc_NetTransportDel { struct { const char *server_unc;/* [unique,charset(UTF16)] */ - uint32_t unknown; - struct srvsvc_NetTransportInfo0 transport; + uint32_t level; + struct srvsvc_NetTransportInfo0 *info0;/* [ref] */ } in; struct { diff --git a/source4/client/client.c b/source4/client/client.c index 56b923974b..7eb14a2ce1 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -2563,9 +2563,11 @@ static bool browse_host(struct loadparm_context *lp_ctx, char *binding; NTSTATUS status; struct srvsvc_NetShareEnumAll r; + struct srvsvc_NetShareInfoCtr info_ctr; uint32_t resume_handle = 0; TALLOC_CTX *mem_ctx = talloc_init("browse_host"); struct srvsvc_NetShareCtr1 ctr1; + uint32_t totalentries = 0; binding = talloc_asprintf(mem_ctx, "ncacn_np:%s", query_host); @@ -2580,11 +2582,16 @@ static bool browse_host(struct loadparm_context *lp_ctx, return false; } + info_ctr.level = 1; + info_ctr.ctr.ctr1 = &ctr1; + r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p)); - r.in.level = 1; - r.in.ctr.ctr1 = &ctr1; + r.in.info_ctr = &info_ctr; r.in.max_buffer = ~0; r.in.resume_handle = &resume_handle; + r.out.resume_handle = &resume_handle; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; d_printf("\n\tSharename Type Comment\n"); d_printf("\t--------- ---- -------\n"); @@ -2596,9 +2603,9 @@ static bool browse_host(struct loadparm_context *lp_ctx, if (NT_STATUS_IS_OK(status) && (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA) || W_ERROR_IS_OK(r.out.result)) && - r.out.ctr.ctr1) { - display_share_result(r.out.ctr.ctr1); - resume_handle += r.out.ctr.ctr1->count; + r.out.info_ctr->ctr.ctr1) { + display_share_result(r.out.info_ctr->ctr.ctr1); + resume_handle += r.out.info_ctr->ctr.ctr1->count; } } while (NT_STATUS_IS_OK(status) && W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)); diff --git a/source4/libnet/libnet_share.c b/source4/libnet/libnet_share.c index e24ba8161a..0bf6749a9c 100644 --- a/source4/libnet/libnet_share.c +++ b/source4/libnet/libnet_share.c @@ -28,7 +28,9 @@ NTSTATUS libnet_ListShares(struct libnet_context *ctx, NTSTATUS status; struct libnet_RpcConnect c; struct srvsvc_NetShareEnumAll s; + struct srvsvc_NetShareInfoCtr info_ctr; uint32_t resume_handle = 0; + uint32_t totalentries = 0; struct srvsvc_NetShareCtr0 ctr0; struct srvsvc_NetShareCtr1 ctr1; struct srvsvc_NetShareCtr2 ctr2; @@ -51,37 +53,39 @@ NTSTATUS libnet_ListShares(struct libnet_context *ctx, return status; } - s.in.level = r->in.level; - switch (s.in.level) { + info_ctr.level = r->in.level; + switch (info_ctr.level) { case 0: - s.in.ctr.ctr0 = &ctr0; + info_ctr.ctr.ctr0 = &ctr0; ZERO_STRUCT(ctr0); break; case 1: - s.in.ctr.ctr1 = &ctr1; + info_ctr.ctr.ctr1 = &ctr1; ZERO_STRUCT(ctr1); break; case 2: - s.in.ctr.ctr2 = &ctr2; + info_ctr.ctr.ctr2 = &ctr2; ZERO_STRUCT(ctr2); break; case 501: - s.in.ctr.ctr501 = &ctr501; + info_ctr.ctr.ctr501 = &ctr501; ZERO_STRUCT(ctr501); break; case 502: - s.in.ctr.ctr502 = &ctr502; + info_ctr.ctr.ctr502 = &ctr502; ZERO_STRUCT(ctr502); break; default: r->out.error_string = talloc_asprintf(mem_ctx, "libnet_ListShares: Invalid info level requested: %d", - s.in.level); + info_ctr.level); return NT_STATUS_INVALID_PARAMETER; } s.in.max_buffer = ~0; s.in.resume_handle = &resume_handle; - + s.in.info_ctr = &info_ctr; + s.out.info_ctr = &info_ctr; + s.out.totalentries = &totalentries; status = dcerpc_srvsvc_NetShareEnumAll(c.out.dcerpc_pipe, mem_ctx, &s); @@ -100,7 +104,7 @@ NTSTATUS libnet_ListShares(struct libnet_context *ctx, goto disconnect; } - r->out.ctr = s.out.ctr; + r->out.ctr = s.out.info_ctr->ctr; disconnect: talloc_free(c.out.dcerpc_pipe); @@ -115,6 +119,7 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx, NTSTATUS status; struct libnet_RpcConnect c; struct srvsvc_NetShareAdd s; + union srvsvc_NetShareInfo info; c.level = LIBNET_RPC_CONNECT_SERVER; c.in.name = r->in.server_name; @@ -129,8 +134,10 @@ NTSTATUS libnet_AddShare(struct libnet_context *ctx, return status; } + info.info2 = &r->in.share; + s.in.level = 2; - s.in.info.info2 = &r->in.share; + s.in.info = &info; s.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", r->in.server_name); status = dcerpc_srvsvc_NetShareAdd(c.out.dcerpc_pipe, mem_ctx, &s); diff --git a/source4/libnet/libnet_time.c b/source4/libnet/libnet_time.c index e1e53fb947..61a451d3fd 100644 --- a/source4/libnet/libnet_time.c +++ b/source4/libnet/libnet_time.c @@ -30,6 +30,7 @@ static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX * NTSTATUS status; struct libnet_RpcConnect c; struct srvsvc_NetRemoteTOD tod; + struct srvsvc_NetRemoteTODInfo *info = NULL; struct tm tm; /* prepare connect to the SRVSVC pipe of a timeserver */ @@ -48,6 +49,7 @@ static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX * /* prepare srvsvc_NetrRemoteTOD */ tod.in.server_unc = talloc_asprintf(mem_ctx, "\\%s", c.in.name); + tod.out.info = &info; /* 2. try srvsvc_NetRemoteTOD */ status = dcerpc_srvsvc_NetRemoteTOD(c.out.dcerpc_pipe, mem_ctx, &tod); @@ -68,18 +70,18 @@ static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX * } /* need to set the out parameters */ - tm.tm_sec = (int)tod.out.info->secs; - tm.tm_min = (int)tod.out.info->mins; - tm.tm_hour = (int)tod.out.info->hours; - tm.tm_mday = (int)tod.out.info->day; - tm.tm_mon = (int)tod.out.info->month -1; - tm.tm_year = (int)tod.out.info->year - 1900; + tm.tm_sec = (int)info->secs; + tm.tm_min = (int)info->mins; + tm.tm_hour = (int)info->hours; + tm.tm_mday = (int)info->day; + tm.tm_mon = (int)info->month -1; + tm.tm_year = (int)info->year - 1900; tm.tm_wday = -1; tm.tm_yday = -1; tm.tm_isdst = -1; r->srvsvc.out.time = timegm(&tm); - r->srvsvc.out.time_zone = tod.out.info->timezone * 60; + r->srvsvc.out.time_zone = info->timezone * 60; goto disconnect; diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index 2d6242e6d1..4304dbed96 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -51,14 +51,18 @@ import "security.idl", "svcctl.idl"; [default] ; } srvsvc_NetCharDevCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetCharDevCtr ctr; + } srvsvc_NetCharDevInfoCtr; + /******************/ /* Function: 0x00 */ WERROR srvsvc_NetCharDevEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetCharDevCtr ctr, + [in,out,ref] srvsvc_NetCharDevInfoCtr *info_ctr, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -68,7 +72,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] [string,charset(UTF16)] uint16 device_name[], [in] uint32 level, - [out,switch_is(level)] srvsvc_NetCharDevInfo info + [out,ref,switch_is(level)] srvsvc_NetCharDevInfo *info ); /******************/ @@ -116,15 +120,19 @@ import "security.idl", "svcctl.idl"; [default] ; } srvsvc_NetCharDevQCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetCharDevQCtr ctr; + } srvsvc_NetCharDevQInfoCtr; + /******************/ /* Function: 0x03 */ WERROR srvsvc_NetCharDevQEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in,unique] [string,charset(UTF16)] uint16 *user, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetCharDevQCtr ctr, + [in,out,ref] srvsvc_NetCharDevQInfoCtr *info_ctr, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -135,13 +143,13 @@ import "security.idl", "svcctl.idl"; [in] [string,charset(UTF16)] uint16 queue_name[], [in] [string,charset(UTF16)] uint16 user[], [in] uint32 level, - [out,switch_is(level)] srvsvc_NetCharDevQInfo info + [out,switch_is(level),ref] srvsvc_NetCharDevQInfo *info ); /******************/ /* Function: 0x05 */ WERROR srvsvc_NetCharDevQSetInfo( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] [string,charset(UTF16)] uint16 queue_name[], [in] uint32 level, [in,switch_is(level)] srvsvc_NetCharDevQInfo info, @@ -206,10 +214,9 @@ import "security.idl", "svcctl.idl"; WERROR srvsvc_NetConnEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in,unique] [string,charset(UTF16)] uint16 *path, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetConnCtr ctr, + [in,out,ref] srvsvc_NetConnInfoCtr *info_ctr, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -261,10 +268,9 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in,unique] [string,charset(UTF16)] uint16 *path, [in,unique] [string,charset(UTF16)] uint16 *user, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetFileCtr ctr, + [in,out,ref] srvsvc_NetFileInfoCtr *info_ctr, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -274,7 +280,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] uint32 fid, [in] uint32 level, - [out,switch_is(level)] srvsvc_NetFileInfo info + [out,switch_is(level),ref] srvsvc_NetFileInfo *info ); /******************/ @@ -374,10 +380,9 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in,unique] [string,charset(UTF16)] uint16 *client, [in,unique] [string,charset(UTF16)] uint16 *user, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetSessCtr ctr, + [in,out,ref] srvsvc_NetSessInfoCtr *info_ctr, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -465,13 +470,11 @@ import "security.idl", "svcctl.idl"; srvsvc_ShareType type; [string,charset(UTF16)] uint16 *comment; uint32 permissions; - int32 max_users; + uint32 max_users; uint32 current_users; [string,charset(UTF16)] uint16 *path; [string,charset(UTF16)] uint16 *password; - /* maybe here is a struct sec_desc_buf following */ - uint32 unknown; - [subcontext(4)] security_descriptor *sd; + sec_desc_buf sd_buf; } srvsvc_NetShareInfo502; typedef struct { @@ -506,7 +509,7 @@ import "security.idl", "svcctl.idl"; } srvsvc_NetShareCtr1005; typedef struct { - int32 max_users; + uint32 max_users; } srvsvc_NetShareInfo1006; typedef struct { @@ -567,7 +570,7 @@ import "security.idl", "svcctl.idl"; WERROR srvsvc_NetShareAdd( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] uint32 level, - [in,switch_is(level)] srvsvc_NetShareInfo info, + [in,ref,switch_is(level)] srvsvc_NetShareInfo *info, [in,out,unique] uint32 *parm_error ); @@ -575,10 +578,9 @@ import "security.idl", "svcctl.idl"; /* Function: 0x0f */ WERROR srvsvc_NetShareEnumAll ( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetShareCtr ctr, + [in,out,ref] srvsvc_NetShareInfoCtr *info_ctr, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -588,7 +590,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] [string,charset(UTF16)] uint16 share_name[], [in] uint32 level, - [out,switch_is(level)] srvsvc_NetShareInfo info + [out,ref,switch_is(level)] srvsvc_NetShareInfo *info ); /******************/ @@ -597,7 +599,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] [string,charset(UTF16)] uint16 share_name[], [in] uint32 level, - [in,switch_is(level)] srvsvc_NetShareInfo info, + [in,ref,switch_is(level)] srvsvc_NetShareInfo *info, [in,out,unique] uint32 *parm_error ); @@ -622,7 +624,7 @@ import "security.idl", "svcctl.idl"; WERROR srvsvc_NetShareCheck( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] [string,charset(UTF16)] uint16 device_name[], - [out] srvsvc_ShareType type + [out,ref] srvsvc_ShareType *type ); /**************************/ @@ -686,6 +688,7 @@ import "security.idl", "svcctl.idl"; uint32 sessreqs; uint32 opensearch; uint32 activelocks; + uint32 numreqbufs; uint32 sizereqbufs; uint32 numbigbufs; uint32 numfiletasks; @@ -719,6 +722,7 @@ import "security.idl", "svcctl.idl"; uint32 sessreqs; uint32 opensearch; uint32 activelocks; + uint32 numreqbufs; uint32 sizereqbufs; uint32 numbigbufs; uint32 numfiletasks; @@ -1132,7 +1136,7 @@ import "security.idl", "svcctl.idl"; WERROR srvsvc_NetSrvGetInfo( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] uint32 level, - [out,switch_is(level)] srvsvc_NetSrvInfo info + [out,ref,switch_is(level)] srvsvc_NetSrvInfo *info ); /******************/ @@ -1140,7 +1144,7 @@ import "security.idl", "svcctl.idl"; WERROR srvsvc_NetSrvSetInfo( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] uint32 level, - [in,switch_is(level)] srvsvc_NetSrvInfo info, + [in,ref,switch_is(level)] srvsvc_NetSrvInfo *info, [in,out,unique] uint32 *parm_error ); @@ -1170,9 +1174,9 @@ import "security.idl", "svcctl.idl"; WERROR srvsvc_NetDiskEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] uint32 level, - [in,out] srvsvc_NetDiskInfo info, + [in,out,ref] srvsvc_NetDiskInfo *info, [in] uint32 maxlen, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -1206,7 +1210,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *service, [in] uint32 level, [in] uint32 options, - [out] srvsvc_Statistics stat + [out,ref] srvsvc_Statistics **stats ); /**************************/ @@ -1287,14 +1291,18 @@ import "security.idl", "svcctl.idl"; [default]; } srvsvc_NetTransportCtr; + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetTransportCtr ctr; + } srvsvc_NetTransportInfoCtr; + /******************/ /* Function: 0x1a */ WERROR srvsvc_NetTransportEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetTransportCtr transports, + [in,out,ref] srvsvc_NetTransportInfoCtr *transports, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -1303,7 +1311,7 @@ import "security.idl", "svcctl.idl"; WERROR srvsvc_NetTransportDel( [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] uint32 level, - [in,switch_is(level)] srvsvc_NetTransportInfo info + [in] srvsvc_NetTransportInfo0 *info0 ); /**************************/ @@ -1328,7 +1336,7 @@ import "security.idl", "svcctl.idl"; /* Function: 0x1c */ WERROR srvsvc_NetRemoteTOD( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [out,unique] srvsvc_NetRemoteTODInfo *info + [out,ref] srvsvc_NetRemoteTODInfo **info ); /**************************/ @@ -1352,7 +1360,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *server_unc, [in] [string,charset(UTF16)] uint16 path[], [in] uint32 pathflags, - [out] uint32 pathtype + [out,ref] uint32 *pathtype ); /******************/ @@ -1363,7 +1371,7 @@ import "security.idl", "svcctl.idl"; [out] [size_is(maxbuf)] uint8 can_path[], [in] uint32 maxbuf, [in] [string,charset(UTF16)] uint16 prefix[], - [in,out] uint32 pathtype, + [in,out,ref] uint32 *pathtype, [in] uint32 pathflags ); @@ -1413,10 +1421,9 @@ import "security.idl", "svcctl.idl"; total entries ... */ WERROR srvsvc_NetShareEnum( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,out] uint32 level, - [in,out,switch_is(level)] srvsvc_NetShareCtr ctr, + [in,out,ref] srvsvc_NetShareInfoCtr *info_ctr, [in] uint32 max_buffer, - [out] uint32 totalentries, + [out,ref] uint32 *totalentries, [in,out,unique] uint32 *resume_handle ); @@ -1442,7 +1449,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *share, [in] [string,charset(UTF16)] uint16 file[], [in] security_secinfo securityinformation, - [out,unique] sec_desc_buf *sd_buf + [out,ref] sec_desc_buf **sd_buf ); /******************/ @@ -1452,7 +1459,7 @@ import "security.idl", "svcctl.idl"; [in,unique] [string,charset(UTF16)] uint16 *share, [in] [string,charset(UTF16)] uint16 file[], [in] security_secinfo securityinformation, - [in] sec_desc_buf sd_buf + [in,ref] sec_desc_buf *sd_buf ); diff --git a/source4/rpc_server/common/share_info.c b/source4/rpc_server/common/share_info.c index 130babd175..48870e602f 100644 --- a/source4/rpc_server/common/share_info.c +++ b/source4/rpc_server/common/share_info.c @@ -107,12 +107,6 @@ uint32_t dcesrv_common_get_share_dfs_flags(TALLOC_CTX *mem_ctx, struct dcesrv_co } /* This hardcoded value should go into a ldb database! */ -uint32_t dcesrv_common_get_share_unknown(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg) -{ - return 0; -} - -/* This hardcoded value should go into a ldb database! */ struct security_descriptor *dcesrv_common_get_security_descriptor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg) { return NULL; diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 58eed57f0f..b4e08896e5 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -45,26 +45,24 @@ static WERROR dcesrv_srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevEnum *r) { - r->out.level = r->in.level; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + *r->out.totalentries = 0; - switch (r->in.level) { + switch (r->in.info_ctr->level) { case 0: - r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); + r->out.info_ctr->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr0); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr0); - r->out.ctr.ctr0->count = 0; - r->out.ctr.ctr0->array = NULL; + r->out.info_ctr->ctr.ctr0->count = 0; + r->out.info_ctr->ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; case 1: - r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); + r->out.info_ctr->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevCtr1); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr1); - r->out.ctr.ctr1->count = 0; - r->out.ctr.ctr1->array = NULL; + r->out.info_ctr->ctr.ctr1->count = 0; + r->out.info_ctr->ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; @@ -82,7 +80,7 @@ static WERROR dcesrv_srvsvc_NetCharDevEnum(struct dcesrv_call_state *dce_call, T static WERROR dcesrv_srvsvc_NetCharDevGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevGetInfo *r) { - ZERO_STRUCT(r->out); + ZERO_STRUCTP(r->out.info); switch (r->in.level) { case 0: @@ -117,28 +115,26 @@ static WERROR dcesrv_srvsvc_NetCharDevControl(struct dcesrv_call_state *dce_call static WERROR dcesrv_srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQEnum *r) { - r->out.level = r->in.level; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + *r->out.totalentries = 0; - switch (r->in.level) { + switch (r->in.info_ctr->level) { case 0: { - r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); + r->out.info_ctr->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr0); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr0); - r->out.ctr.ctr0->count = 0; - r->out.ctr.ctr0->array = NULL; + r->out.info_ctr->ctr.ctr0->count = 0; + r->out.info_ctr->ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; } case 1: { - r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); + r->out.info_ctr->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetCharDevQCtr1); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr1); - r->out.ctr.ctr1->count = 0; - r->out.ctr.ctr1->array = NULL; + r->out.info_ctr->ctr.ctr1->count = 0; + r->out.info_ctr->ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; } @@ -156,7 +152,7 @@ static WERROR dcesrv_srvsvc_NetCharDevQEnum(struct dcesrv_call_state *dce_call, static WERROR dcesrv_srvsvc_NetCharDevQGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetCharDevQGetInfo *r) { - ZERO_STRUCT(r->out); + ZERO_STRUCTP(r->out.info); switch (r->in.level) { case 0: @@ -230,28 +226,26 @@ static WERROR dcesrv_srvsvc_NetCharDevQPurgeSelf(struct dcesrv_call_state *dce_c static WERROR dcesrv_srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetConnEnum *r) { - r->out.level = r->in.level; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + *r->out.totalentries = 0; - switch (r->in.level) { + switch (r->in.info_ctr->level) { case 0: { - r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetConnCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); + r->out.info_ctr->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetConnCtr0); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr0); - r->out.ctr.ctr0->count = 0; - r->out.ctr.ctr0->array = NULL; + r->out.info_ctr->ctr.ctr0->count = 0; + r->out.info_ctr->ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; } case 1: { - r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetConnCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); + r->out.info_ctr->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetConnCtr1); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr1); - r->out.ctr.ctr1->count = 0; - r->out.ctr.ctr1->array = NULL; + r->out.info_ctr->ctr.ctr1->count = 0; + r->out.info_ctr->ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; } @@ -269,28 +263,26 @@ static WERROR dcesrv_srvsvc_NetConnEnum(struct dcesrv_call_state *dce_call, TALL static WERROR dcesrv_srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetFileEnum *r) { - r->out.level = r->in.level; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + *r->out.totalentries = 0; - switch (r->in.level) { + switch (r->in.info_ctr->level) { case 2: { - r->out.ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetFileCtr2); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); + r->out.info_ctr->ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetFileCtr2); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr2); - r->out.ctr.ctr2->count = 0; - r->out.ctr.ctr2->array = NULL; + r->out.info_ctr->ctr.ctr2->count = 0; + r->out.info_ctr->ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; } case 3: { - r->out.ctr.ctr3 = talloc(mem_ctx, struct srvsvc_NetFileCtr3); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr3); + r->out.info_ctr->ctr.ctr3 = talloc(mem_ctx, struct srvsvc_NetFileCtr3); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr3); - r->out.ctr.ctr3->count = 0; - r->out.ctr.ctr3->array = NULL; + r->out.info_ctr->ctr.ctr3->count = 0; + r->out.info_ctr->ctr.ctr3->array = NULL; return WERR_NOT_SUPPORTED; } @@ -308,7 +300,7 @@ static WERROR dcesrv_srvsvc_NetFileEnum(struct dcesrv_call_state *dce_call, TALL static WERROR dcesrv_srvsvc_NetFileGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetFileGetInfo *r) { - ZERO_STRUCT(r->out); + ZERO_STRUCTP(r->out.info); switch (r->in.level) { case 2: @@ -343,58 +335,56 @@ static WERROR dcesrv_srvsvc_NetFileClose(struct dcesrv_call_state *dce_call, TAL static WERROR dcesrv_srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetSessEnum *r) { - r->out.level = r->in.level; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + *r->out.totalentries = 0; - switch (r->in.level) { + switch (r->in.info_ctr->level) { case 0: { - r->out.ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetSessCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr0); + r->out.info_ctr->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetSessCtr0); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr0); - r->out.ctr.ctr0->count = 0; - r->out.ctr.ctr0->array = NULL; + r->out.info_ctr->ctr.ctr0->count = 0; + r->out.info_ctr->ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; } case 1: { - r->out.ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetSessCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr1); + r->out.info_ctr->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetSessCtr1); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr1); - r->out.ctr.ctr1->count = 0; - r->out.ctr.ctr1->array = NULL; + r->out.info_ctr->ctr.ctr1->count = 0; + r->out.info_ctr->ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; } case 2: { - r->out.ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetSessCtr2); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr2); + r->out.info_ctr->ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetSessCtr2); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr2); - r->out.ctr.ctr2->count = 0; - r->out.ctr.ctr2->array = NULL; + r->out.info_ctr->ctr.ctr2->count = 0; + r->out.info_ctr->ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; } case 10: { - r->out.ctr.ctr10 = talloc(mem_ctx, struct srvsvc_NetSessCtr10); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr10); + r->out.info_ctr->ctr.ctr10 = talloc(mem_ctx, struct srvsvc_NetSessCtr10); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr10); - r->out.ctr.ctr2->count = 0; - r->out.ctr.ctr2->array = NULL; + r->out.info_ctr->ctr.ctr10->count = 0; + r->out.info_ctr->ctr.ctr10->array = NULL; return WERR_NOT_SUPPORTED; } case 502: { - r->out.ctr.ctr502 = talloc(mem_ctx, struct srvsvc_NetSessCtr502); - W_ERROR_HAVE_NO_MEMORY(r->out.ctr.ctr502); + r->out.info_ctr->ctr.ctr502 = talloc(mem_ctx, struct srvsvc_NetSessCtr502); + W_ERROR_HAVE_NO_MEMORY(r->out.info_ctr->ctr.ctr502); - r->out.ctr.ctr2->count = 0; - r->out.ctr.ctr2->array = NULL; + r->out.info_ctr->ctr.ctr502->count = 0; + r->out.info_ctr->ctr.ctr502->array = NULL; return WERR_NOT_SUPPORTED; } @@ -458,7 +448,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL info[i].name = SHARE_TYPE; info[i].type = SHARE_INFO_STRING; - switch (r->in.info.info2->type) { + switch (r->in.info->info2->type) { case 0x00: info[i].value = talloc_strdup(info, "DISK"); break; @@ -474,16 +464,16 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; - if (r->in.info.info2->path && r->in.info.info2->path[0]) { + if (r->in.info->info2->path && r->in.info->info2->path[0]) { info[i].name = SHARE_PATH; info[i].type = SHARE_INFO_STRING; /* Windows will send a path in a form of C:\example\path */ - if (r->in.info.info2->path[1] == ':') { - info[i].value = talloc_strdup(info, &r->in.info.info2->path[2]); + if (r->in.info->info2->path[1] == ':') { + info[i].value = talloc_strdup(info, &r->in.info->info2->path[2]); } else { /* very strange let's try to set as is */ - info[i].value = talloc_strdup(info, r->in.info.info2->path); + info[i].value = talloc_strdup(info, r->in.info->info2->path); } W_ERROR_HAVE_NO_MEMORY(info[i].value); all_string_sub((char *)info[i].value, "\\", "/", 0); @@ -491,19 +481,19 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL i++; } - if (r->in.info.info2->comment && r->in.info.info2->comment[0]) { + if (r->in.info->info2->comment && r->in.info->info2->comment[0]) { info[i].name = SHARE_COMMENT; info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info2->comment); + info[i].value = talloc_strdup(info, r->in.info->info2->comment); W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; } - if (r->in.info.info2->password && r->in.info.info2->password[0]) { + if (r->in.info->info2->password && r->in.info->info2->password[0]) { info[i].name = SHARE_PASSWORD; info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info2->password); + info[i].value = talloc_strdup(info, r->in.info->info2->password); W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; @@ -512,12 +502,12 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL info[i].name = SHARE_MAX_CONNECTIONS; info[i].type = SHARE_INFO_INT; info[i].value = talloc(info, int); - *((int *)info[i].value) = r->in.info.info2->max_users; + *((int *)info[i].value) = r->in.info->info2->max_users; i++; /* TODO: security descriptor */ - nterr = share_create(sctx, r->in.info.info2->name, info, i); + nterr = share_create(sctx, r->in.info->info2->name, info, i); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -556,7 +546,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL info[i].name = SHARE_TYPE; info[i].type = SHARE_INFO_STRING; - switch (r->in.info.info502->type) { + switch (r->in.info->info502->type) { case 0x00: info[i].value = talloc_strdup(info, "DISK"); break; @@ -572,16 +562,16 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; - if (r->in.info.info502->path && r->in.info.info502->path[0]) { + if (r->in.info->info502->path && r->in.info->info502->path[0]) { info[i].name = SHARE_PATH; info[i].type = SHARE_INFO_STRING; /* Windows will send a path in a form of C:\example\path */ - if (r->in.info.info502->path[1] == ':') { - info[i].value = talloc_strdup(info, &r->in.info.info502->path[2]); + if (r->in.info->info502->path[1] == ':') { + info[i].value = talloc_strdup(info, &r->in.info->info502->path[2]); } else { /* very strange let's try to set as is */ - info[i].value = talloc_strdup(info, r->in.info.info502->path); + info[i].value = talloc_strdup(info, r->in.info->info502->path); } W_ERROR_HAVE_NO_MEMORY(info[i].value); all_string_sub((char *)info[i].value, "\\", "/", 0); @@ -589,19 +579,19 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL i++; } - if (r->in.info.info502->comment && r->in.info.info502->comment[0]) { + if (r->in.info->info502->comment && r->in.info->info502->comment[0]) { info[i].name = SHARE_COMMENT; info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info502->comment); + info[i].value = talloc_strdup(info, r->in.info->info502->comment); W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; } - if (r->in.info.info502->password && r->in.info.info502->password[0]) { + if (r->in.info->info502->password && r->in.info->info502->password[0]) { info[i].name = SHARE_PASSWORD; info[i].type = SHARE_INFO_STRING; - info[i].value = talloc_strdup(info, r->in.info.info502->password); + info[i].value = talloc_strdup(info, r->in.info->info502->password); W_ERROR_HAVE_NO_MEMORY(info[i].value); i++; @@ -610,12 +600,12 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL info[i].name = SHARE_MAX_CONNECTIONS; info[i].type = SHARE_INFO_INT; info[i].value = talloc(info, int); - *((int *)info[i].value) = r->in.info.info502->max_users; + *((int *)info[i].value) = r->in.info->info502->max_users; i++; /* TODO: security descriptor */ - nterr = share_create(sctx, r->in.info.info502->name, info, i); + nterr = share_create(sctx, r->in.info->info502->name, info, i); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -697,8 +687,7 @@ static WERROR dcesrv_srvsvc_fiel_ShareInfo(struct dcesrv_call_state *dce_call, T info->info502->path = dcesrv_common_get_share_path(mem_ctx, dce_ctx, scfg); W_ERROR_HAVE_NO_MEMORY(info->info502->path); info->info502->password = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_PASSWORD, NULL)); - info->info502->unknown = dcesrv_common_get_share_unknown(mem_ctx, dce_ctx, scfg); - info->info502->sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, scfg); + info->info502->sd_buf.sd = dcesrv_common_get_security_descriptor(mem_ctx, dce_ctx, scfg); return WERR_OK; } @@ -727,10 +716,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, struct share_context *sctx; struct share_config *scfg; - r->out.level = r->in.level; - ZERO_STRUCT(r->out.ctr); - r->out.totalentries = 0; - r->out.resume_handle = NULL; + *r->out.totalentries = 0; /* TODO: - paging of results */ @@ -745,7 +731,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, return ntstatus_to_werror(nterr); } - switch (r->in.level) { + switch (r->in.info_ctr->level) { case 0: { int i; @@ -758,7 +744,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, ctr0->array = NULL; if (ctr0->count == 0) { - r->out.ctr.ctr0 = ctr0; + r->out.info_ctr->ctr.ctr0 = ctr0; return WERR_OK; } @@ -775,7 +761,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, return WERR_GENERAL_FAILURE; } info.info0 = &ctr0->array[i]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -783,8 +769,8 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, } talloc_free(snames); - r->out.ctr.ctr0 = ctr0; - r->out.totalentries = r->out.ctr.ctr0->count; + r->out.info_ctr->ctr.ctr0 = ctr0; + *r->out.totalentries = r->out.info_ctr->ctr.ctr0->count; return WERR_OK; } case 1: @@ -799,7 +785,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, ctr1->array = NULL; if (ctr1->count == 0) { - r->out.ctr.ctr1 = ctr1; + r->out.info_ctr->ctr.ctr1 = ctr1; return WERR_OK; } @@ -816,7 +802,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, return WERR_GENERAL_FAILURE; } info.info1 = &ctr1->array[i]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -824,8 +810,9 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, } talloc_free(snames); - r->out.ctr.ctr1 = ctr1; - r->out.totalentries = r->out.ctr.ctr1->count; + r->out.info_ctr->ctr.ctr1 = ctr1; + *r->out.totalentries = r->out.info_ctr->ctr.ctr1->count; + return WERR_OK; } case 2: @@ -842,7 +829,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, ctr2->array = NULL; if (ctr2->count == 0) { - r->out.ctr.ctr2 = ctr2; + r->out.info_ctr->ctr.ctr2 = ctr2; return WERR_OK; } @@ -859,7 +846,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, return WERR_GENERAL_FAILURE; } info.info2 = &ctr2->array[i]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -867,8 +854,9 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, } talloc_free(snames); - r->out.ctr.ctr2 = ctr2; - r->out.totalentries = r->out.ctr.ctr2->count; + r->out.info_ctr->ctr.ctr2 = ctr2; + *r->out.totalentries = r->out.info_ctr->ctr.ctr2->count; + return WERR_OK; } case 501: @@ -885,7 +873,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, ctr501->array = NULL; if (ctr501->count == 0) { - r->out.ctr.ctr501 = ctr501; + r->out.info_ctr->ctr.ctr501 = ctr501; return WERR_OK; } @@ -902,7 +890,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, return WERR_GENERAL_FAILURE; } info.info501 = &ctr501->array[i]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -910,8 +898,9 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, } talloc_free(snames); - r->out.ctr.ctr501 = ctr501; - r->out.totalentries = r->out.ctr.ctr501->count; + r->out.info_ctr->ctr.ctr501 = ctr501; + *r->out.totalentries = r->out.info_ctr->ctr.ctr501->count; + return WERR_OK; } case 502: @@ -928,7 +917,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, ctr502->array = NULL; if (ctr502->count == 0) { - r->out.ctr.ctr502 = ctr502; + r->out.info_ctr->ctr.ctr502 = ctr502; return WERR_OK; } @@ -945,7 +934,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, return WERR_GENERAL_FAILURE; } info.info502 = &ctr502->array[i]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); if (!W_ERROR_IS_OK(status)) { return status; } @@ -953,8 +942,9 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, } talloc_free(snames); - r->out.ctr.ctr502 = ctr502; - r->out.totalentries = r->out.ctr.ctr502->count; + r->out.info_ctr->ctr.ctr502 = ctr502; + *r->out.totalentries = r->out.info_ctr->ctr.ctr502->count; + return WERR_OK; } default: @@ -975,7 +965,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, struct share_context *sctx = NULL; struct share_config *scfg = NULL; - ZERO_STRUCT(r->out); + ZERO_STRUCTP(r->out.info); /* TODO: - access check */ @@ -1008,7 +998,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return status; } - r->out.info.info0 = info.info0; + r->out.info->info0 = info.info0; return WERR_OK; } case 1: @@ -1024,7 +1014,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return status; } - r->out.info.info1 = info.info1; + r->out.info->info1 = info.info1; return WERR_OK; } case 2: @@ -1042,7 +1032,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return status; } - r->out.info.info2 = info.info2; + r->out.info->info2 = info.info2; return WERR_OK; } case 501: @@ -1058,7 +1048,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return status; } - r->out.info.info501 = info.info501; + r->out.info->info501 = info.info501; return WERR_OK; } case 502: @@ -1076,7 +1066,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return status; } - r->out.info.info502 = info.info502; + r->out.info->info502 = info.info502; return WERR_OK; } case 1005: @@ -1092,7 +1082,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return status; } - r->out.info.info1005 = info.info1005; + r->out.info->info1005 = info.info1005; return WERR_OK; } default: @@ -1248,7 +1238,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info0->name, + r->in.info->info0->name, NULL, NULL, NULL, @@ -1265,11 +1255,11 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info1->name, + r->in.info->info1->name, NULL, - r->in.info.info1->comment, + r->in.info->info1->comment, NULL, - r->in.info.info1->type, + r->in.info->info1->type, 0, 0, NULL); @@ -1282,12 +1272,12 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info2->name, - r->in.info.info2->path, - r->in.info.info2->comment, - r->in.info.info2->password, - r->in.info.info2->type, - r->in.info.info2->max_users, + r->in.info->info2->name, + r->in.info->info2->path, + r->in.info->info2->comment, + r->in.info->info2->password, + r->in.info->info2->type, + r->in.info->info2->max_users, 0, NULL); if (W_ERROR_EQUAL(status, WERR_OK)) { @@ -1299,13 +1289,13 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info501->name, + r->in.info->info501->name, NULL, - r->in.info.info501->comment, + r->in.info->info501->comment, NULL, - r->in.info.info501->type, + r->in.info->info501->type, 0, - r->in.info.info501->csc_policy, + r->in.info->info501->csc_policy, NULL); if (W_ERROR_EQUAL(status, WERR_OK)) { return status; @@ -1316,14 +1306,14 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, { status = dcesrv_srvsvc_fill_share_info(info, &count, r->in.share_name, r->in.level, - r->in.info.info502->name, - r->in.info.info502->path, - r->in.info.info502->comment, - r->in.info.info502->password, - r->in.info.info502->type, - r->in.info.info502->max_users, + r->in.info->info502->name, + r->in.info->info502->path, + r->in.info->info502->comment, + r->in.info->info502->password, + r->in.info->info502->type, + r->in.info->info502->max_users, 0, - r->in.info.info502->sd); + r->in.info->info502->sd_buf.sd); if (W_ERROR_EQUAL(status, WERR_OK)) { return status; } @@ -1335,7 +1325,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, r->in.share_name, r->in.level, NULL, NULL, - r->in.info.info1004->comment, + r->in.info->info1004->comment, NULL, 0, 0, @@ -1396,13 +1386,13 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA const char **names; int count, i; - ZERO_STRUCT(r->out); + *r->out.type = 0; /* TODO: - access check */ if (strcmp("", r->in.device_name) == 0) { - r->out.type = STYPE_IPC; + *r->out.type = STYPE_IPC; return WERR_OK; } @@ -1441,17 +1431,17 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA if (!type) continue; if (strcmp(type, "DISK") == 0) { - r->out.type = STYPE_DISKTREE; + *r->out.type = STYPE_DISKTREE; return WERR_OK; } if (strcmp(type, "IPC") == 0) { - r->out.type = STYPE_IPC; + *r->out.type = STYPE_IPC; return WERR_OK; } if (strcmp(type, "PRINTER") == 0) { - r->out.type = STYPE_PRINTQ; + *r->out.type = STYPE_PRINTQ; return WERR_OK; } } @@ -1469,7 +1459,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA { struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; - ZERO_STRUCT(r->out); + ZERO_STRUCTP(r->out.info); switch (r->in.level) { case 100: @@ -1483,7 +1473,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info100->server_name = dcesrv_common_get_server_name(mem_ctx, dce_ctx, r->in.server_unc); W_ERROR_HAVE_NO_MEMORY(info100->server_name); - r->out.info.info100 = info100; + r->out.info->info100 = info100; return WERR_OK; } case 101: @@ -1503,7 +1493,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info101->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info101->comment); - r->out.info.info101 = info101; + r->out.info->info101 = info101; return WERR_OK; } case 102: @@ -1532,7 +1522,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info102->userpath = dcesrv_common_get_userpath(mem_ctx, dce_ctx); W_ERROR_HAVE_NO_MEMORY(info102->userpath); - r->out.info.info102 = info102; + r->out.info->info102 = info102; return WERR_OK; } default: @@ -1559,27 +1549,26 @@ static WERROR dcesrv_srvsvc_NetSrvSetInfo(struct dcesrv_call_state *dce_call, TA static WERROR dcesrv_srvsvc_NetDiskEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetDiskEnum *r) { - r->out.info.disks = NULL; - r->out.info.count = 0; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + r->out.info->disks = NULL; + r->out.info->count = 0; + *r->out.totalentries = 0; switch (r->in.level) { case 0: { /* we can safely hardcode the reply and report we have only one disk (C:) */ /* for some reason Windows wants 2 entries with the second being empty */ - r->out.info.disks = talloc_array(mem_ctx, struct srvsvc_NetDiskInfo0, 2); - W_ERROR_HAVE_NO_MEMORY(r->out.info.disks); - r->out.info.count = 2; + r->out.info->disks = talloc_array(mem_ctx, struct srvsvc_NetDiskInfo0, 2); + W_ERROR_HAVE_NO_MEMORY(r->out.info->disks); + r->out.info->count = 2; - r->out.info.disks[0].disk = talloc_strdup(mem_ctx, "C:"); - W_ERROR_HAVE_NO_MEMORY(r->out.info.disks[0].disk); + r->out.info->disks[0].disk = talloc_strdup(mem_ctx, "C:"); + W_ERROR_HAVE_NO_MEMORY(r->out.info->disks[0].disk); - r->out.info.disks[1].disk = talloc_strdup(mem_ctx, ""); - W_ERROR_HAVE_NO_MEMORY(r->out.info.disks[1].disk); + r->out.info->disks[1].disk = talloc_strdup(mem_ctx, ""); + W_ERROR_HAVE_NO_MEMORY(r->out.info->disks[1].disk); - r->out.totalentries = 1; + *r->out.totalentries = 1; r->out.resume_handle = r->in.resume_handle; return WERR_OK; @@ -1618,48 +1607,50 @@ static WERROR dcesrv_srvsvc_NetTransportAdd(struct dcesrv_call_state *dce_call, static WERROR dcesrv_srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetTransportEnum *r) { - r->out.level = r->in.level; - r->out.totalentries = 0; - r->out.resume_handle = NULL; + r->out.transports->level = r->in.transports->level; + *r->out.totalentries = 0; + if (r->out.resume_handle) { + *r->out.resume_handle = 0; + } - switch (r->in.level) { + switch (r->in.transports->level) { case 0: { - r->out.transports.ctr0 = talloc(mem_ctx, struct srvsvc_NetTransportCtr0); - W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr0); + r->out.transports->ctr.ctr0 = talloc(mem_ctx, struct srvsvc_NetTransportCtr0); + W_ERROR_HAVE_NO_MEMORY(r->out.transports->ctr.ctr0); - r->out.transports.ctr0->count = 0; - r->out.transports.ctr0->array = NULL; + r->out.transports->ctr.ctr0->count = 0; + r->out.transports->ctr.ctr0->array = NULL; return WERR_NOT_SUPPORTED; } case 1: { - r->out.transports.ctr1 = talloc(mem_ctx, struct srvsvc_NetTransportCtr1); - W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr1); + r->out.transports->ctr.ctr1 = talloc(mem_ctx, struct srvsvc_NetTransportCtr1); + W_ERROR_HAVE_NO_MEMORY(r->out.transports->ctr.ctr1); - r->out.transports.ctr1->count = 0; - r->out.transports.ctr1->array = NULL; + r->out.transports->ctr.ctr1->count = 0; + r->out.transports->ctr.ctr1->array = NULL; return WERR_NOT_SUPPORTED; } case 2: { - r->out.transports.ctr2 = talloc(mem_ctx, struct srvsvc_NetTransportCtr2); - W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr2); + r->out.transports->ctr.ctr2 = talloc(mem_ctx, struct srvsvc_NetTransportCtr2); + W_ERROR_HAVE_NO_MEMORY(r->out.transports->ctr.ctr2); - r->out.transports.ctr2->count = 0; - r->out.transports.ctr2->array = NULL; + r->out.transports->ctr.ctr2->count = 0; + r->out.transports->ctr.ctr2->array = NULL; return WERR_NOT_SUPPORTED; } case 3: { - r->out.transports.ctr3 = talloc(mem_ctx, struct srvsvc_NetTransportCtr3); - W_ERROR_HAVE_NO_MEMORY(r->out.transports.ctr3); + r->out.transports->ctr.ctr3 = talloc(mem_ctx, struct srvsvc_NetTransportCtr3); + W_ERROR_HAVE_NO_MEMORY(r->out.transports->ctr.ctr3); - r->out.transports.ctr3->count = 0; - r->out.transports.ctr3->array = NULL; + r->out.transports->ctr.ctr3->count = 0; + r->out.transports->ctr.ctr3->array = NULL; return WERR_NOT_SUPPORTED; } @@ -1689,31 +1680,34 @@ static WERROR dcesrv_srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TAL struct timeval tval; time_t t; struct tm tm; + struct srvsvc_NetRemoteTODInfo *info; - r->out.info = talloc(mem_ctx, struct srvsvc_NetRemoteTODInfo); - W_ERROR_HAVE_NO_MEMORY(r->out.info); + info = talloc(mem_ctx, struct srvsvc_NetRemoteTODInfo); + W_ERROR_HAVE_NO_MEMORY(info); GetTimeOfDay(&tval); t = tval.tv_sec; gmtime_r(&t, &tm); - r->out.info->elapsed = t; + info->elapsed = t; /* TODO: fake the uptime: just return the milliseconds till 0:00:00 today */ - r->out.info->msecs = (tm.tm_hour*60*60*1000) - + (tm.tm_min*60*1000) - + (tm.tm_sec*1000) - + (tval.tv_usec/1000); - r->out.info->hours = tm.tm_hour; - r->out.info->mins = tm.tm_min; - r->out.info->secs = tm.tm_sec; - r->out.info->hunds = tval.tv_usec/10000; - r->out.info->timezone = get_time_zone(t)/60; - r->out.info->tinterval = 310; /* just return the same as windows */ - r->out.info->day = tm.tm_mday; - r->out.info->month = tm.tm_mon + 1; - r->out.info->year = tm.tm_year + 1900; - r->out.info->weekday = tm.tm_wday; + info->msecs = (tm.tm_hour*60*60*1000) + + (tm.tm_min*60*1000) + + (tm.tm_sec*1000) + + (tval.tv_usec/1000); + info->hours = tm.tm_hour; + info->mins = tm.tm_min; + info->secs = tm.tm_sec; + info->hunds = tval.tv_usec/10000; + info->timezone = get_time_zone(t)/60; + info->tinterval = 310; /* just return the same as windows */ + info->day = tm.tm_mday; + info->month = tm.tm_mon + 1; + info->year = tm.tm_year + 1900; + info->weekday = tm.tm_wday; + + *r->out.info = info; return WERR_OK; } @@ -1821,10 +1815,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL struct share_config *scfg; struct dcesrv_context *dce_ctx = dce_call->conn->dce_ctx; - r->out.level = r->in.level; - ZERO_STRUCT(r->out.ctr); - r->out.totalentries = 0; - r->out.resume_handle = NULL; + *r->out.totalentries = 0; /* TODO: - paging of results */ @@ -1839,7 +1830,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL return ntstatus_to_werror(nterr); } - switch (r->in.level) { + switch (r->in.info_ctr->level) { case 0: { int i, y = 0; @@ -1854,7 +1845,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL ctr0->array = NULL; if (ctr0->count == 0) { - r->out.ctr.ctr0 = ctr0; + r->out.info_ctr->ctr.ctr0 = ctr0; return WERR_OK; } @@ -1880,15 +1871,16 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL } info.info0 = &ctr0->array[y]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); W_ERROR_NOT_OK_RETURN(status); talloc_free(scfg); y++; } talloc_free(snames); - r->out.ctr.ctr0 = ctr0; - r->out.totalentries = r->out.ctr.ctr0->count; + r->out.info_ctr->ctr.ctr0 = ctr0; + *r->out.totalentries = r->out.info_ctr->ctr.ctr0->count; + return WERR_OK; } case 1: @@ -1905,7 +1897,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL ctr1->array = NULL; if (ctr1->count == 0) { - r->out.ctr.ctr1 = ctr1; + r->out.info_ctr->ctr.ctr1 = ctr1; return WERR_OK; } @@ -1931,15 +1923,16 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL } info.info1 = &ctr1->array[y]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); W_ERROR_NOT_OK_RETURN(status); talloc_free(scfg); y++; } talloc_free(snames); - r->out.ctr.ctr1 = ctr1; - r->out.totalentries = r->out.ctr.ctr1->count; + r->out.info_ctr->ctr.ctr1 = ctr1; + *r->out.totalentries = r->out.info_ctr->ctr.ctr1->count; + return WERR_OK; } case 2: @@ -1958,7 +1951,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL ctr2->array = NULL; if (ctr2->count == 0) { - r->out.ctr.ctr2 = ctr2; + r->out.info_ctr->ctr.ctr2 = ctr2; return WERR_OK; } @@ -1984,15 +1977,16 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL } info.info2 = &ctr2->array[y]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); W_ERROR_NOT_OK_RETURN(status); talloc_free(scfg); y++; } talloc_free(snames); - r->out.ctr.ctr2 = ctr2; - r->out.totalentries = r->out.ctr.ctr2->count; + r->out.info_ctr->ctr.ctr2 = ctr2; + *r->out.totalentries = r->out.info_ctr->ctr.ctr2->count; + return WERR_OK; } case 502: @@ -2011,7 +2005,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL ctr502->array = NULL; if (ctr502->count == 0) { - r->out.ctr.ctr502 = ctr502; + r->out.info_ctr->ctr.ctr502 = ctr502; return WERR_OK; } @@ -2037,15 +2031,16 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL } info.info502 = &ctr502->array[y]; - status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.level, &info); + status = dcesrv_srvsvc_fiel_ShareInfo(dce_call, mem_ctx, scfg, r->in.info_ctr->level, &info); W_ERROR_NOT_OK_RETURN(status); talloc_free(scfg); y++; } talloc_free(snames); - r->out.ctr.ctr502 = ctr502; - r->out.totalentries = r->out.ctr.ctr502->count; + r->out.info_ctr->ctr.ctr502 = ctr502; + *r->out.totalentries = r->out.info_ctr->ctr.ctr502->count; + return WERR_OK; } default: @@ -2113,7 +2108,7 @@ static WERROR dcesrv_srvsvc_NetGetFileSecurity(struct dcesrv_call_state *dce_cal sd_buf->sd = io->query_secdesc.out.sd; - r->out.sd_buf = sd_buf; + *r->out.sd_buf = sd_buf; return WERR_OK; } @@ -2145,7 +2140,7 @@ static WERROR dcesrv_srvsvc_NetSetFileSecurity(struct dcesrv_call_state *dce_cal io->set_secdesc.level = RAW_FILEINFO_SEC_DESC; io->set_secdesc.in.file.path = r->in.file; io->set_secdesc.in.secinfo_flags = r->in.securityinformation; - io->set_secdesc.in.sd = r->in.sd_buf.sd; + io->set_secdesc.in.sd = r->in.sd_buf->sd; nt_status = ntvfs_setpathinfo(ntvfs_req, io); if (!NT_STATUS_IS_OK(nt_status)) return ntstatus_to_werror(nt_status); diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c index 6bc5be40a6..e49461357a 100644 --- a/source4/torture/libnet/libnet_share.c +++ b/source4/torture/libnet/libnet_share.c @@ -102,11 +102,11 @@ static void test_displayshares(struct libnet_ListShares s) for (j = 0; j < ARRAY_SIZE(share_types); j++) { if (share_types[j].type == info->type) break; } - d_printf("\t[%d] %s\t%s\n\t %s\n\t [perms=0x%08x, max_usr=%d, cur_usr=%d, path=%s, pass=%s, unknown=0x%08x]\n", + d_printf("\t[%d] %s\t%s\n\t %s\n\t [perms=0x%08x, max_usr=%d, cur_usr=%d, path=%s, pass=%s]\n", i, info->name, share_types[j].desc, info->comment, info->permissions, info->max_users, info->current_users, info->path, - info->password, info->unknown); + info->password); } break; } @@ -170,6 +170,7 @@ static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, con { NTSTATUS status; struct srvsvc_NetShareAdd add; + union srvsvc_NetShareInfo info; struct srvsvc_NetShareInfo2 i; i.name = share; @@ -180,9 +181,11 @@ static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, con i.password = NULL; i.permissions = 0x0; + info.info2 = &i; + add.in.server_unc = host; add.in.level = 2; - add.in.info.info2 = &i; + add.in.info = &info; add.in.parm_error = NULL; status = dcerpc_srvsvc_NetShareAdd(svc_pipe, mem_ctx, &add); diff --git a/source4/torture/rpc/bench.c b/source4/torture/rpc/bench.c index cacc1d3baa..6fa3815516 100644 --- a/source4/torture/rpc/bench.c +++ b/source4/torture/rpc/bench.c @@ -31,32 +31,63 @@ static bool test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; struct srvsvc_NetShareEnumAll r; + struct srvsvc_NetShareInfoCtr info_ctr; struct srvsvc_NetShareCtr0 c0; + struct srvsvc_NetShareCtr1 c1; + struct srvsvc_NetShareCtr2 c2; + struct srvsvc_NetShareCtr501 c501; + struct srvsvc_NetShareCtr502 c502; + uint32_t totalentries = 0; uint32_t levels[] = {0, 1, 2, 501, 502}; int i; bool ret = true; uint32_t resume_handle; - ZERO_STRUCT(c0); + ZERO_STRUCT(info_ctr); r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p)); - r.in.ctr.ctr0 = &c0; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = &resume_handle; r.out.resume_handle = &resume_handle; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); resume_handle = 0; - r.in.level = levels[i]; + info_ctr.level = levels[i]; + + switch (info_ctr.level) { + case 0: + ZERO_STRUCT(c0); + info_ctr.ctr.ctr0 = &c0; + break; + case 1: + ZERO_STRUCT(c1); + info_ctr.ctr.ctr1 = &c1; + break; + case 2: + ZERO_STRUCT(c2); + info_ctr.ctr.ctr2 = &c2; + break; + case 501: + ZERO_STRUCT(c501); + info_ctr.ctr.ctr501 = &c501; + break; + case 502: + ZERO_STRUCT(c502); + info_ctr.ctr.ctr502 = &c502; + break; + } + status = dcerpc_srvsvc_NetShareEnumAll(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - printf("NetShareEnumAll level %u failed - %s\n", r.in.level, nt_errstr(status)); + printf("NetShareEnumAll level %u failed - %s\n", info_ctr.level, nt_errstr(status)); ret = false; continue; } if (!W_ERROR_IS_OK(r.out.result)) { - printf("NetShareEnumAll level %u failed - %s\n", r.in.level, win_errstr(r.out.result)); + printf("NetShareEnumAll level %u failed - %s\n", info_ctr.level, win_errstr(r.out.result)); continue; } } diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index c53c4b72c7..93bcb3a1ea 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -1866,6 +1866,7 @@ static bool test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct srvsvc_NetShareGetInfo r; + union srvsvc_NetShareInfo info; uint32_t levels[] = { 0, 1, 2, 501, 502, 1004, 1005, 1006, 1007, 1501 }; int i; bool ret = true; @@ -1873,12 +1874,11 @@ static bool test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); r.in.share_name = sharename; + r.out.info = &info; for (i=0;i<ARRAY_SIZE(levels);i++) { r.in.level = levels[i]; - ZERO_STRUCT(r.out); - printf("testing NetShareGetInfo level %u on share '%s'\n", r.in.level, r.in.share_name); @@ -1907,38 +1907,87 @@ static bool test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct srvsvc_NetShareEnum r; + struct srvsvc_NetShareInfoCtr info_ctr; struct srvsvc_NetShareCtr0 c0; + struct srvsvc_NetShareCtr1 c1; + struct srvsvc_NetShareCtr2 c2; + struct srvsvc_NetShareCtr501 c501; + struct srvsvc_NetShareCtr502 c502; + struct srvsvc_NetShareCtr1004 c1004; + struct srvsvc_NetShareCtr1005 c1005; + struct srvsvc_NetShareCtr1006 c1006; + struct srvsvc_NetShareCtr1007 c1007; + uint32_t totalentries = 0; uint32_t levels[] = { 0, 1, 2, 501, 502, 1004, 1005, 1006, 1007 }; int i; bool ret = true; + ZERO_STRUCT(info_ctr); + r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p)); - r.in.ctr.ctr0 = &c0; - r.in.ctr.ctr0->count = 0; - r.in.ctr.ctr0->array = NULL; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;i<ARRAY_SIZE(levels);i++) { - r.in.level = levels[i]; - - ZERO_STRUCT(r.out); + info_ctr.level = levels[i]; + + switch (info_ctr.level) { + case 0: + ZERO_STRUCT(c0); + info_ctr.ctr.ctr0 = &c0; + break; + case 1: + ZERO_STRUCT(c1); + info_ctr.ctr.ctr1 = &c1; + break; + case 2: + ZERO_STRUCT(c2); + info_ctr.ctr.ctr2 = &c2; + break; + case 501: + ZERO_STRUCT(c501); + info_ctr.ctr.ctr501 = &c501; + break; + case 502: + ZERO_STRUCT(c502); + info_ctr.ctr.ctr502 = &c502; + break; + case 1004: + ZERO_STRUCT(c1004); + info_ctr.ctr.ctr1004 = &c1004; + break; + case 1005: + ZERO_STRUCT(c1005); + info_ctr.ctr.ctr1005 = &c1005; + break; + case 1006: + ZERO_STRUCT(c1006); + info_ctr.ctr.ctr1006 = &c1006; + break; + case 1007: + ZERO_STRUCT(c1007); + info_ctr.ctr.ctr1007 = &c1007; + break; + } - printf("testing NetShareEnum level %u\n", r.in.level); + printf("testing NetShareEnum level %u\n", info_ctr.level); status = dcerpc_srvsvc_NetShareEnum(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("NetShareEnum level %u failed - %s\n", - r.in.level, nt_errstr(status)); + info_ctr.level, nt_errstr(status)); ret = false; continue; } if (!W_ERROR_IS_OK(r.out.result)) { printf("NetShareEnum level %u failed - %s\n", - r.in.level, win_errstr(r.out.result)); + info_ctr.level, win_errstr(r.out.result)); continue; } - if (r.in.level == 0) { - struct srvsvc_NetShareCtr0 *ctr = r.out.ctr.ctr0; + if (info_ctr.level == 0) { + struct srvsvc_NetShareCtr0 *ctr = r.out.info_ctr->ctr.ctr0; if (ctr->count > 0) { *one_sharename = ctr->array[0].name; } @@ -2114,6 +2163,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p; NTSTATUS status; struct srvsvc_NetShareGetInfo r; + union srvsvc_NetShareInfo info; struct security_descriptor *result; if (!(tmp_ctx = talloc_new(mem_ctx))) { @@ -2144,6 +2194,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx, dcerpc_server_name(p)); r.in.share_name = sharename; r.in.level = 502; + r.out.info = &info; status = dcerpc_srvsvc_NetShareGetInfo(p, tmp_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -2153,7 +2204,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx, return NULL; } - result = talloc_steal(mem_ctx, r.out.info.info502->sd); + result = talloc_steal(mem_ctx, info.info502->sd_buf.sd); talloc_free(tmp_ctx); return result; } @@ -2170,6 +2221,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx, NTSTATUS status; struct sec_desc_buf i; struct srvsvc_NetShareSetInfo r; + union srvsvc_NetShareInfo info; uint32_t error = 0; if (!(tmp_ctx = talloc_new(mem_ctx))) { @@ -2201,12 +2253,13 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx, r.in.share_name = sharename; r.in.level = 1501; i.sd = sd; - r.in.info.info1501 = &i; + info.info1501 = &i; + r.in.info = &info; r.in.parm_error = &error; status = dcerpc_srvsvc_NetShareSetInfo(p, tmp_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - d_printf("srvsvc_NetShareGetInfo failed: %s\n", + d_printf("srvsvc_NetShareSetInfo failed: %s\n", nt_errstr(status)); } @@ -2467,8 +2520,10 @@ static NTSTATUS find_printers(TALLOC_CTX *ctx, struct loadparm_context *lp_ctx, NTSTATUS status; struct dcerpc_pipe *p; struct srvsvc_NetShareEnum r; + struct srvsvc_NetShareInfoCtr info_ctr; struct srvsvc_NetShareCtr1 c1_in; struct srvsvc_NetShareCtr1 *c1; + uint32_t totalentries = 0; int i; mem_ctx = talloc_new(ctx); @@ -2485,25 +2540,29 @@ static NTSTATUS find_printers(TALLOC_CTX *ctx, struct loadparm_context *lp_ctx, return status; } + ZERO_STRUCT(c1_in); + info_ctr.level = 1; + info_ctr.ctr.ctr1 = &c1_in; + r.in.server_unc = talloc_asprintf( mem_ctx, "\\\\%s", dcerpc_server_name(p)); - r.in.level = 1; - ZERO_STRUCT(c1_in); - r.in.ctr.ctr1 = &c1_in; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; status = dcerpc_srvsvc_NetShareEnum(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { d_printf("NetShareEnum level %u failed - %s\n", - r.in.level, nt_errstr(status)); + info_ctr.level, nt_errstr(status)); talloc_free(mem_ctx); return status; } *printers = NULL; *num_printers = 0; - c1 = r.out.ctr.ctr1; + c1 = r.out.info_ctr->ctr.ctr1; for (i=0; i<c1->count; i++) { if (c1->array[i].type != STYPE_PRINTQ) { continue; @@ -3103,11 +3162,12 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct smbcli_state *cli, const char *share, - struct srvsvc_NetShareInfo502 **info) + struct srvsvc_NetShareInfo502 **info502) { struct smbcli_tree *ipc; struct dcerpc_pipe *p; struct srvsvc_NetShareGetInfo r; + union srvsvc_NetShareInfo info; NTSTATUS status; if (!(p = dcerpc_pipe_init(cli, @@ -3140,15 +3200,16 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx, dcerpc_server_name(p)); r.in.share_name = share; r.in.level = 502; + r.out.info = &info; status = dcerpc_srvsvc_NetShareGetInfo(p, p, &r); if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) { - d_printf("(%s) OpenHKLM failed: %s, %s\n", __location__, + d_printf("(%s) srvsvc_NetShareGetInfo failed: %s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); goto fail; } - *info = talloc_move(mem_ctx, &r.out.info.info502); + *info502 = talloc_move(mem_ctx, &info.info502); return NT_STATUS_OK; fail: diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index 1fe1221b0d..82a8a67854 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -32,14 +32,15 @@ static bool test_NetCharDevGetInfo(struct dcerpc_pipe *p, struct torture_context { NTSTATUS status; struct srvsvc_NetCharDevGetInfo r; + union srvsvc_NetCharDevInfo info; uint32_t levels[] = {0, 1}; int i; r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); r.in.device_name = devname; + r.out.info = &info; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); r.in.level = levels[i]; torture_comment(tctx, "testing NetCharDevGetInfo level %u on device '%s'\n", r.in.level, r.in.device_name); @@ -80,23 +81,39 @@ static bool test_NetCharDevEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetCharDevEnum r; + struct srvsvc_NetCharDevInfoCtr info_ctr; struct srvsvc_NetCharDevCtr0 c0; + struct srvsvc_NetCharDevCtr0 c1; + uint32_t totalentries = 0; uint32_t levels[] = {0, 1}; int i; + ZERO_STRUCT(info_ctr); + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); - r.in.ctr.ctr0 = &c0; - r.in.ctr.ctr0->count = 0; - r.in.ctr.ctr0->array = NULL; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.info_ctr = &info_ctr; + r.out.totalentries = &totalentries; for (i=0;i<ARRAY_SIZE(levels);i++) { int j; - ZERO_STRUCT(r.out); - r.in.level = levels[i]; - torture_comment(tctx, "testing NetCharDevEnum level %u\n", r.in.level); + info_ctr.level = levels[i]; + + switch(info_ctr.level) { + case 0: + ZERO_STRUCT(c0); + info_ctr.ctr.ctr0 = &c0; + break; + case 1: + ZERO_STRUCT(c1); + info_ctr.ctr.ctr0 = &c1; + break; + } + + torture_comment(tctx, "testing NetCharDevEnum level %u\n", info_ctr.level); status = dcerpc_srvsvc_NetCharDevEnum(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetCharDevEnum failed"); if (!W_ERROR_IS_OK(r.out.result)) { @@ -105,10 +122,10 @@ static bool test_NetCharDevEnum(struct torture_context *tctx, } /* call test_NetCharDevGetInfo and test_NetCharDevControl for each returned share */ - if (r.in.level == 1) { - for (j=0;j<r.out.ctr.ctr1->count;j++) { + if (info_ctr.level == 1) { + for (j=0;j<r.out.info_ctr->ctr.ctr1->count;j++) { const char *device; - device = r.out.ctr.ctr1->array[j].device; + device = r.out.info_ctr->ctr.ctr1->array[j].device; if (!test_NetCharDevGetInfo(p, tctx, device)) { return false; } @@ -130,15 +147,16 @@ static bool test_NetCharDevQGetInfo(struct dcerpc_pipe *p, struct torture_contex { NTSTATUS status; struct srvsvc_NetCharDevQGetInfo r; + union srvsvc_NetCharDevQInfo info; uint32_t levels[] = {0, 1}; int i; r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); r.in.queue_name = devicequeue; r.in.user = talloc_asprintf(tctx,"Administrator"); + r.out.info = &info; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); r.in.level = levels[i]; torture_comment(tctx, "testing NetCharDevQGetInfo level %u on devicequeue '%s'\n", r.in.level, r.in.queue_name); @@ -210,24 +228,39 @@ static bool test_NetCharDevQEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetCharDevQEnum r; + struct srvsvc_NetCharDevQInfoCtr info_ctr; struct srvsvc_NetCharDevQCtr0 c0; + struct srvsvc_NetCharDevQCtr1 c1; + uint32_t totalentries = 0; uint32_t levels[] = {0, 1}; int i; + ZERO_STRUCT(info_ctr); + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); r.in.user = talloc_asprintf(tctx,"%s","Administrator"); - r.in.ctr.ctr0 = &c0; - r.in.ctr.ctr0->count = 0; - r.in.ctr.ctr0->array = NULL; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;i<ARRAY_SIZE(levels);i++) { int j; - ZERO_STRUCT(r.out); - r.in.level = levels[i]; - torture_comment(tctx, "testing NetCharDevQEnum level %u\n", r.in.level); + info_ctr.level = levels[i]; + + switch (info_ctr.level) { + case 0: + ZERO_STRUCT(c0); + info_ctr.ctr.ctr0 = &c0; + break; + case 1: + ZERO_STRUCT(c1); + info_ctr.ctr.ctr1 = &c1; + break; + } + torture_comment(tctx, "testing NetCharDevQEnum level %u\n", info_ctr.level); status = dcerpc_srvsvc_NetCharDevQEnum(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetCharDevQEnum failed"); if (!W_ERROR_IS_OK(r.out.result)) { @@ -236,10 +269,10 @@ static bool test_NetCharDevQEnum(struct torture_context *tctx, } /* call test_NetCharDevGetInfo and test_NetCharDevControl for each returned share */ - if (r.in.level == 1) { - for (j=0;j<r.out.ctr.ctr1->count;j++) { + if (info_ctr.level == 1) { + for (j=0;j<r.out.info_ctr->ctr.ctr1->count;j++) { const char *device; - device = r.out.ctr.ctr1->array[j].device; + device = r.out.info_ctr->ctr.ctr1->array[j].device; if (!test_NetCharDevQGetInfo(p, tctx, device)) { return false; } @@ -258,22 +291,38 @@ static bool test_NetConnEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetConnEnum r; + struct srvsvc_NetConnInfoCtr info_ctr; struct srvsvc_NetConnCtr0 c0; + struct srvsvc_NetConnCtr1 c1; + uint32_t totalentries = 0; uint32_t levels[] = {0, 1}; int i; + ZERO_STRUCT(info_ctr); + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); r.in.path = talloc_asprintf(tctx,"%s","ADMIN$"); - r.in.ctr.ctr0 = &c0; - r.in.ctr.ctr0->count = 0; - r.in.ctr.ctr0->array = NULL; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); - r.in.level = levels[i]; - torture_comment(tctx, "testing NetConnEnum level %u\n", r.in.level); + info_ctr.level = levels[i]; + + switch (info_ctr.level) { + case 0: + ZERO_STRUCT(c0); + info_ctr.ctr.ctr0 = &c0; + break; + case 1: + ZERO_STRUCT(c1); + info_ctr.ctr.ctr1 = &c1; + break; + } + + torture_comment(tctx, "testing NetConnEnum level %u\n", info_ctr.level); status = dcerpc_srvsvc_NetConnEnum(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetConnEnum failed"); if (!W_ERROR_IS_OK(r.out.result)) { @@ -292,23 +341,38 @@ static bool test_NetFileEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetFileEnum r; + struct srvsvc_NetFileInfoCtr info_ctr; + struct srvsvc_NetFileCtr2 c2; struct srvsvc_NetFileCtr3 c3; + uint32_t totalentries = 0; uint32_t levels[] = {2, 3}; int i; + ZERO_STRUCT(info_ctr); + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); r.in.path = NULL; r.in.user = NULL; - r.in.ctr.ctr3 = &c3; - r.in.ctr.ctr3->count = 0; - r.in.ctr.ctr3->array = NULL; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)4096; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); - r.in.level = levels[i]; - torture_comment(tctx, "testing NetFileEnum level %u\n", r.in.level); + info_ctr.level = levels[i]; + + switch (info_ctr.level) { + case 2: + ZERO_STRUCT(c2); + info_ctr.ctr.ctr2 = &c2; + break; + case 3: + ZERO_STRUCT(c3); + info_ctr.ctr.ctr3 = &c3; + break; + } + torture_comment(tctx, "testing NetFileEnum level %u\n", info_ctr.level); status = dcerpc_srvsvc_NetFileEnum(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetFileEnum failed"); if (!W_ERROR_IS_OK(r.out.result)) { @@ -327,23 +391,54 @@ static bool test_NetSessEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetSessEnum r; + struct srvsvc_NetSessInfoCtr info_ctr; struct srvsvc_NetSessCtr0 c0; + struct srvsvc_NetSessCtr1 c1; + struct srvsvc_NetSessCtr2 c2; + struct srvsvc_NetSessCtr10 c10; + struct srvsvc_NetSessCtr502 c502; + uint32_t totalentries = 0; uint32_t levels[] = {0, 1, 2, 10, 502}; int i; + ZERO_STRUCT(info_ctr); + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); r.in.client = NULL; r.in.user = NULL; - r.in.ctr.ctr0 = &c0; - r.in.ctr.ctr0->count = 0; - r.in.ctr.ctr0->array = NULL; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); - r.in.level = levels[i]; - torture_comment(tctx, "testing NetSessEnum level %u\n", r.in.level); + info_ctr.level = levels[i]; + + switch (info_ctr.level) { + case 0: + ZERO_STRUCT(c0); + info_ctr.ctr.ctr0 = &c0; + break; + case 1: + ZERO_STRUCT(c1); + info_ctr.ctr.ctr1 = &c1; + break; + case 2: + ZERO_STRUCT(c2); + info_ctr.ctr.ctr2 = &c2; + break; + case 10: + ZERO_STRUCT(c10); + info_ctr.ctr.ctr10 = &c10; + break; + case 502: + ZERO_STRUCT(c502); + info_ctr.ctr.ctr502 = &c502; + break; + } + + torture_comment(tctx, "testing NetSessEnum level %u\n", info_ctr.level); status = dcerpc_srvsvc_NetSessEnum(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetSessEnum failed"); if (!W_ERROR_IS_OK(r.out.result)) { @@ -362,9 +457,11 @@ static bool test_NetShareCheck(struct dcerpc_pipe *p, struct torture_context *tc { NTSTATUS status; struct srvsvc_NetShareCheck r; + enum srvsvc_ShareType type; r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.device_name = device_name; + r.out.type = &type; torture_comment(tctx, "testing NetShareCheck on device '%s'\n", r.in.device_name); @@ -382,6 +479,7 @@ static bool test_NetShareGetInfo(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetShareGetInfo r; + union srvsvc_NetShareInfo info; struct { uint32_t level; WERROR anon_status; @@ -398,6 +496,7 @@ static bool test_NetShareGetInfo(struct torture_context *tctx, r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.share_name = sharename; + r.out.info = &info; for (i=0;i<ARRAY_SIZE(levels);i++) { WERROR expected; @@ -405,7 +504,6 @@ static bool test_NetShareGetInfo(struct torture_context *tctx, r.in.level = levels[i].level; expected = levels[i].anon_status; if (admin) expected = levels[i].admin_status; - ZERO_STRUCT(r.out); torture_comment(tctx, "testing NetShareGetInfo level %u on share '%s'\n", r.in.level, r.in.share_name); @@ -415,8 +513,8 @@ static bool test_NetShareGetInfo(struct torture_context *tctx, torture_assert_werr_equal(tctx, r.out.result, expected, "NetShareGetInfo failed"); if (r.in.level != 2) continue; - if (!r.out.info.info2 || !r.out.info.info2->path) continue; - if (!test_NetShareCheck(p, tctx, r.out.info.info2->path)) { + if (!r.out.info->info2 || !r.out.info->info2->path) continue; + if (!test_NetShareCheck(p, tctx, r.out.info->info2->path)) { return false; } } @@ -444,6 +542,8 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx, struct srvsvc_NetShareSetInfo r; struct srvsvc_NetShareGetInfo q; struct srvsvc_NetShareDel d; + struct sec_desc_buf sd_buf; + union srvsvc_NetShareInfo info; struct { uint32_t level; WERROR expected; @@ -465,17 +565,18 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx, talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.share_name = talloc_strdup(tctx, "testshare"); + info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2); + info.info2->name = r.in.share_name; + info.info2->type = STYPE_DISKTREE; + info.info2->comment = talloc_strdup(tctx, "test comment"); + info.info2->permissions = 123434566; + info.info2->max_users = -1; + info.info2->current_users = 0; + info.info2->path = talloc_strdup(tctx, "C:\\"); + info.info2->password = NULL; + + a.in.info = &info; a.in.level = 2; - a.in.info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2); - a.in.info.info2->name = r.in.share_name; - a.in.info.info2->type = STYPE_DISKTREE; - a.in.info.info2->comment = talloc_strdup(tctx, "test comment"); - a.in.info.info2->permissions = 123434566; - a.in.info.info2->max_users = -1; - a.in.info.info2->current_users = 0; - a.in.info.info2->path = talloc_strdup(tctx, "C:\\"); - a.in.info.info2->password = NULL; - a.in.parm_error = NULL; status = dcerpc_srvsvc_NetShareAdd(p, tctx, &a); @@ -496,109 +597,112 @@ static bool test_NetShareAddSetDel(struct torture_context *tctx, switch (levels[i].level) { case 0: - r.in.info.info0 = talloc(tctx, struct srvsvc_NetShareInfo0); - r.in.info.info0->name = r.in.share_name; + info.info0 = talloc(tctx, struct srvsvc_NetShareInfo0); + info.info0->name = r.in.share_name; break; case 1: - r.in.info.info1 = talloc(tctx, struct srvsvc_NetShareInfo1); - r.in.info.info1->name = r.in.share_name; - r.in.info.info1->type = STYPE_DISKTREE; - r.in.info.info1->comment = talloc_strdup(tctx, "test comment 1"); + info.info1 = talloc(tctx, struct srvsvc_NetShareInfo1); + info.info1->name = r.in.share_name; + info.info1->type = STYPE_DISKTREE; + info.info1->comment = talloc_strdup(tctx, "test comment 1"); break; case 2: - r.in.info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2); - r.in.info.info2->name = r.in.share_name; - r.in.info.info2->type = STYPE_DISKTREE; - r.in.info.info2->comment = talloc_strdup(tctx, "test comment 2"); - r.in.info.info2->permissions = 0; - r.in.info.info2->max_users = 2; - r.in.info.info2->current_users = 1; - r.in.info.info2->path = talloc_strdup(tctx, "::BLaH::"); /* "C:\\"); */ - r.in.info.info2->password = NULL; + info.info2 = talloc(tctx, struct srvsvc_NetShareInfo2); + info.info2->name = r.in.share_name; + info.info2->type = STYPE_DISKTREE; + info.info2->comment = talloc_strdup(tctx, "test comment 2"); + info.info2->permissions = 0; + info.info2->max_users = 2; + info.info2->current_users = 1; + info.info2->path = talloc_strdup(tctx, "::BLaH::"); /* "C:\\"); */ + info.info2->password = NULL; break; case 501: - r.in.info.info501 = talloc(tctx, struct srvsvc_NetShareInfo501); - r.in.info.info501->name = r.in.share_name; - r.in.info.info501->type = STYPE_DISKTREE; - r.in.info.info501->comment = talloc_strdup(tctx, "test comment 501"); - r.in.info.info501->csc_policy = 0; + info.info501 = talloc(tctx, struct srvsvc_NetShareInfo501); + info.info501->name = r.in.share_name; + info.info501->type = STYPE_DISKTREE; + info.info501->comment = talloc_strdup(tctx, "test comment 501"); + info.info501->csc_policy = 0; break; case 502: - r.in.info.info502 = talloc(tctx, struct srvsvc_NetShareInfo502); - r.in.info.info502->name = r.in.share_name; - r.in.info.info502->type = STYPE_DISKTREE; - r.in.info.info502->comment = talloc_strdup(tctx, "test comment 502"); - r.in.info.info502->permissions = 0; - r.in.info.info502->max_users = 502; - r.in.info.info502->current_users = 1; - r.in.info.info502->path = talloc_strdup(tctx, "C:\\"); - r.in.info.info502->password = NULL; - r.in.info.info502->unknown = 0; - r.in.info.info502->sd = NULL; + ZERO_STRUCT(sd_buf); + info.info502 = talloc(tctx, struct srvsvc_NetShareInfo502); + info.info502->name = r.in.share_name; + info.info502->type = STYPE_DISKTREE; + info.info502->comment = talloc_strdup(tctx, "test comment 502"); + info.info502->permissions = 0; + info.info502->max_users = 502; + info.info502->current_users = 1; + info.info502->path = talloc_strdup(tctx, "C:\\"); + info.info502->password = NULL; + info.info502->sd_buf = sd_buf; break; case 1004: - r.in.info.info1004 = talloc(tctx, struct srvsvc_NetShareInfo1004); - r.in.info.info1004->comment = talloc_strdup(tctx, "test comment 1004"); + info.info1004 = talloc(tctx, struct srvsvc_NetShareInfo1004); + info.info1004->comment = talloc_strdup(tctx, "test comment 1004"); break; case 1005: - r.in.info.info1005 = talloc(tctx, struct srvsvc_NetShareInfo1005); - r.in.info.info1005->dfs_flags = 0; + info.info1005 = talloc(tctx, struct srvsvc_NetShareInfo1005); + info.info1005->dfs_flags = 0; break; case 1006: - r.in.info.info1006 = talloc(tctx, struct srvsvc_NetShareInfo1006); - r.in.info.info1006->max_users = 1006; + info.info1006 = talloc(tctx, struct srvsvc_NetShareInfo1006); + info.info1006->max_users = 1006; break; /* case 1007: - r.in.info.info1007 = talloc(tctx, struct srvsvc_NetShareInfo1007); - r.in.info.info1007->flags = 0; - r.in.info.info1007->alternate_directory_name = talloc_strdup(tctx, "test"); + info.info1007 = talloc(tctx, struct srvsvc_NetShareInfo1007); + info.info1007->flags = 0; + info.info1007->alternate_directory_name = talloc_strdup(tctx, "test"); break; */ case 1501: - r.in.info.info1501 = talloc_zero(tctx, struct sec_desc_buf); + info.info1501 = talloc_zero(tctx, struct sec_desc_buf); break; } - + + r.in.info = &info; + status = dcerpc_srvsvc_NetShareSetInfo(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetShareGetInfo failed"); torture_assert_werr_equal(tctx, r.out.result, levels[i].expected, "NetShareSetInfo failed"); q.in.share_name = r.in.share_name; + q.out.info = &info; status = dcerpc_srvsvc_NetShareGetInfo(p, tctx, &q); torture_assert_ntstatus_ok(tctx, status, "NetShareGetInfo failed"); torture_assert_werr_ok(tctx, q.out.result, "NetShareGetInfo failed"); - torture_assert_str_equal(tctx, q.out.info.info502->name, r.in.share_name, + torture_assert_str_equal(tctx, q.out.info->info502->name, r.in.share_name, "share name invalid"); switch (levels[i].level) { case 0: break; case 1: - torture_assert_str_equal(tctx, q.out.info.info502->comment, "test comment 1", "comment"); + torture_assert_str_equal(tctx, q.out.info->info502->comment, "test comment 1", "comment"); break; case 2: - torture_assert_str_equal(tctx, q.out.info.info502->comment, "test comment 2", "comment"); - torture_assert_int_equal(tctx, q.out.info.info2->max_users, 2, "max users"); - torture_assert_str_equal(tctx, q.out.info.info2->path, "C:\\", "path"); + torture_assert_str_equal(tctx, q.out.info->info2->comment, "test comment 2", "comment"); + torture_assert_int_equal(tctx, q.out.info->info2->max_users, 2, "max users"); + torture_assert_str_equal(tctx, q.out.info->info2->path, "C:\\", "path"); break; case 501: - torture_assert_str_equal(tctx, q.out.info.info501->comment, "test comment 501", "comment"); + torture_assert_str_equal(tctx, q.out.info->info501->comment, "test comment 501", "comment"); break; case 502: - torture_assert_str_equal(tctx, q.out.info.info502->comment, "test comment 502", "comment"); - torture_assert_int_equal(tctx, q.out.info.info2->max_users, 502, "max users"); - torture_assert_str_equal(tctx, q.out.info.info2->path, "C:\\", "path"); + torture_assert_str_equal(tctx, q.out.info->info502->comment, "test comment 502", "comment"); + torture_assert_int_equal(tctx, q.out.info->info502->max_users, 502, "max users"); + torture_assert_str_equal(tctx, q.out.info->info502->path, "C:\\", "path"); break; case 1004: - torture_assert_str_equal(tctx, q.out.info.info502->comment, "test comment 1004", + torture_assert_str_equal(tctx, q.out.info->info1004->comment, "test comment 1004", "comment"); break; case 1005: break; case 1006: - torture_assert_int_equal(tctx, q.out.info.info2->max_users, 1006, "Max users"); + torture_assert_int_equal(tctx, q.out.info->info1006->max_users, 1006, "Max users"); break; /* case 1007: break; @@ -627,7 +731,13 @@ static bool test_NetShareEnumAll(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetShareEnumAll r; + struct srvsvc_NetShareInfoCtr info_ctr; struct srvsvc_NetShareCtr0 c0; + struct srvsvc_NetShareCtr1 c1; + struct srvsvc_NetShareCtr2 c2; + struct srvsvc_NetShareCtr501 c501; + struct srvsvc_NetShareCtr502 c502; + uint32_t totalentries = 0; struct { uint32_t level; WERROR anon_status; @@ -642,35 +752,61 @@ static bool test_NetShareEnumAll(struct torture_context *tctx, int i; uint32_t resume_handle; - ZERO_STRUCT(c0); + ZERO_STRUCT(info_ctr); r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); - r.in.ctr.ctr0 = &c0; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = &resume_handle; r.out.resume_handle = &resume_handle; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;i<ARRAY_SIZE(levels);i++) { + int j; WERROR expected; - r.in.level = levels[i].level; + info_ctr.level = levels[i].level; + + switch (info_ctr.level) { + case 0: + ZERO_STRUCT(c0); + info_ctr.ctr.ctr0 = &c0; + break; + case 1: + ZERO_STRUCT(c1); + info_ctr.ctr.ctr1 = &c1; + break; + case 2: + ZERO_STRUCT(c2); + info_ctr.ctr.ctr2 = &c2; + break; + case 501: + ZERO_STRUCT(c501); + info_ctr.ctr.ctr501 = &c501; + break; + case 502: + ZERO_STRUCT(c502); + info_ctr.ctr.ctr502 = &c502; + break; + } + expected = levels[i].anon_status; if (admin) expected = levels[i].admin_status; - ZERO_STRUCT(r.out); resume_handle = 0; - torture_comment(tctx, "testing NetShareEnumAll level %u\n", r.in.level); + torture_comment(tctx, "testing NetShareEnumAll level %u\n", info_ctr.level); status = dcerpc_srvsvc_NetShareEnumAll(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetShareEnumAll failed"); torture_assert_werr_equal(tctx, r.out.result, expected, "NetShareEnumAll failed"); /* call srvsvc_NetShareGetInfo for each returned share */ - if (r.in.level == 2 && r.out.ctr.ctr2) { - for (j=0;j<r.out.ctr.ctr2->count;j++) { + if (info_ctr.level == 2 && r.out.info_ctr->ctr.ctr2) { + for (j=0;j<r.out.info_ctr->ctr.ctr2->count;j++) { const char *name; - name = r.out.ctr.ctr2->array[j].name; + name = r.out.info_ctr->ctr.ctr2->array[j].name; if (!test_NetShareGetInfo(tctx, p, name, admin)) { return false; } @@ -698,7 +834,13 @@ static bool test_NetShareEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetShareEnum r; + struct srvsvc_NetShareInfoCtr info_ctr; struct srvsvc_NetShareCtr0 c0; + struct srvsvc_NetShareCtr1 c1; + struct srvsvc_NetShareCtr2 c2; + struct srvsvc_NetShareCtr501 c501; + struct srvsvc_NetShareCtr502 c502; + uint32_t totalentries = 0; struct { uint32_t level; WERROR anon_status; @@ -713,22 +855,44 @@ static bool test_NetShareEnum(struct torture_context *tctx, int i; r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); - r.in.ctr.ctr0 = &c0; - r.in.ctr.ctr0->count = 0; - r.in.ctr.ctr0->array = NULL; + r.in.info_ctr = &info_ctr; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.info_ctr = &info_ctr; for (i=0;i<ARRAY_SIZE(levels);i++) { WERROR expected; - r.in.level = levels[i].level; + info_ctr.level = levels[i].level; + + switch (info_ctr.level) { + case 0: + ZERO_STRUCT(c0); + info_ctr.ctr.ctr0 = &c0; + break; + case 1: + ZERO_STRUCT(c1); + info_ctr.ctr.ctr1 = &c1; + break; + case 2: + ZERO_STRUCT(c2); + info_ctr.ctr.ctr2 = &c2; + break; + case 501: + ZERO_STRUCT(c501); + info_ctr.ctr.ctr501 = &c501; + break; + case 502: + ZERO_STRUCT(c502); + info_ctr.ctr.ctr502 = &c502; + break; + } + expected = levels[i].anon_status; if (admin) expected = levels[i].admin_status; - ZERO_STRUCT(r.out); - - torture_comment(tctx, "testing NetShareEnum level %u\n", r.in.level); + torture_comment(tctx, "testing NetShareEnum level %u\n", info_ctr.level); status = dcerpc_srvsvc_NetShareEnum(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetShareEnum failed"); torture_assert_werr_equal(tctx, r.out.result, expected, "NetShareEnum failed"); @@ -757,19 +921,15 @@ static bool test_NetSrvGetInfo(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetSrvGetInfo r; - struct srvsvc_NetSrvInfo503 i503; + union srvsvc_NetSrvInfo info; uint32_t levels[] = {100, 101, 102, 502, 503}; int i; - uint32_t resume_handle; - - ZERO_STRUCT(i503); r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); - resume_handle = 0; r.in.level = levels[i]; + r.out.info = &info; torture_comment(tctx, "testing NetSrvGetInfo level %u\n", r.in.level); status = dcerpc_srvsvc_NetSrvGetInfo(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetSrvGetInfo failed"); @@ -789,16 +949,23 @@ static bool test_NetDiskEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetDiskEnum r; + struct srvsvc_NetDiskInfo info; + uint32_t totalentries = 0; uint32_t levels[] = {0}; int i; uint32_t resume_handle=0; - ZERO_STRUCT(r.in); + ZERO_STRUCT(info); + r.in.server_unc = NULL; r.in.resume_handle = &resume_handle; + r.in.info = &info; + r.out.info = &info; + r.out.totalentries = &totalentries; + r.out.resume_handle = &resume_handle; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); + ZERO_STRUCTP(r.out.info); r.in.level = levels[i]; torture_comment(tctx, "testing NetDiskEnum level %u\n", r.in.level); status = dcerpc_srvsvc_NetDiskEnum(p, tctx, &r); @@ -817,21 +984,36 @@ static bool test_NetTransportEnum(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetTransportEnum r; - struct srvsvc_NetTransportCtr0 c0; + struct srvsvc_NetTransportInfoCtr transports; + struct srvsvc_NetTransportCtr0 ctr0; + struct srvsvc_NetTransportCtr1 ctr1; + + uint32_t totalentries = 0; uint32_t levels[] = {0, 1}; int i; + ZERO_STRUCT(transports); + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s", dcerpc_server_name(p)); - r.in.transports.ctr0 = &c0; - r.in.transports.ctr0->count = 0; - r.in.transports.ctr0->array = NULL; + r.in.transports = &transports; r.in.max_buffer = (uint32_t)-1; r.in.resume_handle = NULL; + r.out.totalentries = &totalentries; + r.out.transports = &transports; for (i=0;i<ARRAY_SIZE(levels);i++) { - ZERO_STRUCT(r.out); - r.in.level = levels[i]; - torture_comment(tctx, "testing NetTransportEnum level %u\n", r.in.level); + transports.level = levels[i]; + switch (transports.level) { + case 0: + ZERO_STRUCT(ctr0); + transports.ctr.ctr0 = &ctr0; + break; + case 1: + ZERO_STRUCT(ctr1); + transports.ctr.ctr1 = &ctr1; + break; + } + torture_comment(tctx, "testing NetTransportEnum level %u\n", transports.level); status = dcerpc_srvsvc_NetTransportEnum(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetTransportEnum failed"); if (!W_ERROR_IS_OK(r.out.result)) { @@ -850,10 +1032,11 @@ static bool test_NetRemoteTOD(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetRemoteTOD r; + struct srvsvc_NetRemoteTODInfo *info = NULL; r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); + r.out.info = &info; - ZERO_STRUCT(r.out); torture_comment(tctx, "testing NetRemoteTOD\n"); status = dcerpc_srvsvc_NetRemoteTOD(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetRemoteTOD failed"); |