summaryrefslogtreecommitdiff
path: root/libgpo/gpo_fetch.c
diff options
context:
space:
mode:
authorWilco Baan Hofman <wilco@baanhofman.nl>2009-03-15 04:40:12 +0100
committerGünther Deschner <gd@samba.org>2009-04-20 23:16:17 +0200
commitb939638dc79daa065c58755abf9f58d1df571401 (patch)
tree877eea4bc07701bbba497028e6e870fb74890606 /libgpo/gpo_fetch.c
parent161d2603d2d7b1163b124ba3c529780e8aeec409 (diff)
downloadsamba-b939638dc79daa065c58755abf9f58d1df571401.tar.gz
samba-b939638dc79daa065c58755abf9f58d1df571401.tar.bz2
samba-b939638dc79daa065c58755abf9f58d1df571401.zip
Make the gpo files build for samba 4.
Only gpt.ini remaining. Not suitable for merge yet, samba 3 is currently broken due to some changed public API. Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'libgpo/gpo_fetch.c')
-rw-r--r--libgpo/gpo_fetch.c79
1 files changed, 78 insertions, 1 deletions
diff --git a/libgpo/gpo_fetch.c b/libgpo/gpo_fetch.c
index ee3f28d1f3..b6d50ad852 100644
--- a/libgpo/gpo_fetch.c
+++ b/libgpo/gpo_fetch.c
@@ -21,6 +21,17 @@
#include "system/filesys.h"
#include "../libgpo/gpo.h"
+#if _SAMBA_BUILD_ == 4
+#include "param/param.h"
+#include "libcli/resolve/resolve.h"
+#include "../lib/tevent/tevent.h"
+#include "libcli/libcli.h"
+#include "libcli/raw/libcliraw.h"
+#include "libcli/libcli_proto.h"
+#include "libgpo/ads_convenience.h"
+#include "libgpo/gpo.h"
+#endif
+
/****************************************************************
explode the GPO CIFS URI into their components
****************************************************************/
@@ -118,24 +129,90 @@ static NTSTATUS gpo_prepare_local_store(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
+static NTSTATUS gpo_connect_server(ADS_STRUCT *ads, struct loadparm_context *lp_ctx,
+ const char *server, const char *service, void *ret_cli)
+{
+ NTSTATUS result;
+#if _SAMBA_BUILD_ == 3
+ struct cli_state *cli;
+
+
+ result = cli_full_connection(&cli,
+ global_myname(),
+ server,
+ NULL, 0,
+ service, "A:",
+ ads->auth.user_name, NULL,
+ ads->auth.password,
+ CLI_FULL_CONNECTION_USE_KERBEROS |
+ CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS,
+ Undefined, NULL);
+ if (!NT_STATUS_IS_OK(result)) {
+ DEBUG(10,("check_refresh_gpo: "
+ "failed to connect: %s\n",
+ nt_errstr(result)));
+ return result;
+ }
+ }
+ *(struct cli_state **) ret_cli = cli;
+#else
+ struct smbcli_state *cli = NULL;
+ struct smbcli_options options;
+ struct smbcli_session_options session_options;
+
+ lp_smbcli_options(lp_ctx, &options);
+ lp_smbcli_session_options(lp_ctx, &session_options);
+
+ result = smbcli_full_connection(NULL, &cli,
+ server,
+ NULL, service,
+ NULL /*devtype*/, NULL /* socket options */,
+ ads->credentials,
+ lp_resolve_context(lp_ctx),
+ tevent_context_init(ads),
+ &options,
+ &session_options,
+ lp_iconv_convenience(lp_ctx),
+ lp_gensec_settings(ads, lp_ctx));
+ if (!NT_STATUS_IS_OK(result)) {
+ DEBUG(10,("failed to connect: %s\n",
+ nt_errstr(result)));
+ return result;
+ }
+ *(struct smbcli_state **) ret_cli = cli;
+#endif
+ return NT_STATUS_OK;
+}
+
/****************************************************************
download a full GPO via CIFS
****************************************************************/
NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
+ ADS_STRUCT *ads,
+ struct loadparm_context *lp_ctx,
const char *cache_path,
- 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;
+#if _SAMBA_BUILD_ == 3
+ struct cli_state *cli;
+#else
+ struct smbcli_state *cli;
+#endif
+
result = gpo_explode_filesyspath(mem_ctx, cache_path, gpo->file_sys_path,
&server, &service, &nt_path,
&unix_path);
NT_STATUS_NOT_OK_RETURN(result);
+
+ result = gpo_connect_server(ads, lp_ctx, server, service, &cli);
+
+
result = gpo_prepare_local_store(mem_ctx, cache_path, unix_path);
NT_STATUS_NOT_OK_RETURN(result);