diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | cram.c | 8 | ||||
-rw-r--r-- | fetchmail.h | 8 | ||||
-rw-r--r-- | fm_md5.h (renamed from md5.h) | 13 | ||||
-rw-r--r-- | gssapi.c | 2 | ||||
-rw-r--r-- | md5c.c | 2 | ||||
-rw-r--r-- | md5ify.c | 2 | ||||
-rw-r--r-- | opie.c | 2 | ||||
-rw-r--r-- | pop3.c | 2 | ||||
-rw-r--r-- | rpa.c | 5 | ||||
-rw-r--r-- | smbutil.c | 10 | ||||
-rw-r--r-- | smtp.c | 2 | ||||
-rw-r--r-- | transact.c | 2 |
14 files changed, 37 insertions, 29 deletions
diff --git a/Makefile.am b/Makefile.am index 488346d3..900ea59e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,7 +61,7 @@ TESTS+= t.regression endif fetchmail_SOURCES= fetchmail.h getopt.h \ - i18n.h kerberos.h md5.h mx.h netrc.h smtp.h \ + i18n.h kerberos.h fm_md5.h mx.h netrc.h smtp.h \ socket.h tunable.h \ socket.c getpass.c \ fetchmail.c env.c idle.c options.c daemon.c \ diff --git a/configure.ac b/configure.ac index 69e38390..6f47a32c 100644 --- a/configure.ac +++ b/configure.ac @@ -72,7 +72,7 @@ AC_TYPE_SIGNAL AC_CHECK_HEADERS([unistd.h termios.h termio.h sgtty.h stdarg.h \ sys/itimer.h fcntl.h sys/fcntl.h memory.h sys/wait.h \ arpa/inet.h arpa/nameser.h netinet/in.h net/socket.h netdb.h \ - sys/select.h sys/socket.h sys/time.h langinfo.h]) + sys/select.h sys/socket.h sys/time.h langinfo.h md5.h]) if test _$ac_cv_header_stdarg_h != _yes ; then AC_MSG_WARN([stdarg.h is not defined. Unsupported configuration, proceed at your own risk.]) fi @@ -502,7 +502,7 @@ AC_CACHE_CHECK([for getnameinfo],[fm_cv_getnameinfo],[ #include <netdb.h> #endif #ifndef NULL -#define NULL ((void *)0) +#define NULL 0 #endif ], [getnameinfo(NULL,0, NULL,0, NULL, 0, 0);], [ fm_cv_getnameinfo=yes], @@ -791,7 +791,7 @@ then save_LIBS="$LIBS" for i in "" "-ldl" ; do LIBS="$LDFLAGS $save_LIBS $i" - AC_LINK_IFELSE([AC_LANG_PROGRAM(,[SSL_library_init()])],[found=1; break]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/ssl.h>],[SSL_library_init()])],[found=1; break]) done if test $found = 0 ; then AC_MSG_RESULT([error]) @@ -15,16 +15,16 @@ #include "socket.h" #include "i18n.h" -#include "md5.h" +#include "fm_md5.h" -void hmac_md5 (const char *password, size_t pass_len, +void hmac_md5 (const unsigned char *password, size_t pass_len, const char *challenge, size_t chal_len, unsigned char *response, size_t resp_len) { int i; unsigned char ipad[64]; unsigned char opad[64]; - char hash_passwd[16]; + unsigned char hash_passwd[16]; MD5_CTX ctx; @@ -110,7 +110,7 @@ int do_cram_md5 (int sock, const char *command, struct query *ctl, const char *s * (including angle-brackets). */ - hmac_md5(ctl->password, strlen(ctl->password), + hmac_md5((unsigned char *)ctl->password, strlen(ctl->password), msg_id, strlen (msg_id), response, sizeof (response)); diff --git a/fetchmail.h b/fetchmail.h index 51562933..a786caf2 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -324,7 +324,7 @@ struct query char *smtpaddress; /* address to force in RCPT TO */ char *smtpname; /* full RCPT TO name, including domain */ struct idlist *antispam; /* list of listener's antispam response */ - char *mda; /* local MDA to pass mail to */ + const char *mda; /* local MDA to pass mail to */ char *bsmtp; /* BSMTP output file */ char listener; /* what's the listener's wire protocol? */ #define SMTP_MODE 'S' @@ -384,7 +384,7 @@ struct query /* internal use -- per-message state */ int mimemsg; /* bitmask indicating MIME body-type */ - char digest[DIGESTLEN]; /* md5 digest buffer */ + unsigned char digest[DIGESTLEN]; /* md5 digest buffer */ /* internal use -- housekeeping */ struct query *next; /* next query control block in chain */ @@ -651,8 +651,8 @@ extern char currentwd[1024], rcfiledir[1024]; struct query *hostalloc(struct query *); int parsecmdline (int, char **, struct runctl *, struct query *); char *prependdir (const char *, const char *); -char *MD5Digest (unsigned const char *); -void hmac_md5 (const char *, size_t, const char *, size_t, unsigned char *, size_t); +unsigned char *MD5Digest (unsigned const char *); +void hmac_md5 (const unsigned char *, size_t, const char *, size_t, unsigned char *, size_t); int POP3_auth_rpa(char *, char *, int socket); typedef RETSIGTYPE (*SIGHANDLERTYPE) (int); void deal_with_sigchld(void); @@ -1,11 +1,19 @@ #ifndef MD5_H #define MD5_H + +#include "config.h" + +#include <sys/types.h> + +#ifdef HAVE_MD5_H +#include <md5.h> +#else + #ifndef HEADER_MD5_H /* Try to avoid clashes with OpenSSL */ #define HEADER_MD5_H #endif -#include "config.h" #if SIZEOF_INT == 4 typedef unsigned int uint32; @@ -24,11 +32,10 @@ void MD5Update(struct MD5Context *context, const void *buf, unsigned len); void MD5Final(void *digest, struct MD5Context *context); void MD5Transform(uint32 buf[], uint32 const in[]); -char *MD5Digest (unsigned const char *s); - /* * This is needed to make RSAREF happy on some MS-DOS compilers. */ typedef struct MD5Context MD5_CTX; +#endif #endif /* !MD5_H */ @@ -15,7 +15,7 @@ #include "socket.h" #include "i18n.h" -#include "md5.h" +#include "fm_md5.h" #include <sys/types.h> #include <netinet/in.h> /* for htonl/ntohl */ @@ -16,7 +16,7 @@ */ #include "config.h" -#include "md5.h" +#include "fm_md5.h" #ifdef HAVE_STRING_H #include <string.h> /* memmove */ #endif @@ -17,7 +17,7 @@ #include <string.h> #endif -#include "md5.h" +#include "fm_md5.h" char * MD5Digest (unsigned const char *s) @@ -15,7 +15,7 @@ #include "socket.h" #include "i18n.h" -#include "md5.h" +#include "fm_md5.h" #ifdef OPIE_ENABLE #ifdef __cplusplus @@ -690,7 +690,7 @@ static int pop3_getauth(int sock, struct query *ctl, char *greeting) msg = (char *)xmalloc((end-start+1) + strlen(ctl->password) + 1); strcpy(msg,start); strcat(msg,ctl->password); - strcpy(ctl->digest, MD5Digest((unsigned char *)msg)); + strcpy((char *)ctl->digest, (char *)MD5Digest((unsigned char *)msg)); free(msg); ok = gen_transact(sock, "APOP %s %s", ctl->remotename, ctl->digest); @@ -21,10 +21,11 @@ #include <unistd.h> #include <ctype.h> #include <string.h> +#include <sys/types.h> #include "socket.h" #include "fetchmail.h" -#include "md5.h" +#include "fm_md5.h" #include "i18n.h" #ifdef TESTMODE @@ -114,7 +115,7 @@ int POP3_auth_rpa (char *userid, char *passphrase, int socket) char buf [POPBUFSIZE]; char *bufp; int status,aulin,kuslin; - char* stdec[4] = { N_("Success") , + const char* stdec[4] = { N_("Success") , N_("Restricted user (something wrong with account)") , N_("Invalid userid or passphrase") , N_("Deity error") }; @@ -84,12 +84,12 @@ static void dumpRaw(FILE *fp, unsigned char *buf, size_t len) /* helper macro to destructively resize buffers; assumes that bufsiz * is initialized to 0 if buf is unallocated! */ -#define allocbuf(buf, bufsiz, need) do { \ +#define allocbuf(buf, bufsiz, need, type) do { \ if (!buf || (need) > (bufsiz)) \ { \ (bufsiz) = ((need) < 1024) ? 1024 : (need); \ xfree(buf); \ - (buf) = xmalloc(bufsiz); \ + (buf) = (type)xmalloc(bufsiz); \ } \ } while (0); @@ -101,7 +101,7 @@ static char *unicodeToString(char *p, size_t len) static char *buf; static size_t bufsiz; - allocbuf(buf, bufsiz, len + 1); + allocbuf(buf, bufsiz, len + 1, char *); for (i=0; i<len; ++i) { @@ -121,7 +121,7 @@ static unsigned char *strToUnicode(char *p) size_t l = strlen(p); int i = 0; - allocbuf(buf, bufsiz, l * 2); + allocbuf(buf, bufsiz, l * 2, unsigned char *); while (l--) { @@ -137,7 +137,7 @@ static unsigned char *toString(char *p, size_t len) static unsigned char *buf; static size_t bufsiz; - allocbuf(buf, bufsiz, len + 1); + allocbuf(buf, bufsiz, len + 1, unsigned char *); memcpy(buf,p,len); buf[len] = 0; @@ -97,7 +97,7 @@ static void SMTP_auth(int sock, char smtp_mode, char *username, char *password, } if (outlevel >= O_DEBUG) report(stdout, GT_("Challenge decoded: %s\n"), b64buf); - hmac_md5(password, strlen(password), + hmac_md5((unsigned char *)password, strlen(password), b64buf, strlen(b64buf), digest, sizeof(digest)); snprintf(tmp, sizeof(tmp), "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", @@ -29,7 +29,7 @@ #endif #include <sys/socket.h> #include <netdb.h> -#include "md5.h" +#include "fm_md5.h" #include "i18n.h" #include "socket.h" |