Lines 1-10
Link Here
|
1 |
--- src/imapcommon.c.orig |
1 |
--- src/imapcommon.c.orig 2005-02-01 15:21:28 UTC |
2 |
+++ src/imapcommon.c |
2 |
+++ src/imapcommon.c |
3 |
@@ -121,6 +121,7 @@ |
3 |
@@ -121,6 +121,7 @@ |
4 |
#include <errno.h> |
4 |
#include <errno.h> |
5 |
|
5 |
|
6 |
#include <openssl/evp.h> |
6 |
#include <openssl/evp.h> |
7 |
+#include <openssl/md5.h> |
7 |
+#include <openssl/opensslv.h> |
8 |
|
8 |
|
9 |
#include <pthread.h> |
9 |
#include <pthread.h> |
10 |
#include <sys/types.h> |
10 |
#include <sys/types.h> |
|
|
11 |
@@ -143,7 +144,7 @@ extern pthread_mutex_t trace; |
12 |
extern IMAPCounter_Struct *IMAPCount; |
13 |
extern ProxyConfig_Struct PC_Struct; |
14 |
|
15 |
-#if HAVE_LIBSSL |
16 |
+#if HAVE_LIBCRYPTO |
17 |
#if USE_IMAP |
18 |
extern SSL_CTX *tls_ctx; |
19 |
|
20 |
@@ -186,7 +187,7 @@ static const char *SSLerrmessage( void ) |
21 |
return errbuf; |
22 |
} |
23 |
#endif /* USE_IMAP */ |
24 |
-#endif /* HAVE_LIBSSL */ |
25 |
+#endif /* HAVE_LIBCRYPTO */ |
26 |
|
27 |
|
28 |
/*++ |
29 |
@@ -294,18 +295,27 @@ extern ICD_Struct *Get_Server_conn( char *Username, |
30 |
ITD_Struct Server; |
31 |
int rc; |
32 |
unsigned int Expiration; |
33 |
- |
34 |
+#if OPENSSL_VERSION_NUMBER > 0x1010000fL |
35 |
+ EVP_MD_CTX *mdctx; |
36 |
+ mdctx = EVP_MD_CTX_new(); |
37 |
+#else |
38 |
EVP_MD_CTX mdctx; |
39 |
+#endif |
40 |
int md_len; |
41 |
|
42 |
Expiration = PC_Struct.cache_expiration_time; |
43 |
memset( &Server, 0, sizeof Server ); |
44 |
|
45 |
/* need to md5 the passwd regardless, so do that now */ |
46 |
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL |
47 |
EVP_DigestInit(&mdctx, EVP_md5()); |
48 |
EVP_DigestUpdate(&mdctx, Password, strlen(Password)); |
49 |
EVP_DigestFinal(&mdctx, md5pw, &md_len); |
50 |
- |
51 |
+#else |
52 |
+ EVP_DigestInit(mdctx, EVP_md5()); |
53 |
+ EVP_DigestUpdate(mdctx, Password, strlen(Password)); |
54 |
+ EVP_DigestFinal(mdctx, md5pw, &md_len); |
55 |
+#endif |
56 |
/* see if we have a reusable connection available */ |
57 |
ICC_Active = NULL; |
58 |
HashIndex = Hash( Username, HASH_TABLE_SIZE ); |
59 |
@@ -441,7 +451,7 @@ extern ICD_Struct *Get_Server_conn( char *Username, |
60 |
/* |
61 |
* Do STARTTLS if necessary. |
62 |
*/ |
63 |
-#if HAVE_LIBSSL |
64 |
+#if HAVE_LIBCRYPTO |
65 |
#if USE_IMAP |
66 |
if ( PC_Struct.login_disabled ) |
67 |
{ |
68 |
@@ -540,7 +550,7 @@ extern ICD_Struct *Get_Server_conn( char *Username, |
69 |
/* XXX Should we grab the session id for later reuse? */ |
70 |
} |
71 |
#endif /* USE_IMAP */ |
72 |
-#endif /* HAVE_LIBSSL */ |
73 |
+#endif /* HAVE_LIBCRYPTO */ |
74 |
|
75 |
|
76 |
/* |
77 |
@@ -671,7 +681,7 @@ extern ICD_Struct *Get_Server_conn( char *Username, |
78 |
} |
79 |
|
80 |
fail: |
81 |
-#if HAVE_LIBSSL |
82 |
+#if HAVE_LIBCRYPTO |
83 |
#if USE_IMAP |
84 |
if ( Server.conn->tls ) |
85 |
{ |
86 |
@@ -819,7 +829,7 @@ extern char *memtok( char *Begin, char *End, char **La |
87 |
*/ |
88 |
extern int IMAP_Write( ICD_Struct *ICD, const void *buf, int count ) |
89 |
{ |
90 |
-#if HAVE_LIBSSL |
91 |
+#if HAVE_LIBCRYPTO |
92 |
#if USE_IMAP |
93 |
if ( ICD->tls ) |
94 |
return SSL_write( ICD->tls, buf, count ); |
95 |
@@ -853,7 +863,7 @@ extern int IMAP_Read( ICD_Struct *ICD, void *buf, int |
96 |
char *fn = "IMAP_Read()"; |
97 |
|
98 |
|
99 |
-#if HAVE_LIBSSL |
100 |
+#if HAVE_LIBCRYPTO |
101 |
#if USE_IMAP |
102 |
if ( ICD->tls ) |
103 |
return SSL_read( ICD->tls, buf, count ); |