From bb347ffffe3bbfb035479c4b590963eb0d0638b7 Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Sun, 21 Dec 2014 22:24:28 -0500 Subject: [PATCH] now rsync builds (untested) --- jni/Android.mk | 68 ++++++++++++++++++++++++++++++++++++++++++++ rsync/clientserver.c | 6 ++++ rsync/config.h | 53 ++++++++++++++++++++++++++++++++++ rsync/generator.c | 8 ++++-- rsync/popt/system.h | 2 -- 5 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 rsync/config.h diff --git a/jni/Android.mk b/jni/Android.mk index 83c5f6a..4fe69d8 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -546,3 +546,71 @@ LOCAL_C_INCLUDES:= libz # LOCAL_LDLIBS := include $(BUILD_STATIC_LIBRARY) + + +# build separate rsync executable + +include $(CLEAR_VARS) + +LOCAL_CFLAGS := +LOCAL_MODULE := rsync + +RSYNC_PATH := ../rsync +LOCAL_SRC_FILES := $(RSYNC_PATH)/flist.c \ + $(RSYNC_PATH)/rsync.c \ + $(RSYNC_PATH)/generator.c \ + $(RSYNC_PATH)/receiver.c \ + $(RSYNC_PATH)/cleanup.c \ + $(RSYNC_PATH)/sender.c \ + $(RSYNC_PATH)/exclude.c \ + $(RSYNC_PATH)/util.c \ + $(RSYNC_PATH)/util2.c \ + $(RSYNC_PATH)/main.c \ + $(RSYNC_PATH)/checksum.c \ + $(RSYNC_PATH)/match.c \ + $(RSYNC_PATH)/syscall.c \ + $(RSYNC_PATH)/log.c \ + $(RSYNC_PATH)/backup.c \ + $(RSYNC_PATH)/delete.c \ + $(RSYNC_PATH)/options.c \ + $(RSYNC_PATH)/io.c \ + $(RSYNC_PATH)/compat.c \ + $(RSYNC_PATH)/hlink.c \ + $(RSYNC_PATH)/token.c \ + $(RSYNC_PATH)/uidlist.c \ + $(RSYNC_PATH)/socket.c \ + $(RSYNC_PATH)/hashtable.c \ + $(RSYNC_PATH)/fileio.c \ + $(RSYNC_PATH)/batch.c \ + $(RSYNC_PATH)/clientname.c \ + $(RSYNC_PATH)/chmod.c \ + $(RSYNC_PATH)/acls.c \ + $(RSYNC_PATH)/xattrs.c \ + $(RSYNC_PATH)/progress.c \ + $(RSYNC_PATH)/pipe.c \ + $(RSYNC_PATH)/params.c \ + $(RSYNC_PATH)/loadparm.c \ + $(RSYNC_PATH)/clientserver.c \ + $(RSYNC_PATH)/access.c \ + $(RSYNC_PATH)/connection.c \ + $(RSYNC_PATH)/authenticate.c \ + $(RSYNC_PATH)/lib/wildmatch.c \ + $(RSYNC_PATH)/lib/compat.c \ + $(RSYNC_PATH)/lib/snprintf.c \ + $(RSYNC_PATH)/lib/mdfour.c \ + $(RSYNC_PATH)/lib/md5.c \ + $(RSYNC_PATH)/lib/permstring.c \ + $(RSYNC_PATH)/lib/pool_alloc.c \ + $(RSYNC_PATH)/lib/sysacls.c \ + $(RSYNC_PATH)/lib/sysxattrs.c \ + $(RSYNC_PATH)/lib/getpass.c \ + $(RSYNC_PATH)/popt/findme.c \ + $(RSYNC_PATH)/popt/popt.c \ + $(RSYNC_PATH)/popt/poptconfig.c \ + $(RSYNC_PATH)/popt/popthelp.c \ + $(RSYNC_PATH)/popt/poptparse.c + +LOCAL_C_INCLUDES:= rsync rsync/popt +LOCAL_LDLIBS := -lz + +include $(BUILD_EXECUTABLE) diff --git a/rsync/clientserver.c b/rsync/clientserver.c index d9b5bb0..4a09e91 100644 --- a/rsync/clientserver.c +++ b/rsync/clientserver.c @@ -588,6 +588,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char uid = MY_UID(); am_root = (uid == 0); +#if 0 p = *lp_uid(i) ? lp_uid(i) : am_root ? NOBODY_USER : NULL; if (p) { if (!user_to_uid(p, &uid, True)) { @@ -597,6 +598,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char } set_uid = 1; } else +#endif /* 0 */ set_uid = 0; p = *lp_gid(i) ? strtok(lp_gid(i), ", ") : NULL; @@ -627,9 +629,11 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char if (add_a_group(f_out, p) < 0) return -1; } +#if 0 } else if (am_root) { if (add_a_group(f_out, NOBODY_GROUP) < 0) return -1; +#endif /* 0 */ } module_dir = lp_path(i); @@ -1030,9 +1034,11 @@ static void send_listing(int fd) static int load_config(int globals_only) { if (!config_file) { +#if 0 if (am_server && am_root <= 0) config_file = RSYNCD_USERCONF; else +#endif /* 0 */ config_file = RSYNCD_SYSCONF; } return lp_load(config_file, globals_only); diff --git a/rsync/config.h b/rsync/config.h new file mode 100644 index 0000000..12ae7a1 --- /dev/null +++ b/rsync/config.h @@ -0,0 +1,53 @@ +#ifndef __RSYNC_CONFIG_H +#define __RSYNC_CONFIG_H 1 + +#define HAVE_ID_T 1 +#define HAVE_PID_T 1 +#define HAVE_MODE_T 1 +#define HAVE_OFF_T 1 +#define SIZEOF_INT32_T 4 +#define SIZEOF_UINT32_T 4 +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define TIME_WITH_SYS_TIME 1 +#define HAVE_FCNTL_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_UTIME_H 1 +#define RETSIGTYPE void +#define HAVE_ERRNO_DECL 1 +#define HAVE_DIRENT_H 1 +#define HAVE_SYS_WAIT_H 1 +#define RSYNC_RSH "ssh" +#define HAVE_UTIMES 1 +#define RSYNC_VERSION "3.1.1" +#define RSYNC_PATH "rsync" +#define SIZEOF_OFF_T 4 +#define EXTERNAL_ZLIB 1 +#define RSYNCD_SYSCONF "/sdcard/ssh/rsyncd.conf" +#define HAVE_NETDB_H 1 +#define HAVE_STRUCT_ADDRINFO 1 +#define HAVE_STRDUP 1 +#define HAVE_GETCWD 1 +#define HAVE_WAITPID 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRPBRK 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_GETTIMEOFDAY_TZ 1 +#define HAVE_STRERROR 1 +#define HAVE_STRCHR 1 +#define HAVE_GETADDRINFO 1 +#define HAVE_CHMOD 1 +#define HAVE_SIGACTION 1 +#define HAVE_SIGPROCMASK 1 + +#endif /* __RSYNC_CONFIG_H */ diff --git a/rsync/generator.c b/rsync/generator.c index 91009a5..ee0d085 100644 --- a/rsync/generator.c +++ b/rsync/generator.c @@ -374,7 +374,9 @@ static void do_delete_pass(void) || !S_ISDIR(st.st_mode)) continue; - delete_in_dir(fbuf, file, &st.st_dev); + { dev_t t = st.st_dev; + delete_in_dir(fbuf, file, &t); + } } delete_in_dir(NULL, NULL, &dev_zero); @@ -1463,7 +1465,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, else if (delete_during && f_out != -1 && !phase && !(file->flags & FLAG_MISSING_DIR)) { if (file->flags & FLAG_CONTENT_DIR) - delete_in_dir(fname, file, &real_sx.st.st_dev); + { dev_t t = real_sx.st.st_dev; + delete_in_dir(fname, file, &t); + } else change_local_filter_dir(fname, strlen(fname), F_DEPTH(file)); } diff --git a/rsync/popt/system.h b/rsync/popt/system.h index 50cecaf..48c054c 100644 --- a/rsync/popt/system.h +++ b/rsync/popt/system.h @@ -1,6 +1,4 @@ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #if defined (__GLIBC__) && defined(__LCLINT__) /*@-declundef@*/