1/*
2   Unix SMB/CIFS implementation.
3   Kerberos authorization data
4   Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
5
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 2 of the License, or
10   (at your option) any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program; if not, write to the Free Software
19   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef _AUTHDATA_H
23#define _AUTHDATA_H
24
25#include "rpc_misc.h"
26
27#define PAC_TYPE_LOGON_INFO 1
28#define PAC_TYPE_SERVER_CHECKSUM 6
29#define PAC_TYPE_PRIVSVR_CHECKSUM 7
30#define PAC_TYPE_UNKNOWN_10 10
31
32typedef struct unknown_type_10 {
33	NTTIME unknown_time;
34	uint16 len;
35	uint16 *username; /* might not be null terminated, so not UNISTR */
36} UNKNOWN_TYPE_10;
37
38typedef struct pac_signature_data {
39	uint32 type;
40	uint8 *signature;
41} PAC_SIGNATURE_DATA;
42
43typedef struct group_membership {
44	uint32 rid;
45	uint32 attrs;
46} GROUP_MEMBERSHIP;
47
48typedef struct group_membership_array {
49	uint32 count;
50	GROUP_MEMBERSHIP *group_membership;
51} GROUP_MEMBERSHIP_ARRAY;
52
53typedef struct krb_sid_and_attrs {
54	uint32 sid_ptr;
55	uint32 attrs;
56	DOM_SID2 *sid;
57} KRB_SID_AND_ATTRS;
58
59typedef struct krb_sid_and_attr_array {
60	uint32 count;
61	KRB_SID_AND_ATTRS *krb_sid_and_attrs;
62} KRB_SID_AND_ATTR_ARRAY;
63
64
65/* This is awfully similar to a samr_user_info_23, but not identical.
66   Many of the field names have been swiped from there, because it is
67   so similar that they are likely the same, but many have been verified.
68   Some are in a different order, though... */
69typedef struct pac_logon_info {
70	NTTIME logon_time;            /* logon time */
71	NTTIME logoff_time;           /* logoff time */
72	NTTIME kickoff_time;          /* kickoff time */
73	NTTIME pass_last_set_time;    /* password last set time */
74	NTTIME pass_can_change_time;  /* password can change time */
75	NTTIME pass_must_change_time; /* password must change time */
76
77	UNIHDR hdr_user_name;    /* user name unicode string header */
78	UNIHDR hdr_full_name;    /* user's full name unicode string header */
79	UNIHDR hdr_logon_script; /* these last 4 appear to be in a different */
80	UNIHDR hdr_profile_path; /* order than in the info23 */
81	UNIHDR hdr_home_dir;
82	UNIHDR hdr_dir_drive;
83
84	uint16 logon_count; /* number of times user has logged onto domain */
85	uint16 reserved12;
86
87	uint32 user_rid;
88	uint32 group_rid;
89	uint32 group_count;
90	uint32 group_membership_ptr;
91	uint32 user_flags;
92
93	uint32 reserved13[4];
94	UNIHDR hdr_dom_controller;
95	UNIHDR hdr_dom_name;
96
97	uint32 ptr_dom_sid;
98
99	uint32 reserved16[2];
100	uint32 reserved17;      /* looks like it may be acb_info */
101	uint32 reserved18[7];
102
103	uint32 sid_count;
104	uint32 ptr_extra_sids;
105
106	uint32 ptr_res_group_dom_sid;
107	uint32 res_group_count;
108	uint32 ptr_res_groups;
109
110	UNISTR2 uni_user_name;    /* user name unicode string header */
111	UNISTR2 uni_full_name;    /* user's full name unicode string header */
112	UNISTR2 uni_logon_script; /* these last 4 appear to be in a different*/
113	UNISTR2 uni_profile_path; /* order than in the info23 */
114	UNISTR2 uni_home_dir;
115	UNISTR2 uni_dir_drive;
116	UNISTR2 uni_dom_controller;
117	UNISTR2 uni_dom_name;
118	DOM_SID2 dom_sid;
119	GROUP_MEMBERSHIP_ARRAY groups;
120	KRB_SID_AND_ATTR_ARRAY extra_sids;
121	DOM_SID2 res_group_dom_sid;
122	GROUP_MEMBERSHIP_ARRAY res_groups;
123
124} PAC_LOGON_INFO;
125
126typedef struct pac_info_ctr
127{
128	union
129	{
130		PAC_LOGON_INFO *logon_info;
131		PAC_SIGNATURE_DATA *srv_cksum;
132		PAC_SIGNATURE_DATA *privsrv_cksum;
133		UNKNOWN_TYPE_10 *type_10;
134	} pac;
135} PAC_INFO_CTR;
136
137typedef struct pac_info_hdr {
138	uint32 type;
139	uint32 size;
140	uint32 offset;
141	uint32 offsethi;
142	PAC_INFO_CTR *ctr;
143} PAC_INFO_HDR;
144
145typedef struct pac_data {
146	uint32 num_buffers;
147	uint32 version;
148	PAC_INFO_HDR *pac_info_hdr_ptr;
149} PAC_DATA;
150
151
152#endif
153