summaryrefslogtreecommitdiff
path: root/libgpo/gpext/gpext.h
blob: a550f4e02d577ea29df07d0c5b3c6a421dc3c4b4 (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
/*
 *  Unix SMB/CIFS implementation.
 *  Group Policy Support
 *  Copyright (C) Guenther Deschner 2007-2008
 *
 *  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 3 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef __GPEXT_H__
#define __GPEXT_H__

#include "librpc/gen_ndr/winreg.h"

#define KEY_WINLOGON_GPEXT_PATH "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\GPExtensions"

#define SAMBA_SUBSYSTEM_GPEXT "gpext"

#define SMB_GPEXT_INTERFACE_VERSION 1

struct gp_extension {
	struct GUID *guid;
	const char *name;
	struct gp_extension_methods *methods;
	struct gp_extension *prev, *next;
};

struct gp_extension_reg_table {
	const char *val;
	enum winreg_Type type;
	const char *data;
};

struct gp_extension_reg_entry {
	const char *value;
	struct registry_value *data;
};

struct gp_extension_reg_info_entry {
	struct GUID guid;
	size_t num_entries;
	struct gp_extension_reg_entry *entries;
};

struct gp_extension_reg_info {
	size_t num_entries;
	struct gp_extension_reg_info_entry *entries;
};

struct gp_extension_methods {

	NTSTATUS (*initialize)(TALLOC_CTX *mem_ctx);

	NTSTATUS (*process_group_policy)(TALLOC_CTX *mem_ctx,
					 uint32_t flags,
					 struct registry_key *root_key,
					 const struct security_token *token,
					 struct GROUP_POLICY_OBJECT *gpo,
					 const char *extension_guid,
					 const char *snapin_guid);

	NTSTATUS (*process_group_policy2)(TALLOC_CTX *mem_ctx,
					 uint32_t flags,
					 const struct security_token *token,
					 struct GROUP_POLICY_OBJECT *gpo_list,
					 const char *extension_guid);

	NTSTATUS (*get_reg_config)(TALLOC_CTX *mem_ctx,
				   struct gp_extension_reg_info **info);

	NTSTATUS (*shutdown)(void);
};

/* The following definitions come from libgpo/gpext/gpext.c  */

struct gp_extension *get_gp_extension_list(void);
NTSTATUS unregister_gp_extension(const char *name);
NTSTATUS register_gp_extension(TALLOC_CTX *gpext_ctx,
			       int version,
			       const char *name,
			       const char *guid,
			       struct gp_extension_methods *methods);
NTSTATUS gp_ext_info_add_entry(TALLOC_CTX *mem_ctx,
			       const char *module,
			       const char *ext_guid,
			       struct gp_extension_reg_table *table,
			       struct gp_extension_reg_info *info);
NTSTATUS shutdown_gp_extensions(void);
NTSTATUS init_gp_extensions(TALLOC_CTX *mem_ctx);
NTSTATUS free_gp_extensions(void);
void debug_gpext_header(int lvl,
			const char *name,
			uint32_t flags,
			struct GROUP_POLICY_OBJECT *gpo,
			const char *extension_guid,
			const char *snapin_guid);
NTSTATUS process_gpo_list_with_extension(
			   TALLOC_CTX *mem_ctx,
			   uint32_t flags,
			   const struct security_token *token,
			   struct GROUP_POLICY_OBJECT *gpo_list,
			   const char *extension_guid,
			   const char *snapin_guid);
NTSTATUS gpext_process_extension(TALLOC_CTX *mem_ctx,
				 uint32_t flags,
				 const struct security_token *token,
				 struct registry_key *root_key,
				 struct GROUP_POLICY_OBJECT *gpo,
				 const char *extension_guid,
				 const char *snapin_guid);


#endif /* __GPEXT_H__ */