source: vendor/current/source4/lib/policy/policy.h

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 4.7 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 * Group Policy Object Support
4 * Copyright (C) Guenther Deschner 2005-2008 (from samba 3 gpo.h)
5 * Copyright (C) Wilco Baan Hofman 2010
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __POLICY_H__
22#define __POLICY_H__
23
24#define GPLINK_OPT_DISABLE (1 << 0)
25#define GPLINK_OPT_ENFORCE (1 << 1)
26
27#define GPO_FLAG_USER_DISABLE (1 << 0)
28#define GPO_FLAG_MACHINE_DISABLE (1 << 1)
29
30struct security_token;
31struct nbt_dc_name;
32
33enum gpo_inheritance {
34 GPO_INHERIT = 0,
35 GPO_BLOCK_INHERITANCE = 1,
36};
37
38struct gp_context {
39 struct ldb_context *ldb_ctx;
40 struct loadparm_context *lp_ctx;
41 struct cli_credentials *credentials;
42 struct tevent_context *ev_ctx;
43 struct smbcli_state *cli;
44 struct nbt_dc_name *active_dc;
45};
46
47struct gp_object {
48 uint32_t version;
49 uint32_t flags;
50 const char *display_name;
51 const char *name;
52 const char *dn;
53 const char *file_sys_path;
54 struct security_descriptor *security_descriptor;
55};
56
57
58struct gp_link {
59 uint32_t options;
60 const char *dn;
61};
62
63struct gp_ini_param {
64 char *name;
65 char *value;
66};
67
68struct gp_ini_section {
69 char *name;
70 uint16_t num_params;
71 struct gp_ini_param *params;
72};
73
74struct gp_ini_context {
75 uint16_t num_sections;
76 struct gp_ini_section *sections;
77};
78
79NTSTATUS gp_init(TALLOC_CTX *mem_ctx,
80 struct loadparm_context *lp_ctx,
81 struct cli_credentials *creds,
82 struct tevent_context *ev_ctx,
83 struct gp_context **gp_ctx);
84
85
86/* LDAP functions */
87NTSTATUS gp_list_all_gpos(struct gp_context *gp_ctx, struct gp_object ***ret);
88NTSTATUS gp_get_gplinks(struct gp_context *gp_ctx, const char *req_dn, struct gp_link ***ret);
89NTSTATUS gp_list_gpos(struct gp_context *gp_ctx, struct security_token *token, const char ***ret);
90
91NTSTATUS gp_get_gpo_info(struct gp_context *gp_ctx, const char *dn_str, struct gp_object **ret);
92NTSTATUS gp_set_gpo_info(struct gp_context *gp_ctx, const char *dn_str, struct gp_object *gpo);
93NTSTATUS gp_del_gpo(struct gp_context *gp_ctx, const char *dn_str);
94
95
96NTSTATUS gp_get_gplink_options(TALLOC_CTX *mem_ctx, uint32_t flags, const char ***ret);
97NTSTATUS gp_get_gpo_flags(TALLOC_CTX *mem_ctx, uint32_t flags, const char ***ret);
98
99NTSTATUS gp_set_gplink(struct gp_context *gp_ctx, const char *dn_str, struct gp_link *gplink);
100NTSTATUS gp_del_gplink(struct gp_context *gp_ctx, const char *dn_str, const char *gp_dn);
101NTSTATUS gp_get_inheritance(struct gp_context *gp_ctx, const char *dn_str, enum gpo_inheritance *inheritance);
102NTSTATUS gp_set_inheritance(struct gp_context *gp_ctx, const char *dn_str, enum gpo_inheritance inheritance);
103
104NTSTATUS gp_create_ldap_gpo(struct gp_context *gp_ctx, struct gp_object *gpo);
105NTSTATUS gp_set_ads_acl (struct gp_context *gp_ctx, const char *dn_str, const struct security_descriptor *sd);
106NTSTATUS gp_push_gpo (struct gp_context *gp_ctx, const char *local_path, struct gp_object *gpo);
107NTSTATUS gp_set_ldap_gpo(struct gp_context *gp_ctx, struct gp_object *gpo);
108
109/* File system functions */
110NTSTATUS gp_fetch_gpt (struct gp_context *gp_ctx, struct gp_object *gpo, const char **path);
111NTSTATUS gp_create_gpt(struct gp_context *gp_ctx, const char *name, const char *file_sys_path);
112NTSTATUS gp_set_gpt_security_descriptor(struct gp_context *gp_ctx, struct gp_object *gpo, struct security_descriptor *sd);
113NTSTATUS gp_push_gpt(struct gp_context *gp_ctx, const char *local_path,
114 const char *file_sys_path);
115
116/* Ini functions */
117NTSTATUS gp_parse_ini(TALLOC_CTX *mem_ctx, struct gp_context *gp_ctx, const char *filename, struct gp_ini_context **ret);
118NTSTATUS gp_get_ini_string(struct gp_ini_context *ini, const char *section, const char *name, char **ret);
119NTSTATUS gp_get_ini_uint(struct gp_ini_context *ini, const char *section, const char *name, uint32_t *ret);
120
121/* Managing functions */
122NTSTATUS gp_create_gpo (struct gp_context *gp_ctx, const char *display_name, struct gp_object **ret);
123NTSTATUS gp_create_gpt_security_descriptor (TALLOC_CTX *mem_ctx, struct security_descriptor *ds_sd, struct security_descriptor **ret);
124NTSTATUS gp_set_acl (struct gp_context *gp_ctx, const char *dn_str, const struct security_descriptor *sd);
125uint32_t gp_ads_to_dir_access_mask(uint32_t access_mask);
126
127#endif
Note: See TracBrowser for help on using the repository browser.