1998-03-12 00:11:04 +03:00
/*
2002-01-30 09:08:46 +03:00
Unix SMB / CIFS implementation .
2005-03-24 02:26:33 +03:00
2005-04-06 07:08:25 +04:00
Copyright ( C ) Andrew Tridgell 1992 - 1997
Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1997
Copyright ( C ) Paul Ashton 1997
Copyright ( C ) Gerald ( Jerry ) Carter 2005
1998-03-12 00:11:04 +03:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
# ifndef _RPC_MISC_H /* _RPC_MISC_H */
# define _RPC_MISC_H
2003-04-28 21:48:48 +04:00
# define SMB_RPC_INTERFACE_VERSION 1
2005-03-24 02:26:33 +03:00
# define PRS_POINTER_CAST BOOL (*)(const char*, prs_struct*, int, void*)
2005-10-06 21:48:03 +04:00
enum unistr2_term_codes { UNI_FLAGS_NONE = 0 , UNI_STR_TERMINATE = 1 , UNI_MAXLEN_TERMINATE = 2 , UNI_BROKEN_NON_NULL = 3 , UNI_STR_DBLTERMINATE = 4 } ;
2005-04-06 07:08:25 +04:00
2005-03-24 02:26:33 +03:00
2005-04-06 07:08:25 +04:00
/**********************************************************************
* well - known RIDs - Relative IDs
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-03-12 00:11:04 +03:00
/* RIDs - Well-known users ... */
# define DOMAIN_USER_RID_ADMIN (0x000001F4L)
# define DOMAIN_USER_RID_GUEST (0x000001F5L)
2002-03-19 16:57:53 +03:00
# define DOMAIN_USER_RID_KRBTGT (0x000001F6L)
1998-03-12 00:11:04 +03:00
/* RIDs - well-known groups ... */
# define DOMAIN_GROUP_RID_ADMINS (0x00000200L)
# define DOMAIN_GROUP_RID_USERS (0x00000201L)
# define DOMAIN_GROUP_RID_GUESTS (0x00000202L)
2002-03-19 16:57:53 +03:00
# define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L)
# define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L)
# define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L)
# define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L)
# define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L)
/* is the following the right number? I bet it is --simo
# define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L)
*/
1998-03-12 00:11:04 +03:00
/* RIDs - well-known aliases ... */
1998-06-09 06:26:26 +04:00
# define BUILTIN_ALIAS_RID_ADMINS (0x00000220L)
# define BUILTIN_ALIAS_RID_USERS (0x00000221L)
# define BUILTIN_ALIAS_RID_GUESTS (0x00000222L)
# define BUILTIN_ALIAS_RID_POWER_USERS (0x00000223L)
1999-12-13 16:27:58 +03:00
1998-06-09 06:26:26 +04:00
# define BUILTIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L)
# define BUILTIN_ALIAS_RID_SYSTEM_OPS (0x00000225L)
# define BUILTIN_ALIAS_RID_PRINT_OPS (0x00000226L)
# define BUILTIN_ALIAS_RID_BACKUP_OPS (0x00000227L)
1999-12-13 16:27:58 +03:00
1998-06-09 06:26:26 +04:00
# define BUILTIN_ALIAS_RID_REPLICATOR (0x00000228L)
2002-03-19 16:57:53 +03:00
# define BUILTIN_ALIAS_RID_RAS_SERVERS (0x00000229L)
2003-12-23 00:48:06 +03:00
# define BUILTIN_ALIAS_RID_PRE_2K_ACCESS (0x0000022aL)
1998-03-12 00:11:04 +03:00
2005-04-06 07:08:25 +04:00
/**********************************************************************
1998-06-01 22:50:27 +04:00
* Masks for mappings between unix uid and gid types and
* NT RIDS .
2005-04-06 07:08:25 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2002-03-19 16:57:53 +03:00
# define BASE_RID (0x000003E8L)
1999-12-13 16:27:58 +03:00
/* Take the bottom bit. */
2005-04-06 07:08:25 +04:00
# define RID_TYPE_MASK 1
# define RID_MULTIPLIER 2
1999-04-08 09:35:53 +04:00
1999-12-13 16:27:58 +03:00
/* The two common types. */
2005-04-06 07:08:25 +04:00
# define USER_RID_TYPE 0
# define GROUP_RID_TYPE 1
1999-04-08 09:35:53 +04:00
2005-04-06 07:08:25 +04:00
/**********************************************************************
* RPC policy handle used pretty much everywhere
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2006-09-12 02:02:34 +04:00
typedef struct policy_handle POLICY_HND ;
1998-03-12 00:11:04 +03:00
2006-09-12 02:02:34 +04:00
# define OUR_HANDLE(hnd) (((hnd)==NULL) ? "NULL" :\
( IVAL ( ( hnd ) - > uuid . node , 2 ) = = ( uint32 ) sys_getpid ( ) ? " OURS " : \
" OTHER " ) ) , ( ( unsigned int ) IVAL ( ( hnd ) - > uuid . node , 2 ) ) , \
( ( unsigned int ) sys_getpid ( ) )
2005-04-06 07:08:25 +04:00
/**********************************************************************
* Buffer Headers - - use by SEC_DESC_BUF in winreg and netlogon code
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-05-31 17:46:45 +04:00
/* TODO: replace this with an encompassing buffer structure */
2005-04-06 07:08:25 +04:00
typedef struct {
2003-09-23 02:08:53 +04:00
uint32 buf_max_len ;
uint32 buf_len ;
1998-11-10 22:05:00 +03:00
} BUFHDR ;
2005-05-31 17:46:45 +04:00
/* this is a BUFHDR + a pointer to a buffer */
2005-04-06 07:08:25 +04:00
typedef struct {
uint32 info_level ;
uint32 length ; /* uint8 chars */
uint32 buffer ;
} BUFHDR2 ;
2005-05-31 17:46:45 +04:00
/* generic buffer ? wrapped around void*? */
2005-04-06 07:08:25 +04:00
typedef struct {
uint32 size ;
uint32 buffer ;
} BUFHDR4 ;
/**********************************************************************
2005-04-07 08:58:38 +04:00
* Buffers
2005-04-06 07:08:25 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-04-07 08:58:38 +04:00
/* buffer used by \winreg\ calls to fill in arbitrary REG_XXX values.
It * may * look like a UNISTR2 but it is * not * . This is not a goof
2005-05-31 17:46:45 +04:00
by the winreg developers . It is a generic buffer . buffer length
is stored in bytes ( not # of uint16 ' s ) */
2005-03-24 02:26:33 +03:00
typedef struct {
2003-09-23 02:08:53 +04:00
uint32 buf_max_len ;
2003-09-26 01:26:16 +04:00
uint32 offset ;
2003-09-23 02:08:53 +04:00
uint32 buf_len ;
uint16 * buffer ;
2005-03-24 02:26:33 +03:00
} REGVAL_BUFFER ;
1998-11-10 22:05:00 +03:00
2005-04-07 08:58:38 +04:00
/* generic rpc version of the DATA_BLOB. Just a length and uint8 array */
2005-04-06 07:08:25 +04:00
typedef struct {
2003-09-23 02:08:53 +04:00
uint32 buf_len ;
2005-04-07 08:58:38 +04:00
uint8 * buffer ;
} RPC_DATA_BLOB ;
2005-04-06 07:08:25 +04:00
/**********************************************************************
2005-04-07 08:58:38 +04:00
* Buffers use by spoolss ( i might be able to replace it with
* an RPC_DATA_BLOB )
2005-04-06 07:08:25 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
typedef struct {
uint32 buf_len ;
2005-04-07 08:58:38 +04:00
uint16 * buffer ; /* data */
} BUFFER5 ;
2005-04-06 07:08:25 +04:00
/**********************************************************************
* Unicode and basic string headers
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
typedef struct {
uint16 str_str_len ;
uint16 str_max_len ;
uint32 buffer ; /* non-zero */
} STRHDR ;
typedef struct {
uint16 uni_str_len ;
uint16 uni_max_len ;
uint32 buffer ;
} UNIHDR ;
/**********************************************************************
* UNICODE string variations
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
typedef struct { /* UNISTR - unicode string size and buffer */
uint16 * buffer ; /* unicode characters. ***MUST*** be
little - endian . * * * MUST * * * be null - terminated */
} UNISTR ;
typedef struct { /* UNISTR2 - unicode string size (in
uint16 unicode chars ) and buffer */
2003-09-23 02:08:53 +04:00
uint32 uni_max_len ;
2003-09-26 01:26:16 +04:00
uint32 offset ;
2003-09-23 02:08:53 +04:00
uint32 uni_str_len ;
2005-04-06 07:08:25 +04:00
uint16 * buffer ; /* unicode characters. ***MUST*** be little-endian.
* * must * * be null - terminated and the uni_str_len
should include the NULL character */
1998-03-12 00:11:04 +03:00
} UNISTR2 ;
2005-05-31 17:46:45 +04:00
/* i think this is the same as a BUFFER5 used in the spoolss code --jerry */
/* not sure about how the termination matches between the uint16 buffers thought */
2005-04-06 07:08:25 +04:00
typedef struct { /* UNISTR3 - XXXX not sure about this structure */
1998-11-10 22:05:00 +03:00
uint32 uni_str_len ;
UNISTR str ;
} UNISTR3 ;
2005-04-07 02:27:55 +04:00
typedef struct { /* Buffer wrapped around a UNISTR2 */
2005-04-06 07:08:25 +04:00
uint16 length ; /* number of bytes not counting NULL terminatation */
uint16 size ; /* number of bytes including NULL terminatation */
2005-03-26 09:52:56 +03:00
UNISTR2 * string ;
} UNISTR4 ;
typedef struct {
2003-01-15 20:22:48 +03:00
uint32 count ;
2005-03-26 09:52:56 +03:00
UNISTR4 * strings ;
} UNISTR4_ARRAY ;
1998-03-12 00:11:04 +03:00
2003-05-12 22:12:31 +04:00
2005-04-06 07:08:25 +04:00
/**********************************************************************
* String variations
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
typedef struct { /* STRING2 - string size (in uint8 chars) and buffer */
uint32 str_max_len ;
uint32 offset ;
uint32 str_str_len ;
uint8 * buffer ; /* uint8 characters. **NOT** necessarily null-terminated */
} STRING2 ;
2003-05-12 22:12:31 +04:00
2005-04-06 07:08:25 +04:00
/**********************************************************************
* Domain SID structures
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
typedef struct {
uint32 num_auths ; /* length, bytes, including length of len :-) */
DOM_SID sid ;
} DOM_SID2 ;
/**********************************************************************
* Domain SID structures
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2003-05-12 22:12:31 +04:00
2006-02-11 05:46:41 +03:00
/* DOM_RID - domain RID structure for ntlsa pipe */
2005-04-06 07:08:25 +04:00
typedef struct {
2006-03-03 02:32:44 +03:00
uint16 type ; /* value is SID_NAME_USE enum */
1998-11-25 22:57:04 +03:00
uint32 rid ;
uint32 rid_idx ; /* referenced domain index */
2006-02-11 05:46:41 +03:00
} DOM_RID ;
1998-03-12 00:11:04 +03:00
2006-02-11 05:46:41 +03:00
/* DOM_RID2 - second domain RID structure for ntlsa pipe */
typedef struct {
2006-03-03 02:32:44 +03:00
uint16 type ; /* value is SID_NAME_USE enum */
2006-02-11 05:46:41 +03:00
uint32 rid ;
uint32 rid_idx ; /* referenced domain index */
uint32 unknown ;
} DOM_RID2 ;
2005-04-06 07:08:25 +04:00
typedef struct { /* DOM_RID3 - domain RID structure for samr pipe */
1998-11-25 22:57:04 +03:00
uint32 rid ; /* domain-relative (to a SID) id */
uint32 type1 ; /* value is 0x1 */
uint32 ptr_type ; /* undocumented pointer */
uint32 type2 ; /* value is 0x1 */
1998-12-02 04:13:02 +03:00
uint32 unk ; /* value is 0x2 */
1998-03-12 00:11:04 +03:00
} DOM_RID3 ;
1999-12-13 16:27:58 +03:00
/* DOM_RID4 - rid + user attributes */
typedef struct domrid4_info
{
2003-09-23 02:08:53 +04:00
uint32 unknown ;
uint16 attr ;
uint32 rid ; /* user RID */
1999-12-13 16:27:58 +03:00
} DOM_RID4 ;
2005-04-06 07:08:25 +04:00
/* DOM_GID - group id + user attributes */
typedef struct {
uint32 g_rid ; /* a group RID */
uint32 attr ;
} DOM_GID ;
/**********************************************************************
* ? ? ? ?
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-03-12 00:11:04 +03:00
/* DOM_CLNT_SRV - client / server names */
2005-09-30 21:13:37 +04:00
typedef struct clnt_srv_info {
2003-09-23 02:08:53 +04:00
uint32 undoc_buffer ; /* undocumented 32 bit buffer pointer */
UNISTR2 uni_logon_srv ; /* logon server name */
uint32 undoc_buffer2 ; /* undocumented 32 bit buffer pointer */
UNISTR2 uni_comp_name ; /* client machine name */
1998-03-12 00:11:04 +03:00
} DOM_CLNT_SRV ;
/* DOM_LOG_INFO - login info */
2005-09-30 21:13:37 +04:00
typedef struct log_info {
2003-09-23 02:08:53 +04:00
uint32 undoc_buffer ; /* undocumented 32 bit buffer pointer */
UNISTR2 uni_logon_srv ; /* logon server name */
UNISTR2 uni_acct_name ; /* account name */
uint16 sec_chan ; /* secure channel type */
UNISTR2 uni_comp_name ; /* client machine name */
1998-03-12 00:11:04 +03:00
} DOM_LOG_INFO ;
2001-03-12 01:26:28 +03:00
/* DOM_CHAL - challenge info */
2005-09-30 21:13:37 +04:00
typedef struct chal_info {
2006-02-18 03:27:31 +03:00
unsigned char data [ 8 ] ; /* credentials */
2001-03-12 01:26:28 +03:00
} DOM_CHAL ;
/* DOM_CREDs - timestamped client or server credentials */
2005-09-30 21:13:37 +04:00
typedef struct cred_info {
2003-09-23 02:08:53 +04:00
DOM_CHAL challenge ; /* credentials */
UTIME timestamp ; /* credential time-stamp */
2001-03-12 01:26:28 +03:00
} DOM_CRED ;
1998-03-12 00:11:04 +03:00
/* DOM_CLNT_INFO - client info */
2005-09-30 21:13:37 +04:00
typedef struct clnt_info {
2003-09-23 02:08:53 +04:00
DOM_LOG_INFO login ;
DOM_CRED cred ;
1998-03-12 00:11:04 +03:00
} DOM_CLNT_INFO ;
/* DOM_CLNT_INFO2 - client info */
2005-09-30 21:13:37 +04:00
typedef struct clnt_info2 {
2003-09-23 02:08:53 +04:00
DOM_CLNT_SRV login ;
uint32 ptr_cred ;
DOM_CRED cred ;
1998-03-12 00:11:04 +03:00
} DOM_CLNT_INFO2 ;
/* DOM_LOGON_ID - logon id */
2005-09-30 21:13:37 +04:00
typedef struct logon_info {
2003-09-23 02:08:53 +04:00
uint32 low ;
uint32 high ;
1998-03-12 00:11:04 +03:00
} DOM_LOGON_ID ;
1998-03-24 03:37:53 +03:00
/* OWF INFO */
2005-09-30 21:13:37 +04:00
typedef struct owf_info {
2003-09-23 02:08:53 +04:00
uint8 data [ 16 ] ;
1998-03-24 03:37:53 +03:00
} OWF_INFO ;
1998-03-12 00:11:04 +03:00
2000-05-12 18:28:46 +04:00
1998-03-12 00:11:04 +03:00
# endif /* _RPC_MISC_H */