| 1 | /* | 
|---|
| 2 | *  Unix SMB/CIFS implementation. | 
|---|
| 3 | *  Group Policy Object Support | 
|---|
| 4 | *  Copyright (C) Guenther Deschner 2005-2007 | 
|---|
| 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 3 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, see <http://www.gnu.org/licenses/>. | 
|---|
| 18 | */ | 
|---|
| 19 |  | 
|---|
| 20 | enum GPO_LINK_TYPE { | 
|---|
| 21 | GP_LINK_UNKOWN  = 0, | 
|---|
| 22 | GP_LINK_MACHINE = 1, | 
|---|
| 23 | GP_LINK_SITE    = 2, | 
|---|
| 24 | GP_LINK_DOMAIN  = 3, | 
|---|
| 25 | GP_LINK_OU      = 4 | 
|---|
| 26 | }; | 
|---|
| 27 |  | 
|---|
| 28 | /* GPO_OPTIONS */ | 
|---|
| 29 | #define GPO_FLAG_DISABLE        0x00000001 | 
|---|
| 30 | #define GPO_FLAG_FORCE          0x00000002 | 
|---|
| 31 |  | 
|---|
| 32 | /* GPO_LIST_FLAGS */ | 
|---|
| 33 | #define GPO_LIST_FLAG_MACHINE   0x00000001 | 
|---|
| 34 | #define GPO_LIST_FLAG_SITEONLY  0x00000002 | 
|---|
| 35 |  | 
|---|
| 36 | #define GPO_VERSION_USER(x) (x >> 16) | 
|---|
| 37 | #define GPO_VERSION_MACHINE(x) (x & 0xffff) | 
|---|
| 38 |  | 
|---|
| 39 | struct GROUP_POLICY_OBJECT { | 
|---|
| 40 | uint32_t options;       /* GPFLAGS_* */ | 
|---|
| 41 | uint32_t version; | 
|---|
| 42 | const char *ds_path; | 
|---|
| 43 | const char *file_sys_path; | 
|---|
| 44 | const char *display_name; | 
|---|
| 45 | const char *name; | 
|---|
| 46 | const char *link; | 
|---|
| 47 | enum GPO_LINK_TYPE link_type; | 
|---|
| 48 | const char *user_extensions; | 
|---|
| 49 | const char *machine_extensions; | 
|---|
| 50 | SEC_DESC *security_descriptor; | 
|---|
| 51 | struct GROUP_POLICY_OBJECT *next, *prev; | 
|---|
| 52 | }; | 
|---|
| 53 |  | 
|---|
| 54 | /* the following is seen on the DS (see adssearch.pl for details) */ | 
|---|
| 55 |  | 
|---|
| 56 | /* the type field in a 'gPLink', the same as GPO_FLAG ? */ | 
|---|
| 57 | #define GPO_LINK_OPT_NONE       0x00000000 | 
|---|
| 58 | #define GPO_LINK_OPT_DISABLED   0x00000001 | 
|---|
| 59 | #define GPO_LINK_OPT_ENFORCED   0x00000002 | 
|---|
| 60 |  | 
|---|
| 61 | /* GPO_LINK_OPT_ENFORCED takes precedence over GPOPTIONS_BLOCK_INHERITANCE */ | 
|---|
| 62 |  | 
|---|
| 63 | /* 'gPOptions', maybe a bitmask as well */ | 
|---|
| 64 | enum GPO_INHERIT { | 
|---|
| 65 | GPOPTIONS_INHERIT               = 0, | 
|---|
| 66 | GPOPTIONS_BLOCK_INHERITANCE     = 1 | 
|---|
| 67 | }; | 
|---|
| 68 |  | 
|---|
| 69 | /* 'flags' in a 'groupPolicyContainer' object */ | 
|---|
| 70 | #define GPFLAGS_ALL_ENABLED                     0x00000000 | 
|---|
| 71 | #define GPFLAGS_USER_SETTINGS_DISABLED          0x00000001 | 
|---|
| 72 | #define GPFLAGS_MACHINE_SETTINGS_DISABLED       0x00000002 | 
|---|
| 73 | #define GPFLAGS_ALL_DISABLED (GPFLAGS_USER_SETTINGS_DISABLED | \ | 
|---|
| 74 | GPFLAGS_MACHINE_SETTINGS_DISABLED) | 
|---|
| 75 |  | 
|---|
| 76 | struct GP_LINK { | 
|---|
| 77 | const char *gp_link;    /* raw link name */ | 
|---|
| 78 | uint32_t gp_opts;               /* inheritance options GPO_INHERIT */ | 
|---|
| 79 | uint32_t num_links;     /* number of links */ | 
|---|
| 80 | char **link_names;      /* array of parsed link names */ | 
|---|
| 81 | uint32_t *link_opts;    /* array of parsed link opts GPO_LINK_OPT_* */ | 
|---|
| 82 | }; | 
|---|
| 83 |  | 
|---|
| 84 | struct GP_EXT { | 
|---|
| 85 | const char *gp_extension;       /* raw extension name */ | 
|---|
| 86 | uint32_t num_exts; | 
|---|
| 87 | char **extensions; | 
|---|
| 88 | char **extensions_guid; | 
|---|
| 89 | char **snapins; | 
|---|
| 90 | char **snapins_guid; | 
|---|
| 91 | }; | 
|---|
| 92 |  | 
|---|
| 93 | #define GPO_CACHE_DIR "gpo_cache" | 
|---|
| 94 | #define GPT_INI "GPT.INI" | 
|---|
| 95 |  | 
|---|
| 96 | #define GP_EXT_GUID_SECURITY "827D319E-6EAC-11D2-A4EA-00C04F79F83A" | 
|---|
| 97 | #define GP_EXT_GUID_REGISTRY "35378EAC-683F-11D2-A89A-00C04FBBCFA2" | 
|---|
| 98 | #define GP_EXT_GUID_SCRIPTS  "42B5FAAE-6536-11D2-AE5A-0000F87571E3" | 
|---|