s3:registry: move the reg_api prototypes to their own header.
[kai/samba.git] / libgpo / gpo_util.c
index 2dd7c496c829fecdac550c6a334a2815b500be6c..3320d97b2123ad1cc989f51c90416ba98284e334 100644 (file)
 #define TALLOC_DEPRECATED 1
 #include "includes.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #define TALLOC_DEPRECATED 1
 #include "includes.h"
 #include "librpc/gen_ndr/ndr_misc.h"
+#include "../librpc/gen_ndr/ndr_security.h"
+#include "../libgpo/gpo.h"
 #if _SAMBA_BUILD_ == 4
 #include "system/filesys.h"
 #include "auth/auth.h"
 #if _SAMBA_BUILD_ == 4
 #include "system/filesys.h"
 #include "auth/auth.h"
-#include "../libgpo/gpo.h"
-#include "../lib/talloc/talloc.h"
+#include <talloc.h>
 #include "source4/libgpo/ads_convenience.h"
 #endif
 #undef strdup
 #include "source4/libgpo/ads_convenience.h"
 #endif
 #undef strdup
@@ -321,10 +322,11 @@ void dump_gpo(ADS_STRUCT *ads,
                }
                dump_gp_ext(gp_ext, lvl);
        }
                }
                dump_gp_ext(gp_ext, lvl);
        }
+       if (gpo->security_descriptor) {
+               DEBUGADD(lvl,("security descriptor:\n"));
 
 
-       DEBUGADD(lvl,("security descriptor:\n"));
-
-       NDR_PRINT_DEBUG(security_descriptor, gpo->security_descriptor);
+               NDR_PRINT_DEBUG(security_descriptor, gpo->security_descriptor);
+       }
 }
 
 /****************************************************************
 }
 
 /****************************************************************
@@ -446,7 +448,7 @@ static bool gpo_get_gp_ext_from_gpo(TALLOC_CTX *mem_ctx,
 
 ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads,
                             TALLOC_CTX *mem_ctx,
 
 ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads,
                             TALLOC_CTX *mem_ctx,
-                            const NT_USER_TOKEN *token,
+                            const struct security_token *token,
                             struct registry_key *root_key,
                             struct GROUP_POLICY_OBJECT *gpo,
                             const char *extension_guid_filter,
                             struct registry_key *root_key,
                             struct GROUP_POLICY_OBJECT *gpo,
                             const char *extension_guid_filter,
@@ -503,7 +505,7 @@ ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads,
 
 static ADS_STATUS gpo_process_gpo_list_by_ext(ADS_STRUCT *ads,
                                              TALLOC_CTX *mem_ctx,
 
 static ADS_STATUS gpo_process_gpo_list_by_ext(ADS_STRUCT *ads,
                                              TALLOC_CTX *mem_ctx,
-                                             const NT_USER_TOKEN *token,
+                                             const struct security_token *token,
                                              struct registry_key *root_key,
                                              struct GROUP_POLICY_OBJECT *gpo_list,
                                              const char *extensions_guid,
                                              struct registry_key *root_key,
                                              struct GROUP_POLICY_OBJECT *gpo_list,
                                              const char *extensions_guid,
@@ -541,7 +543,7 @@ static ADS_STATUS gpo_process_gpo_list_by_ext(ADS_STRUCT *ads,
 
 ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
                                TALLOC_CTX *mem_ctx,
 
 ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
                                TALLOC_CTX *mem_ctx,
-                               const NT_USER_TOKEN *token,
+                               const struct security_token *token,
                                struct GROUP_POLICY_OBJECT *gpo_list,
                                const char *extensions_guid_filter,
                                uint32_t flags)
                                struct GROUP_POLICY_OBJECT *gpo_list,
                                const char *extensions_guid_filter,
                                uint32_t flags)
@@ -551,8 +553,9 @@ ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
        struct gp_extension *gp_ext = NULL;
        struct registry_key *root_key = NULL;
        struct gp_registry_context *reg_ctx = NULL;
        struct gp_extension *gp_ext = NULL;
        struct registry_key *root_key = NULL;
        struct gp_registry_context *reg_ctx = NULL;
+#if 0
        WERROR werr;
        WERROR werr;
-
+#endif
        status = ADS_ERROR_NT(init_gp_extensions(mem_ctx));
        if (!ADS_ERR_OK(status)) {
                return status;
        status = ADS_ERROR_NT(init_gp_extensions(mem_ctx));
        if (!ADS_ERR_OK(status)) {
                return status;
@@ -574,11 +577,11 @@ ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
                                       token,
                                       &reg_ctx);
        }
                                       token,
                                       &reg_ctx);
        }
-#endif
        if (!W_ERROR_IS_OK(werr)) {
                talloc_free(reg_ctx);
                return ADS_ERROR_NT(werror_to_ntstatus(werr));
        }
        if (!W_ERROR_IS_OK(werr)) {
                talloc_free(reg_ctx);
                return ADS_ERROR_NT(werror_to_ntstatus(werr));
        }
+#endif
 
        root_key = reg_ctx->curr_key;
 
 
        root_key = reg_ctx->curr_key;
 
@@ -626,7 +629,7 @@ ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads,
 
 NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
                           TALLOC_CTX *mem_ctx,
 
 NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
                           TALLOC_CTX *mem_ctx,
-                           const char *cache_path,
+                           const char *cache_dir,
                            struct loadparm_context *lp_ctx,
                           uint32_t flags,
                           struct GROUP_POLICY_OBJECT *gpo)
                            struct loadparm_context *lp_ctx,
                           uint32_t flags,
                           struct GROUP_POLICY_OBJECT *gpo)
@@ -639,7 +642,7 @@ NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
        uint32_t sysvol_gpt_version = 0;
        char *display_name = NULL;
 
        uint32_t sysvol_gpt_version = 0;
        char *display_name = NULL;
 
-       result = gpo_explode_filesyspath(mem_ctx, cache_path, gpo->file_sys_path,
+       result = gpo_explode_filesyspath(mem_ctx, cache_dir, gpo->file_sys_path,
                                         &server, &share, &nt_path, &unix_path);
 
        if (!NT_STATUS_IS_OK(result)) {
                                         &server, &share, &nt_path, &unix_path);
 
        if (!NT_STATUS_IS_OK(result)) {
@@ -667,7 +670,7 @@ NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
 
                DEBUG(1,("check_refresh_gpo: need to refresh GPO\n"));
 
 
                DEBUG(1,("check_refresh_gpo: need to refresh GPO\n"));
 
-               result = gpo_fetch_files(mem_ctx, ads, lp_ctx, cache_path, gpo);
+               result = gpo_fetch_files(mem_ctx, ads, lp_ctx, cache_dir, gpo);
                if (!NT_STATUS_IS_OK(result)) {
                        goto out;
                }
                if (!NT_STATUS_IS_OK(result)) {
                        goto out;
                }
@@ -713,7 +716,7 @@ NTSTATUS check_refresh_gpo(ADS_STRUCT *ads,
 
 NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
                                TALLOC_CTX *mem_ctx,
 
 NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
                                TALLOC_CTX *mem_ctx,
-                               const char *cache_path,
+                               const char *cache_dir,
                                 struct loadparm_context *lp_ctx,
                                uint32_t flags,
                                struct GROUP_POLICY_OBJECT *gpo_list)
                                 struct loadparm_context *lp_ctx,
                                uint32_t flags,
                                struct GROUP_POLICY_OBJECT *gpo_list)
@@ -727,7 +730,7 @@ NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
 
        for (gpo = gpo_list; gpo; gpo = gpo->next) {
 
 
        for (gpo = gpo_list; gpo; gpo = gpo->next) {
 
-               result = check_refresh_gpo(ads, mem_ctx, cache_path, lp_ctx, flags, gpo);
+               result = check_refresh_gpo(ads, mem_ctx, cache_dir, lp_ctx, flags, gpo);
                if (!NT_STATUS_IS_OK(result)) {
                        goto out;
                }
                if (!NT_STATUS_IS_OK(result)) {
                        goto out;
                }
@@ -745,12 +748,12 @@ NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads,
 ****************************************************************/
 
 NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx,
 ****************************************************************/
 
 NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx,
