isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit b535af4fc468f1d9e9be7be33b219d583a40d22c
parent ff8991fd004f3659105b465997f95d504a071f08
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Wed,  7 May 2003 00:06:37 +0000

- make it work without SSL
- switch from -Ds in Makefile to config.h
- small header cleaup

Diffstat:
M.cvsignore | 4++++
MMakefile.am | 2+-
Mautogen.sh | 1+
Mconfigure.in | 53++++++++++++++++++++++++++++++++++++++---------------
Mdebian/changelog | 8+++++++-
Msrc/config.c | 10+++++++---
Msrc/cram.c | 6++++--
Msrc/dotlock.c | 4+++-
Msrc/imap.c | 8++++++--
Msrc/isync.h | 8+++++---
Msrc/list.c | 3++-
Msrc/maildir.c | 5+++--
Msrc/main.c | 3++-
Msrc/sync.c | 3++-
14 files changed, 85 insertions(+), 33 deletions(-)

diff --git a/.cvsignore b/.cvsignore @@ -3,9 +3,13 @@ Makefile.in autom4te.cache aclocal.m4 build-stamp +config.h +config.h.in config.cache config.log config.status configure +configure.lineno configure-stamp isync.spec +stamp-h1 diff --git a/Makefile.am b/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = debian src man_MANS = isync.1 -EXTRA_DIST = isyncrc.sample isync.spec.in $(man_MANS) +EXTRA_DIST = isyncrc.sample isync.spec $(man_MANS) DISTCLEANFILES = *~ build-stamp configure-stamp log: diff --git a/autogen.sh b/autogen.sh @@ -2,6 +2,7 @@ # $Id$ set -e -v aclocal +autoheader automake --add-missing autoconf ./configure "$@" diff --git a/configure.in b/configure.in @@ -1,24 +1,37 @@ AC_INIT(src/isync.h) -AM_INIT_AUTOMAKE(isync,0.9) +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(isync, 0.9.1) AM_PROG_CC_STDC if test "$GCC" = yes; then - CFLAGS="$CFLAGS -pipe -W -Wall -Wshadow -Wmissing-prototypes" + CFLAGS="$CFLAGS -pipe -W -Wall -Wshadow -Wmissing-prototypes" fi -AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=DIR location where OpenSSL is installed], - [if test -d $withval/lib; then - LIBS="$LIBS -L$withval/lib" - CFLAGS="$CFLAGS -I$withval/include" - else - AC_MSG_ERROR(can't find OpenSSL in $withval) - fi]) - AC_CHECK_FUNCS(getopt_long) -AC_CHECK_LIB(socket,socket) -AC_CHECK_LIB(nsl,inet_ntoa) -AC_CHECK_LIB(crypto,ERR_error_string) -AC_CHECK_LIB(ssl,SSL_library_init) + +AC_CHECK_LIB(socket, socket) +AC_CHECK_LIB(nsl, inet_ntoa) + +ssl=false +AC_ARG_WITH(ssl, + [ --with-ssl=DIR yes/no/OpenSSL installation root [detect]], + [ob_cv_with_ssl=$withval]) +if test "x$ob_cv_with_ssl" != xno; then + if test -d "$ob_cv_with_ssl/lib"; then + CPFLAGS="$CPPFLAGS -I$ob_cv_with_ssl/include" + LDFLAGS="$LDFLAGS -L$ob_cv_with_ssl/lib" + fi + AC_CHECK_LIB(crypto, ERR_error_string, [cryptolib=" -lcrypto"]) + AC_CHECK_LIB(ssl, SSL_library_init, [ + LIBS="-lssl$cryptolib $LIBS" + AC_DEFINE(HAVE_LIBSSL, 1, [Define if you want SSL support]) + ssl=true + ],[ + if test -n "$ob_cv_with_ssl"; then + AC_MSG_ERROR([can't find OpenSSL]) + fi + ]) +fi AC_CACHE_CHECK(for dbm_open, ac_cv_dbmopen, [ac_cv_dbmopen=no @@ -37,10 +50,20 @@ if test $ac_cv_dbmopen = no; then if test $ac_cv_libdb = yes; then LIBS="$LIBS -ldb" - AC_DEFINE(HAVE_LIBDB) + AC_DEFINE(HAVE_LIBDB, 1, [Define if you have libdb]) else AC_MSG_ERROR([Could not find dbm_open(), you must install libdb]) fi fi AC_OUTPUT(Makefile src/Makefile debian/Makefile isync.spec) + +if $ssl; then + AC_MSG_RESULT([ +Using SSL +]) +else + AC_MSG_RESULT([ +Not using SSL +]) +fi diff --git a/debian/changelog b/debian/changelog @@ -1,8 +1,14 @@ +isync (0.9.1-1) unstable; urgency=medium + + * New upstream release + + -- Oswald Buddenhagen <ossi@users.sf.net> Wed, 07 May 2003 01:22:00 +0200 + isync (0.9-1) unstable; urgency=low * New upstream release - -- Oswald Buddenhagen <ossi@users.sf.net> Wed, 26 Mar 2003 04:12:00 +0100 + -- Oswald Buddenhagen <ossi@users.sf.net> Mon, 05 May 2003 20:15:00 +0200 isync (0.8-1) unstable; urgency=low diff --git a/src/config.c b/src/config.c @@ -22,6 +22,8 @@ * despite that library's more restrictive license. */ +#include "isync.h" + #include <unistd.h> #include <limits.h> #include <errno.h> @@ -30,7 +32,6 @@ #include <string.h> #include <stdlib.h> #include <stdio.h> -#include "isync.h" config_t *boxes = 0; @@ -45,8 +46,11 @@ static char * my_strndup (const char *s, size_t nchars) { char *r = malloc (sizeof (char) * (nchars + 1)); - strncpy (r, s, nchars); - r[nchars] = 0; + if (r) + { + memcpy (r, s, nchars); + r[nchars] = 0; + } return r; } diff --git a/src/cram.c b/src/cram.c @@ -21,11 +21,13 @@ * despite that library's more restrictive license. */ -#include <assert.h> -#include "isync.h" +#include <config.h> #if HAVE_LIBSSL +#include "isync.h" + +#include <assert.h> #include <string.h> #include <openssl/hmac.h> diff --git a/src/dotlock.c b/src/dotlock.c @@ -24,13 +24,15 @@ /* * this file contains routines to establish a mutex using a `dotlock' file */ + +#include "dotlock.h" + #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #if TESTING #include <stdio.h> #endif -#include "dotlock.h" static struct flock lck = { 0, SEEK_SET, 0, 0, 0 }; diff --git a/src/imap.c b/src/imap.c @@ -22,12 +22,15 @@ * despite that library's more restrictive license. */ +#include "isync.h" + #include <assert.h> #include <unistd.h> #include <sys/mman.h> #include <sys/time.h> #include <stdlib.h> #include <stdio.h> +#include <stdarg.h> #include <errno.h> #include <string.h> #include <ctype.h> @@ -36,9 +39,8 @@ #include <arpa/inet.h> #include <netdb.h> #if HAVE_LIBSSL -#include <openssl/err.h> +# include <openssl/err.h> #endif -#include "isync.h" const char *Flags[] = { "\\Seen", @@ -594,6 +596,7 @@ imap_exec (imap_t * imap, const char *fmt, ...) /* not reached */ } +#ifdef HAVE_LIBSSL static int start_tls (imap_t *imap, config_t * cfg) { @@ -619,6 +622,7 @@ start_tls (imap_t *imap, config_t * cfg) puts ("SSL support enabled"); return 0; } +#endif imap_t * imap_connect (config_t * cfg) diff --git a/src/isync.h b/src/isync.h @@ -22,6 +22,10 @@ * despite that library's more restrictive license. */ +#include <config.h> + +#include <sys/types.h> + #if HAVE_LIBDB # define DB_DBM_HSEARCH 1 # include <db.h> @@ -29,8 +33,6 @@ # include <ndbm.h> #endif -#include <sys/types.h> -#include <stdarg.h> #if HAVE_LIBSSL # include <openssl/ssl.h> #endif @@ -47,9 +49,9 @@ typedef struct typedef struct { Socket_t *sock; - char buf[1024]; int bytes; int offset; + char buf[1024]; } buffer_t; diff --git a/src/list.c b/src/list.c @@ -21,10 +21,11 @@ * despite that library's more restrictive license. */ +#include "isync.h" + #include <ctype.h> #include <stdlib.h> #include <string.h> -#include "isync.h" static char * skip_string (char *s) diff --git a/src/maildir.c b/src/maildir.c @@ -22,6 +22,9 @@ * despite that library's more restrictive license. */ +#include "isync.h" +#include "dotlock.h" + #include <limits.h> #include <stdlib.h> #include <string.h> @@ -32,8 +35,6 @@ #include <sys/stat.h> #include <errno.h> #include <time.h> -#include "isync.h" -#include "dotlock.h" /* 2,<flags> */ static void diff --git a/src/main.c b/src/main.c @@ -22,6 +22,8 @@ * despite that library's more restrictive license. */ +#include "isync.h" + #include <sys/types.h> #include <stdlib.h> #include <unistd.h> @@ -33,7 +35,6 @@ #include <string.h> #include <ctype.h> #include <dirent.h> -#include "isync.h" int Quiet; diff --git a/src/sync.c b/src/sync.c @@ -22,6 +22,8 @@ * despite that library's more restrictive license. */ +#include "isync.h" + #include <stdio.h> #include <limits.h> #include <stdlib.h> @@ -31,7 +33,6 @@ #include <string.h> #include <errno.h> #include <sys/stat.h> -#include "isync.h" static unsigned int MaildirCount = 0;