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 "librpc/gen_ndr/ndr_misc.h"
22 #if _SAMBA_BUILD_ == 4
23 #include "../libgpo/gpo.h"
24 #include "source4/libgpo/ads_convenience.h"
28 #define DEFAULT_DOMAIN_POLICY "Default Domain Policy"
29 #define DEFAULT_DOMAIN_CONTROLLERS_POLICY "Default Domain Controllers Policy"
31 /* should we store a parsed guid ? */
34 const char *guid_string;
38 static struct gp_table gpo_default_policy[] = {
39 { DEFAULT_DOMAIN_POLICY,
40 "31B2F340-016D-11D2-945F-00C04FB984F9" },
41 { DEFAULT_DOMAIN_CONTROLLERS_POLICY,
42 "6AC1786C-016F-11D2-945F-00C04fB984F9" },
47 /* the following is seen in gPCMachineExtensionNames / gPCUserExtensionNames */
49 static struct gp_table gpo_cse_extensions[] = {
50 /* used to be "Administrative Templates Extension" */
51 /* "Registry Settings"
52 (http://support.microsoft.com/kb/216357/EN-US/) */
53 { "Registry Settings",
54 GP_EXT_GUID_REGISTRY },
55 { "Microsoft Disc Quota",
56 "3610EDA5-77EF-11D2-8DC5-00C04FA31A66" },
58 "B1BE8D72-6EAC-11D2-A4EA-00C04F79F83A" },
59 { "Folder Redirection",
60 "25537BA6-77A8-11D2-9B6C-0000F8080861" },
62 "E437BC1C-AA7D-11D2-A382-00C04F991E27" },
63 { "Internet Explorer Branding",
64 "A2E30F80-D7DE-11d2-BBDE-00C04F86AE3B" },
65 { "QoS Packet Scheduler",
66 "426031c0-0b47-4852-b0ca-ac3d37bfcb39" },
68 GP_EXT_GUID_SCRIPTS },
70 GP_EXT_GUID_SECURITY },
71 { "Software Installation",
72 "C6DC5466-785A-11D2-84D0-00C04FB169F7" },
73 { "Wireless Group Policy",
74 "0ACDD40C-75AC-BAA0-BF6DE7E7FE63" },
75 { "Application Management",
76 "C6DC5466-785A-11D2-84D0-00C04FB169F7" },
78 "3060E8D0-7020-11D2-842D-00C04FA372D4" },
83 static struct gp_table gpo_cse_snapin_extensions[] = {
84 { "Administrative Templates",
85 "0F6B957D-509E-11D1-A7CC-0000F87571E3" },
87 "53D6AB1D-2488-11D1-A28C-00C04FB94F17" },
88 { "EFS recovery policy processing",
89 "B1BE8D72-6EAC-11D2-A4EA-00C04F79F83A" },
90 { "Folder Redirection policy processing",
91 "25537BA6-77A8-11D2-9B6C-0000F8080861" },
92 { "Folder Redirection",
93 "88E729D6-BDC1-11D1-BD2A-00C04FB9603F" },
94 { "Registry policy processing",
95 "35378EAC-683F-11D2-A89A-00C04FBBCFA2" },
96 { "Remote Installation Services",
97 "3060E8CE-7020-11D2-842D-00C04FA372D4" },
98 { "Security Settings",
99 "803E14A0-B4FB-11D0-A0D0-00A0C90F574B" },
100 { "Security policy processing",
101 "827D319E-6EAC-11D2-A4EA-00C04F79F83A" },
103 "3060E8D0-7020-11D2-842D-00C04FA372D4" },
105 "53D6AB1B-2488-11D1-A28C-00C04FB94F17" },
109 /****************************************************************
110 ****************************************************************/
112 static const char *name_to_guid_string(const char *name,
113 struct gp_table *table)
117 for (i = 0; table[i].name; i++) {
118 if (strequal(name, table[i].name)) {
119 return table[i].guid_string;
126 /****************************************************************
127 ****************************************************************/
129 static const char *guid_string_to_name(const char *guid_string,
130 struct gp_table *table)
134 for (i = 0; table[i].guid_string; i++) {
135 if (strequal(guid_string, table[i].guid_string)) {
136 return table[i].name;
143 /****************************************************************
144 ****************************************************************/
146 static const char *snapin_guid_string_to_name(const char *guid_string,
147 struct gp_table *table)
150 for (i = 0; table[i].guid_string; i++) {
151 if (strequal(guid_string, table[i].guid_string)) {
152 return table[i].name;
159 static const char *default_gpo_name_to_guid_string(const char *name)
161 return name_to_guid_string(name, gpo_default_policy);
164 static const char *default_gpo_guid_string_to_name(const char *guid)
166 return guid_string_to_name(guid, gpo_default_policy);
170 /****************************************************************
171 ****************************************************************/
173 const char *cse_gpo_guid_string_to_name(const char *guid)
175 return guid_string_to_name(guid, gpo_cse_extensions);
178 /****************************************************************
179 ****************************************************************/
181 const char *cse_gpo_name_to_guid_string(const char *name)
183 return name_to_guid_string(name, gpo_cse_extensions);
186 /****************************************************************
187 ****************************************************************/
189 const char *cse_snapin_gpo_guid_string_to_name(const char *guid)
191 return snapin_guid_string_to_name(guid, gpo_cse_snapin_extensions);
194 /****************************************************************
195 ****************************************************************/
197 void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel)
199 int lvl = debuglevel;
202 if (gp_ext == NULL) {
206 DEBUG(lvl,("\t---------------------\n\n"));
207 DEBUGADD(lvl,("\tname:\t\t\t%s\n", gp_ext->gp_extension));
209 for (i=0; i< gp_ext->num_exts; i++) {
211 DEBUGADD(lvl,("\textension:\t\t\t%s\n",
212 gp_ext->extensions_guid[i]));
213 DEBUGADD(lvl,("\textension (name):\t\t\t%s\n",
214 gp_ext->extensions[i]));
216 DEBUGADD(lvl,("\tsnapin:\t\t\t%s\n",
217 gp_ext->snapins_guid[i]));
218 DEBUGADD(lvl,("\tsnapin (name):\t\t\t%s\n",
219 gp_ext->snapins[i]));
225 /****************************************************************
226 ****************************************************************/
228 void dump_gpo(ADS_STRUCT *ads,
230 struct GROUP_POLICY_OBJECT *gpo,
233 int lvl = debuglevel;
239 DEBUG(lvl,("---------------------\n\n"));
241 DEBUGADD(lvl,("name:\t\t\t%s\n", gpo->name));
242 DEBUGADD(lvl,("displayname:\t\t%s\n", gpo->display_name));
243 DEBUGADD(lvl,("version:\t\t%d (0x%08x)\n", gpo->version, gpo->version));
244 DEBUGADD(lvl,("version_user:\t\t%d (0x%04x)\n",
245 GPO_VERSION_USER(gpo->version),
246 GPO_VERSION_USER(gpo->version)));
247 DEBUGADD(lvl,("version_machine:\t%d (0x%04x)\n",
248 GPO_VERSION_MACHINE(gpo->version),
249 GPO_VERSION_MACHINE(gpo->version)));
250 DEBUGADD(lvl,("filesyspath:\t\t%s\n", gpo->file_sys_path));
251 DEBUGADD(lvl,("dspath:\t\t%s\n", gpo->ds_path));
253 DEBUGADD(lvl,("options:\t\t%d ", gpo->options));
254 switch (gpo->options) {
255 case GPFLAGS_ALL_ENABLED:
256 DEBUGADD(lvl,("GPFLAGS_ALL_ENABLED\n"));
258 case GPFLAGS_USER_SETTINGS_DISABLED:
259 DEBUGADD(lvl,("GPFLAGS_USER_SETTINGS_DISABLED\n"));
261 case GPFLAGS_MACHINE_SETTINGS_DISABLED:
262 DEBUGADD(lvl,("GPFLAGS_MACHINE_SETTINGS_DISABLED\n"));
264 case GPFLAGS_ALL_DISABLED:
265 DEBUGADD(lvl,("GPFLAGS_ALL_DISABLED\n"));
268 DEBUGADD(lvl,("unknown option: %d\n", gpo->options));
272 DEBUGADD(lvl,("link:\t\t\t%s\n", gpo->link));
273 DEBUGADD(lvl,("link_type:\t\t%d ", gpo->link_type));
274 switch (gpo->link_type) {
276 DEBUGADD(lvl,("GP_LINK_UNKOWN\n"));
279 DEBUGADD(lvl,("GP_LINK_OU\n"));
282 DEBUGADD(lvl,("GP_LINK_DOMAIN\n"));
285 DEBUGADD(lvl,("GP_LINK_SITE\n"));
287 case GP_LINK_MACHINE:
288 DEBUGADD(lvl,("GP_LINK_MACHINE\n"));
294 DEBUGADD(lvl,("machine_extensions:\t%s\n", gpo->machine_extensions));
296 if (gpo->machine_extensions) {
298 struct GP_EXT *gp_ext = NULL;
300 if (!ads_parse_gp_ext(mem_ctx, gpo->machine_extensions,
304 dump_gp_ext(gp_ext, lvl);
307 DEBUGADD(lvl,("user_extensions:\t%s\n", gpo->user_extensions));
309 if (gpo->user_extensions) {
311 struct GP_EXT *gp_ext = NULL;
313 if (!ads_parse_gp_ext(mem_ctx, gpo->user_extensions,
317 dump_gp_ext(gp_ext, lvl);
320 DEBUGADD(lvl,("security descriptor:\n"));
322 NDR_PRINT_DEBUG(security_descriptor, gpo->security_descriptor);
325 /****************************************************************
326 ****************************************************************/
328 void dump_gpo_list(ADS_STRUCT *ads,
330 struct GROUP_POLICY_OBJECT *gpo_list,
333 struct GROUP_POLICY_OBJECT *gpo = NULL;
335 for (gpo = gpo_list; gpo; gpo = gpo->next) {
336 dump_gpo(ads, mem_ctx, gpo, debuglevel);
340 /****************************************************************
341 ****************************************************************/
343 void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link)
349 if (gp_link == NULL) {
353 DEBUG(lvl,("---------------------\n\n"));
355 DEBUGADD(lvl,("gplink: %s\n", gp_link->gp_link));
356 DEBUGADD(lvl,("gpopts: %d ", gp_link->gp_opts));
357 switch (gp_link->gp_opts) {
358 case GPOPTIONS_INHERIT:
359 DEBUGADD(lvl,("GPOPTIONS_INHERIT\n"));
361 case GPOPTIONS_BLOCK_INHERITANCE:
362 DEBUGADD(lvl,("GPOPTIONS_BLOCK_INHERITANCE\n"));
368 DEBUGADD(lvl,("num links: %d\n", gp_link->num_links));
370 for (i = 0; i < gp_link->num_links; i++) {
372 DEBUGADD(lvl,("---------------------\n\n"));
374 DEBUGADD(lvl,("link: #%d\n", i + 1));
375 DEBUGADD(lvl,("name: %s\n", gp_link->link_names[i]));
377 DEBUGADD(lvl,("opt: %d ", gp_link->link_opts[i]));
378 if (gp_link->link_opts[i] & GPO_LINK_OPT_ENFORCED) {
379 DEBUGADD(lvl,("GPO_LINK_OPT_ENFORCED "));
381 if (gp_link->link_opts[i] & GPO_LINK_OPT_DISABLED) {
382 DEBUGADD(lvl,("GPO_LINK_OPT_DISABLED"));
384 DEBUGADD(lvl,("\n"));
386 if (ads != NULL && mem_ctx != NULL) {
388 struct GROUP_POLICY_OBJECT gpo;
390 status = ads_get_gpo(ads, mem_ctx,
391 gp_link->link_names[i],
393 if (!ADS_ERR_OK(status)) {
394 DEBUG(lvl,("get gpo for %s failed: %s\n",
395 gp_link->link_names[i],
396 ads_errstr(status)));
399 dump_gpo(ads, mem_ctx, &gpo, lvl);
404 #endif /* HAVE_LDAP */
406 /****************************************************************
407 ****************************************************************/
409 static bool gpo_get_gp_ext_from_gpo(TALLOC_CTX *mem_ctx,
411 struct GROUP_POLICY_OBJECT *gpo,
412 struct GP_EXT **gp_ext)
414 ZERO_STRUCTP(*gp_ext);
416 if (flags & GPO_INFO_FLAG_MACHINE) {
418 if (gpo->machine_extensions) {
420 if (!ads_parse_gp_ext(mem_ctx, gpo->machine_extensions,
427 if (gpo->user_extensions) {
429 if (!ads_parse_gp_ext(mem_ctx, gpo->user_extensions,
439 /****************************************************************
440 ****************************************************************/
442 ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads,
444 const NT_USER_TOKEN *token,
445 struct registry_key *root_key,
446 struct GROUP_POLICY_OBJECT *gpo,
447 const char *extension_guid_filter,
450 struct GP_EXT *gp_ext = NULL;
453 DEBUG(10,("gpo_process_a_gpo: processing gpo %s (%s)\n",
454 gpo->name, gpo->display_name));
455 if (extension_guid_filter) {
456 DEBUGADD(10,("gpo_process_a_gpo: using filter %s (%s)\n",
457 extension_guid_filter,
458 cse_gpo_guid_string_to_name(extension_guid_filter)));
461 if (!gpo_get_gp_ext_from_gpo(mem_ctx, flags, gpo, &gp_ext)) {
462 return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER);
465 if (!gp_ext || !gp_ext->num_exts) {
466 if (flags & GPO_INFO_FLAG_VERBOSE) {
467 DEBUG(0,("gpo_process_a_gpo: "
468 "no policies in %s (%s) for this extension\n",
469 gpo->name, gpo->display_name));
474 for (i=0; i<gp_ext->num_exts; i++) {
478 if (extension_guid_filter &&
479 !strequal(extension_guid_filter,
480 gp_ext->extensions_guid[i])) {
484 ntstatus = gpext_process_extension(ads, mem_ctx,
485 flags, token, root_key, gpo,
486 gp_ext->extensions_guid[i],
487 gp_ext->snapins_guid[i]);
488 if (!NT_STATUS_IS_OK(ntstatus)) {
489 ADS_ERROR_NT(ntstatus);
496 /****************************************************************
497 ****************************************************************/
499 static ADS_STATUS gpo_process_gpo_list_by_ext(ADS_STRUCT *ads,
501 const NT_USER_TOKEN *token,
502 struct registry_key *root_key,
503 struct GROUP_POLICY_OBJECT *gpo_list,
504 const char *extensions_guid,
508 struct GROUP_POLICY_OBJECT *gpo;
510 for (gpo = gpo_list; gpo; gpo = gpo->next) {
512 if (gpo->link_type == GP_LINK_LOCAL) {
517 /* FIXME: we need to pass down the *list* down to the
518 * extension, otherwise we cannot store the e.g. the *list* of
519 * logon-scripts correctly (for more then one GPO) */
521 status = gpo_process_a_gpo(ads, mem_ctx, token, root_key,
522 gpo, extensions_guid, flags);
524 if (!ADS_ERR_OK(status)) {
525 DEBUG(0,("failed to process gpo by ext: %s\n",
526 ads_errstr(status)));
534 /****************************************************************
535 ****************************************************************/
537 ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
539 const NT_USER_TOKEN *token,
540 struct GROUP_POLICY_OBJECT *gpo_list,
541 const char *extensions_guid_filter,
544 ADS_STATUS status = ADS_SUCCESS;
545 struct gp_extension *gp_ext_list = NULL;
546 struct gp_extension *gp_ext = NULL;
547 struct registry_key *root_key = NULL;
548 struct gp_registry_context *reg_ctx = NULL;
551 status = ADS_ERROR_NT(init_gp_extensions(mem_ctx));
552 if (!ADS_ERR_OK(status)) {
556 gp_ext_list = get_gp_extension_list();
558 return ADS_ERROR_NT(NT_STATUS_DLL_INIT_FAILED);
560 /* FIXME Needs to be replaced with new patchfile_preg calls */
562 /* get the key here */
563 if (flags & GPO_LIST_FLAG_MACHINE) {
564 werr = gp_init_reg_ctx(mem_ctx, KEY_HKLM, REG_KEY_WRITE,
568 werr = gp_init_reg_ctx(mem_ctx, KEY_HKCU, REG_KEY_WRITE,
573 if (!W_ERROR_IS_OK(werr)) {
574 gp_free_reg_ctx(reg_ctx);
575 return ADS_ERROR_NT(werror_to_ntstatus(werr));
578 root_key = reg_ctx->curr_key;
580 for (gp_ext = gp_ext_list; gp_ext; gp_ext = gp_ext->next) {
582 const char *guid_str = NULL;
584 guid_str = GUID_string(mem_ctx, gp_ext->guid);
586 status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
590 if (extensions_guid_filter &&
591 (!strequal(guid_str, extensions_guid_filter))) {
595 DEBUG(0,("-------------------------------------------------\n"));
596 DEBUG(0,("gpo_process_gpo_list: processing ext: %s {%s}\n",
597 gp_ext->name, guid_str));
600 status = gpo_process_gpo_list_by_ext(ads, mem_ctx, token,
603 if (!ADS_ERR_OK(status)) {
609 gp_free_reg_ctx(reg_ctx);
610 talloc_free(root_key);
611 free_gp_extensions();
617 /****************************************************************
618 check wether the version number in a GROUP_POLICY_OBJECT match those of the
619 locally stored version. If not, fetch the required policy via CIFS
620 ****************************************************************/
622 NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
624 const char *cache_path,
626 struct GROUP_POLICY_OBJECT *gpo,
627 struct cli_state **cli_out)
632 char *nt_path = NULL;
633 char *unix_path = NULL;
634 uint32_t sysvol_gpt_version = 0;
635 char *display_name = NULL;
636 struct cli_state *cli = NULL;
638 result = gpo_explode_filesyspath(mem_ctx, cache_path, gpo->file_sys_path,
639 &server, &share, &nt_path, &unix_path);
641 if (!NT_STATUS_IS_OK(result)) {
645 result = gpo_get_sysvol_gpt_version(mem_ctx,
649 if (!NT_STATUS_IS_OK(result) &&
650 !NT_STATUS_EQUAL(result, NT_STATUS_NO_SUCH_FILE)) {
651 DEBUG(10,("check_refresh_gpo: "
652 "failed to get local gpt version: %s\n",
657 DEBUG(10,("check_refresh_gpo: versions gpo %d sysvol %d\n",
658 gpo->version, sysvol_gpt_version));
660 /* FIXME: handle GPO_INFO_FLAG_FORCED_REFRESH from flags */
662 while (gpo->version > sysvol_gpt_version) {
664 DEBUG(1,("check_refresh_gpo: need to refresh GPO\n"));
666 #if _SAMBA_BUILD == 3
667 if (*cli_out == NULL) {
668 result = cli_full_connection(&cli,
670 ads_get_ldap_server_name(ads),
674 ads->auth.user_name, NULL,
676 CLI_FULL_CONNECTION_USE_KERBEROS |
677 CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS,
679 if (!NT_STATUS_IS_OK(result)) {
680 DEBUG(10,("check_refresh_gpo: "
681 "failed to connect: %s\n",
691 result = gpo_fetch_files(mem_ctx, cache_path, *cli_out, gpo);
692 if (!NT_STATUS_IS_OK(result)) {
696 result = gpo_get_sysvol_gpt_version(mem_ctx,
700 if (!NT_STATUS_IS_OK(result)) {
701 DEBUG(10,("check_refresh_gpo: "
702 "failed to get local gpt version: %s\n",
707 if (gpo->version == sysvol_gpt_version) {
712 DEBUG(10,("Name:\t\t\t%s (%s)\n", gpo->display_name, gpo->name));
713 DEBUGADD(10,("sysvol GPT version:\t%d (user: %d, machine: %d)\n",
715 GPO_VERSION_USER(sysvol_gpt_version),
716 GPO_VERSION_MACHINE(sysvol_gpt_version)));
717 DEBUGADD(10,("LDAP GPO version:\t%d (user: %d, machine: %d)\n",
719 GPO_VERSION_USER(gpo->version),
720 GPO_VERSION_MACHINE(gpo->version)));
721 DEBUGADD(10,("LDAP GPO link:\t\t%s\n", gpo->link));
723 result = NT_STATUS_OK;
730 /****************************************************************
731 check wether the version numbers in the gpo_list match the locally stored, if
732 not, go and get each required GPO via CIFS
733 ****************************************************************/
735 NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
737 const char *cache_path,
739 struct GROUP_POLICY_OBJECT *gpo_list)
741 NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
742 struct cli_state *cli = NULL;
743 struct GROUP_POLICY_OBJECT *gpo;
746 return NT_STATUS_INVALID_PARAMETER;
749 for (gpo = gpo_list; gpo; gpo = gpo->next) {
751 result = check_refresh_gpo(ads, mem_ctx, cache_path, flags, gpo, &cli);
752 if (!NT_STATUS_IS_OK(result)) {
757 result = NT_STATUS_OK;
767 /****************************************************************
768 ****************************************************************/
770 NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx,
771 struct GROUP_POLICY_OBJECT *gpo,
774 char *server, *share, *nt_path;
775 return gpo_explode_filesyspath(mem_ctx, gpo->file_sys_path,
776 &server, &share, &nt_path, unix_path);
779 /****************************************************************
780 ****************************************************************/
782 char *gpo_flag_str(uint32_t flags)
790 if (flags & GPO_INFO_FLAG_SLOWLINK)
791 fstrcat(str, "GPO_INFO_FLAG_SLOWLINK ");
792 if (flags & GPO_INFO_FLAG_VERBOSE)
793 fstrcat(str, "GPO_INFO_FLAG_VERBOSE ");
794 if (flags & GPO_INFO_FLAG_SAFEMODE_BOOT)
795 fstrcat(str, "GPO_INFO_FLAG_SAFEMODE_BOOT ");
796 if (flags & GPO_INFO_FLAG_NOCHANGES)
797 fstrcat(str, "GPO_INFO_FLAG_NOCHANGES ");
798 if (flags & GPO_INFO_FLAG_MACHINE)
799 fstrcat(str, "GPO_INFO_FLAG_MACHINE ");
800 if (flags & GPO_INFO_FLAG_LOGRSOP_TRANSITION)
801 fstrcat(str, "GPO_INFO_FLAG_LOGRSOP_TRANSITION ");
802 if (flags & GPO_INFO_FLAG_LINKTRANSITION)
803 fstrcat(str, "GPO_INFO_FLAG_LINKTRANSITION ");
804 if (flags & GPO_INFO_FLAG_FORCED_REFRESH)
805 fstrcat(str, "GPO_INFO_FLAG_FORCED_REFRESH ");
806 if (flags & GPO_INFO_FLAG_BACKGROUND)
807 fstrcat(str, "GPO_INFO_FLAG_BACKGROUND ");
812 /****************************************************************
813 ****************************************************************/
815 NTSTATUS gp_find_file(TALLOC_CTX *mem_ctx,
817 const char *filename,
819 const char **filename_out)
821 const char *tmp = NULL;
823 const char *path = NULL;
825 if (flags & GPO_LIST_FLAG_MACHINE) {
831 tmp = talloc_asprintf(mem_ctx, "%s/%s/%s", filename,
833 NT_STATUS_HAVE_NO_MEMORY(tmp);
835 if (stat(tmp, &sbuf) == 0) {
840 path = talloc_strdup_upper(mem_ctx, path);
841 NT_STATUS_HAVE_NO_MEMORY(path);
843 tmp = talloc_asprintf(mem_ctx, "%s/%s/%s", filename,
845 NT_STATUS_HAVE_NO_MEMORY(tmp);
847 if (stat(tmp, &sbuf) == 0) {
852 return NT_STATUS_NO_SUCH_FILE;
855 /****************************************************************
856 ****************************************************************/
858 ADS_STATUS gp_get_machine_token(ADS_STRUCT *ads,
861 NT_USER_TOKEN **token)
863 NT_USER_TOKEN *ad_token = NULL;
868 return ADS_ERROR_NT(NT_STATUS_NOT_SUPPORTED);
870 status = ads_get_sid_token(ads, mem_ctx, dn, &ad_token);
871 if (!ADS_ERR_OK(status)) {
875 ntstatus = merge_nt_token(mem_ctx, ad_token, get_system_token(),
877 if (!NT_STATUS_IS_OK(ntstatus)) {
878 return ADS_ERROR_NT(ntstatus);