r9557: Some more updates. Use combined function for parsing a set of
[samba.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 /* SID Types */
55 enum SID_NAME_USE
56 {
57         SID_NAME_USE_NONE = 0,
58         SID_NAME_USER    = 1, /* user */
59         SID_NAME_DOM_GRP,     /* domain group */
60         SID_NAME_DOMAIN,      /* domain sid */
61         SID_NAME_ALIAS,       /* local group */
62         SID_NAME_WKN_GRP,     /* well-known group */
63         SID_NAME_DELETED,     /* deleted account: needed for c2 rating */
64         SID_NAME_INVALID,     /* invalid account */
65         SID_NAME_UNKNOWN,     /* unknown sid type */
66         SID_NAME_COMPUTER     /* sid for a computer */
67 };
68
69 struct samba3_groupmapping {
70         struct pdb_methods *methods;
71         gid_t gid;
72         struct dom_sid *sid;
73         enum SID_NAME_USE sid_name_use;
74         const char *nt_name;
75         const char *comment;
76 };
77
78 struct samba3_alias {
79         struct dom_sid *sid;
80         uint32_t member_count;
81         struct dom_sid **members;
82 };
83
84 struct samba3_groupdb {
85         uint32_t groupmap_count;
86         struct samba3_groupmapping *groupmappings;
87
88         uint32_t alias_count;
89         struct samba3_alias *aliases;
90 };
91
92 struct samba3_idmap_mapping
93 {
94         enum { IDMAP_GROUP, IDMAP_USER } type;
95         uint32_t unix_id;
96         struct dom_sid *sid;
97 };
98
99 struct samba3_idmapdb
100 {
101         /* High water marks */
102         uint32_t user_hwm;
103         uint32_t group_hwm;
104
105         uint32_t mapping_count;
106         struct samba3_idmap_mapping *mappings;
107 };
108
109 struct samba3_winsdb_entry 
110 {
111         char *name;
112         int nb_flags;
113         int type;
114         time_t ttl;
115         uint32_t ip_count;
116         struct ipv4_addr *ips;
117 };
118
119 struct samba3_policy
120 {
121         uint32_t min_password_length;
122         uint32_t password_history;
123         uint32_t user_must_logon_to_change_password;
124         uint32_t maximum_password_age;
125         uint32_t minimum_password_age;
126         uint32_t lockout_duration;
127         uint32_t reset_count_minutes;
128         uint32_t bad_lockout_minutes;
129         uint32_t disconnect_time;
130         uint32_t refuse_machine_password_change;
131 };
132
133 struct samba3 
134 {
135         uint32_t winsdb_count;
136         struct samba3_winsdb_entry *winsdb_entries;
137         
138         uint32_t samaccount_count;
139         struct samba3_samaccount *samaccounts;
140
141         struct samba3_groupdb group;
142         struct samba3_idmapdb idmap;
143         struct samba3_policy policy;
144 };
145
146 #endif /* _SAMBA3_H */