r9623: samba3dump now generates LDIF for the registry hives from registry.tdb
[samba.git] / source / 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         gid_t gid;
56         struct dom_sid *sid;
57         int sid_name_use;
58         const char *nt_name;
59         const char *comment;
60 };
61
62 struct samba3_alias {
63         struct dom_sid *sid;
64         uint32_t member_count;
65         struct dom_sid **members;
66 };
67
68 struct samba3_groupdb {
69         uint32_t groupmap_count;
70         struct samba3_groupmapping *groupmappings;
71
72         uint32_t alias_count;
73         struct samba3_alias *aliases;
74 };
75
76 struct samba3_idmap_mapping
77 {
78         enum { IDMAP_GROUP, IDMAP_USER } type;
79         uint32_t unix_id;
80         struct dom_sid *sid;
81 };
82
83 struct samba3_idmapdb
84 {
85         /* High water marks */
86         uint32_t user_hwm;
87         uint32_t group_hwm;
88
89         uint32_t mapping_count;
90         struct samba3_idmap_mapping *mappings;
91 };
92
93 struct samba3_winsdb_entry 
94 {
95         char *name;
96         int nb_flags;
97         int type;
98         time_t ttl;
99         uint32_t ip_count;
100         struct ipv4_addr *ips;
101 };
102
103 struct samba3_policy
104 {
105         uint32_t min_password_length;
106         uint32_t password_history;
107         uint32_t user_must_logon_to_change_password;
108         uint32_t maximum_password_age;
109         uint32_t minimum_password_age;
110         uint32_t lockout_duration;
111         uint32_t reset_count_minutes;
112         uint32_t bad_lockout_minutes;
113         uint32_t disconnect_time;
114         uint32_t refuse_machine_password_change;
115 };
116
117 struct samba3_regval {
118         char *name;
119         uint16_t                type;
120         DATA_BLOB               data;
121 };
122
123 struct samba3_regkey {
124         char *name;
125         
126         uint32_t value_count;
127         struct samba3_regval *values;
128
129         uint32_t subkey_count;
130         char **subkeys;
131 };
132
133 struct samba3_regdb
134 {
135         uint32_t key_count;
136         struct samba3_regkey *keys;
137 };
138
139 struct samba3_secrets
140 {
141         struct cli_credentials *ipc_cred;
142         
143         uint32_t ldappw_count;
144         struct samba3_ldappw 
145         {
146                 char *dn;
147                 char *password;
148         } *ldappws;
149
150         uint32_t domain_count;
151         struct samba3_domainsecrets 
152         {
153                 char *name;
154                 struct dom_sid sid;
155                 struct GUID guid;
156                 char *plaintext_pw;
157                 time_t last_change_time;
158                 struct {
159                         uint8_t hash[16];
160                         time_t mod_time;
161                 } hash_pw;;
162                 int sec_channel_type;
163         } *domains;
164
165         uint32_t trusted_domain_count;
166         struct samba3_trusted_dom_pass {
167                 uint32_t uni_name_len;
168                 const char *uni_name[32]; /* unicode domain name */
169                 const char *pass;               /* trust relationship's password */
170                 time_t mod_time;
171                 struct dom_sid domain_sid;      /* remote domain's sid */
172         } *trusted_domains;
173
174         uint32_t afs_keyfile_count;
175
176         struct samba3_afs_keyfile {
177                 uint32_t nkeys;
178                 struct {
179                         uint32_t kvno;
180                         char key[8];
181                 } entry[8];
182                 char *cell;
183         } *afs_keyfiles;
184 };
185
186 struct samba3_parameter {
187         char *name;
188         char *value;
189 };
190
191 struct samba3_share_info {
192         char *name;
193         struct security_descriptor secdesc;
194
195         uint32_t parameter_count;
196         struct samba3_parameter *parameters;
197 };
198
199 struct samba3 
200 {
201         uint32_t winsdb_count;
202         struct samba3_winsdb_entry *winsdb_entries;
203         
204         uint32_t samaccount_count;
205         struct samba3_samaccount *samaccounts;
206
207         uint32_t share_count;
208         struct samba3_share_info *shares;
209
210         struct samba3_secrets secrets;
211         struct samba3_groupdb group;
212         struct samba3_idmapdb idmap;
213         struct samba3_policy policy;
214         struct samba3_regdb registry;
215 };
216
217 #endif /* _SAMBA3_H */