libgpo: pass cli_credentials instead of ADS_STRUCT to check_refresh_gpo*()
[metze/samba/wip.git] / libgpo / gpo_fetch.c
index 7ea78830cdcebcf7c6432ae8dbac31b05c179b6b..80b812820d396ace6e93e9432d064a6b7e391d5e 100644 (file)
@@ -118,26 +118,12 @@ static NTSTATUS gpo_prepare_local_store(TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 }
 
-static NTSTATUS gpo_connect_server(ADS_STRUCT *ads,
+static NTSTATUS gpo_connect_server(struct cli_credentials *creds,
                                    const char *server, const char *service, void *ret_cli)
 {
        NTSTATUS result;
-       struct cli_credentials *creds = NULL;
        struct cli_state *cli = NULL;
 
-       creds = cli_session_creds_init(NULL,
-                                      ads->auth._user_name,
-                                      NULL, /* domain (use default) */
-                                      NULL, /* realm (use default) */
-                                      ads->auth._password,
-                                      true, /* use_kerberos */
-                                      true, /* fallback_after_kerberos */
-                                      false, /* use_ccache */
-                                      false); /* pw_nt_hash */
-       if (creds == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
        result = cli_full_connection_creds(&cli,
                        lp_netbios_name(),
                        server,
@@ -145,7 +131,6 @@ static NTSTATUS gpo_connect_server(ADS_STRUCT *ads,
                        service, "A:",
                        creds, 0,
                        SMB_SIGNING_REQUIRED);
-       TALLOC_FREE(creds);
        if (!NT_STATUS_IS_OK(result)) {
                DEBUG(10,("check_refresh_gpo: "
                                "failed to connect: %s\n",
@@ -161,7 +146,7 @@ static NTSTATUS gpo_connect_server(ADS_STRUCT *ads,
 ****************************************************************/
 
 NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
-                         ADS_STRUCT *ads,
+                        struct cli_credentials *creds,
                          const char *cache_dir,
                         const struct GROUP_POLICY_OBJECT *gpo)
 {
@@ -178,7 +163,7 @@ NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx,
 
        /* for now reuse the existing ds connection */
 
-       result = gpo_connect_server(ads, server, service, &cli);
+       result = gpo_connect_server(creds, server, service, &cli);
        NT_STATUS_NOT_OK_RETURN(result);
 
        result = gpo_prepare_local_store(mem_ctx, cache_dir, unix_path);