s3-net: Bind our gettext results to 'unix charset'
[Samba.git] / libgpo / gpo.h
blobe6443825eceec4d542871f28d87b132430bf6007
1 /*
2 * Unix SMB/CIFS implementation.
3 * Group Policy Object Support
4 * Copyright (C) Guenther Deschner 2005-2008
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 3 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef __GPO_H__
21 #define __GPO_H__
23 #if _SAMBA_BUILD_ == 4
24 #include "source4/libgpo/ads_convenience.h"
25 #else
26 struct loadparm_context;
27 #include "ads.h"
28 #endif
30 enum GPO_LINK_TYPE {
31 GP_LINK_UNKOWN = 0,
32 GP_LINK_MACHINE = 1,
33 GP_LINK_SITE = 2,
34 GP_LINK_DOMAIN = 3,
35 GP_LINK_OU = 4,
36 GP_LINK_LOCAL = 5 /* for convenience */
39 /* GPO_OPTIONS */
40 #define GPO_FLAG_DISABLE 0x00000001
41 #define GPO_FLAG_FORCE 0x00000002
43 /* GPO_LIST_FLAGS */
44 #define GPO_LIST_FLAG_MACHINE 0x00000001
45 #define GPO_LIST_FLAG_SITEONLY 0x00000002
47 /* following flags from http://support.microsoft.com/kb/312164/EN-US/ */
48 #define GPO_INFO_FLAG_MACHINE 0x00000001
49 #define GPO_INFO_FLAG_BACKGROUND 0x00000010
50 #define GPO_INFO_FLAG_SLOWLINK 0x00000020
51 #define GPO_INFO_FLAG_VERBOSE 0x00000040
52 #define GPO_INFO_FLAG_NOCHANGES 0x00000080
53 #define GPO_INFO_FLAG_LINKTRANSITION 0x00000100
54 #define GPO_INFO_FLAG_LOGRSOP_TRANSITION 0x00000200
55 #define GPO_INFO_FLAG_FORCED_REFRESH 0x00000400
56 #define GPO_INFO_FLAG_SAFEMODE_BOOT 0x00000800
58 #define GPO_VERSION_USER(x) (x >> 16)
59 #define GPO_VERSION_MACHINE(x) (x & 0xffff)
61 struct GROUP_POLICY_OBJECT {
62 uint32_t options; /* GPFLAGS_* */
63 uint32_t version;
64 const char *ds_path;
65 const char *file_sys_path;
66 const char *display_name;
67 const char *name;
68 const char *link;
69 enum GPO_LINK_TYPE link_type;
70 const char *user_extensions;
71 const char *machine_extensions;
72 struct security_descriptor *security_descriptor;
73 struct GROUP_POLICY_OBJECT *next, *prev;
76 /* the following is seen on the DS (see adssearch.pl for details) */
78 /* the type field in a 'gPLink', the same as GPO_FLAG ? */
79 #define GPO_LINK_OPT_NONE 0x00000000
80 #define GPO_LINK_OPT_DISABLED 0x00000001
81 #define GPO_LINK_OPT_ENFORCED 0x00000002
83 /* GPO_LINK_OPT_ENFORCED takes precedence over GPOPTIONS_BLOCK_INHERITANCE */
85 /* 'gPOptions', maybe a bitmask as well */
86 enum GPO_INHERIT {
87 GPOPTIONS_INHERIT = 0,
88 GPOPTIONS_BLOCK_INHERITANCE = 1
91 /* 'flags' in a 'groupPolicyContainer' object */
92 #define GPFLAGS_ALL_ENABLED 0x00000000
93 #define GPFLAGS_USER_SETTINGS_DISABLED 0x00000001
94 #define GPFLAGS_MACHINE_SETTINGS_DISABLED 0x00000002
95 #define GPFLAGS_ALL_DISABLED (GPFLAGS_USER_SETTINGS_DISABLED | \
96 GPFLAGS_MACHINE_SETTINGS_DISABLED)
98 struct GP_LINK {
99 const char *gp_link; /* raw link name */
100 uint32_t gp_opts; /* inheritance options GPO_INHERIT */
101 uint32_t num_links; /* number of links */
102 char **link_names; /* array of parsed link names */
103 uint32_t *link_opts; /* array of parsed link opts GPO_LINK_OPT_* */
106 struct GP_EXT {
107 const char *gp_extension; /* raw extension name */
108 uint32_t num_exts;
109 char **extensions;
110 char **extensions_guid;
111 char **snapins;
112 char **snapins_guid;
113 struct GP_EXT *next, *prev;
116 #define GPO_CACHE_DIR "gpo_cache"
117 #define GPT_INI "GPT.INI"
118 #define GPO_REFRESH_INTERVAL 60*90
120 #define GPO_REG_STATE_MACHINE "State\\Machine"
122 enum gp_reg_action {
123 GP_REG_ACTION_NONE = 0,
124 GP_REG_ACTION_ADD_VALUE = 1,
125 GP_REG_ACTION_ADD_KEY = 2,
126 GP_REG_ACTION_DEL_VALUES = 3,
127 GP_REG_ACTION_DEL_VALUE = 4,
128 GP_REG_ACTION_DEL_ALL_VALUES = 5,
129 GP_REG_ACTION_DEL_KEYS = 6,
130 GP_REG_ACTION_SEC_KEY_SET = 7,
131 GP_REG_ACTION_SEC_KEY_RESET = 8
134 struct gp_registry_entry {
135 enum gp_reg_action action;
136 const char *key;
137 const char *value;
138 struct registry_value *data;
141 struct gp_registry_value {
142 const char *value;
143 struct registry_value *data;
146 struct gp_registry_entry2 {
147 enum gp_reg_action action;
148 const char *key;
149 size_t num_values;
150 struct gp_registry_value **values;
153 struct gp_registry_entries {
154 size_t num_entries;
155 struct gp_registry_entry **entries;
158 struct gp_registry_context {
159 const struct security_token *token;
160 const char *path;
161 struct registry_key *curr_key;
164 #define GP_EXT_GUID_SECURITY "827D319E-6EAC-11D2-A4EA-00C04F79F83A"
165 #define GP_EXT_GUID_REGISTRY "35378EAC-683F-11D2-A89A-00C04FBBCFA2"
166 #define GP_EXT_GUID_SCRIPTS "42B5FAAE-6536-11D2-AE5A-0000F87571E3"
167 #define ADS_EXTENDED_RIGHT_APPLY_GROUP_POLICY "edacfd8f-ffb3-11d1-b41d-00a0c968f939"
170 struct cli_state;
172 /* The following definitions come from libgpo/gpo_fetch.c */
174 NTSTATUS gpo_explode_filesyspath(TALLOC_CTX *mem_ctx,
175 const char *cache_dir,
176 const char *file_sys_path,
177 char **server,
178 char **service,
179 char **nt_path,
180 char **unix_path);
181 NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
182 ADS_STRUCT *ads,
183 struct loadparm_context *lp_ctx,
184 const char *cache_dir,
185 struct GROUP_POLICY_OBJECT *gpo);
186 NTSTATUS gpo_get_sysvol_gpt_version(TALLOC_CTX *mem_ctx,
187 const char *unix_path,
188 uint32_t *sysvol_version,
189 char **display_name);
191 /* The following definitions come from libgpo/gpo_ldap.c */
193 bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
194 const char *extension_raw,
195 struct GP_EXT **gp_ext);
196 ADS_STATUS ads_get_gpo_link(ADS_STRUCT *ads,
197 TALLOC_CTX *mem_ctx,
198 const char *link_dn,
199 struct GP_LINK *gp_link_struct);
200 ADS_STATUS ads_add_gpo_link(ADS_STRUCT *ads,
201 TALLOC_CTX *mem_ctx,
202 const char *link_dn,
203 const char *gpo_dn,
204 uint32_t gpo_opt);
205 ADS_STATUS ads_delete_gpo_link(ADS_STRUCT *ads,
206 TALLOC_CTX *mem_ctx,
207 const char *link_dn,
208 const char *gpo_dn);
209 ADS_STATUS ads_get_gpo(ADS_STRUCT *ads,
210 TALLOC_CTX *mem_ctx,
211 const char *gpo_dn,
212 const char *display_name,
213 const char *guid_name,
214 struct GROUP_POLICY_OBJECT *gpo);
215 ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads,
216 TALLOC_CTX *mem_ctx,
217 const char *dn,
218 struct security_token **token);
219 ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads,
220 TALLOC_CTX *mem_ctx,
221 const char *dn,
222 uint32_t flags,
223 const struct security_token *token,
224 struct GROUP_POLICY_OBJECT **gpo_list);
226 /* The following definitions come from libgpo/gpo_sec.c */
228 NTSTATUS gpo_apply_security_filtering(const struct GROUP_POLICY_OBJECT *gpo,
229 const struct security_token *token);
231 /* The following definitions come from libgpo/gpo_util.c */
233 const char *cse_gpo_guid_string_to_name(const char *guid);
234 const char *cse_gpo_name_to_guid_string(const char *name);
235 const char *cse_snapin_gpo_guid_string_to_name(const char *guid);
236 void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel);
237 void dump_gpo(ADS_STRUCT *ads,
238 TALLOC_CTX *mem_ctx,
239 struct GROUP_POLICY_OBJECT *gpo,
240 int debuglevel);
241 void dump_gpo_list(ADS_STRUCT *ads,
242 TALLOC_CTX *mem_ctx,
243 struct GROUP_POLICY_OBJECT *gpo_list,
244 int debuglevel);
245 void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link);
246 ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads,
247 TALLOC_CTX *mem_ctx,
248 const struct security_token *token,
249 struct registry_key *root_key,
250 struct GROUP_POLICY_OBJECT *gpo,
251 const char *extension_guid_filter,
252 uint32_t flags);
253 ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
254 TALLOC_CTX *mem_ctx,
255 const struct security_token *token,
256 struct GROUP_POLICY_OBJECT *gpo_list,
257 const char *extensions_guid_filter,
258 uint32_t flags);
259 NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
260 TALLOC_CTX *mem_ctx,
261 const char *cache_dir,
262 struct loadparm_context *lp_ctx,
263 uint32_t flags,
264 struct GROUP_POLICY_OBJECT *gpo);
265 NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
266 TALLOC_CTX *mem_ctx,
267 const char *cache_dir,
268 struct loadparm_context *lp_ctx,
269 uint32_t flags,
270 struct GROUP_POLICY_OBJECT *gpo_list);
271 NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx,
272 const char *cache_dir,
273 struct GROUP_POLICY_OBJECT *gpo,
274 char **unix_path);
275 char *gpo_flag_str(TALLOC_CTX *mem_ctx, uint32_t flags);
276 NTSTATUS gp_find_file(TALLOC_CTX *mem_ctx,
277 uint32_t flags,
278 const char *filename,
279 const char *suffix,
280 const char **filename_out);
281 ADS_STATUS gp_get_machine_token(ADS_STRUCT *ads,
282 TALLOC_CTX *mem_ctx,
283 struct loadparm_context *lp_ctx,
284 const char *dn,
285 struct security_token **token);
288 #include "../libgpo/gpext/gpext.h"
290 #endif