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/>.
21 #include "../libgpo/gpo.h"
24 #define DEFAULT_DOMAIN_POLICY "Default Domain Policy"
25 #define DEFAULT_DOMAIN_CONTROLLERS_POLICY "Default Domain Controllers Policy"
27 /* should we store a parsed guid ? */
30 const char *guid_string;
34 static struct gp_table gpo_default_policy[] = {
35 { DEFAULT_DOMAIN_POLICY,
36 "31B2F340-016D-11D2-945F-00C04FB984F9" },
37 { DEFAULT_DOMAIN_CONTROLLERS_POLICY,
38 "6AC1786C-016F-11D2-945F-00C04fB984F9" },
43 /* the following is seen in gPCMachineExtensionNames / gPCUserExtensionNames */
45 static struct gp_table gpo_cse_extensions[] = {
46 /* used to be "Administrative Templates Extension" */
47 /* "Registry Settings"
48 (http://support.microsoft.com/kb/216357/EN-US/) */
49 { "Registry Settings",
50 GP_EXT_GUID_REGISTRY },
51 { "Microsoft Disc Quota",
52 "3610EDA5-77EF-11D2-8DC5-00C04FA31A66" },
54 "B1BE8D72-6EAC-11D2-A4EA-00C04F79F83A" },
55 { "Folder Redirection",
56 "25537BA6-77A8-11D2-9B6C-0000F8080861" },
58 "E437BC1C-AA7D-11D2-A382-00C04F991E27" },
59 { "Internet Explorer Branding",
60 "A2E30F80-D7DE-11d2-BBDE-00C04F86AE3B" },
61 { "QoS Packet Scheduler",
62 "426031c0-0b47-4852-b0ca-ac3d37bfcb39" },
64 GP_EXT_GUID_SCRIPTS },
66 GP_EXT_GUID_SECURITY },
67 { "Software Installation",
68 "C6DC5466-785A-11D2-84D0-00C04FB169F7" },
69 { "Wireless Group Policy",
70 "0ACDD40C-75AC-BAA0-BF6DE7E7FE63" },
71 { "Application Management",
72 "C6DC5466-785A-11D2-84D0-00C04FB169F7" },
74 "3060E8D0-7020-11D2-842D-00C04FA372D4" },
79 static struct gp_table gpo_cse_snapin_extensions[] = {
80 { "Administrative Templates",
81 "0F6B957D-509E-11D1-A7CC-0000F87571E3" },
83 "53D6AB1D-2488-11D1-A28C-00C04FB94F17" },
84 { "EFS recovery policy processing",
85 "B1BE8D72-6EAC-11D2-A4EA-00C04F79F83A" },
86 { "Folder Redirection policy processing",
87 "25537BA6-77A8-11D2-9B6C-0000F8080861" },
88 { "Folder Redirection",
89 "88E729D6-BDC1-11D1-BD2A-00C04FB9603F" },
90 { "Registry policy processing",
91 "35378EAC-683F-11D2-A89A-00C04FBBCFA2" },
92 { "Remote Installation Services",
93 "3060E8CE-7020-11D2-842D-00C04FA372D4" },
94 { "Security Settings",
95 "803E14A0-B4FB-11D0-A0D0-00A0C90F574B" },
96 { "Security policy processing",
97 "827D319E-6EAC-11D2-A4EA-00C04F79F83A" },
99 "3060E8D0-7020-11D2-842D-00C04FA372D4" },
101 "53D6AB1B-2488-11D1-A28C-00C04FB94F17" },
105 /****************************************************************
106 ****************************************************************/
108 static const char *name_to_guid_string(const char *name,
109 struct gp_table *table)
113 for (i = 0; table[i].name; i++) {
114 if (strequal(name, table[i].name)) {
115 return table[i].guid_string;
122 /****************************************************************
123 ****************************************************************/
125 static const char *guid_string_to_name(const char *guid_string,
126 struct gp_table *table)
130 for (i = 0; table[i].guid_string; i++) {
131 if (strequal(guid_string, table[i].guid_string)) {
132 return table[i].name;
139 /****************************************************************
140 ****************************************************************/
142 static const char *snapin_guid_string_to_name(const char *guid_string,
143 struct gp_table *table)
146 for (i = 0; table[i].guid_string; i++) {
147 if (strequal(guid_string, table[i].guid_string)) {
148 return table[i].name;
155 static const char *default_gpo_name_to_guid_string(const char *name)
157 return name_to_guid_string(name, gpo_default_policy);
160 static const char *default_gpo_guid_string_to_name(const char *guid)
162 return guid_string_to_name(guid, gpo_default_policy);
166 /****************************************************************
167 ****************************************************************/
169 const char *cse_gpo_guid_string_to_name(const char *guid)
171 return guid_string_to_name(guid, gpo_cse_extensions);
174 /****************************************************************
175 ****************************************************************/
177 const char *cse_gpo_name_to_guid_string(const char *name)
179 return name_to_guid_string(name, gpo_cse_extensions);
182 /****************************************************************
183 ****************************************************************/
185 const char *cse_snapin_gpo_guid_string_to_name(const char *guid)
187 return snapin_guid_string_to_name(guid, gpo_cse_snapin_extensions);
190 /****************************************************************
191 ****************************************************************/
193 void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel)
195 int lvl = debuglevel;
198 if (gp_ext == NULL) {
202 DEBUG(lvl,("\t---------------------\n\n"));
203 DEBUGADD(lvl,("\tname:\t\t\t%s\n", gp_ext->gp_extension));
205 for (i=0; i< gp_ext->num_exts; i++) {
207 DEBUGADD(lvl,("\textension:\t\t\t%s\n",
208 gp_ext->extensions_guid[i]));
209 DEBUGADD(lvl,("\textension (name):\t\t\t%s\n",
210 gp_ext->extensions[i]));
212 DEBUGADD(lvl,("\tsnapin:\t\t\t%s\n",
213 gp_ext->snapins_guid[i]));
214 DEBUGADD(lvl,("\tsnapin (name):\t\t\t%s\n",
215 gp_ext->snapins[i]));
221 /****************************************************************
222 ****************************************************************/
224 void dump_gpo(ADS_STRUCT *ads,
226 struct GROUP_POLICY_OBJECT *gpo,
229 int lvl = debuglevel;
235 DEBUG(lvl,("---------------------\n\n"));
237 DEBUGADD(lvl,("name:\t\t\t%s\n", gpo->name));
238 DEBUGADD(lvl,("displayname:\t\t%s\n", gpo->display_name));
239 DEBUGADD(lvl,("version:\t\t%d (0x%08x)\n", gpo->version, gpo->version));
240 DEBUGADD(lvl,("version_user:\t\t%d (0x%04x)\n",
241 GPO_VERSION_USER(gpo->version),
242 GPO_VERSION_USER(gpo->version)));
243 DEBUGADD(lvl,("version_machine:\t%d (0x%04x)\n",
244 GPO_VERSION_MACHINE(gpo->version),
245 GPO_VERSION_MACHINE(gpo->version)));
246 DEBUGADD(lvl,("filesyspath:\t\t%s\n", gpo->file_sys_path));
247 DEBUGADD(lvl,("dspath:\t\t%s\n", gpo->ds_path));
249 DEBUGADD(lvl,("options:\t\t%d ", gpo->options));
250 switch (gpo->options) {
251 case GPFLAGS_ALL_ENABLED:
252 DEBUGADD(lvl,("GPFLAGS_ALL_ENABLED\n"));
254 case GPFLAGS_USER_SETTINGS_DISABLED:
255 DEBUGADD(lvl,("GPFLAGS_USER_SETTINGS_DISABLED\n"));
257 case GPFLAGS_MACHINE_SETTINGS_DISABLED:
258 DEBUGADD(lvl,("GPFLAGS_MACHINE_SETTINGS_DISABLED\n"));
260 case GPFLAGS_ALL_DISABLED:
261 DEBUGADD(lvl,("GPFLAGS_ALL_DISABLED\n"));
264 DEBUGADD(lvl,("unknown option: %d\n", gpo->options));
268 DEBUGADD(lvl,("link:\t\t\t%s\n", gpo->link));
269 DEBUGADD(lvl,("link_type:\t\t%d ", gpo->link_type));
270 switch (gpo->link_type) {
272 DEBUGADD(lvl,("GP_LINK_UNKOWN\n"));
275 DEBUGADD(lvl,("GP_LINK_OU\n"));
278 DEBUGADD(lvl,("GP_LINK_DOMAIN\n"));
281 DEBUGADD(lvl,("GP_LINK_SITE\n"));
283 case GP_LINK_MACHINE:
284 DEBUGADD(lvl,("GP_LINK_MACHINE\n"));
290 DEBUGADD(lvl,("machine_extensions:\t%s\n", gpo->machine_extensions));
292 if (gpo->machine_extensions) {
294 struct GP_EXT *gp_ext = NULL;
296 if (!ads_parse_gp_ext(mem_ctx, gpo->machine_extensions,
300 dump_gp_ext(gp_ext, lvl);
303 DEBUGADD(lvl,("user_extensions:\t%s\n", gpo->user_extensions));
305 if (gpo->user_extensions) {
307 struct GP_EXT *gp_ext = NULL;
309 if (!ads_parse_gp_ext(mem_ctx, gpo->user_extensions,
313 dump_gp_ext(gp_ext, lvl);
316 DEBUGADD(lvl,("security descriptor:\n"));
318 ads_disp_sd(ads, mem_ctx, gpo->security_descriptor);
321 /****************************************************************
322 ****************************************************************/
324 void dump_gpo_list(ADS_STRUCT *ads,
326 struct GROUP_POLICY_OBJECT *gpo_list,
329 struct GROUP_POLICY_OBJECT *gpo = NULL;
331 for (gpo = gpo_list; gpo; gpo = gpo->next) {
332 dump_gpo(ads, mem_ctx, gpo, debuglevel);
336 /****************************************************************
337 ****************************************************************/
339 void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link)
345 if (gp_link == NULL) {
349 DEBUG(lvl,("---------------------\n\n"));
351 DEBUGADD(lvl,("gplink: %s\n", gp_link->gp_link));
352 DEBUGADD(lvl,("gpopts: %d ", gp_link->gp_opts));
353 switch (gp_link->gp_opts) {
354 case GPOPTIONS_INHERIT:
355 DEBUGADD(lvl,("GPOPTIONS_INHERIT\n"));
357 case GPOPTIONS_BLOCK_INHERITANCE:
358 DEBUGADD(lvl,("GPOPTIONS_BLOCK_INHERITANCE\n"));
364 DEBUGADD(lvl,("num links: %d\n", gp_link->num_links));
366 for (i = 0; i < gp_link->num_links; i++) {
368 DEBUGADD(lvl,("---------------------\n\n"));
370 DEBUGADD(lvl,("link: #%d\n", i + 1));
371 DEBUGADD(lvl,("name: %s\n", gp_link->link_names[i]));
373 DEBUGADD(lvl,("opt: %d ", gp_link->link_opts[i]));
374 if (gp_link->link_opts[i] & GPO_LINK_OPT_ENFORCED) {
375 DEBUGADD(lvl,("GPO_LINK_OPT_ENFORCED "));
377 if (gp_link->link_opts[i] & GPO_LINK_OPT_DISABLED) {
378 DEBUGADD(lvl,("GPO_LINK_OPT_DISABLED"));
380 DEBUGADD(lvl,("\n"));
382 if (ads != NULL && mem_ctx != NULL) {
384 struct GROUP_POLICY_OBJECT gpo;
386 status = ads_get_gpo(ads, mem_ctx,
387 gp_link->link_names[i],
389 if (!ADS_ERR_OK(status)) {
390 DEBUG(lvl,("get gpo for %s failed: %s\n",
391 gp_link->link_names[i],
392 ads_errstr(status)));
395 dump_gpo(ads, mem_ctx, &gpo, lvl);
400 #endif /* HAVE_LDAP */
402 /****************************************************************
403 ****************************************************************/
405 static bool gpo_get_gp_ext_from_gpo(TALLOC_CTX *mem_ctx,
407 struct GROUP_POLICY_OBJECT *gpo,
408 struct GP_EXT **gp_ext)
410 ZERO_STRUCTP(*gp_ext);
412 if (flags & GPO_INFO_FLAG_MACHINE) {
414 if (gpo->machine_extensions) {
416 if (!ads_parse_gp_ext(mem_ctx, gpo->machine_extensions,
423 if (gpo->user_extensions) {
425 if (!ads_parse_gp_ext(mem_ctx, gpo->user_extensions,
435 /****************************************************************
436 ****************************************************************/
438 ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads,
440 const struct nt_user_token *token,
441 struct registry_key *root_key,
442 struct GROUP_POLICY_OBJECT *gpo,
443 const char *extension_guid_filter,
446 struct GP_EXT *gp_ext = NULL;
449 DEBUG(10,("gpo_process_a_gpo: processing gpo %s (%s)\n",
450 gpo->name, gpo->display_name));
451 if (extension_guid_filter) {
452 DEBUGADD(10,("gpo_process_a_gpo: using filter %s (%s)\n",
453 extension_guid_filter,
454 cse_gpo_guid_string_to_name(extension_guid_filter)));
457 if (!gpo_get_gp_ext_from_gpo(mem_ctx, flags, gpo, &gp_ext)) {
458 return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER);
461 if (!gp_ext || !gp_ext->num_exts) {
462 if (flags & GPO_INFO_FLAG_VERBOSE) {
463 DEBUG(0,("gpo_process_a_gpo: "
464 "no policies in %s (%s) for this extension\n",
465 gpo->name, gpo->display_name));
470 for (i=0; i<gp_ext->num_exts; i++) {
474 if (extension_guid_filter &&
475 !strequal(extension_guid_filter,
476 gp_ext->extensions_guid[i])) {
480 ntstatus = gpext_process_extension(ads, mem_ctx,
481 flags, token, root_key, gpo,
482 gp_ext->extensions_guid[i],
483 gp_ext->snapins_guid[i]);
484 if (!NT_STATUS_IS_OK(ntstatus)) {
485 ADS_ERROR_NT(ntstatus);
492 /****************************************************************
493 ****************************************************************/
495 static ADS_STATUS gpo_process_gpo_list_by_ext(ADS_STRUCT *ads,
497 const struct nt_user_token *token,
498 struct registry_key *root_key,
499 struct GROUP_POLICY_OBJECT *gpo_list,
500 const char *extensions_guid,
504 struct GROUP_POLICY_OBJECT *gpo;
506 for (gpo = gpo_list; gpo; gpo = gpo->next) {
508 if (gpo->link_type == GP_LINK_LOCAL) {
513 /* FIXME: we need to pass down the *list* down to the
514 * extension, otherwise we cannot store the e.g. the *list* of
515 * logon-scripts correctly (for more then one GPO) */
517 status = gpo_process_a_gpo(ads, mem_ctx, token, root_key,
518 gpo, extensions_guid, flags);
520 if (!ADS_ERR_OK(status)) {
521 DEBUG(0,("failed to process gpo by ext: %s\n",
522 ads_errstr(status)));
530 /****************************************************************
531 ****************************************************************/
533 ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
535 const struct nt_user_token *token,
536 struct GROUP_POLICY_OBJECT *gpo_list,
537 const char *extensions_guid_filter,
540 ADS_STATUS status = ADS_SUCCESS;
541 struct gp_extension *gp_ext_list = NULL;
542 struct gp_extension *gp_ext = NULL;
543 struct registry_key *root_key = NULL;
544 struct gp_registry_context *reg_ctx = NULL;
547 status = ADS_ERROR_NT(init_gp_extensions(mem_ctx));
548 if (!ADS_ERR_OK(status)) {
552 gp_ext_list = get_gp_extension_list();
554 return ADS_ERROR_NT(NT_STATUS_DLL_INIT_FAILED);
557 /* get the key here */
558 if (flags & GPO_LIST_FLAG_MACHINE) {
559 werr = gp_init_reg_ctx(mem_ctx, KEY_HKLM, REG_KEY_WRITE,
563 werr = gp_init_reg_ctx(mem_ctx, KEY_HKCU, REG_KEY_WRITE,
567 if (!W_ERROR_IS_OK(werr)) {
568 gp_free_reg_ctx(reg_ctx);
569 return ADS_ERROR_NT(werror_to_ntstatus(werr));
572 root_key = reg_ctx->curr_key;
574 for (gp_ext = gp_ext_list; gp_ext; gp_ext = gp_ext->next) {
576 const char *guid_str = NULL;
578 guid_str = GUID_string(mem_ctx, gp_ext->guid);
580 status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
584 if (extensions_guid_filter &&
585 (!strequal(guid_str, extensions_guid_filter))) {
589 DEBUG(0,("-------------------------------------------------\n"));
590 DEBUG(0,("gpo_process_gpo_list: processing ext: %s {%s}\n",
591 gp_ext->name, guid_str));
594 status = gpo_process_gpo_list_by_ext(ads, mem_ctx, token,
597 if (!ADS_ERR_OK(status)) {
603 gp_free_reg_ctx(reg_ctx);
604 TALLOC_FREE(root_key);
605 free_gp_extensions();
611 /****************************************************************
612 check wether the version number in a GROUP_POLICY_OBJECT match those of the
613 locally stored version. If not, fetch the required policy via CIFS
614 ****************************************************************/
616 NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
619 struct GROUP_POLICY_OBJECT *gpo,
620 struct cli_state **cli_out)
625 char *nt_path = NULL;
626 char *unix_path = NULL;
627 uint32_t sysvol_gpt_version = 0;
628 char *display_name = NULL;
629 struct cli_state *cli = NULL;
631 result = gpo_explode_filesyspath(mem_ctx, gpo->file_sys_path,
632 &server, &share, &nt_path, &unix_path);
634 if (!NT_STATUS_IS_OK(result)) {
638 result = gpo_get_sysvol_gpt_version(mem_ctx,
642 if (!NT_STATUS_IS_OK(result) &&
643 !NT_STATUS_EQUAL(result, NT_STATUS_NO_SUCH_FILE)) {
644 DEBUG(10,("check_refresh_gpo: "
645 "failed to get local gpt version: %s\n",
650 DEBUG(10,("check_refresh_gpo: versions gpo %d sysvol %d\n",
651 gpo->version, sysvol_gpt_version));
653 /* FIXME: handle GPO_INFO_FLAG_FORCED_REFRESH from flags */
655 while (gpo->version > sysvol_gpt_version) {
657 DEBUG(1,("check_refresh_gpo: need to refresh GPO\n"));
659 if (*cli_out == NULL) {
661 result = cli_full_connection(&cli,
663 ads->config.ldap_server_name,
667 ads->auth.user_name, NULL,
669 CLI_FULL_CONNECTION_USE_KERBEROS |
670 CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS,
672 if (!NT_STATUS_IS_OK(result)) {
673 DEBUG(10,("check_refresh_gpo: "
674 "failed to connect: %s\n",
682 result = gpo_fetch_files(mem_ctx, *cli_out, gpo);
683 if (!NT_STATUS_IS_OK(result)) {
687 result = gpo_get_sysvol_gpt_version(mem_ctx,
691 if (!NT_STATUS_IS_OK(result)) {
692 DEBUG(10,("check_refresh_gpo: "
693 "failed to get local gpt version: %s\n",
698 if (gpo->version == sysvol_gpt_version) {
703 DEBUG(10,("Name:\t\t\t%s (%s)\n", gpo->display_name, gpo->name));
704 DEBUGADD(10,("sysvol GPT version:\t%d (user: %d, machine: %d)\n",
706 GPO_VERSION_USER(sysvol_gpt_version),
707 GPO_VERSION_MACHINE(sysvol_gpt_version)));
708 DEBUGADD(10,("LDAP GPO version:\t%d (user: %d, machine: %d)\n",
710 GPO_VERSION_USER(gpo->version),
711 GPO_VERSION_MACHINE(gpo->version)));
712 DEBUGADD(10,("LDAP GPO link:\t\t%s\n", gpo->link));
714 result = NT_STATUS_OK;
721 /****************************************************************
722 check wether the version numbers in the gpo_list match the locally stored, if
723 not, go and get each required GPO via CIFS
724 ****************************************************************/
726 NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
729 struct GROUP_POLICY_OBJECT *gpo_list)
731 NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
732 struct cli_state *cli = NULL;
733 struct GROUP_POLICY_OBJECT *gpo;
736 return NT_STATUS_INVALID_PARAMETER;
739 for (gpo = gpo_list; gpo; gpo = gpo->next) {
741 result = check_refresh_gpo(ads, mem_ctx, flags, gpo, &cli);
742 if (!NT_STATUS_IS_OK(result)) {
747 result = NT_STATUS_OK;
757 /****************************************************************
758 ****************************************************************/
760 NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx,
761 struct GROUP_POLICY_OBJECT *gpo,
764 char *server, *share, *nt_path;
765 return gpo_explode_filesyspath(mem_ctx, gpo->file_sys_path,
766 &server, &share, &nt_path, unix_path);
769 /****************************************************************
770 ****************************************************************/
772 char *gpo_flag_str(uint32_t flags)
780 if (flags & GPO_INFO_FLAG_SLOWLINK)
781 fstrcat(str, "GPO_INFO_FLAG_SLOWLINK ");
782 if (flags & GPO_INFO_FLAG_VERBOSE)
783 fstrcat(str, "GPO_INFO_FLAG_VERBOSE ");
784 if (flags & GPO_INFO_FLAG_SAFEMODE_BOOT)
785 fstrcat(str, "GPO_INFO_FLAG_SAFEMODE_BOOT ");
786 if (flags & GPO_INFO_FLAG_NOCHANGES)
787 fstrcat(str, "GPO_INFO_FLAG_NOCHANGES ");
788 if (flags & GPO_INFO_FLAG_MACHINE)
789 fstrcat(str, "GPO_INFO_FLAG_MACHINE ");
790 if (flags & GPO_INFO_FLAG_LOGRSOP_TRANSITION)
791 fstrcat(str, "GPO_INFO_FLAG_LOGRSOP_TRANSITION ");
792 if (flags & GPO_INFO_FLAG_LINKTRANSITION)
793 fstrcat(str, "GPO_INFO_FLAG_LINKTRANSITION ");
794 if (flags & GPO_INFO_FLAG_FORCED_REFRESH)
795 fstrcat(str, "GPO_INFO_FLAG_FORCED_REFRESH ");
796 if (flags & GPO_INFO_FLAG_BACKGROUND)
797 fstrcat(str, "GPO_INFO_FLAG_BACKGROUND ");
802 /****************************************************************
803 ****************************************************************/
805 NTSTATUS gp_find_file(TALLOC_CTX *mem_ctx,
807 const char *filename,
809 const char **filename_out)
811 const char *tmp = NULL;
813 const char *path = NULL;
815 if (flags & GPO_LIST_FLAG_MACHINE) {
821 tmp = talloc_asprintf(mem_ctx, "%s/%s/%s", filename,
823 NT_STATUS_HAVE_NO_MEMORY(tmp);
825 if (stat(tmp, &sbuf) == 0) {
830 path = talloc_strdup_upper(mem_ctx, path);
831 NT_STATUS_HAVE_NO_MEMORY(path);
833 tmp = talloc_asprintf(mem_ctx, "%s/%s/%s", filename,
835 NT_STATUS_HAVE_NO_MEMORY(tmp);
837 if (sys_stat(tmp, &sbuf) == 0) {
842 return NT_STATUS_NO_SUCH_FILE;
845 /****************************************************************
846 ****************************************************************/
848 ADS_STATUS gp_get_machine_token(ADS_STRUCT *ads,
851 struct nt_user_token **token)
853 struct nt_user_token *ad_token = NULL;
858 return ADS_ERROR_NT(NT_STATUS_NOT_SUPPORTED);
860 status = ads_get_sid_token(ads, mem_ctx, dn, &ad_token);
861 if (!ADS_ERR_OK(status)) {
865 ntstatus = merge_nt_token(mem_ctx, ad_token, get_system_token(),
867 if (!NT_STATUS_IS_OK(ntstatus)) {
868 return ADS_ERROR_NT(ntstatus);