summaryrefslogtreecommitdiff
path: root/source4/lib/samba3/samba3.h
blob: adb7b8973aba8d2b53429e0607805f07691afa47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* 
   Unix SMB/CIFS implementation.
   Samba3 interfaces
   Copyright (C) Jelmer Vernooij			2005.
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _SAMBA3_H /* _SAMBA3_H */
#define _SAMBA3_H 

#include "librpc/gen_ndr/security.h"

struct samba3_samaccount {
	uint32_t logon_time,
		logoff_time,
		kickoff_time,
		bad_password_time,
		pass_last_set_time,
		pass_can_change_time,
		pass_must_change_time;
	char *username;
	char *domain;
	char *nt_username;
	char *dir_drive;
	char *unknown_str;
	char *munged_dial;
	char *fullname;
	char *homedir;
	char *logon_script;
	char *profile_path;
	char *acct_desc;
	char *workstations;
	uint32_t user_rid, group_rid, hours_len, unknown_6;
	uint16_t acct_ctrl, logon_divs;
	uint16_t bad_password_count, logon_count;
	uint8_t	*lm_pw_ptr, *nt_pw_ptr;
	uint8_t *nt_pw_hist_ptr;
	uint8_t	*hours;
};

/* SID Types */
enum SID_NAME_USE
{
	SID_NAME_USE_NONE = 0,
	SID_NAME_USER    = 1, /* user */
	SID_NAME_DOM_GRP,     /* domain group */
	SID_NAME_DOMAIN,      /* domain sid */
	SID_NAME_ALIAS,       /* local group */
	SID_NAME_WKN_GRP,     /* well-known group */
	SID_NAME_DELETED,     /* deleted account: needed for c2 rating */
	SID_NAME_INVALID,     /* invalid account */
	SID_NAME_UNKNOWN,     /* unknown sid type */
	SID_NAME_COMPUTER     /* sid for a computer */
};

struct samba3_groupmapping {
	struct pdb_methods *methods;
	gid_t gid;
	struct dom_sid *sid;
	enum SID_NAME_USE sid_name_use;
	const char *nt_name;
	const char *comment;
};

struct samba3_alias {
	struct dom_sid *sid;
	uint32_t member_count;
	struct dom_sid **members;
};

struct samba3_groupdb {
	uint32_t groupmap_count;
	struct samba3_groupmapping *groupmappings;

	uint32_t alias_count;
	struct samba3_alias *aliases;
};

struct samba3_idmap_mapping
{
	enum { IDMAP_GROUP, IDMAP_USER } type;
	uint32_t unix_id;
	struct dom_sid *sid;
};

struct samba3_idmapdb
{
	/* High water marks */
	uint32_t user_hwm;
	uint32_t group_hwm;

	uint32_t mapping_count;
	struct samba3_idmap_mapping *mappings;
};

struct samba3_winsdb_entry 
{
	char *name;
	int nb_flags;
	int type;
	time_t ttl;
	uint32_t ip_count;
	struct ipv4_addr *ips;
};

struct samba3_policy
{
	uint32_t min_password_length;
	uint32_t password_history;
	uint32_t user_must_logon_to_change_password;
	uint32_t maximum_password_age;
	uint32_t minimum_password_age;
	uint32_t lockout_duration;
	uint32_t reset_count_minutes;
	uint32_t bad_lockout_minutes;
	uint32_t disconnect_time;
	uint32_t refuse_machine_password_change;
};

struct samba3 
{
	uint32_t winsdb_count;
	struct samba3_winsdb_entry *winsdb_entries;
	
	uint32_t samaccount_count;
	struct samba3_samaccount *samaccounts;

	struct samba3_groupdb group;
	struct samba3_idmapdb idmap;
	struct samba3_policy policy;
};

#endif /* _SAMBA3_H */