summaryrefslogtreecommitdiff
path: root/source3/libgpo/gpo_fetch.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-09-29 16:36:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:14:55 -0500
commit824966fb3c88958b851b9ac5c29d95f770d98429 (patch)
treeed768f6738ff582ec7804fc7d574e96c20dd261e /source3/libgpo/gpo_fetch.c
parentc9cea2d6247480e0f7c15c50eaa16e41b09b937f (diff)
downloadsamba-824966fb3c88958b851b9ac5c29d95f770d98429.tar.gz
samba-824966fb3c88958b851b9ac5c29d95f770d98429.tar.bz2
samba-824966fb3c88958b851b9ac5c29d95f770d98429.zip
r19002: Add a very simple synchronisation function to download the full GPO.
Guenther (This used to be commit 02b75ff2a833677df3448b0f9a4928cb3f0274de)
Diffstat (limited to 'source3/libgpo/gpo_fetch.c')
-rw-r--r--source3/libgpo/gpo_fetch.c51
1 files changed, 4 insertions, 47 deletions
diff --git a/source3/libgpo/gpo_fetch.c b/source3/libgpo/gpo_fetch.c
index 23a719a95d..3347a36b07 100644
--- a/source3/libgpo/gpo_fetch.c
+++ b/source3/libgpo/gpo_fetch.c
@@ -121,14 +121,7 @@ NTSTATUS ads_fetch_gpo_files(ADS_STRUCT *ads,
struct GROUP_POLICY_OBJECT *gpo)
{
NTSTATUS result;
- int fnum = 0;
- int fd = 0;
- char *data = NULL;
- static int io_bufsize = 64512;
- int read_size = io_bufsize;
char *server, *service, *nt_path, *unix_path, *nt_ini_path, *unix_ini_path;
- off_t start = 0;
- off_t nread = 0;
result = ads_gpo_explode_filesyspath(ads, mem_ctx, gpo->file_sys_path,
&server, &service, &nt_path, &unix_path);
@@ -148,55 +141,19 @@ NTSTATUS ads_fetch_gpo_files(ADS_STRUCT *ads,
goto out;
}
- /* open local file */
-
- fd = sys_open(unix_ini_path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
- if (fd == -1) {
- result = map_nt_error_from_unix(errno);
- goto out;
- }
-
- /* open remote file */
-
- fnum = cli_open(cli, nt_ini_path, O_RDONLY, DENY_NONE);
- if (fnum == -1) {
- result = NT_STATUS_NO_SUCH_FILE;
+ result = gpo_copy_file(mem_ctx, cli, nt_ini_path, unix_ini_path);
+ if (!NT_STATUS_IS_OK(result)) {
goto out;
}
- /* copy gpt.ini */
-
- data = (char *)SMB_MALLOC(read_size);
- if (data == NULL) {
- result = NT_STATUS_NO_MEMORY;
+ result = gpo_sync_directories(mem_ctx, cli, nt_path, unix_path);
+ if (!NT_STATUS_IS_OK(result)) {
goto out;
}
- while (1) {
-
- int n = cli_read(cli, fnum, data, nread + start, read_size);
-
- if (n <= 0)
- break;
-
- if (write(fd, data, n) != n) {
- break;
- }
-
- nread += n;
- }
-
result = NT_STATUS_OK;
out:
- SAFE_FREE(data);
- if (fd) {
- close(fd);
- }
- if (fnum) {
- cli_close(cli, fnum);
- }
-
return result;
}