f0f4c99513c4e4e193fb30dc22f8e5e020554319
[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 #include "librpc/gen_ndr/samr.h"
26 #include "param/generic.h"
27
28 struct samba3_samaccount {
29         uint32_t logon_time,
30                 logoff_time,
31                 kickoff_time,
32                 bad_password_time,
33                 pass_last_set_time,
34                 pass_can_change_time,
35                 pass_must_change_time;
36         char *username;
37         char *domain;
38         char *nt_username;
39         char *dir_drive;
40         char *unknown_str;
41         char *munged_dial;
42         char *fullname;
43         char *homedir;
44         char *logon_script;
45         char *profile_path;
46         char *acct_desc;
47         char *workstations;
48         uid_t uid;
49         uint32_t user_rid, group_rid, hours_len, unknown_6;
50         uint16_t acct_ctrl, logon_divs;
51         uint16_t bad_password_count, logon_count;
52         struct samr_Password lm_pw, nt_pw;
53         uint8_t *nt_pw_hist_ptr;
54         uint8_t *hours;
55 };
56
57 struct samba3_groupmapping {
58         gid_t gid;
59         struct dom_sid *sid;
60         int sid_name_use;
61         const char *nt_name;
62         const char *comment;
63 };
64
65 struct samba3_alias {
66         struct dom_sid *sid;
67         uint32_t member_count;
68         struct dom_sid **members;
69 };
70
71 struct samba3_groupdb {
72         uint32_t groupmap_count;
73         struct samba3_groupmapping *groupmappings;
74
75         uint32_t alias_count;
76         struct samba3_alias *aliases;
77 };
78
79 struct samba3_idmap_mapping
80 {
81         enum { IDMAP_GROUP, IDMAP_USER } type;
82         uint32_t unix_id;
83         struct dom_sid *sid;
84 };
85
86 struct samba3_idmapdb
87 {
88         /* High water marks */
89         uint32_t user_hwm;
90         uint32_t group_hwm;
91
92         uint32_t mapping_count;
93         struct samba3_idmap_mapping *mappings;
94 };
95
96 struct samba3_winsdb_entry 
97 {
98         char *name;
99         int nb_flags;
100         int type;
101         time_t ttl;
102         uint32_t ip_count;
103         struct ipv4_addr *ips;
104 };
105
106 struct samba3_policy
107 {
108         uint32_t min_password_length;
109         uint32_t password_history;
110         uint32_t user_must_logon_to_change_password;
111         uint32_t maximum_password_age;
112         uint32_t minimum_password_age;
113         uint32_t lockout_duration;
114         uint32_t reset_count_minutes;
115         uint32_t bad_lockout_minutes;
116         uint32_t disconnect_time;
117         uint32_t refuse_machine_password_change;
118 };
119
120 struct samba3_regval {
121         char *name;
122         uint16_t                type;
123         DATA_BLOB               data;
124 };
125
126 struct samba3_regkey {
127         char *name;
128         
129         uint32_t value_count;
130         struct samba3_regval *values;
131
132         uint32_t subkey_count;
133         char **subkeys;
134 };
135
136 struct samba3_regdb
137 {
138         uint32_t key_count;
139         struct samba3_regkey *keys;
140 };
141
142 struct samba3_secrets
143 {
144         struct cli_credentials *ipc_cred;
145         
146         uint32_t ldappw_count;
147         struct samba3_ldappw 
148         {
149                 char *dn;
150                 char *password;
151         } *ldappws;
152
153         uint32_t domain_count;
154         struct samba3_domainsecrets 
155         {
156                 char *name;
157                 struct dom_sid sid;
158                 struct GUID guid;
159                 char *plaintext_pw;
160                 time_t last_change_time;
161                 struct {
162                         uint8_t hash[16];
163                         time_t mod_time;
164                 } hash_pw;
165                 int sec_channel_type;
166         } *domains;
167
168         uint32_t trusted_domain_count;
169         struct samba3_trusted_dom_pass {
170                 uint32_t uni_name_len;
171                 const char *uni_name[32]; /* unicode domain name */
172                 const char *pass;               /* trust relationship's password */
173                 time_t mod_time;
174                 struct dom_sid domain_sid;      /* remote domain's sid */
175         } *trusted_domains;
176
177         uint32_t afs_keyfile_count;
178
179         struct samba3_afs_keyfile {
180                 uint32_t nkeys;
181                 struct {
182                         uint32_t kvno;
183                         char key[8];
184                 } entry[8];
185                 char *cell;
186         } *afs_keyfiles;
187 };
188
189 struct samba3_share_info {
190         char *name;
191         struct security_descriptor secdesc;
192 };
193
194 struct samba3 
195 {
196         struct param_context *configuration;
197
198         uint32_t winsdb_count;
199         struct samba3_winsdb_entry *winsdb_entries;
200         
201         uint32_t samaccount_count;
202         struct samba3_samaccount *samaccounts;
203
204         uint32_t share_count;
205         struct samba3_share_info *shares;
206
207         struct samba3_secrets secrets;
208         struct samba3_groupdb group;
209         struct samba3_idmapdb idmap;
210         struct samba3_policy policy;
211         struct samba3_regdb registry;
212 };
213
214 #endif /* _SAMBA3_H */