diff options
Diffstat (limited to 'source4')
-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 | 1540 | ||||
-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 |
10 files changed, 714 insertions, 1971 deletions
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 deleted file mode 100644 index 2d6242e6d1..0000000000 --- a/source4/librpc/idl/srvsvc.idl +++ /dev/null @@ -1,1540 +0,0 @@ -#include "idl_types.h" - -/* - srvsvc interface definitions -*/ -import "security.idl", "svcctl.idl"; - -[ uuid("4b324fc8-1670-01d3-1278-5a47bf6ee188"), - version(3.0), - endpoint("ncacn_np:[\\pipe\\srvsvc]", "ncacn_ip_tcp:", "ncalrpc:"), - pointer_default(unique), - helpstring("Server Service") -] interface srvsvc -{ - typedef bitmap svcctl_ServerType svcctl_ServerType; - typedef bitmap security_secinfo security_secinfo; - -/**************************/ -/* srvsvc_NetCharDev */ -/**************************/ - typedef struct { - [string,charset(UTF16)] uint16 *device; - } srvsvc_NetCharDevInfo0; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetCharDevInfo0 *array; - } srvsvc_NetCharDevCtr0; - - typedef struct { - [string,charset(UTF16)] uint16 *device; - uint32 status; - [string,charset(UTF16)] uint16 *user; - uint32 time; - } srvsvc_NetCharDevInfo1; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetCharDevInfo1 *array; - } srvsvc_NetCharDevCtr1; - - typedef union { - [case(0)] srvsvc_NetCharDevInfo0 *info0; - [case(1)] srvsvc_NetCharDevInfo1 *info1; - [default] ; - } srvsvc_NetCharDevInfo; - - typedef union { - [case(0)] srvsvc_NetCharDevCtr0 *ctr0; - [case(1)] srvsvc_NetCharDevCtr1 *ctr1; - [default] ; - } srvsvc_NetCharDevCtr; - - /******************/ - /* 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] uint32 max_buffer, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - - /******************/ - /* Function: 0x01 */ - WERROR srvsvc_NetCharDevGetInfo( - [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 - ); - - /******************/ - /* Function: 0x02 */ - WERROR srvsvc_NetCharDevControl( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 device_name[], - [in] uint32 opcode - ); - -/**************************/ -/* srvsvc_NetCharDevQ */ -/**************************/ - typedef struct { - [string,charset(UTF16)] uint16 *device; - } srvsvc_NetCharDevQInfo0; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetCharDevQInfo0 *array; - } srvsvc_NetCharDevQCtr0; - - typedef struct { - [string,charset(UTF16)] uint16 *device; - uint32 priority; - [string,charset(UTF16)] uint16 *devices; - uint32 users; - uint32 num_ahead; - } srvsvc_NetCharDevQInfo1; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetCharDevQInfo1 *array; - } srvsvc_NetCharDevQCtr1; - - typedef union { - [case(0)] srvsvc_NetCharDevQInfo0 *info0; - [case(1)] srvsvc_NetCharDevQInfo1 *info1; - [default] ; - } srvsvc_NetCharDevQInfo; - - typedef union { - [case(0)] srvsvc_NetCharDevQCtr0 *ctr0; - [case(1)] srvsvc_NetCharDevQCtr1 *ctr1; - [default] ; - } srvsvc_NetCharDevQCtr; - - /******************/ - /* 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] uint32 max_buffer, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - - /******************/ - /* Function: 0x04 */ - WERROR srvsvc_NetCharDevQGetInfo( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 queue_name[], - [in] [string,charset(UTF16)] uint16 user[], - [in] uint32 level, - [out,switch_is(level)] srvsvc_NetCharDevQInfo info - ); - - /******************/ - /* Function: 0x05 */ - WERROR srvsvc_NetCharDevQSetInfo( - [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, - [in,out,unique] uint32 *parm_error - ); - - /******************/ - /* Function: 0x06 */ - WERROR srvsvc_NetCharDevQPurge( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 queue_name[] - ); - - /******************/ - /* Function: 0x07 */ - WERROR srvsvc_NetCharDevQPurgeSelf( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 queue_name[], - [in] [string,charset(UTF16)] uint16 computer_name[] - ); - -/**************************/ -/* srvsvc_NetConn */ -/**************************/ - typedef struct { - uint32 conn_id; - } srvsvc_NetConnInfo0; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetConnInfo0 *array; - } srvsvc_NetConnCtr0; - - typedef struct { - uint32 conn_id; - uint32 conn_type; - uint32 num_open; - uint32 num_users; - uint32 conn_time; - [string,charset(UTF16)] uint16 *user; - [string,charset(UTF16)] uint16 *share; - } srvsvc_NetConnInfo1; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetConnInfo1 *array; - } srvsvc_NetConnCtr1; - - typedef union { - [case(0)] srvsvc_NetConnCtr0 *ctr0; - [case(1)] srvsvc_NetConnCtr1 *ctr1; - [default] ; - } srvsvc_NetConnCtr; - - typedef struct { - uint32 level; - [switch_is(level)] srvsvc_NetConnCtr ctr; - } srvsvc_NetConnInfoCtr; - - /******************/ - /* Function: 0x08 */ - 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] uint32 max_buffer, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - -/**************************/ -/* srvsvc_NetFile */ -/**************************/ - typedef struct { - uint32 fid; - } srvsvc_NetFileInfo2; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetFileInfo2 *array; - } srvsvc_NetFileCtr2; - - typedef struct { - uint32 fid; - uint32 permissions; - uint32 num_locks; - [string,charset(UTF16)] uint16 *path; - [string,charset(UTF16)] uint16 *user; - } srvsvc_NetFileInfo3; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetFileInfo3 *array; - } srvsvc_NetFileCtr3; - - typedef union { - [case(2)] srvsvc_NetFileInfo2 *info2; - [case(3)] srvsvc_NetFileInfo3 *info3; - [default] ; - } srvsvc_NetFileInfo; - - typedef union { - [case(2)] srvsvc_NetFileCtr2 *ctr2; - [case(3)] srvsvc_NetFileCtr3 *ctr3; - [default] ; - } srvsvc_NetFileCtr; - - typedef struct { - uint32 level; - [switch_is(level)] srvsvc_NetFileCtr ctr; - } srvsvc_NetFileInfoCtr; - - /******************/ - /* Function: 0x09 */ - WERROR srvsvc_NetFileEnum( - [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] uint32 max_buffer, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - - /******************/ - /* Function: 0x0a */ - WERROR srvsvc_NetFileGetInfo( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 fid, - [in] uint32 level, - [out,switch_is(level)] srvsvc_NetFileInfo info - ); - - /******************/ - /* Function: 0x0b */ - WERROR srvsvc_NetFileClose( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 fid - ); - -/**************************/ -/* srvsvc_NetSess */ -/**************************/ - typedef struct { - [string,charset(UTF16)] uint16 *client; - } srvsvc_NetSessInfo0; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetSessInfo0 *array; - } srvsvc_NetSessCtr0; - - typedef struct { - [string,charset(UTF16)] uint16 *client; - [string,charset(UTF16)] uint16 *user; - uint32 num_open; - uint32 time; - uint32 idle_time; - uint32 user_flags; - } srvsvc_NetSessInfo1; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetSessInfo1 *array; - } srvsvc_NetSessCtr1; - - typedef struct { - [string,charset(UTF16)] uint16 *client; - [string,charset(UTF16)] uint16 *user; - uint32 num_open; - uint32 time; - uint32 idle_time; - uint32 user_flags; - [string,charset(UTF16)] uint16 *client_type; - } srvsvc_NetSessInfo2; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetSessInfo2 *array; - } srvsvc_NetSessCtr2; - - typedef struct { - [string,charset(UTF16)] uint16 *client; - [string,charset(UTF16)] uint16 *user; - uint32 time; - uint32 idle_time; - } srvsvc_NetSessInfo10; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetSessInfo10 *array; - } srvsvc_NetSessCtr10; - - typedef struct { - [string,charset(UTF16)] uint16 *client; - [string,charset(UTF16)] uint16 *user; - uint32 num_open; - uint32 time; - uint32 idle_time; - uint32 user_flags; - [string,charset(UTF16)] uint16 *client_type; - [string,charset(UTF16)] uint16 *transport; - } srvsvc_NetSessInfo502; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetSessInfo502 *array; - } srvsvc_NetSessCtr502; - - typedef union { - [case(0)] srvsvc_NetSessCtr0 *ctr0; - [case(1)] srvsvc_NetSessCtr1 *ctr1; - [case(2)] srvsvc_NetSessCtr2 *ctr2; - [case(10)] srvsvc_NetSessCtr10 *ctr10; - [case(502)] srvsvc_NetSessCtr502 *ctr502; - [default] ; - } srvsvc_NetSessCtr; - - /******************/ - /* Function: 0x0c */ - - typedef struct { - uint32 level; - [switch_is(level)] srvsvc_NetSessCtr ctr; - } srvsvc_NetSessInfoCtr; - - WERROR srvsvc_NetSessEnum( - [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] uint32 max_buffer, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - - /******************/ - /* Function: 0x0d */ - WERROR srvsvc_NetSessDel( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,unique] [string,charset(UTF16)] uint16 *client, - [in,unique] [string,charset(UTF16)] uint16 *user - ); - -/**************************/ -/* srvsvc_NetShare */ -/**************************/ - - /* share types */ - const uint32 STYPE_TEMPORARY = 0x40000000; /* share is a temporary one */ - const uint32 STYPE_HIDDEN = 0x80000000; /* share is a hidden one */ - - typedef [v1_enum, flag(NDR_PAHEX)] enum { - STYPE_DISKTREE = 0, - STYPE_DISKTREE_TEMPORARY = STYPE_DISKTREE|STYPE_TEMPORARY, - STYPE_DISKTREE_HIDDEN = STYPE_DISKTREE|STYPE_HIDDEN, - STYPE_PRINTQ = 1, - STYPE_PRINTQ_TEMPORARY = STYPE_PRINTQ|STYPE_TEMPORARY, - STYPE_PRINTQ_HIDDEN = STYPE_PRINTQ|STYPE_HIDDEN, - STYPE_DEVICE = 2, /* Serial device */ - STYPE_DEVICE_TEMPORARY = STYPE_DEVICE|STYPE_TEMPORARY, - STYPE_DEVICE_HIDDEN = STYPE_DEVICE|STYPE_HIDDEN, - STYPE_IPC = 3, /* Interprocess communication (IPC) */ - STYPE_IPC_TEMPORARY = STYPE_IPC|STYPE_TEMPORARY, - STYPE_IPC_HIDDEN = STYPE_IPC|STYPE_HIDDEN - } srvsvc_ShareType; - - typedef struct { - [string,charset(UTF16)] uint16 *name; - } srvsvc_NetShareInfo0; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo0 *array; - } srvsvc_NetShareCtr0; - - typedef struct { - [string,charset(UTF16)] uint16 *name; - srvsvc_ShareType type; - [string,charset(UTF16)] uint16 *comment; - } srvsvc_NetShareInfo1; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo1 *array; - } srvsvc_NetShareCtr1; - - typedef struct { - [string,charset(UTF16)] uint16 *name; - srvsvc_ShareType type; - [string,charset(UTF16)] uint16 *comment; - uint32 permissions; - uint32 max_users; - uint32 current_users; - [string,charset(UTF16)] uint16 *path; - [string,charset(UTF16)] uint16 *password; - } srvsvc_NetShareInfo2; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo2 *array; - } srvsvc_NetShareCtr2; - - typedef struct { - [string,charset(UTF16)] uint16 *name; - srvsvc_ShareType type; - [string,charset(UTF16)] uint16 *comment; - uint32 csc_policy; - } srvsvc_NetShareInfo501; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo501 *array; - } srvsvc_NetShareCtr501; - - typedef struct { - [string,charset(UTF16)] uint16 *name; - srvsvc_ShareType type; - [string,charset(UTF16)] uint16 *comment; - uint32 permissions; - int32 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; - } srvsvc_NetShareInfo502; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo502 *array; - } srvsvc_NetShareCtr502; - - typedef struct { - [string,charset(UTF16)] uint16 *comment; - } srvsvc_NetShareInfo1004; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo1004 *array; - } srvsvc_NetShareCtr1004; - - typedef bitmap { - 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; - - typedef struct { - NetShareInfo1005Flags dfs_flags; - } srvsvc_NetShareInfo1005; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo1005 *array; - } srvsvc_NetShareCtr1005; - - typedef struct { - int32 max_users; - } srvsvc_NetShareInfo1006; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo1006 *array; - } srvsvc_NetShareCtr1006; - - typedef struct { - uint32 flags; - [string,charset(UTF16)] uint16 *alternate_directory_name; - } srvsvc_NetShareInfo1007; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetShareInfo1007 *array; - } srvsvc_NetShareCtr1007; - - typedef struct { - uint32 count; - [size_is(count)] sec_desc_buf *array; - } srvsvc_NetShareCtr1501; - - typedef union { - [case(0)] srvsvc_NetShareInfo0 *info0; - [case(1)] srvsvc_NetShareInfo1 *info1; - [case(2)] srvsvc_NetShareInfo2 *info2; - [case(501)] srvsvc_NetShareInfo501 *info501; - [case(502)] srvsvc_NetShareInfo502 *info502; - [case(1004)] srvsvc_NetShareInfo1004 *info1004; - [case(1005)] srvsvc_NetShareInfo1005 *info1005; - [case(1006)] srvsvc_NetShareInfo1006 *info1006; - [case(1007)] srvsvc_NetShareInfo1007 *info1007; - [case(1501)] sec_desc_buf *info1501; - [default] ; - } srvsvc_NetShareInfo; - - typedef union { - [case(0)] srvsvc_NetShareCtr0 *ctr0; - [case(1)] srvsvc_NetShareCtr1 *ctr1; - [case(2)] srvsvc_NetShareCtr2 *ctr2; - [case(501)] srvsvc_NetShareCtr501 *ctr501; - [case(502)] srvsvc_NetShareCtr502 *ctr502; - [case(1004)] srvsvc_NetShareCtr1004 *ctr1004; - [case(1005)] srvsvc_NetShareCtr1005 *ctr1005; - [case(1006)] srvsvc_NetShareCtr1006 *ctr1006; - [case(1007)] srvsvc_NetShareCtr1007 *ctr1007; - [case(1501)] srvsvc_NetShareCtr1501 *ctr1501; - [default] ; - } srvsvc_NetShareCtr; - - typedef struct { - uint32 level; - [switch_is(level)] srvsvc_NetShareCtr ctr; - } srvsvc_NetShareInfoCtr; - - /******************/ - /* Function: 0x0e */ - WERROR srvsvc_NetShareAdd( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 level, - [in,switch_is(level)] srvsvc_NetShareInfo info, - [in,out,unique] uint32 *parm_error - ); - - /******************/ - /* 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] uint32 max_buffer, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - - /******************/ - /* Function: 0x10 */ - WERROR srvsvc_NetShareGetInfo( - [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 - ); - - /******************/ - /* Function: 0x11 */ - WERROR srvsvc_NetShareSetInfo( - [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,out,unique] uint32 *parm_error - ); - - /******************/ - /* Function: 0x12 */ - WERROR srvsvc_NetShareDel( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 share_name[], - [in] uint32 reserved - ); - - /******************/ - /* Function: 0x13 */ - WERROR srvsvc_NetShareDelSticky( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 share_name[], - [in] uint32 reserved - ); - - /******************/ - /* Function: 0x14 */ - WERROR srvsvc_NetShareCheck( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 device_name[], - [out] srvsvc_ShareType type - ); - -/**************************/ -/* srvsvc_NetSrv */ -/**************************/ - typedef [public,v1_enum] enum { - PLATFORM_ID_DOS = 300, - PLATFORM_ID_OS2 = 400, - PLATFORM_ID_NT = 500, - PLATFORM_ID_OSF = 600, - PLATFORM_ID_VMS = 700 - } srvsvc_PlatformId; - - typedef struct { - srvsvc_PlatformId platform_id; - [string,charset(UTF16)] uint16 *server_name; - } srvsvc_NetSrvInfo100; - - typedef struct { - srvsvc_PlatformId platform_id; - [string,charset(UTF16)] uint16 *server_name; - uint32 version_major; - uint32 version_minor; - svcctl_ServerType server_type; - [string,charset(UTF16)] uint16 *comment; - } srvsvc_NetSrvInfo101; - - typedef struct { - srvsvc_PlatformId platform_id; - [string,charset(UTF16)] uint16 *server_name; - uint32 version_major; - uint32 version_minor; - svcctl_ServerType server_type; - [string,charset(UTF16)] uint16 *comment; - uint32 users; - uint32 disc; - uint32 hidden; - uint32 announce; - uint32 anndelta; - uint32 licenses; - [string,charset(UTF16)] uint16 *userpath; - } srvsvc_NetSrvInfo102; - - typedef struct { - uint32 ulist_mtime; - uint32 glist_mtime; - uint32 alist_mtime; - [string,charset(UTF16)] uint16 *alerts; - uint32 security; - uint32 numadmin; - uint32 lanmask; - [string,charset(UTF16)] uint16 *guestaccount; - uint32 chdevs; - uint32 chdevqs; - uint32 chdevjobs; - uint32 connections; - uint32 shares; - uint32 openfiles; - uint32 sessopen; - uint32 sesssvc; - uint32 sessreqs; - uint32 opensearch; - uint32 activelocks; - uint32 sizereqbufs; - uint32 numbigbufs; - uint32 numfiletasks; - uint32 alertsched; - uint32 erroralert; - uint32 logonalert; - uint32 accessalert; - uint32 diskalert; - uint32 netioalert; - uint32 maxaudits; - [string,charset(UTF16)] uint16 *srvheuristics; - } srvsvc_NetSrvInfo402; - - typedef struct { - uint32 ulist_mtime; - uint32 glist_mtime; - uint32 alist_mtime; - [string,charset(UTF16)] uint16 *alerts; - uint32 security; - uint32 numadmin; - uint32 lanmask; - [string,charset(UTF16)] uint16 *guestaccount; - uint32 chdevs; - uint32 chdevqs; - uint32 chdevjobs; - uint32 connections; - uint32 shares; - uint32 openfiles; - uint32 sessopen; - uint32 sesssvc; - uint32 sessreqs; - uint32 opensearch; - uint32 activelocks; - uint32 sizereqbufs; - uint32 numbigbufs; - uint32 numfiletasks; - uint32 alertsched; - uint32 eroralert; - uint32 logonalert; - uint32 accessalert; - uint32 diskalert; - uint32 netioalert; - uint32 maxaudits; - [string,charset(UTF16)] uint16 *srvheuristics; - uint32 auditedevents; - uint32 auditprofile; - [string,charset(UTF16)] uint16 *autopath; - } srvsvc_NetSrvInfo403; - - typedef struct { - uint32 sessopen; - uint32 sesssvc; - uint32 opensearch; - uint32 sizereqbufs; - uint32 initworkitems; - uint32 maxworkitems; - uint32 rawworkitems; - uint32 irpstacksize; - uint32 maxrawbuflen; - uint32 sessusers; - uint32 sessconns; - uint32 maxpagedmemoryusage; - uint32 maxnonpagedmemoryusage; - uint32 enablesoftcompat; - uint32 enableforcedlogoff; - uint32 timesource; - uint32 acceptdownlevelapis; - uint32 lmannounce; - } srvsvc_NetSrvInfo502; - - typedef struct{ - uint32 sessopen; - uint32 sesssvc; - uint32 opensearch; - uint32 sizereqbufs; - uint32 initworkitems; - uint32 maxworkitems; - uint32 rawworkitems; - uint32 irpstacksize; - uint32 maxrawbuflen; - uint32 sessusers; - uint32 sessconns; - uint32 maxpagedmemoryusage; - uint32 maxnonpagedmemoryusage; - uint32 enablesoftcompat; - uint32 enableforcedlogoff; - uint32 timesource; - uint32 acceptdownlevelapis; - uint32 lmannounce; - [string,charset(UTF16)] uint16 *domain; - uint32 maxcopyreadlen; - uint32 maxcopywritelen; - uint32 minkeepsearch; - uint32 maxkeepsearch; - uint32 minkeepcomplsearch; - uint32 maxkeepcomplsearch; - uint32 threadcountadd; - uint32 numlockthreads; - uint32 scavtimeout; - uint32 minrcvqueue; - uint32 minfreeworkitems; - uint32 xactmemsize; - uint32 threadpriority; - uint32 maxmpxct; - uint32 oplockbreakwait; - uint32 oplockbreakresponsewait; - uint32 enableoplocks; - uint32 enableoplockforceclose; - uint32 enablefcbopens; - uint32 enableraw; - uint32 enablesharednetdrives; - uint32 minfreeconnections; - uint32 maxfreeconnections; - } srvsvc_NetSrvInfo503; - - typedef struct{ - uint32 sessopen; - uint32 sesssvc; - uint32 opensearch; - uint32 sizereqbufs; - uint32 initworkitems; - uint32 maxworkitems; - uint32 rawworkitems; - uint32 irpstacksize; - uint32 maxrawbuflen; - uint32 sessusers; - uint32 sessconns; - uint32 maxpagedmemoryusage; - uint32 maxnonpagedmemoryusage; - uint32 enablesoftcompat; - uint32 enableforcedlogoff; - uint32 timesource; - uint32 acceptdownlevelapis; - uint32 lmannounce; - [string,charset(UTF16)] uint16 *domain; - uint32 maxcopyreadlen; - uint32 maxcopywritelen; - uint32 minkeepsearch; - uint32 minkeepcomplsearch; - uint32 maxkeepcomplsearch; - uint32 threadcountadd; - uint32 numlockthreads; - uint32 scavtimeout; - uint32 minrcvqueue; - uint32 minfreeworkitems; - uint32 xactmemsize; - uint32 threadpriority; - uint32 maxmpxct; - uint32 oplockbreakwait; - uint32 oplockbreakresponsewait; - uint32 enableoplocks; - uint32 enableoplockforceclose; - uint32 enablefcbopens; - uint32 enableraw; - uint32 enablesharednetdrives; - uint32 minfreeconnections; - uint32 maxfreeconnections; - uint32 initsesstable; - uint32 initconntable; - uint32 initfiletable; - uint32 initsearchtable; - uint32 alertsched; - uint32 errortreshold; - uint32 networkerrortreshold; - uint32 diskspacetreshold; - uint32 reserved; - uint32 maxlinkdelay; - uint32 minlinkthroughput; - uint32 linkinfovalidtime; - uint32 scavqosinfoupdatetime; - uint32 maxworkitemidletime; - } srvsvc_NetSrvInfo599; - - typedef struct{ - [string,charset(UTF16)] uint16 *comment; - } srvsvc_NetSrvInfo1005; - - typedef struct{ - uint32 disc; - } srvsvc_NetSrvInfo1010; - - typedef struct{ - uint32 hidden; - } srvsvc_NetSrvInfo1016; - - typedef struct{ - uint32 announce; - } srvsvc_NetSrvInfo1017; - - typedef struct{ - uint32 anndelta; - } srvsvc_NetSrvInfo1018; - - typedef struct{ - uint32 users; - } srvsvc_NetSrvInfo1107; - - typedef struct{ - uint32 sessopens; - } srvsvc_NetSrvInfo1501; - - typedef struct{ - uint32 sessvcs; - } srvsvc_NetSrvInfo1502; - - typedef struct{ - uint32 opensearch; - } srvsvc_NetSrvInfo1503; - - typedef struct{ - uint32 maxworkitems; - } srvsvc_NetSrvInfo1506; - - typedef struct{ - uint32 maxrawbuflen; - } srvsvc_NetSrvInfo1509; - - typedef struct{ - uint32 sessusers; - } srvsvc_NetSrvInfo1510; - - typedef struct{ - uint32 sesscons; - } srvsvc_NetSrvInfo1511; - - typedef struct{ - uint32 maxnonpagedmemoryusage; - } srvsvc_NetSrvInfo1512; - - typedef struct{ - uint32 maxpagedmemoryusage; - } srvsvc_NetSrvInfo1513; - - typedef struct{ - uint32 enablesoftcompat; - } srvsvc_NetSrvInfo1514; - - typedef struct{ - uint32 enableforcedlogoff; - } srvsvc_NetSrvInfo1515; - - typedef struct{ - uint32 timesource; - } srvsvc_NetSrvInfo1516; - - typedef struct{ - uint32 lmannounce; - } srvsvc_NetSrvInfo1518; - - typedef struct{ - uint32 maxcopyreadlen; - } srvsvc_NetSrvInfo1520; - - typedef struct{ - uint32 maxcopywritelen; - } srvsvc_NetSrvInfo1521; - - typedef struct{ - uint32 minkeepsearch; - } srvsvc_NetSrvInfo1522; - - typedef struct{ - uint32 maxkeepsearch; - } srvsvc_NetSrvInfo1523; - - typedef struct{ - uint32 minkeepcomplsearch; - } srvsvc_NetSrvInfo1524; - - typedef struct{ - uint32 maxkeepcomplsearch; - } srvsvc_NetSrvInfo1525; - - typedef struct{ - uint32 scavtimeout; - } srvsvc_NetSrvInfo1528; - - typedef struct{ - uint32 minrcvqueue; - } srvsvc_NetSrvInfo1529; - - typedef struct{ - uint32 minfreeworkitems; - } srvsvc_NetSrvInfo1530; - - typedef struct{ - uint32 maxmpxct; - } srvsvc_NetSrvInfo1533; - - typedef struct{ - uint32 oplockbreakwait; - } srvsvc_NetSrvInfo1534; - - typedef struct{ - uint32 oplockbreakresponsewait; - } srvsvc_NetSrvInfo1535; - - typedef struct{ - uint32 enableoplocks; - } srvsvc_NetSrvInfo1536; - - typedef struct{ - uint32 enableoplockforceclose; - } srvsvc_NetSrvInfo1537; - - typedef struct{ - uint32 enablefcbopens; - } srvsvc_NetSrvInfo1538; - - typedef struct{ - uint32 enableraw; - } srvsvc_NetSrvInfo1539; - - typedef struct{ - uint32 enablesharednetdrives; - } srvsvc_NetSrvInfo1540; - - typedef struct{ - uint32 minfreeconnections; - } srvsvc_NetSrvInfo1541; - - typedef struct{ - uint32 maxfreeconnections; - } srvsvc_NetSrvInfo1542; - - typedef struct{ - uint32 initsesstable; - } srvsvc_NetSrvInfo1543; - - typedef struct{ - uint32 initconntable; - } srvsvc_NetSrvInfo1544; - - typedef struct{ - uint32 initfiletable; - } srvsvc_NetSrvInfo1545; - - typedef struct{ - uint32 initsearchtable; - } srvsvc_NetSrvInfo1546; - - typedef struct{ - uint32 alertsched; - } srvsvc_NetSrvInfo1547; - - typedef struct{ - uint32 errortreshold; - } srvsvc_NetSrvInfo1548; - - typedef struct{ - uint32 networkerrortreshold; - } srvsvc_NetSrvInfo1549; - - typedef struct{ - uint32 diskspacetreshold; - } srvsvc_NetSrvInfo1550; - - typedef struct{ - uint32 maxlinkdelay; - } srvsvc_NetSrvInfo1552; - - typedef struct{ - uint32 minlinkthroughput; - } srvsvc_NetSrvInfo1553; - - typedef struct{ - uint32 linkinfovalidtime; - } srvsvc_NetSrvInfo1554; - - typedef struct{ - uint32 scavqosinfoupdatetime; - } srvsvc_NetSrvInfo1555; - - typedef struct{ - uint32 maxworkitemidletime; - } srvsvc_NetSrvInfo1556; - - - typedef union{ - [case(100)] srvsvc_NetSrvInfo100 *info100; - [case(101)] srvsvc_NetSrvInfo101 *info101; - [case(102)] srvsvc_NetSrvInfo102 *info102; - [case(402)] srvsvc_NetSrvInfo402 *info402; - [case(403)] srvsvc_NetSrvInfo403 *info403; - [case(502)] srvsvc_NetSrvInfo502 *info502; - [case(503)] srvsvc_NetSrvInfo503 *info503; - [case(599)] srvsvc_NetSrvInfo599 *info599; - [case(1005)] srvsvc_NetSrvInfo1005 *info1005; - [case(1010)] srvsvc_NetSrvInfo1010 *info1010; - [case(1016)] srvsvc_NetSrvInfo1016 *info1016; - [case(1017)] srvsvc_NetSrvInfo1017 *info1017; - [case(1018)] srvsvc_NetSrvInfo1018 *info1018; - [case(1107)] srvsvc_NetSrvInfo1107 *info1107; - [case(1501)] srvsvc_NetSrvInfo1501 *info1501; - [case(1502)] srvsvc_NetSrvInfo1502 *info1502; - [case(1503)] srvsvc_NetSrvInfo1503 *info1503; - [case(1506)] srvsvc_NetSrvInfo1506 *info1506; - [case(1509)] srvsvc_NetSrvInfo1509 *info1509; - [case(1510)] srvsvc_NetSrvInfo1510 *info1510; - [case(1511)] srvsvc_NetSrvInfo1511 *info1511; - [case(1512)] srvsvc_NetSrvInfo1512 *info1512; - [case(1513)] srvsvc_NetSrvInfo1513 *info1513; - [case(1514)] srvsvc_NetSrvInfo1514 *info1514; - [case(1515)] srvsvc_NetSrvInfo1515 *info1515; - [case(1516)] srvsvc_NetSrvInfo1516 *info1516; - [case(1518)] srvsvc_NetSrvInfo1518 *info1518; - [case(1520)] srvsvc_NetSrvInfo1520 *info1520; - [case(1521)] srvsvc_NetSrvInfo1521 *info1521; - [case(1522)] srvsvc_NetSrvInfo1522 *info1522; - [case(1523)] srvsvc_NetSrvInfo1523 *info1523; - [case(1524)] srvsvc_NetSrvInfo1524 *info1524; - [case(1525)] srvsvc_NetSrvInfo1525 *info1525; - [case(1528)] srvsvc_NetSrvInfo1528 *info1528; - [case(1529)] srvsvc_NetSrvInfo1529 *info1529; - [case(1530)] srvsvc_NetSrvInfo1530 *info1530; - [case(1533)] srvsvc_NetSrvInfo1533 *info1533; - [case(1534)] srvsvc_NetSrvInfo1534 *info1534; - [case(1535)] srvsvc_NetSrvInfo1535 *info1535; - [case(1536)] srvsvc_NetSrvInfo1536 *info1536; - [case(1537)] srvsvc_NetSrvInfo1537 *info1537; - [case(1538)] srvsvc_NetSrvInfo1538 *info1538; - [case(1539)] srvsvc_NetSrvInfo1539 *info1539; - [case(1540)] srvsvc_NetSrvInfo1540 *info1540; - [case(1541)] srvsvc_NetSrvInfo1541 *info1541; - [case(1542)] srvsvc_NetSrvInfo1542 *info1542; - [case(1543)] srvsvc_NetSrvInfo1543 *info1543; - [case(1544)] srvsvc_NetSrvInfo1544 *info1544; - [case(1545)] srvsvc_NetSrvInfo1545 *info1545; - [case(1546)] srvsvc_NetSrvInfo1546 *info1546; - [case(1547)] srvsvc_NetSrvInfo1547 *info1547; - [case(1548)] srvsvc_NetSrvInfo1548 *info1548; - [case(1549)] srvsvc_NetSrvInfo1549 *info1549; - [case(1550)] srvsvc_NetSrvInfo1550 *info1550; - [case(1552)] srvsvc_NetSrvInfo1552 *info1552; - [case(1553)] srvsvc_NetSrvInfo1553 *info1553; - [case(1554)] srvsvc_NetSrvInfo1554 *info1554; - [case(1555)] srvsvc_NetSrvInfo1555 *info1555; - [case(1556)] srvsvc_NetSrvInfo1556 *info1556; - [default]; - } srvsvc_NetSrvInfo; - - /******************/ - /* Function: 0x15 */ - WERROR srvsvc_NetSrvGetInfo( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 level, - [out,switch_is(level)] srvsvc_NetSrvInfo info - ); - - /******************/ - /* Function: 0x16 */ - WERROR srvsvc_NetSrvSetInfo( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 level, - [in,switch_is(level)] srvsvc_NetSrvInfo info, - [in,out,unique] uint32 *parm_error - ); - -/**************************/ -/* srvsvc_NetDisk */ -/**************************/ - typedef struct { - /* - * 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 { - uint32 count; - [size_is(count), length_is(count)] srvsvc_NetDiskInfo0 *disks; - } srvsvc_NetDiskInfo; - - /******************/ - /* Function: 0x17 */ - WERROR srvsvc_NetDiskEnum( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 level, - [in,out] srvsvc_NetDiskInfo info, - [in] uint32 maxlen, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - -/**************************/ -/* srvsvc_NetStatistics */ -/**************************/ - typedef struct { - uint32 start; - uint32 fopens; - uint32 devopens; - uint32 jobsqueued; - uint32 sopens; - uint32 stimeouts; - uint32 serrorout; - uint32 pwerrors; - uint32 permerrors; - uint32 syserrors; - uint32 bytessent_low; - uint32 bytessent_high; - uint32 bytesrcvd_low; - uint32 bytesrcvd_high; - uint32 avresponse; - uint32 reqbufneed; - uint32 bigbufneed; - } srvsvc_Statistics; - - /******************/ - /* Function: 0x18 */ - WERROR srvsvc_NetServerStatisticsGet( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,unique] [string,charset(UTF16)] uint16 *service, - [in] uint32 level, - [in] uint32 options, - [out] srvsvc_Statistics stat - ); - -/**************************/ -/* srvsvc_NetTransport */ -/**************************/ - typedef struct { - uint32 vcs; - [string,charset(UTF16)] uint16 *name; - [size_is(addr_len)] uint8 *addr; - uint32 addr_len; - [string,charset(UTF16)] uint16 *net_addr; - } srvsvc_NetTransportInfo0; - - /******************/ - /* Function: 0x19 */ - WERROR srvsvc_NetTransportAdd( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 level, - [in,switch_is(level)] srvsvc_NetTransportInfo info - ); - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetTransportInfo0 *array; - } srvsvc_NetTransportCtr0; - - typedef struct { - uint32 vcs; - [string,charset(UTF16)] uint16 *name; - [size_is(addr_len)] uint8 *addr; - uint32 addr_len; - [string,charset(UTF16)] uint16 *net_addr; - [string,charset(UTF16)] uint16 *domain; - } srvsvc_NetTransportInfo1; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetTransportInfo1 *array; - } srvsvc_NetTransportCtr1; - - typedef struct { - uint32 vcs; - [string,charset(UTF16)] uint16 *name; - [size_is(addr_len)] uint8 *addr; - uint32 addr_len; - [string,charset(UTF16)] uint16 *net_addr; - [string,charset(UTF16)] uint16 *domain; - uint32 unknown; - } srvsvc_NetTransportInfo2; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetTransportInfo2 *array; - } srvsvc_NetTransportCtr2; - - typedef struct { - uint32 vcs; - [string,charset(UTF16)] uint16 *name; - [size_is(addr_len)] uint8 *addr; - uint32 addr_len; - [string,charset(UTF16)] uint16 *net_addr; - [string,charset(UTF16)] uint16 *domain; - uint32 unknown1; - uint32 unknown2; - uint8 unknown3[256]; - } srvsvc_NetTransportInfo3; - - typedef struct { - uint32 count; - [size_is(count)] srvsvc_NetTransportInfo3 *array; - } srvsvc_NetTransportCtr3; - - typedef union { - [case(0)] srvsvc_NetTransportCtr0 *ctr0; - [case(1)] srvsvc_NetTransportCtr1 *ctr1; - [case(2)] srvsvc_NetTransportCtr2 *ctr2; - [case(3)] srvsvc_NetTransportCtr3 *ctr3; - [default]; - } srvsvc_NetTransportCtr; - - /******************/ - /* 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] uint32 max_buffer, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - - /******************/ - /* Function: 0x1b */ - WERROR srvsvc_NetTransportDel( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 level, - [in,switch_is(level)] srvsvc_NetTransportInfo info - ); - -/**************************/ -/* srvsvc_NetRemoteTOD */ -/**************************/ - typedef struct { - uint32 elapsed; /* time(NULL) */ - uint32 msecs; /* milliseconds till system reboot (uptime) */ - uint32 hours; - uint32 mins; - uint32 secs; - uint32 hunds; - int32 timezone; /* in minutes */ - uint32 tinterval; /* clock tick interval in 0.0001 second units; 310 on windows */ - uint32 day; - uint32 month; - uint32 year; - uint32 weekday; - } srvsvc_NetRemoteTODInfo; - - /******************/ - /* Function: 0x1c */ - WERROR srvsvc_NetRemoteTOD( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [out,unique] srvsvc_NetRemoteTODInfo *info - ); - -/**************************/ -/* srvsvc_NetServiceBits */ -/**************************/ - /******************/ - /* Function: 0x1d */ - WERROR srvsvc_NetSetServiceBits( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,unique] [string,charset(UTF16)] uint16 *transport, - [in] uint32 servicebits, - [in] uint32 updateimmediately - ); - -/**************************/ -/* srvsvc_NetPath */ -/**************************/ - /******************/ - /* Function: 0x1e */ - WERROR srvsvc_NetPathType( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 path[], - [in] uint32 pathflags, - [out] uint32 pathtype - ); - - /******************/ - /* Function: 0x1f */ - WERROR srvsvc_NetPathCanonicalize( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 path[], - [out] [size_is(maxbuf)] uint8 can_path[], - [in] uint32 maxbuf, - [in] [string,charset(UTF16)] uint16 prefix[], - [in,out] uint32 pathtype, - [in] uint32 pathflags - ); - - /******************/ - /* Function: 0x20 */ - WERROR srvsvc_NetPathCompare( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 path1[], - [in] [string,charset(UTF16)] uint16 path2[], - [in] uint32 pathtype, - [in] uint32 pathflags - ); - -/**************************/ -/* srvsvc_NetName */ -/**************************/ - /******************/ - /* Function: 0x21 */ - WERROR srvsvc_NetNameValidate( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 name[], - [in] uint32 name_type, - [in] uint32 flags - ); - - /******************/ - /* Function: 0x22 */ - [todo] WERROR srvsvc_NETRPRNAMECANONICALIZE( - ); - - /******************/ - /* Function: 0x23 */ - WERROR srvsvc_NetPRNameCompare( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 name1[], - [in] [string,charset(UTF16)] uint16 name2[], - [in] uint32 name_type, - [in] uint32 flags - ); - -/**************************/ -/* srvsvc_NetShare ... */ -/**************************/ - /******************/ - /* Function: 0x24 */ - /* Note, there must be some way to return entries read vs - 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] uint32 max_buffer, - [out] uint32 totalentries, - [in,out,unique] uint32 *resume_handle - ); - - /******************/ - /* Function: 0x25 */ - WERROR srvsvc_NetShareDelStart( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] [string,charset(UTF16)] uint16 share[], - [in] uint32 reserved, - [out,unique] policy_handle *hnd - ); - - /******************/ - /* Function: 0x26 */ - WERROR srvsvc_NetShareDelCommit( - [in, out,unique] policy_handle *hnd - ); - - /******************/ - /* Function: 0x27 */ - WERROR srvsvc_NetGetFileSecurity( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,unique] [string,charset(UTF16)] uint16 *share, - [in] [string,charset(UTF16)] uint16 file[], - [in] security_secinfo securityinformation, - [out,unique] sec_desc_buf *sd_buf - ); - - /******************/ - /* Function: 0x28 */ - WERROR srvsvc_NetSetFileSecurity( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,unique] [string,charset(UTF16)] uint16 *share, - [in] [string,charset(UTF16)] uint16 file[], - [in] security_secinfo securityinformation, - [in] sec_desc_buf sd_buf - ); - - - - typedef [switch_type(uint32)] union { - [case(0)] srvsvc_NetTransportInfo0 info0; - [case(1)] srvsvc_NetTransportInfo1 info1; - [case(2)] srvsvc_NetTransportInfo2 info2; - [case(3)] srvsvc_NetTransportInfo3 info3; - } srvsvc_NetTransportInfo; - - /******************/ - /* Function: 0x29 */ - WERROR srvsvc_NetServerTransportAddEx( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in] uint32 level, - [in,switch_is(level)] srvsvc_NetTransportInfo info - ); - - /******************/ - /* Function: 0x2a */ - WERROR srvsvc_NetServerSetServiceBitsEx( - [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [in,unique] [string,charset(UTF16)] uint16 *emulated_server_unc, - [in,unique] [string,charset(UTF16)] uint16 *transport, - [in] uint32 servicebitsofinterest, - [in] uint32 servicebits, - [in] uint32 updateimmediately - ); - - /******************/ - /* Function: 0x2b */ - [todo] WERROR srvsvc_NETRDFSGETVERSION( - ); - - /******************/ - /* Function: 0x2c */ - [todo] WERROR srvsvc_NETRDFSCREATELOCALPARTITION( - ); - - /******************/ - /* Function: 0x2d */ - [todo] WERROR srvsvc_NETRDFSDELETELOCALPARTITION( - ); - - /******************/ - /* Function: 0x2e */ - [todo] WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE( - ); - - /******************/ - /* Function: 0x2f */ - [todo] WERROR srvsvc_NETRDFSSETSERVERINFO( - ); - - /******************/ - /* Function: 0x30 */ - [todo] WERROR srvsvc_NETRDFSCREATEEXITPOINT( - ); - - /******************/ - /* Function: 0x31 */ - [todo] WERROR srvsvc_NETRDFSDELETEEXITPOINT( - ); - - /******************/ - /* Function: 0x32 */ - [todo] WERROR srvsvc_NETRDFSMODIFYPREFIX( - ); - - /******************/ - /* Function: 0x33 */ - [todo] WERROR srvsvc_NETRDFSFIXLOCALVOLUME( - ); - - /******************/ - /* Function: 0x34 */ - [todo] WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO( - ); - - /******************/ - /* Function: 0x35 */ - [todo] WERROR srvsvc_NETRSERVERTRANSPORTDELEX( - ); -} 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"); |