summaryrefslogtreecommitdiff
path: root/librpc/idl/krb5pac.idl
blob: 0fce16baaa38c3b7a86eae58616ba51d0d0ae542 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
  krb5 PAC
*/

#include "idl_types.h"

import "security.idl", "lsa.idl", "netlogon.idl", "samr.idl";

[
  uuid("12345778-1234-abcd-0000-00000000"),
  version(0.0),
  pointer_default(unique),
  helpstring("Active Directory KRB5 PAC")
]
interface krb5pac
{
	typedef struct {
		NTTIME logon_time;
		[value(2*strlen_m(account_name))] uint16 size;
		[charset(UTF16)] uint8 account_name[size];
	} PAC_LOGON_NAME;

	typedef [public,flag(NDR_PAHEX)] struct {
		uint32 type;
		[flag(NDR_REMAINING)] DATA_BLOB signature;
	} PAC_SIGNATURE_DATA;

	typedef struct {
		netr_SamInfo3 info3;
		dom_sid2 *res_group_dom_sid;
		samr_RidWithAttributeArray res_groups;
	} PAC_LOGON_INFO;

	typedef struct {
		lsa_String proxy_target;
		uint32 num_transited_services;
		[size_is(num_transited_services)] lsa_String *transited_services;
	} PAC_CONSTRAINED_DELEGATION;

	typedef [public,bitmap32bit] bitmap {
		UDI_ACCT_HAS_NO_UPN	= 0x00000001 /* 1= User account has no UPN */
	} upn_dns_info_flags;

	typedef struct {
		[value(2*strlen_m(upn_name))] uint16 upn_size;
		uint16 upn_offset;
		[value(2*strlen_m(domain_name))] uint16 domain_size;
		uint16 domain_offset;
		upn_dns_info_flags flags;
		uint32 padding;
		[charset(UTF16)] uint8 upn_name[upn_size+2];
		[charset(UTF16)] uint8 domain_name[domain_size+2];
	} PAC_UPN_DNS_INFO;

	typedef [public] struct {
		PAC_LOGON_INFO *info;
	} PAC_LOGON_INFO_CTR;

	typedef [public] struct {
		PAC_CONSTRAINED_DELEGATION *info;
	} PAC_CONSTRAINED_DELEGATION_CTR;

	typedef [public,v1_enum] enum {
		PAC_TYPE_LOGON_INFO = 1,
		PAC_TYPE_SRV_CHECKSUM = 6,
		PAC_TYPE_KDC_CHECKSUM = 7,
		PAC_TYPE_LOGON_NAME = 10,
		PAC_TYPE_CONSTRAINED_DELEGATION = 11,
		PAC_TYPE_UPN_DNS_INFO = 12
	} PAC_TYPE;

	typedef struct {
		[flag(NDR_REMAINING)] DATA_BLOB remaining;
	} DATA_BLOB_REM;

	typedef [public,nodiscriminant,gensize] union {
		[case(PAC_TYPE_LOGON_INFO)][subcontext(0xFFFFFC01)] PAC_LOGON_INFO_CTR logon_info;
		[case(PAC_TYPE_SRV_CHECKSUM)]	PAC_SIGNATURE_DATA srv_cksum;
		[case(PAC_TYPE_KDC_CHECKSUM)]	PAC_SIGNATURE_DATA kdc_cksum;
		[case(PAC_TYPE_LOGON_NAME)]	PAC_LOGON_NAME logon_name;
		[case(PAC_TYPE_CONSTRAINED_DELEGATION)][subcontext(0xFFFFFC01)]
			PAC_CONSTRAINED_DELEGATION_CTR constrained_delegation;
		[case(PAC_TYPE_UPN_DNS_INFO)]	PAC_UPN_DNS_INFO upn_dns_info;
		/* when new PAC info types are added they are supposed to be done
		   in such a way that they are backwards compatible with existing
		   servers. This makes it safe to just use a [default] for
		   unknown types, which lets us ignore the data */
		[default]	[subcontext(0)] DATA_BLOB_REM unknown;
	} PAC_INFO;

	typedef [public,nopush,nopull,noprint] struct {
		PAC_TYPE type;
		[value(_ndr_size_PAC_INFO(info, type, 0))] uint32 _ndr_size;
		[relative,switch_is(type),subcontext(0),subcontext_size(_subcontext_size_PAC_INFO(r, ndr->flags)),flag(NDR_ALIGN8)] PAC_INFO *info;
		[value(0)] uint32 _pad; /* Top half of a 64 bit pointer? */
	} PAC_BUFFER;

	typedef [public] struct {
		uint32 num_buffers;
		uint32 version;
		PAC_BUFFER buffers[num_buffers];
	} PAC_DATA;

	typedef [public] struct {
		PAC_TYPE type;
		uint32 ndr_size;
		[relative,subcontext(0),subcontext_size(NDR_ROUND(ndr_size,8)),flag(NDR_ALIGN8)] DATA_BLOB_REM *info;
		[value(0)] uint32 _pad; /* Top half of a 64 bit pointer? */
	} PAC_BUFFER_RAW;

	typedef [public] struct {
		uint32 num_buffers;
		uint32 version;
		PAC_BUFFER_RAW buffers[num_buffers];
	} PAC_DATA_RAW;

	const int NETLOGON_GENERIC_KRB5_PAC_VALIDATE = 3;

	typedef [public] struct {
		[value(NETLOGON_GENERIC_KRB5_PAC_VALIDATE)] uint32 MessageType;
		uint32 ChecksumLength;
		int32 SignatureType;
		uint32 SignatureLength;
		[flag(NDR_REMAINING)] DATA_BLOB ChecksumAndSignature;
	} PAC_Validate;

	[nopython] void decode_pac(
		[in] PAC_DATA pac
		);

	[nopython] void decode_pac_raw(
		[in] PAC_DATA_RAW pac
		);

	[nopython] void decode_login_info(
		[in] PAC_LOGON_INFO logon_info
		);

	[nopython] void decode_login_info_ctr(
		[in] PAC_LOGON_INFO_CTR logon_info_ctr
		);

	[nopython] void decode_pac_validate(
		[in] PAC_Validate pac_validate
		);

	/* used for samba3 netsamlogon cache */
	typedef [public] struct {
		time_t timestamp;
		netr_SamInfo3 info3;
	} netsamlogoncache_entry;
}