--- /dev/null
+link-warning.h
+*~
--- /dev/null
+
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = lib
+
+AM_LIBS = @SSL_LIBS@
+AM_CFLAGS = @SSL_CFLAGS@ -DSYSCONFDIR="\"$(sysconfdir)\"" -DBACKUPPC_PIDFILE="\"$(localstatedir)/run/backuppcd.pid\""
+
+bin_PROGRAMS = backuppcd backuppcd-client backuppcd-tar backuppcd-passwd
+
+noinst_LIBS = backuppcd backuppc
+
+backuppcd_SOURCES = backuppcd.c \
+ net.c \
+ backuppcd-common.c \
+ sha1.c \
+ md4.c \
+ md5.c \
+ backuppcd-auth.c \
+ backuppcd-notify.c
+
+backuppcd_client_SOURCES = backuppcd-client.c \
+ libbackuppcd.c \
+ net.c \
+ backuppcd-common.c \
+ sha1.c \
+ md4.c \
+ md5.c \
+ libbackuppc.c
+
+backuppcd_tar_SOURCES = backuppcd-tar.c \
+ net.c \
+ backuppcd-common.c \
+ sha1.c
+
+backuppcd_passwd_SOURCES = backuppcd-passwd.c \
+ sha1.c
+
+++ /dev/null
-backuppcd-auth.o: backuppcd-auth.c compat.h win32.h config.h htonll.h ntohll.h \
- backuppcd-auth.h
-backuppcd-client.o: backuppcd-client.c compat.h win32.h config.h htonll.h \
- ntohll.h backuppcd-common.h
-backuppcd-common.o: backuppcd-common.c compat.h win32.h config.h htonll.h \
- ntohll.h backuppcd-common.h
-backuppcd-notify.o: backuppcd-notify.c compat.h win32.h config.h htonll.h \
- ntohll.h net.h
-backuppcd-passwd.o: backuppcd-passwd.c compat.h win32.h config.h htonll.h \
- ntohll.h sha1.h
-backuppcd-tar.o: backuppcd-tar.c compat.h win32.h config.h htonll.h ntohll.h \
- backuppcd.h backuppcd-common.h net.h
-backuppcd.o: backuppcd.c compat.h win32.h config.h htonll.h ntohll.h backuppcd.h \
- backuppcd-common.h backuppcd-auth.h backuppcd-notify.h net.h sha1.h \
- md4.h md5.h
-chown.o: chown.c chown.h compat.h win32.h config.h htonll.h ntohll.h backuppcd.h \
- backuppcd-common.h
-fnmatch.o: fnmatch.c compat.h win32.h config.h htonll.h ntohll.h
-gethostname.o: gethostname.c compat.h win32.h config.h htonll.h ntohll.h
-htonll.o: htonll.c compat.h win32.h config.h htonll.h ntohll.h
-libbackuppc.o: libbackuppc.c
-libbackuppcd.o: libbackuppcd.c compat.h win32.h config.h htonll.h ntohll.h \
- backuppcd.h backuppcd-common.h libbackuppcd.h sha1.h net.h
-link.o: link.c compat.h win32.h config.h htonll.h ntohll.h link.h backuppcd.h \
- backuppcd-common.h
-md4.o: md4.c md4.h compat.h win32.h config.h htonll.h ntohll.h
-md5.o: md5.c md5.h compat.h win32.h config.h htonll.h ntohll.h
-net.o: net.c compat.h win32.h config.h htonll.h ntohll.h net.h
-ntohll.o: ntohll.c compat.h win32.h config.h htonll.h ntohll.h
-sha1.o: sha1.c compat.h win32.h config.h htonll.h ntohll.h sha1.h
-strsep.o: strsep.c
+++ /dev/null
-prefix = @prefix@
-mandir = @mandir@
-sysconfdir = @sysconfdir@
-datadir = @datadir@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir = @libdir@
-localstatedir = @localstatedir@
-
-CC = @CC@
-CFLAGS = -Wall -Os @CFLAGS@ @DEFS@ -I.
-CPPFLAGS = @CPPFLAGS@ @DEFS@ "-DSYSCONFDIR=\"$(sysconfdir)\"" "-DBACKUPPC_PIDFILE=\"$(localstatedir)/run/backuppcd.pid\"" "-DEXEEXT=\"$(EXEEXT)\"" "-DEXECPREFIX=\"$(exec_prefix)\"" -I.
-LDFLAGS = @LDFLAGS@ @LIBS@
-INSTALL = @INSTALL@
-EXEEXT = @EXEEXT@
-OBJEXT = @OBJEXT@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-AR = @AR@
-RANLIB = @RANLIB@
-AREXT = @AREXT@
-
-
-BINS = backuppcd$(EXEEXT) backuppcd-client$(EXEEXT) backuppcd-tar$(EXEEXT) backuppcd-passwd$(EXEEXT) tools/file_sync$(EXEEXT)
-LIBS = libbackuppcd$(AREXT) libbackuppc$(AREXT)
-
-all: $(BINS) $(LIBS)
-
-backuppcd$(EXEEXT): Makefile.dep backuppcd.o net.o backuppcd-common.o sha1.o md4.o md5.o backuppcd-auth.o backuppcd-notify.o @LIBOBJS@
- $(CC) $(CPPFLAGS) $(CFLAGS) -o backuppcd$(EXEEXT) backuppcd.o net.o backuppcd-common.o sha1.o md4.o md5.o backuppcd-auth.o backuppcd-notify.o @LIBOBJS@ $(LDFLAGS)
-
-backuppcd-client$(EXEEXT): Makefile.dep libbackuppcd$(AREXT) libbackuppc$(AREXT) backuppcd-client.o
- $(CC) $(CPPFLAGS) $(CFLAGS) -o backuppcd-client$(EXEEXT) backuppcd-client.o -L. -lbackuppcd -lbackuppc $(LDFLAGS)
-
-backuppcd-tar$(EXEEXT): Makefile.dep backuppcd-tar.o net.o backuppcd-common.o sha1.o @LIBOBJS@
- $(CC) $(CPPFLAGS) $(CFLAGS) -o backuppcd-tar$(EXEEXT) backuppcd-tar.o net.o backuppcd-common.o sha1.o @LIBOBJS@ $(LDFLAGS)
-
-backuppcd-passwd$(EXEEXT): Makefile.dep backuppcd-passwd.o sha1.o
- $(CC) $(CPPFLAGS) $(CFLAGS) -o backuppcd-passwd$(EXEEXT) backuppcd-passwd.o sha1.o $(LDFLAGS)
-
-tools/file_sync$(EXEEXT): Makefile.dep tools/file_sync.o net.o md4.o @LIBOBJS@
- $(CC) $(CPPFLAGS) $(CFLAGS) -I.. -o tools/file_sync$(EXEEXT) tools/file_sync.o net.o md4.o @LIBOBJS@ -L.. $(LDFLAGS)
-
-libbackuppcd$(AREXT): Makefile.dep libbackuppcd.o net.o backuppcd-common.o sha1.o md4.o md5.o @LIBOBJS@
- $(AR) rcu libbackuppcd$(AREXT) libbackuppcd.o net.o backuppcd-common.o sha1.o md4.o md5.o @LIBOBJS@
- $(RANLIB) libbackuppcd$(AREXT)
-
-libbackuppc$(AREXT): Makefile.dep libbackuppc.o sha1.o md4.o md5.o
- $(AR) rcu libbackuppc$(AREXT) libbackuppc.o sha1.o md4.o md5.o
- $(RANLIB) libbackuppc$(AREXT)
-
-Makefile.dep:
- -$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > Makefile.dep
- -$(CC) $(CFLAGS) $(CPPFLAGS) -I.. -MM tools/*.c >> Makefile.dep
- -@test -s Makefile.dep || cp Makefile.dep.dist Makefile.dep
-
--include Makefile.dep
-
-.PHONY: clean distclean install
-clean:
- rm -f tools/*.o *.o $(BINS) $(LIBS) *~
-
-distclean: clean
- rm -f Makefile config.h config.status config.log Makefile.dep
-
-install: all
- -$(INSTALL) -d $(bindir)
- -$(INSTALL) -d $(libdir)
- -$(INSTALL) -d $(prefix)/include
- $(INSTALL) -m 755 backuppcd$(EXEEXT) $(bindir)/backuppcd$(EXEEXT)
- $(INSTALL) -m 644 libbackuppcd$(AREXT) $(libdir)/libbackuppcd$(AREXT)
- $(INSTALL) -m 644 libbackuppc$(AREXT) $(libdir)/libbackuppc$(AREXT)
- $(INSTALL) -m 644 backuppcd.h $(prefix)/include/backuppcd.h
- $(INSTALL) -m 644 libbackuppcd.h $(prefix)/include/libbackuppcd.h
- $(INSTALL) -m 644 libbackuppc.h $(prefix)/include/libbackuppc.h
#include "compat.h"
-#include <libconfig.h>
+#include <stdio.h>
#include "backuppcd-auth.h"
struct bpcd_auth_userinfo;
struct bpcd_auth_userinfo *userlist = NULL;
+#ifdef HAVE_LIBCONFIG
static int bpcd_auth_opt_user(const char *shortvar, const char *var, const char *arguments, const char *value, lc_flags_t flags, void *extra) {
struct bpcd_auth_userinfo *newnode;
char *valcopy_s, *valcopy;
newnode = malloc(sizeof(*newnode));
if (newnode == NULL) {
- return(LC_CBRET_ERROR);
+ return -1;
}
valcopy_s = valcopy = strdup(value);
free(valcopy_s);
free(newnode);
fprintf(stderr, "error: usage: USER <Username> <Password> <Privilegs>\n");
- return(LC_CBRET_ERROR);
+ return -1;
}
newnode->passhash = strsep(&valcopy, " ,\t");
free(valcopy_s);
free(newnode);
fprintf(stderr, "error: usage: USER <Username> <Password> <Privilegs>\n");
- return(LC_CBRET_ERROR);
+ return -1;
}
privstr = strsep(&valcopy, " ,\t");
free(valcopy_s);
free(newnode);
fprintf(stderr, "error: usage: USER <Username> <Password> <Privilegs>\n");
- return(LC_CBRET_ERROR);
+ return -1;
}
if (strlen(newnode->passhash) != 40) {
free(valcopy_s);
free(newnode);
fprintf(stderr, "error: Password hash must be exactly 40 charectars long.\n");
- return(LC_CBRET_ERROR);
+ return -1;
}
if (strcasecmp(privstr, "Read") == 0) {
free(valcopy_s);
free(newnode);
fprintf(stderr, "error: usage: Privileges must be one of: READ, WRITE, or READWRITE\n");
- return(LC_CBRET_ERROR);
+ return -1
}
newnode->_next = userlist;
userlist = newnode;
- return(LC_CBRET_OKAY);
+ return 0;
}
+#endif
void bpcd_auth_init(void) {
+#ifdef HAVE_LIBCONFIG
lc_register_callback("User", 'u', LC_VAR_STRING, bpcd_auth_opt_user, NULL);
+#endif
return;
}
#include "compat.h"
#include "backuppcd-common.h"
#include <libbackuppcd.h>
-#include <libconfig.h>
/* XXX: include safety */
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <stdio.h>
#define BPC_CLIENT_LIST 0
#define BPC_CLIENT_GET_INCR 1
char newfilelistname[16384], xferfilename[16384];
FILE *newfilelistfp = NULL;
+#ifdef HAVE_LIBCONFIG
lc_register_var("Host", LC_VAR_STRING, &host, 'H');
lc_register_var("Port", LC_VAR_INT, &port, 'P');
lc_register_var("User", LC_VAR_STRING, &username, 'U');
}
command = argv[lc_optind];
+#endif
if (strcasecmp(command, "list") == 0) {
mode = BPC_CLIENT_LIST;
#include "compat.h"
#include "sha1.h"
+#include <stdio.h>
int main(int argc, char **argv) {
char *plaintext;
#include "backuppcd.h"
#include "backuppcd-common.h"
#include "net.h"
+#include <stdio.h>
typedef enum {
BPC_CDT_END,
#include "md4.h"
#include "md5.h"
+#include <stdio.h>
+
#define DAEMON_RET_SUCCESS 0
#define DAEMON_RET_FAILURE 1
* NOTES:
*
*/
+
+#ifdef HAVE_LIBCONFIG
static int backuppc_opt_remove_svc(const char *shortvar, const char *var, const char *arguments, const char *value, lc_flags_t flags, void *extra) {
if (daemon_remove() < 0) {
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
}
+#endif
/*
* SYNOPSIS:
* NOTES:
*
*/
+
+#ifdef HAVE_LIBCONFIG
static int backuppc_opt_stop_svc(const char *shortvar, const char *var, const char *arguments, const char *value, lc_flags_t flags, void *extra) {
if (daemon_stop() < 0) {
exit(EXIT_FAILURE);
return(LC_CBRET_OKAY);
}
+#endif
+
/*
* SYNOPSIS:
* static void backuppc_pathmangle(
/*
* Register configuration commands and command line arguments.
*/
+#ifdef HAVE_LIBCONFIG
lc_register_callback("Remove", 'r', LC_VAR_NONE, backuppc_opt_remove_svc, NULL);
lc_register_callback("Stop", 'k', LC_VAR_NONE, backuppc_opt_stop_svc, NULL);
lc_register_callback("Version", 'V', LC_VAR_NONE, backuppc_opt_showvers, NULL);
lc_register_var("BinaryFile", LC_VAR_STRING, &backuppc_binfile, 0);
lc_register_var("ConfigFile", LC_VAR_STRING, &config_file, 'C');
lc_register_var("NotifyServer", LC_VAR_STRING, &backuppc_notifyserv, 'S');
-
/*
* Process standard config files, command line arguments, and
* environment variables.
* Finished with configuration.
*/
lc_cleanup();
+#endif
/*
* If we've been told to delete a file, do so without regard for
#define RSK_COMPAT_H
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#ifdef __WIN32__
#include "win32.h"
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
-#ifdef HAVE_STDIO_H
-#include <stdio.h>
-#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-AC_REVISION($Revision $)
-AC_INIT(backuppcd, 0.1.3)
+AC_INIT([backuppcd], 0.1.3)
+AM_INIT_AUTOMAKE([1.9 foreign])
AC_CONFIG_HEADER(config.h)
-dnl Check OS info
-DC_CHK_OS_INFO
-
dnl Checks for programs.
+AC_GNU_SOURCE
AC_PROG_CC
+gl_EARLY
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_RANLIB
-AC_AIX
-AC_GNU_SOURCE
+gl_INIT
AC_CHECK_TOOL(AR, ar, true)
AC_CHECK_HEADERS(stdlib.h string.h unistd.h time.h sys/time.h sys/types.h signal.h syslog.h sys/select.h netinet/in.h arpa/inet.h sys/socket.h ssl.h openssl/ssl.h ssl/ssl.h fcntl.h dirent.h ctype.h assert.h endian.h stdarg.h utime.h fnmatch.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h sys/resource.h limits.h)
AC_CHECK_FUNCS(sysinfo openlog syslog setsid fork fcntl stat lstat lchown symlink readlink signal getenv utime statfs getmntinfo setpriority)
AC_REPLACE_FUNCS(htonll ntohll chown link fnmatch strsep gethostname)
-DC_DO_NETWORK
-
-dnl Check for various types we use
-DC_DO_TYPE(uint64_t, unsigned, 8)
-DC_DO_TYPE(int64_t, signed, 8)
-DC_DO_TYPE(uint32_t, unsigned, 4)
-DC_DO_TYPE(int32_t, signed, 4)
-DC_DO_TYPE(uint16_t, unsigned, 2)
-DC_DO_TYPE(int16_t, signed, 2)
-AC_TYPE_UID_T
-
-dnl Checks for Win32 specific things.
-DC_DO_WIN32
-
dnl Large file support
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AC_TYPE_OFF_T
-dnl Check for libopennet
-DC_ASK_OPTLIB(opennet, fopen_net,opennet.h, [Support opennet (required for automatic updates)], opennet, HAVE_LIBOPENNET, HAVE_OPENNET_H)
-
-dnl Check for libconfig
-DC_ASK_OPTLIB(config, lc_process, libconfig.h, [Process configuration files using libconfig], libconfig, HAVE_LIBCONFIG, HAVE_LIBCONFIG_H,, [
- AC_MSG_ERROR([Libconfig is required. http://www.rkeene.org/oss/libconfig/])
-])
-
-DC_ASK_OPTLIB(ssl, SSL_library_init,, [Allow encrypted connections using SSL], openssl, HAVE_LIBSSL, THIS_MAKES_STUPID_AUTOHEADER_HAPPY, [-lwsock32 -lcrypto -lgdi32])
-
-AC_ARG_WITH(nt4, AC_HELP_STRING([--with-nt4], [Enable support for Windows NT 4 (only applies for Windows)]), [ winntfoursupport=$withval ], [ winntfoursupport=no ])
-if test "$winntfoursupport" = "no"; then
- AC_DEFINE(NO_WIN32_NT4, [1], [Define if you wish to disallow support for Windows NT 4])
-fi
+PKG_CHECK_MODULES([SSL], [openssl])
AC_ARG_WITH(masterpw, AC_HELP_STRING([--with-masterpw], [Enable support for a hard-coded master password]), [ masterpw=$withval ], [ masterpw=no ])
if test "$masterpw" != "no"; then
AC_DEFINE(ENDIAN_UNKNOWN, [1], [Define this to 1 if you do not know what endian-ness your platform is.])
])
-AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [Enable (mostly) static build.]), [ staticbuild=$enableval ], [ staticbuild=no ])
-if test ! "$staticbuild" = "no"; then
- DC_MAKE_STATIC
-fi
-
-
-AC_OUTPUT(Makefile)
+AC_OUTPUT(Makefile lib/Makefile)
#include "compat.h"
#include "net.h"
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
-#endif
#include <stdarg.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#include <fcntl.h>
-#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
-#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
#include <string.h>
-#endif
-#ifdef HAVE_NETDB_H
#include <netdb.h>
-#endif
-#ifdef HAVE_ERRNO_H
#include <errno.h>
-#endif
-#ifdef HAVE_STDIO_H
#include <stdio.h>
-#endif
#ifndef SHUT_RDWR
#define SHUT_RDWR 2
#endif
+#ifndef HAVE_HTONLL
+uint64_t htonll(uint64_t n) {
+ uint64_t retval;
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+ retval = n;
+#else
+ retval = ((uint64_t) htonl(n & 0xFFFFFFFFLLU)) << 32;
+ retval |= htonl((n & 0xFFFFFFFF00000000LLU) >> 32);
+#endif
+ return(retval);
+}
+#endif
+
+#ifndef HAVE_NTOHLL
+
+uint64_t ntohll(uint64_t n) {
+ uint64_t retval;
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+ retval = n;
+#else
+ retval = ((uint64_t) ntohl(n & 0xFFFFFFFFLLU)) << 32;
+ retval |= ntohl((n & 0xFFFFFFFF00000000LLU) >> 32);
+#endif
+ return(retval);
+}
+
+#endif
+
+
/* Do things required for network access. */
static int net_init(void) {
#ifdef _USE_WIN32_
shutdown(sockid, SHUT_RDWR);
return(close(sockid));
}
+