srvsvc.ndl revision 3db3f65c6274eb042354801a308c8e9bc4994553
1N/A * The contents of this file are subject to the terms of the 1N/A * Common Development and Distribution License (the "License"). 1N/A * You may not use this file except in compliance with the License. 1N/A * See the License for the specific language governing permissions 1N/A * and limitations under the License. 1N/A * When distributing Covered Code, include this CDDL HEADER in each 1N/A * If applicable, add the following below this CDDL HEADER, with the 1N/A * fields enclosed by brackets "[]" replaced with your own identifying 1N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 1N/A * Use is subject to license terms. 1N/A * LanMan RPC (WKSSVC and SRVSVC) interface definitions. 1N/A * WARNING: The cpp(1) macros in this file are not understood by 1N/A * TYPE CONSTRUCTOR MACROS FOR INFORMATION RESULTS 1N/A **************************************************************** 1N/A * This is an explanation of the macros that follow this comment. 1N/A * The LANMAN API's look something like this: 1N/A * IN char * servername, 1N/A * IN char * XXX_name, 1N/A * OUT char ** bufptr); 1N/A * The bufptr is a pointer-to-pointer (**). The NetXXXGetInfo() function 1N/A * malloc()s memory, and sets *bufptr to the memory. The API's 1N/A * are undiscriminated about what bufptr really points to. 1N/A * However, for RPI (Remote Procedure Interface), this just won't fly. 1N/A * We have to know what the result data looks like in order to 1N/A * properly (un)marshall it. 1N/A * As best we can determine, the MSC developers use an RPI that looks 1N/A * like this (approximately in IDL): 1N/A * RemoteNetXXXGetInfo ( 1N/A * IN char * servername, 1N/A * IN char * XXX_name, 1N/A * OUT union switch(level) { 1N/A * case(1): XXX_INFO_1 * info1; 1N/A * case(2): XXX_INFO_2 * info2; 1N/A * The level guides the (un)marshalling as it follows the pointer. 1N/A * DCE(MS) IDL will automatically form a structure for the union 1N/A * which looks about like this (much as Sun/RPC does): 1N/A * XXX_INFO_1 *info1; 1N/A * XXX_INFO_2 *info2; 1N/A * This struct is not made visible to the application. It is purely 1N/A * an internal (automagic) thing. However, ndrgen does not do this. 1N/A * The ndrgen input MUST remain a valid C header file, and all 1N/A * struct and union declarations must be exact, and we (would) have 1N/A * to tediously code sequences like this (approximately NDL)): 1N/A * union XXXGetInfo_result_u { 1N/A * XXX_INFO_1 * info1; 1N/A * XXX_INFO_2 * info2; 1N/A * struct XXXGetInfo_result { 1N/A * union XXXGetInfo_result_u bufptr; 1N/A * struct XXXGetInfo_param { // still have to code this one 1N/A * [in] char * servername; 1N/A * [in] ushort level; 1N/A * [out] struct XXXGetInfo_result result; 1N/A * This is error prone and difficult to write, and more difficult 1N/A * and distracting to read. It is hard to pick through the 1N/A * necessary evils and see what's really going on. To mitigate 1N/A * the situation, we have a series of macros which generate 1N/A * the tedious code, and are easily recognized as supporting 1N/A * fluff rather than important structures: 1N/A * INFO1RES_DEFINITION(XXXGetInfo, 1N/A * INFO1RES_UNION_ENTRY(XXXGetInfo, 1) 1N/A * INFO1RES_UNION_ENTRY(XXXGetInfo, 2)) 1N/A * structt XXXGetInfo_param { // still have to code this one 1N/A * [in] char * servername; 1N/A * [in] ushort level; 1N/A * [out] struct XXXGetInfo_result result; 1N/A * The INFO1RES_DEFINITION macro defines two types: 1N/A * union ...__ru {...} 1N/A * struct ..._result { DWORD level; union ..._ru bufptr; } 1N/A * There is a similar macro, INFO1RESBUF_DEFINITION, which defines 1N/A * actual space rather than just pointers. It defines: 1N/A * union ...._rb {...} 1N/A * typedef union ..._rb ..._rb; 1N/A * Which is handy in functions because the initial coding sequence 1N/A * looks something like: 1N/A * XXXGetInfoParam (struct XXXGetInfo_param *param) { 1N/A * param->result.level = param->level; // for marshalling 1N/A * param->result.bufptr.nullptr = &rb; // anything fits 1N/A * There are two flavors of Info results. The first is the 1N/A * single XXX_INFO_x result, which the foregoing example 1N/A * uses. The second flavor is when there are multiple entries 1N/A * possible. Again, for the sake of guiding the marshalling, 1N/A * the RPIs use something accommodating: 1N/A * struct XXX_INFO_1_result { 1N/A * unsigned entriesread; 1N/A * [size_is(entriesread)] 1N/A * XXX_INFO_1 * table; 1N/A * union { XXX_INFO_1_result *info1; ...} 1N/A * Notice this is using XXX_INFO_1_result rather than just XXX_INFO_1. 1N/A * The requirements from this point are much like before. Because of 1N/A * the variable-length value, there is no realistic way to do something 1N/A * like INFO1RESBUF_DEFINITION. 1N/A * There are two sets of macros here. INFO1RES_xxx are for the 1N/A * single result case, and INFONRES_xxx for the multiple entry case. 1N/A * Type constructors for single-result case 1N/A * Type constructors for single-result buffering. 1N/A * Type constructors for multiple-result case 1N/A * This just makes things a little easier on the stub modules: 1N/A * XXXGetInfoParam (struct XXXGetInfo_param *param) { 1N/A * struct mslm_infonres infonres; 1N/A * infonres.entriesread = 0; 1N/A * infonres.entries = 0; 1N/A * param->result.level = param->level; // for marshalling 1N/A * param->result.bufptr.p = &infonres; 1N/A * SRVSVC - Server Service 1N/A/* Windows XP and Windows Server 2003 */ 1N/A *********************************************************************** 1N/A *********************************************************************** 1N/A * Level 0 connect information. 1N/A * Level 1 connect information. 1N/A *********************************************************************** 1N/A *********************************************************************** 1N/A *********************************************************************** 1N/A * Close files using a file id reported by NetFileEnum. 1N/A *********************************************************************** 1N/A *********************************************************************** 1N/A * NetShareGetInfo: netname is the name of a share. 1N/A * 1 Sets information about the shared resource: name, type 1N/A * of resource and a comment. 1N/A * 2 Sets information about the shared resource: name, type, 1N/A * permissions, password and number of connections. 1N/A * 501 Sets information about the shared resource: name, type 1N/A * of resource and a comment. 1N/A * 502 Sets information about the shared resource, including 1N/A * the name, type, permissions, number of connections etc. 1N/A * 1004 Specifies a comment for the shared resource. 1N/A * 1005 Specifies a set of flags describing the shared resource. 1N/A * 1006 Specifies the maximum number of concurrent connections 1N/A * that the shared resource can accommodate. 1N/A * 1501 Specifies the SECURITY_DESCRIPTOR for the share. 1N/A * Windows Me/98/95 supports level 50, which is similar to level 1. 1N/A * shi1005_flags: SHI1005_VALID_FLAGS_SET defines the set of flags that 1N/A * can be set with the NetShareSetInfo function. SHI1005_FLAGS_DFS and 1N/A * SHI1005_FLAGS_DFS_ROOT can only be returned, but not set. 1N/A * 0x01 SHI1005_FLAGS_DFS 1N/A * The specified share is present in a Dfs tree structure. 1N/A * This flag cannot be set with NetShareSetInfo. 1N/A * 0x02 SHI1005_FLAGS_DFS_ROOT 1N/A * The specified share is the root volume in a Dfs tree. 1N/A * This flag cannot be set with NetShareSetInfo. 1N/A * 0x30 CSC_MASK Client-side caching (CSC) state: 1N/A * 0x00 CSC_CACHE_MANUAL_REINT Automatic file-by-file 1N/A * reintegration not allowed. 1N/A * 0x10 CSC_CACHE_AUTO_REINT File-by-file reintegration allowed. 1N/A * 0x20 CSC_CACHE_VDO File opens do not need to be flowed. 1N/A * 0x30 CSC_CACHE_NONE CSC is disabled for this share. 1N/A * 0x0100 SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 1N/A * The specified share disallows exclusive file opens, 1N/A * where reads to an open file are disallowed. 1N/A * 0x0200 SHI1005_FLAGS_FORCE_SHARED_DELETE 1N/A * Shared files in the specified share can be forcibly deleted. 1N/A * 0x0400 SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 1N/A * Clients are allowed to cache the namespace of the share. 1N/A * 0x0800 SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 1N/A * The server will filter directory entries based on the access 1N/A * permissions of the client. This flag is only supported on 1N/A * servers running Windows Server 2003 SP1. 1N/A * Note: The access-based enumeration (ABE) flag may also 1N/A * appear as SHI1005_FLAGS_ENFORCE_NAMESPACE_ACCESS. 1N/A *********************************************************************** 1N/A *********************************************************************** 1N/A * NetShareSetInfo: netname is the name of a share. 1N/A * The levels and shi1005_flags are as described for NetShareGetInfo. 1N/A * Support for Access-based Enumeration (ABE) was added to Windows in 1N/A * Windows Server 2003 Service Pack 1. ABE filters directory contents 1N/A * (and other shared resources) returned via a share based on a user's 1N/A * access rights, i.e. a user would not see objects that are 1N/A * inaccessible to that user. ABE requests are made using info level 1N/A * 1005 with the value 0x0800 in the flags field (see NetShareGetInfo). 1N/A *********************************************************************** 1N/A * This should accept all the same levels as NetShareGetInfo 1N/A * but we always return ACCESS_DENIED for now. So there's no 1N/A * point in unmarshalling the share information. 1N/A * IN struct mlsm_NetShareGetInfoRes result; 1N/A *********************************************************************** 1N/A * The NetSessionEnum function provides information about sessions 1N/A * established on a server. 1N/A * Only members of the Administrators or Account Operators local groups 1N/A * can successfully execute the NetSessionEnum function at level 1 or 1N/A * level 2. No special group membership is required for level 0 or level 1N/A * Windows NT/2000/XP: The parameter order is as follows. 1N/A * NET_API_STATUS NetSessionEnum(LPWSTR servername, 1N/A * LPWSTR UncClientName, 1N/A * LPDWORD entriesread, 1N/A * LPDWORD totalentries, 1N/A * LPDWORD resume_handle); 1N/A * Windows 95/98/Me: The calling application must use the cbBuffer parameter 1N/A * to specify the size, in bytes, of the information buffer pointed to by the 1N/A * pbBuffer parameter. (The cbBuffer parameter replaces the prefmaxlen 1N/A * parameter.) Neither a user name parameter nor a resume handle parameter is 1N/A * available on this platform. Therefore, the parameter list is as follows. 1N/A * API_FUNCTION NetSessionEnum(const char FAR *pszServer, 1N/A * char FAR *pbBuffer, 1N/A * unsigned short cbBuffer, 1N/A * unsigned short FAR *pcEntriesRead, 1N/A * unsigned short FAR *pcTotalAvail); 1N/A * [in] Pointer to a string that specifies the DNS or NetBIOS name of the 1N/A * remote server on which the function is to execute. If this parameter is 1N/A * NULL, the local computer is used. 1N/A * Windows NT 4.0 and earlier: This string must begin with \\. 1N/A * [in] Pointer to a string that specifies the name of the computer session 1N/A * for which information is to be returned. If this parameter is NULL, 1N/A * NetSessionEnum returns information for all computer sessions on the server. 1N/A * [in] Pointer to a string that specifies the name of the user for which 1N/A * information is to be returned. If this parameter is NULL, NetSessionEnum 1N/A * returns information for all users. 1N/A * [in] Specifies the information level of the data. This parameter can be 1N/A * one of the following values. 1N/A * Windows NT/2000/XP: The following levels are valid. 1N/A * 0 Return the name of the computer that established the session. 1N/A * The bufptr parameter points to an array of SESSION_INFO_0 1N/A * 1 Return the name of the computer, name of the user, and open files, 1N/A * pipes, and devices on the computer. The bufptr parameter points to 1N/A * an array of SESSION_INFO_1 structures. 1N/A * 2 In addition to the information indicated for level 1, return the 1N/A * type of client and how the user established the session. The bufptr 1N/A * parameter points to an array of SESSION_INFO_2 structures. 1N/A * 10 Return the name of the computer, name of the user, and active and 1N/A * idle times for the session. The bufptr parameter points to an array 1N/A * of SESSION_INFO_10 structures. 1N/A * 502 Return the name of the computer; name of the user; open files, 1N/A * pipes, and devices on the computer; and the name of the transport 1N/A * the client is using. The bufptr parameter points to an array of 1N/A * SESSION_INFO_502 structures. 1N/A * Windows 95/98/Me: The following level is valid. 1N/A * 50 Return the name of the computer, name of the user, open files on 1N/A * the computer, and the name of the transport protocol the client is 1N/A * using. The pbBuffer parameter points to an array of session_info_50 1N/A * [out] Pointer to the buffer that receives the data. The format of this 1N/A * data depends on the value of the level parameter. 1N/A * Windows NT/2000/XP: This buffer is allocated by the system and must be 1N/A * freed using the NetApiBufferFree function. Note that you must free the 1N/A * buffer even if the function fails with ERROR_MORE_DATA. 1N/A * Windows 95/98/Me: The caller must allocate and deallocate this buffer. 1N/A * [in] Specifies the preferred maximum length of returned data, in bytes. 1N/A * If you specify MAX_PREFERRED_LENGTH, the function allocates the amount 1N/A * of memory required for the data. If you specify another value in this 1N/A * parameter, it can restrict the number of bytes that the function returns. 1N/A * If the buffer size is insufficient to hold all entries, the function 1N/A * returns ERROR_MORE_DATA. For more information, see Network Management 1N/A * Function Buffers and Network Management Function Buffer Lengths. 1N/A * [out] Pointer to a value that receives the count of elements actually 1N/A * [out] Pointer to a value that receives the total number of entries that 1N/A * could have been enumerated from the current resume position. 1N/A * [in/out] Pointer to a value that contains a resume handle which is used 1N/A * to continue an existing session search. The handle should be zero on the 1N/A * first call and left unchanged for subsequent calls. If resume_handle is 1N/A * NULL, no resume handle is stored. 1N/A * The SESSION_INFO_1 structure contains information about the session, 1N/A * including name of the computer; name of the user; and open files, pipes, 1N/A * and devices on the computer. 1N/A * Pointer to a Unicode string specifying the name of the computer that 1N/A * established the session. 1N/A * Pointer to a Unicode string specifying the name of the user who established 1N/A * Specifies a DWORD value that contains the number of files, devices, 1N/A * and pipes opened during the session. 1N/A * Specifies a DWORD value that contains the number of seconds the session 1N/A * Specifies a DWORD value that contains the number of seconds the session 1N/A * Specifies a DWORD value that describes how the user established the 1N/A * session. This member can be one of the following values: 1N/A * SESS_GUEST The user specified by the sesi1_username member 1N/A * established the session using a guest account. 1N/A * SESS_NOENCRYPTION The user specified by the sesi1_username member 1N/A * established the session without using password 1N/A *********************************************************************** 1N/A *********************************************************************** 1N/A * NetSessionDel (Platform SDK: Network Management) 1N/A * The NetSessionDel function ends a network session between a server 1N/A * and a workstation. 1N/A * Security Requirements 1N/A * Only members of the Administrators or Account Operators local group 1N/A * can successfully execute the NetSessionDel function. 1N/A * Windows NT/2000/XP: The parameter order is as follows. 1N/A * NET_API_STATUS NetSessionDel(LPWSTR servername, 1N/A * LPWSTR UncClientName, 1N/A * Windows 95/98/Me: The sReserved parameter replaces the username 1N/A * parameter. For more information, see the following Remarks section. 1N/A * The parameter list is as follows. 1N/A * API_FUNCTION NetSessionDel(const char FAR *pszServer, 1N/A * const char FAR *pszClientName, 1N/A * [in] Pointer to a string that specifies the DNS or NetBIOS name 1N/A * of the remote server on which the function is to execute. If this 1N/A * parameter is NULL, the local computer is used. 1N/A * Windows NT 4.0 and earlier: This string must begin with \\. 1N/A * [in] Pointer to a string that specifies the computer name of the 1N/A * client to disconnect. If UncClientName is NULL, then all the sessions 1N/A * of the user identified by the username parameter will be deleted on 1N/A * the server specified by servername. For more information, see 1N/A * [in] Pointer to a string that specifies the name of the user whose 1N/A * session is to be terminated. If this parameter is NULL, all users' 1N/A * sessions from the client specified by the UncClientName parameter 1N/A * are to be terminated. 1N/A * Windows 95/98/Me: You must specify the session key in the sReserved 1N/A * parameter when you call NetSessionDel. The session key is returned by 1N/A * the NetSessionEnum function or the NetSessionGetInfo function in the 1N/A * sesi50_key member of the session_info_50 structure. 1N/A *********************************************************************** 1N/A * SRVSVC NetServerGetInfo ( 1N/A * IN LPTSTR servername, 1N/A * OUT union switch(level) { 1N/A * case 100: _SERVER_INFO_100 * p100; 1N/A * case 101: _SERVER_INFO_101 * p101; 1N/A * case 102: _SERVER_INFO_102 * p102; 1N/A/* for svX_platform */ 1N/A/* Bit-mapped values for svX_type fields */ 1N/A * alternate transport */ 1N/A/* NT-Server 4.0 sends 0x0006_120B */ 1N/A/* NT-workstation 4.0 send 0x0004_1013 */ 1N/A/* Special value for sv102_disc that specifies infinite disconnect time */ 1N/A/* Values of svX_security field */ 1N/A/* Values of svX_hidden field */ 1N/A/* Let's get some info already */ 1N/A * SRVSVC NetRemoteTOD ( 1N/A * IN LPTSTR servername, 1N/A * OUT _TIME_OF_DAY_INFO *bufptr, 1N/A * SRVSVC NetShareEnum ( 1N/A * IN LPTSTR servername, 1N/A * OUT union switch(level) { 1N/A * DWORD entriesread; 1N/A * [size_is(entriesread)] 1N/A * _SHARE_INFO_0 *entries; 1N/A * DWORD entriesread; 1N/A * [size_is(entriesread)] 1N/A * _SHARE_INFO_1 *entries; 1N/A * IN DWORD prefmaxlen, 1N/A * OUT DWORD totalentries, 1N/A * IN OUT DWORD ?* resume_handle, 1N/A * Share types for shiX_type fields - duplicated from cifs.h 1N/A/* Maximum uses for shiX_max_uses fields */ 1N/A * shi501_flags must be zero. 1N/A * Note: shi502_security_descriptor should be a pointer to a 1N/A * security descriptor (W32SEC_SECURITY_DESCRIPTOR): 1N/A * PSECURITY_DESCRIPTOR shi502_security_descriptor; 1N/A * For now use a DWORD and set it to zero. 1N/A * NetShareEnum: enumerate all shares (see also NetShareEnumSticky). 1N/A * Note: the server should ignore the content of servername. 1N/A * Delete a share. The reserved field appears in netmon 1N/A * but I've left it out in case it's not always present. 1N/A * This won't affect RPC processing. 1N/A /* IN DWORD reserved; */ 1N/A * NetShareEnumSticky is the same as NetShareEnum except that 1N/A * STYPE_SPECIAL (hidden or special) shares are not returned. 1N/A * Note: the server should ignore the content of servername. 1N/A * When you install Windows NT Server Tools on a Win95 client, 1N/A * Within this security tab, when you try to get/set permissions on a 1N/A * Right now, we can't send back SD of the requested object 1N/A * in MLRPC code, so we just reply with access denied error 1N/A * code. Thus, this output declaration is only valid in this 1N/A * case i.e., it's not complete. 1N/A * A Length (equal to the prev length) 1N/A * This is the request: 1N/A * R_SRVSVC: RPC Client call srvsvc:NetrpSetFileSecurity(..) 1N/A * R_SRVSVC: SRVSVC_HANDLE ServerName = \\WK76-177 1N/A * R_SRVSVC: LPWSTR ShareName = AFSHIN 1N/A * R_SRVSVC: SECURITY_INFORMATION SecurityInformation = 4 (0x4) 1N/A * -R_SRVSVC: PADT_SECURITY_DESCRIPTOR SecurityDescriptor {..} 1N/A * R_SRVSVC: DWORD Length = 64 (0x40) 1N/A * R_SRVSVC: LPBYTE Buffer = 4496048 (0x449AB0) 1N/A * R_SRVSVC: LPBYTE Buffer [..] = 01 00 04 80 00 00 00 00 00 00 00 00 00 00 00 1N/A * 000000A0 00 83 46 00 0B 00 00 00 00 00 00 00 0B 00 ..F........... 1N/A * 000000B0 00 00 5C 00 5C 00 57 00 4B 00 37 00 36 00 2D 00 ..\.\.W.K.7.6.-. 1N/A * 000000C0 31 00 37 00 37 00 00 00 08 00 16 83 46 00 07 00 1.7.7.......F... 1N/A * 000000D0 00 00 00 00 00 00 07 00 00 00 41 00 46 00 53 00 ..........A.F.S. 1N/A * 000000E0 48 00 49 00 4E 00 00 00 00 00 0B 00 00 00 00 00 H.I.N........... 1N/A * 000000F0 00 00 0B 00 00 00 5C 00 73 00 61 00 6C 00 65 00 ......\.s.a.l.e. 1N/A * 00000100 6B 00 2E 00 74 00 78 00 74 00 00 00 00 00 04 00 k...t.x.t....... 1N/A * 00000110 00 00 40 00 00 00 B0 9A 44 00 40 00 00 00 01 00 ..@.....D.@..... 1N/A * 00000120 04 80 00 00 00 00 00 00 00 00 00 00 00 00 14 00 ................ 1N/A * 00000130 00 00 02 00 2C 00 01 00 00 00 00 00 24 00 00 00 ....,.......$... 1N/A * 00000140 00 A0 01 05 00 00 00 00 00 05 15 00 00 00 1A 24 ...............$ 1N/A * 00000150 44 38 90 00 0F 02 65 3A BE 4C FF 03 00 00 00 00 D8....e:.L...... 1N/A * 00000160 00 00 00 00 00 00 00 00 00 00 .......... 1N/A * IN Security Descriptor (looks like): 1N/A * Length2 (== Length1) 1N/A * The SRVSVC already 1N/A * WKSSVC - Workstation Service 1N/A/* Windows XP and Windows Server 2003 */ 1N/A/* NetWkstaGetInfo only. System information - user access */ 1N/A/* NetWkstaGetInfo only. System information - admin or operator access */ *********************************************************************** *********************************************************************** #
endif /* _MLSVC_LANMAN_NDL_ */