431702e300131cba0a3b34785c98cd82da27e9d7
[kai/samba-autobuild/.git] / source / include / gpo.h
1 /* 
2  *  Unix SMB/CIFS implementation.
3  *  Group Policy Object Support
4  *  Copyright (C) Guenther Deschner 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
22 enum GPO_LINK_TYPE {
23         GP_LINK_UNKOWN  = 0,
24         GP_LINK_MACHINE = 1,
25         GP_LINK_SITE    = 2,
26         GP_LINK_DOMAIN  = 3,
27         GP_LINK_OU      = 4
28 };
29
30 /* GPO_OPTIONS */
31 #define GPO_FLAG_DISABLE        0x00000001
32 #define GPO_FLAG_FORCE          0x00000002
33
34 /* GPO_LIST_FLAGS */
35 #define GPO_LIST_FLAG_MACHINE   0x00000001
36 #define GPO_LIST_FLAG_SITEONLY  0x00000002
37
38 #define GPO_VERSION_USER(x) (x >> 16)
39 #define GPO_VERSION_MACHINE(x) (x & 0xffff)
40
41 struct GROUP_POLICY_OBJECT {
42         uint32 options; /* GPFLAGS_* */ 
43         uint32 version;
44         const char *ds_path;
45         const char *file_sys_path;
46         const char *display_name;
47         const char *name;
48         const char *link;
49         uint32 link_type; /* GPO_LINK_TYPE */
50         const char *user_extensions;
51         const char *machine_extensions;
52         SEC_DESC *security_descriptor;
53         struct GROUP_POLICY_OBJECT *next, *prev;
54 };
55
56 /* the following is seen on the DS (see adssearch.pl for details) */
57
58 /* the type field in a 'gPLink', the same as GPO_FLAG ? */
59 #define GPO_LINK_OPT_NONE       0x00000000
60 #define GPO_LINK_OPT_DISABLED   0x00000001
61 #define GPO_LINK_OPT_ENFORCED   0x00000002
62
63 /* GPO_LINK_OPT_ENFORCED takes precedence over GPOPTIONS_BLOCK_INHERITANCE */
64
65 /* 'gPOptions', maybe a bitmask as well */
66 enum GPO_INHERIT {
67         GPOPTIONS_INHERIT               = 0,
68         GPOPTIONS_BLOCK_INHERITANCE     = 1
69 };
70
71 /* 'flags' in a 'groupPolicyContainer' object */
72 #define GPFLAGS_ALL_ENABLED                     0x00000000
73 #define GPFLAGS_USER_SETTINGS_DISABLED          0x00000001
74 #define GPFLAGS_MACHINE_SETTINGS_DISABLED       0x00000002
75 #define GPFLAGS_ALL_DISABLED (GPFLAGS_USER_SETTINGS_DISABLED | \
76                               GPFLAGS_MACHINE_SETTINGS_DISABLED)
77
78 struct GP_LINK {
79         const char *gp_link;    /* raw link name */
80         uint32 gp_opts;         /* inheritance options GPO_INHERIT */
81         uint32 num_links;       /* number of links */
82         char **link_names;      /* array of parsed link names */
83         uint32 *link_opts;      /* array of parsed link opts GPO_LINK_OPT_* */
84 };
85
86 struct GP_EXT {
87         const char *gp_extension;       /* raw extension name */
88         uint32 num_exts;
89         char **extensions;
90         char **extensions_guid;
91         char **snapins;
92         char **snapins_guid;
93 };
94
95 #define GPO_CACHE_DIR "gpo_cache"
96 #define GPT_INI "GPT.INI"
97
98 struct GPO_SID_TOKEN {
99         DOM_SID object_sid;
100         DOM_SID primary_group_sid;
101         size_t num_token_sids;
102         DOM_SID *token_sids;
103 };