Bläddra i källkod

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

Oswald Buddenhagen 22 år sedan
förälder
incheckning
b535af4fc4
14 ändrade filer med 85 tillägg och 33 borttagningar
  1. 4 0
      .cvsignore
  2. 1 1
      Makefile.am
  3. 1 0
      autogen.sh
  4. 38 15
      configure.in
  5. 7 1
      debian/changelog
  6. 7 3
      src/config.c
  7. 4 2
      src/cram.c
  8. 3 1
      src/dotlock.c
  9. 6 2
      src/imap.c
  10. 5 3
      src/isync.h
  11. 2 1
      src/list.c
  12. 3 2
      src/maildir.c
  13. 2 1
      src/main.c
  14. 2 1
      src/sync.c

+ 4 - 0
.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

+ 1 - 1
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:

+ 1 - 0
autogen.sh

@@ -2,6 +2,7 @@
 # $Id$
 set -e -v
 aclocal
+autoheader
 automake --add-missing
 autoconf
 ./configure "$@"

+ 38 - 15
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

+ 7 - 1
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
 

+ 7 - 3
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;
 }
 

+ 4 - 2
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>
 

+ 3 - 1
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 };
 

+ 6 - 2
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)

+ 5 - 3
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;
 

+ 2 - 1
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)

+ 3 - 2
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

+ 2 - 1
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;
 

+ 2 - 1
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;