r9600: fixed the intermittent failures we were getting with ejs in the build
[sfrench/samba-autobuild/.git] / source4 / lib / samba3 / samba3.h
1 /* 
2    Unix SMB/CIFS implementation.
3    Samba3 interfaces
4    Copyright (C) Jelmer Vernooij                        2005.
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #ifndef _SAMBA3_H /* _SAMBA3_H */
22 #define _SAMBA3_H 
23
24 #include "librpc/gen_ndr/security.h"
25
26 struct samba3_samaccount {
27         uint32_t logon_time,
28                 logoff_time,
29                 kickoff_time,
30                 bad_password_time,
31                 pass_last_set_time,
32                 pass_can_change_time,
33                 pass_must_change_time;
34         char *username;
35         char *domain;
36         char *nt_username;
37         char *dir_drive;
38         char *unknown_str;
39         char *munged_dial;
40         char *fullname;
41         char *homedir;
42         char *logon_script;
43         char *profile_path;
44         char *acct_desc;
45         char *workstations;
46         uint32_t user_rid, group_rid, hours_len, unknown_6;
47         uint16_t acct_ctrl, logon_divs;
48         uint16_t bad_password_count, logon_count;
49         uint8_t *lm_pw_ptr, *nt_pw_ptr;
50         uint8_t *nt_pw_hist_ptr;
51         uint8_t *hours;
52 };
53
54 struct samba3_groupmapping {
55         struct pdb_methods *methods;
56         gid_t gid;
57         struct dom_sid *sid;
58         int sid_name_use;
59         const char *nt_name;
60         const char *comment;
61 };
62
63 struct samba3_alias {
64         struct dom_sid *sid;
65         uint32_t member_count;
66         struct dom_sid **members;
67 };
68
69 struct samba3_groupdb {
70         uint32_t groupmap_count;
71         struct samba3_groupmapping *groupmappings;
72
73         uint32_t alias_count;
74         struct samba3_alias *aliases;
75 };
76
77 struct samba3_idmap_mapping
78 {
79         enum { IDMAP_GROUP, IDMAP_USER } type;
80         uint32_t unix_id;
81         struct dom_sid *sid;
82 };
83
84 struct samba3_idmapdb
85 {
86         /* High water marks */
87         uint32_t user_hwm;
88         uint32_t group_hwm;
89
90         uint32_t mapping_count;
91         struct samba3_idmap_mapping *mappings;
92 };
93
94 struct samba3_winsdb_entry 
95 {
96         char *name;
97         int nb_flags;
98         int type;
99         time_t ttl;
100         uint32_t ip_count;
101         struct ipv4_addr *ips;
102 };
103
104 struct samba3_policy
105 {
106         uint32_t min_password_length;
107         uint32_t password_history;
108         uint32_t user_must_logon_to_change_password;
109         uint32_t maximum_password_age;
110         uint32_t minimum_password_age;
111         uint32_t lockout_duration;
112         uint32_t reset_count_minutes;
113         uint32_t bad_lockout_minutes;
114         uint32_t disconnect_time;
115         uint32_t refuse_machine_password_change;
116 };
117
118 struct samba3_regval {
119         char *name;
120         uint16_t                type;
121         DATA_BLOB               data;
122 };
123
124 struct samba3_regkey {
125         char *name;
126         
127         uint32_t value_count;
128         struct samba3_regval *values;
129
130         uint32_t subkey_count;
131         char **subkeys;
132 };
133
134 struct samba3_regdb
135 {
136         uint32_t key_count;
137         struct samba3_regkey *keys;
138 };
139
140 struct samba3_secrets
141 {
142         struct cli_credentials *ipc_cred;
143         
144         uint32_t ldappw_count;
145         struct samba3_ldappw 
146         {
147                 char *dn;
148                 char *password;
149         } *ldappws;
150
151         uint32_t domain_count;
152         struct samba3_domainsecrets 
153         {
154                 char *name;
155                 struct dom_sid sid;
156                 struct GUID guid;
157                 char *plaintext_pw;
158                 time_t last_change_time;
159                 struct {
160                         uint8_t hash[16];
161                         time_t mod_time;
162                 } hash_pw;;
163                 int sec_channel_type;
164         } *domains;
165
166         uint32_t trusted_domain_count;
167         struct samba3_trusted_dom_pass {
168                 uint32_t uni_name_len;
169                 const char *uni_name[32]; /* unicode domain name */
170                 const char *pass;               /* trust relationship's password */
171                 time_t mod_time;
172                 struct dom_sid domain_sid;      /* remote domain's sid */
173         } *trusted_domains;
174
175         uint32_t afs_keyfile_count;
176
177         struct samba3_afs_keyfile {
178                 uint32_t nkeys;
179                 struct {
180                         uint32_t kvno;
181                         char key[8];
182                 } entry[8];
183                 char *cell;
184         } *afs_keyfiles;
185 };
186
187 struct samba3 
188 {
189         uint32_t winsdb_count;
190         struct samba3_winsdb_entry *winsdb_entries;
191         
192         uint32_t samaccount_count;
193         struct samba3_samaccount *samaccounts;
194
195         struct samba3_secrets secrets;
196         struct samba3_groupdb group;
197         struct samba3_idmapdb idmap;
198         struct samba3_policy policy;
199         struct samba3_regdb registry;
200 };
201
202 #endif /* _SAMBA3_H */