-                           const char *cache_path,
+                           const char *cache_dir,
                           struct GROUP_POLICY_OBJECT *gpo,
                           char **unix_path)
 {
        char *server, *share, *nt_path;
                           struct GROUP_POLICY_OBJECT *gpo,
                           char **unix_path)
 {
        char *server, *share, *nt_path;
-       return gpo_explode_filesyspath(mem_ctx, cache_path, gpo->file_sys_path,
+       return gpo_explode_filesyspath(mem_ctx, cache_dir, gpo->file_sys_path,
                                       &server, &share, &nt_path, unix_path);
 }
 
                                       &server, &share, &nt_path, unix_path);
 }
 
@@ -837,9 +840,9 @@ ADS_STATUS gp_get_machine_token(ADS_STRUCT *ads,
                                TALLOC_CTX *mem_ctx,
                                struct loadparm_context *lp_ctx,
                                const char *dn,
                                TALLOC_CTX *mem_ctx,
                                struct loadparm_context *lp_ctx,
                                const char *dn,
-                               NT_USER_TOKEN **token)
+                               struct security_token **token)
 {
 {
-       NT_USER_TOKEN *ad_token = NULL;
+       struct security_token *ad_token = NULL;
        ADS_STATUS status;
 #if _SAMBA_BUILD_ == 4
        struct auth_session_info *info;
        ADS_STATUS status;
 #if _SAMBA_BUILD_ == 4
        struct auth_session_info *info;