NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx, struct cli_state *cli, struct GROUP_POLICY_OBJECT *gpo) { NTSTATUS result; char *server, *service, *nt_path, *unix_path; char *nt_ini_path, *unix_ini_path; result = gpo_explode_filesyspath(mem_ctx, gpo->file_sys_path, &server, &service, &nt_path, &unix_path); NT_STATUS_NOT_OK_RETURN(result); result = gpo_prepare_local_store(mem_ctx, unix_path); NT_STATUS_NOT_OK_RETURN(result); unix_ini_path = talloc_asprintf(mem_ctx, "%s/%s", unix_path, GPT_INI); nt_ini_path = talloc_asprintf(mem_ctx, "%s\\%s", nt_path, GPT_INI); NT_STATUS_HAVE_NO_MEMORY(unix_ini_path); NT_STATUS_HAVE_NO_MEMORY(nt_ini_path); result = gpo_copy_file(mem_ctx, cli, nt_ini_path, unix_ini_path); NT_STATUS_NOT_OK_RETURN(result); result = gpo_sync_directories(mem_ctx, cli, nt_path, unix_path); NT_STATUS_NOT_OK_RETURN(result); return NT_STATUS_OK; }
NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx, ADS_STRUCT *ads, const char *cache_dir, const struct GROUP_POLICY_OBJECT *gpo) { NTSTATUS result; char *server, *service, *nt_path, *unix_path; char *nt_ini_path, *unix_ini_path; struct cli_state *cli; result = gpo_explode_filesyspath(mem_ctx, cache_dir, gpo->file_sys_path, &server, &service, &nt_path, &unix_path); NT_STATUS_NOT_OK_RETURN(result); /* for now reuse the existing ds connection */ result = gpo_connect_server(ads, ads->server.ldap_server, service, &cli); NT_STATUS_NOT_OK_RETURN(result); result = gpo_prepare_local_store(mem_ctx, cache_dir, unix_path); NT_STATUS_NOT_OK_RETURN(result); unix_ini_path = talloc_asprintf(mem_ctx, "%s/%s", unix_path, GPT_INI); nt_ini_path = talloc_asprintf(mem_ctx, "%s\\%s", nt_path, GPT_INI); NT_STATUS_HAVE_NO_MEMORY(unix_ini_path); NT_STATUS_HAVE_NO_MEMORY(nt_ini_path); result = gpo_copy_file(mem_ctx, cli, nt_ini_path, unix_ini_path); NT_STATUS_NOT_OK_RETURN(result); result = gpo_sync_directories(mem_ctx, cli, nt_path, unix_path); NT_STATUS_NOT_OK_RETURN(result); return NT_STATUS_OK; }