aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-08-19 10:36:31 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-08-19 10:36:31 +0800
commitdbf631a87d1678374d92254b6ba92089b987c064 (patch)
treed6b51727b6f6a5fb991e490396de148e52f959b5 /camel
parent1b1404afa3555f751ab78cc8e4f84ebf6b52bc2c (diff)
downloadgsoc2013-evolution-dbf631a87d1678374d92254b6ba92089b987c064.tar
gsoc2013-evolution-dbf631a87d1678374d92254b6ba92089b987c064.tar.gz
gsoc2013-evolution-dbf631a87d1678374d92254b6ba92089b987c064.tar.bz2
gsoc2013-evolution-dbf631a87d1678374d92254b6ba92089b987c064.tar.lz
gsoc2013-evolution-dbf631a87d1678374d92254b6ba92089b987c064.tar.xz
gsoc2013-evolution-dbf631a87d1678374d92254b6ba92089b987c064.tar.zst
gsoc2013-evolution-dbf631a87d1678374d92254b6ba92089b987c064.zip
Various fixes to make it work.
2003-08-18 Not Zed <NotZed@Ximian.com> * camel-http-stream.c: Various fixes to make it work. * tests/smime/pgp-mime.c (main): added missing 'ret' variable. * providers/smtp/camel-smtp-transport.c (connect_to_server): * providers/imapp/camel-imapp-store.c (connect_to_server: * providers/imap/camel-imap-store.c (connect_to_server): * providers/pop3/camel-pop3-store.c (connect_to_server): * camel-http-stream.c (http_connect): change service->session for tcp_stream_ssl_new. * camel-tcp-stream-ssl.c: Changed service to session, and fix some refcounting of it. include camel-operation.h svn path=/trunk/; revision=22275
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog17
-rw-r--r--camel/camel-http-stream.c170
-rw-r--r--camel/camel-http-stream.h6
-rw-r--r--camel/camel-tcp-stream-ssl.c48
-rw-r--r--camel/camel-tcp-stream-ssl.h7
-rw-r--r--camel/providers/imap/camel-imap-store.c4
-rw-r--r--camel/providers/imapp/camel-imapp-store.c4
-rw-r--r--camel/providers/pop3/camel-pop3-store.c4
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c4
-rw-r--r--camel/tests/smime/pgp-mime.c3
10 files changed, 162 insertions, 105 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 92e759c655..8517c00feb 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,20 @@
+2003-08-18 Not Zed <NotZed@Ximian.com>
+
+ * camel-http-stream.c: Various fixes to make it work.
+
+ * tests/smime/pgp-mime.c (main): added missing 'ret' variable.
+
+ * providers/smtp/camel-smtp-transport.c (connect_to_server):
+ * providers/imapp/camel-imapp-store.c (connect_to_server:
+ * providers/imap/camel-imap-store.c (connect_to_server):
+ * providers/pop3/camel-pop3-store.c (connect_to_server):
+ * camel-http-stream.c (http_connect): change service->session for
+ tcp_stream_ssl_new.
+
+ * camel-tcp-stream-ssl.c: Changed service to session, and fix some
+ refcounting of it.
+ include camel-operation.h
+
2003-08-15 Not Zed <NotZed@Ximian.com>
** See bug #47634.
diff --git a/camel/camel-http-stream.c b/camel/camel-http-stream.c
index 9d4c62709a..d9dc6e0d61 100644
--- a/camel/camel-http-stream.c
+++ b/camel/camel-http-stream.c
@@ -41,6 +41,7 @@
#endif
#include "camel-exception.h"
#include "camel-session.h"
+#include "camel-service.h" /* for hostname stuff */
#define d(x) x
@@ -77,7 +78,7 @@ camel_http_stream_init (gpointer object, gpointer klass)
http->parser = NULL;
http->content_type = NULL;
http->headers = NULL;
- http->service = NULL;
+ http->session = NULL;
http->url = NULL;
http->proxy = NULL;
http->authrealm = NULL;
@@ -92,7 +93,7 @@ camel_http_stream_finalize (CamelObject *object)
CamelHttpStream *http = CAMEL_HTTP_STREAM (object);
if (http->parser)
- camel_object_unref (CAMEL_OBJECT (http->parser));
+ camel_object_unref(http->parser);
if (http->content_type)
header_content_type_unref (http->content_type);
@@ -100,8 +101,8 @@ camel_http_stream_finalize (CamelObject *object)
if (http->headers)
header_raw_clear (&http->headers);
- if (http->service)
- camel_object_unref (CAMEL_OBJECT (http->service));
+ if (http->session)
+ camel_object_unref(http->session);
if (http->url)
camel_url_free (http->url);
@@ -113,10 +114,11 @@ camel_http_stream_finalize (CamelObject *object)
g_free (http->authpass);
if (http->raw)
- camel_object_unref (CAMEL_OBJECT (http->raw));
+ camel_object_unref(http->raw);
+ if (http->read)
+ camel_object_unref(http->read);
}
-
CamelType
camel_http_stream_get_type (void)
{
@@ -136,49 +138,48 @@ camel_http_stream_get_type (void)
return type;
}
-
/**
* camel_http_stream_new:
* @method: HTTP method
- * @service: parent service (for SSL/TLS)
+ * @session: active session
* @url: URL to act upon
*
* Return value: a http stream
**/
CamelStream *
-camel_http_stream_new (CamelHttpMethod method, CamelService *service, CamelURL *url)
+camel_http_stream_new (CamelHttpMethod method, struct _CamelSession *session, CamelURL *url)
{
CamelHttpStream *stream;
char *str;
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
- g_return_val_if_fail (url != NULL, NULL);
+ g_return_val_if_fail(CAMEL_IS_SESSION(session), NULL);
+ g_return_val_if_fail(url != NULL, NULL);
stream = CAMEL_HTTP_STREAM (camel_object_new (camel_http_stream_get_type ()));
stream->method = method;
- stream->service = service;
- camel_object_ref (CAMEL_OBJECT (service));
+ stream->session = session;
+ camel_object_ref(session);
str = camel_url_to_string (url, 0);
stream->url = camel_url_new (str, NULL);
g_free (str);
- return CAMEL_STREAM (stream);
+ return (CamelStream *)stream;
}
#define SSL_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
static CamelStream *
-http_connect (CamelService *service, CamelURL *url)
+http_connect (CamelHttpStream *http, CamelURL *url)
{
- CamelStream *buffered, *stream = NULL;
+ CamelStream *stream = NULL;
struct hostent *host;
int errsave;
if (!strcasecmp (url->protocol, "https")) {
#ifdef HAVE_SSL
- stream = camel_tcp_stream_ssl_new (service, url->host, SSL_FLAGS);
+ stream = camel_tcp_stream_ssl_new (http->session, url->host, SSL_FLAGS);
#endif
} else {
stream = camel_tcp_stream_raw_new ();
@@ -189,6 +190,8 @@ http_connect (CamelService *service, CamelURL *url)
return NULL;
}
+ printf("connecting to http stream @ '%s'\n", url->host);
+
host = camel_gethostbyname (url->host, NULL);
if (!host) {
errno = EHOSTUNREACH;
@@ -204,13 +207,31 @@ http_connect (CamelService *service, CamelURL *url)
}
camel_free_host (host);
+
+ http->raw = stream;
+ http->read = camel_stream_buffer_new (stream, CAMEL_STREAM_BUFFER_READ);
- buffered = camel_stream_buffer_new (stream, CAMEL_STREAM_BUFFER_READ);
- camel_object_unref (CAMEL_OBJECT (stream));
-
- return buffered;
+ return stream;
}
+static void
+http_disconnect(CamelHttpStream *http)
+{
+ if (http->raw) {
+ camel_object_unref(http->raw);
+ http->raw = NULL;
+ }
+
+ if (http->read) {
+ camel_object_unref(http->read);
+ http->read = NULL;
+ }
+
+ if (http->parser) {
+ camel_object_unref(http->parser);
+ http->parser = NULL;
+ }
+}
static const char *
http_next_token (const unsigned char *in)
@@ -232,18 +253,19 @@ http_get_statuscode (CamelHttpStream *http)
const char *token;
char buffer[4096];
- if (camel_stream_buffer_gets (CAMEL_STREAM_BUFFER (http->raw), buffer, sizeof (buffer)) <= 0)
+ if (camel_stream_buffer_gets ((CamelStreamBuffer *)http->read, buffer, sizeof (buffer)) <= 0)
return -1;
-
+
+ d(printf("HTTP Status: %s\n", buffer));
+
/* parse the HTTP status code */
if (!strncasecmp (buffer, "HTTP/", 5)) {
token = http_next_token (buffer);
http->statuscode = header_decode_int (&token);
return http->statuscode;
}
-
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->raw = NULL;
+
+ http_disconnect(http);
return -1;
}
@@ -261,15 +283,12 @@ http_get_headers (CamelHttpStream *http)
camel_object_unref (CAMEL_OBJECT (http->parser));
http->parser = camel_mime_parser_new ();
- camel_mime_parser_init_with_stream (http->parser, http->raw);
+ camel_mime_parser_init_with_stream (http->parser, http->read);
switch (camel_mime_parser_step (http->parser, &buf, &len)) {
case HSCAN_MESSAGE:
case HSCAN_HEADER:
- /* we have the headers, build them into 'us' */
headers = camel_mime_parser_headers_raw (http->parser);
-
- /* if content-type exists, process it first, set for fallback charset in headers */
if (http->content_type)
header_content_type_unref (http->content_type);
type = header_raw_find (&headers, "Content-Type", NULL);
@@ -284,7 +303,9 @@ http_get_headers (CamelHttpStream *http)
http->headers = NULL;
tail = (struct _header_raw *) &http->headers;
+ d(printf("HTTP Headers:\n"));
while (headers) {
+ d(printf(" %s:%s\n", headers->name, headers->value));
node = g_new (struct _header_raw, 1);
node->next = NULL;
node->name = g_strdup (headers->name);
@@ -313,8 +334,7 @@ http_get_headers (CamelHttpStream *http)
return 0;
exception:
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->raw = NULL;
+ http_disconnect(http);
return -1;
}
@@ -337,34 +357,39 @@ http_method_invoke (CamelHttpStream *http)
}
url = camel_url_to_string (http->url, 0);
+ d(printf("HTTP Stream Sending: %s %s HTTP/1.0\r\nUser-Agent: %s\r\nHost: %s\r\n",
+ method,
+ http->proxy ? url : http->url->path,
+ http->user_agent ? http->user_agent : "CamelHttpStream/1.0",
+ http->url->host));
if (camel_stream_printf (http->raw, "%s %s HTTP/1.0\r\nUser-Agent: %s\r\nHost: %s\r\n",
- method, http->user_agent ? http->user_agent : "CamelHttpStream/1.0",
+ method,
http->proxy ? url : http->url->path,
+ http->user_agent ? http->user_agent : "CamelHttpStream/1.0",
http->url->host) == -1) {
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->raw = NULL;
+ http_disconnect(http);
g_free (url);
return -1;
}
g_free (url);
+
+ if (http->authrealm)
+ d(printf("HTTP Stream Sending: WWW-Authenticate: %s\n", http->authrealm));
if (http->authrealm && camel_stream_printf (http->raw, "WWW-Authenticate: %s\r\n", http->authrealm) == -1) {
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->raw = NULL;
+ http_disconnect(http);
return -1;
}
if (http->authpass && http->proxy && camel_stream_printf (http->raw, "Proxy-Authorization: Basic %s\r\n",
http->authpass) == -1) {
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->raw = NULL;
+ http_disconnect(http);
return -1;
}
/* end the headers */
if (camel_stream_write (http->raw, "\r\n", 2) == -1 || camel_stream_flush (http->raw) == -1) {
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->raw = NULL;
+ http_disconnect(http);
return -1;
}
@@ -386,8 +411,7 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
redirect:
if (!http->raw) {
- http->raw = http_connect (http->service, http->proxy ? http->proxy : http->url);
- if (!http->raw)
+ if (http_connect (http, http->proxy ? http->proxy : http->url) == NULL)
return -1;
if (http_method_invoke (http) == -1)
@@ -405,28 +429,39 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
/* we are OK to go... */
break;
case 301:
- case 302:
+ case 302: {
+ char *loc;
+
+ header_content_type_unref (http->content_type);
+ http->content_type = NULL;
+ http_disconnect(http);
+
+ loc = g_strdup(header_raw_find(&http->headers, "Location", NULL));
+ if (loc == NULL) {
+ header_raw_clear(&http->headers);
+ return -1;
+ }
+
/* redirect... */
+ g_strstrip(loc);
+ d(printf("HTTP redirect, location = %s\n", loc));
camel_url_free (http->url);
- http->url = camel_url_new (header_raw_find (&http->headers, "Location", NULL), NULL);
-
- camel_object_unref (CAMEL_OBJECT (http->parser));
- camel_object_unref (CAMEL_OBJECT (http->raw));
- header_content_type_unref (http->content_type);
+ http->url = camel_url_new(loc, NULL);
+ if (http->url == NULL) {
+ printf("redirect url '%s' cannot be parsed\n", loc);
+ header_raw_clear (&http->headers);
+ return -1;
+ }
+ d(printf(" redirect url = %p\n", http->url));
header_raw_clear (&http->headers);
- http->parser = NULL;
- http->raw = NULL;
-
+
goto redirect;
- break;
+ break; }
case 407:
/* failed proxy authentication? */
default:
/* unknown error */
- camel_object_unref (CAMEL_OBJECT (http->parser));
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->parser = NULL;
- http->raw = NULL;
+ http_disconnect(http);
return -1;
}
}
@@ -435,6 +470,8 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
if (nread > 0)
memcpy (buffer, parser_buf, nread);
+ else if (nread == 0)
+ stream->eos = TRUE;
return nread;
}
@@ -464,9 +501,8 @@ stream_close (CamelStream *stream)
if (http->raw) {
if (camel_stream_close (http->raw) == -1)
return -1;
-
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->raw = NULL;
+
+ http_disconnect(http);
}
return 0;
@@ -477,24 +513,19 @@ stream_reset (CamelStream *stream)
{
CamelHttpStream *http = CAMEL_HTTP_STREAM (stream);
- if (http->raw) {
- camel_stream_close (http->raw);
- camel_object_unref (CAMEL_OBJECT (http->raw));
- http->raw = NULL;
- }
-
+ if (http->raw)
+ http_disconnect(http);
+
return 0;
};
-
CamelContentType *
camel_http_stream_get_content_type (CamelHttpStream *http_stream)
{
g_return_val_if_fail (CAMEL_IS_HTTP_STREAM (http_stream), NULL);
if (!http_stream->content_type && !http_stream->raw) {
- http_stream->raw = http_connect (http_stream->service, http_stream->url);
- if (!http_stream->raw)
+ if (http_connect (http_stream, http_stream->url) == NULL)
return NULL;
if (http_method_invoke (http_stream) == -1)
@@ -510,7 +541,6 @@ camel_http_stream_get_content_type (CamelHttpStream *http_stream)
return http_stream->content_type;
}
-
void
camel_http_stream_set_user_agent (CamelHttpStream *http_stream, const char *user_agent)
{
diff --git a/camel/camel-http-stream.h b/camel/camel-http-stream.h
index 40733662ef..41a82d0def 100644
--- a/camel/camel-http-stream.h
+++ b/camel/camel-http-stream.h
@@ -31,7 +31,6 @@ extern "C" {
#include <camel/camel-mime-parser.h>
#include <camel/camel-mime-utils.h>
-#include <camel/camel-service.h>
#include <camel/camel-stream.h>
#include <camel/camel-url.h>
@@ -63,7 +62,7 @@ struct _CamelHttpStream {
struct _header_raw *headers;
CamelHttpMethod method;
- CamelService *service;
+ struct _CamelSession *session;
CamelURL *url;
char *user_agent;
@@ -76,6 +75,7 @@ struct _CamelHttpStream {
int statuscode;
CamelStream *raw;
+ CamelStream *read;
};
struct _CamelHttpStreamClass {
@@ -88,7 +88,7 @@ struct _CamelHttpStreamClass {
CamelType camel_http_stream_get_type (void);
/* public methods */
-CamelStream *camel_http_stream_new (CamelHttpMethod method, CamelService *service, CamelURL *url);
+CamelStream *camel_http_stream_new (CamelHttpMethod method, struct _CamelSession *session, CamelURL *url);
void camel_http_stream_set_user_agent (CamelHttpStream *http_stream, const char *user_agent);
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index 3a3f234544..1c8f1b34de 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -60,6 +60,7 @@
#include "camel-stream-fs.h"
#include "camel-session.h"
#include "camel-certdb.h"
+#include "camel-operation.h"
/* from md5-utils.h */
void md5_get_digest (const char *buffer, int buffer_size, unsigned char digest[16]);
@@ -86,7 +87,7 @@ static CamelTcpAddress *stream_get_remote_address (CamelTcpStream *stream);
struct _CamelTcpStreamSSLPrivate {
PRFileDesc *sockfd;
- CamelService *service;
+ struct _CamelSession *session;
char *expected_host;
gboolean ssl_mode;
guint32 flags;
@@ -130,7 +131,10 @@ camel_tcp_stream_ssl_finalize (CamelObject *object)
if (stream->priv->sockfd != NULL)
PR_Close (stream->priv->sockfd);
-
+
+ if (stream->priv->session)
+ camel_object_unref(stream->priv->session);
+
g_free (stream->priv->expected_host);
g_free (stream->priv);
@@ -159,24 +163,27 @@ camel_tcp_stream_ssl_get_type (void)
/**
* camel_tcp_stream_ssl_new:
- * @service: camel service
+ * @session: active session
* @expected_host: host that the stream is expected to connect with.
* @flags: ENABLE_SSL2, ENABLE_SSL3 and/or ENABLE_TLS
*
* Since the SSL certificate authenticator may need to prompt the
- * user, a CamelService is needed. @expected_host is needed as a
+ * user, a CamelSession is needed. @expected_host is needed as a
* protection against an MITM attack.
*
* Return value: a ssl stream (in ssl mode)
**/
CamelStream *
-camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host, guint32 flags)
+camel_tcp_stream_ssl_new (CamelSession *session, const char *expected_host, guint32 flags)
{
CamelTcpStreamSSL *stream;
-
+
+ g_assert(CAMEL_IS_SESSION(session));
+
stream = CAMEL_TCP_STREAM_SSL (camel_object_new (camel_tcp_stream_ssl_get_type ()));
- stream->priv->service = service;
+ stream->priv->session = session;
+ camel_object_ref(session);
stream->priv->expected_host = g_strdup (expected_host);
stream->priv->ssl_mode = TRUE;
stream->priv->flags = flags;
@@ -187,24 +194,27 @@ camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host, guin
/**
* camel_tcp_stream_ssl_new_raw:
- * @service: camel service
+ * @session: active session
* @expected_host: host that the stream is expected to connect with.
* @flags: ENABLE_SSL2, ENABLE_SSL3 and/or ENABLE_TLS
*
* Since the SSL certificate authenticator may need to prompt the
- * user, a CamelService is needed. @expected_host is needed as a
+ * user, a CamelSession is needed. @expected_host is needed as a
* protection against an MITM attack.
*
* Return value: a ssl-capable stream (in non ssl mode)
**/
CamelStream *
-camel_tcp_stream_ssl_new_raw (CamelService *service, const char *expected_host, guint32 flags)
+camel_tcp_stream_ssl_new_raw (CamelSession *session, const char *expected_host, guint32 flags)
{
CamelTcpStreamSSL *stream;
+
+ g_assert(CAMEL_IS_SESSION(session));
stream = CAMEL_TCP_STREAM_SSL (camel_object_new (camel_tcp_stream_ssl_get_type ()));
- stream->priv->service = service;
+ stream->priv->session = session;
+ camel_object_ref(session);
stream->priv->expected_host = g_strdup (expected_host);
stream->priv->ssl_mode = FALSE;
stream->priv->flags = flags;
@@ -797,14 +807,12 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
char *prompt, *cert_str, *fingerprint;
CamelTcpStreamSSL *ssl;
CERTCertificate *cert;
- CamelService *service;
SECStatus status = SECFailure;
g_return_val_if_fail (data != NULL, SECFailure);
g_return_val_if_fail (CAMEL_IS_TCP_STREAM_SSL (data), SECFailure);
- ssl = CAMEL_TCP_STREAM_SSL (data);
- service = ssl->priv->service;
+ ssl = data;
cert = SSL_PeerCertificate (sockfd);
if (cert == NULL)
@@ -831,11 +839,11 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
/* construct our user prompt */
prompt = g_strdup_printf (_("SSL Certificate check for %s:\n\n%s\n\nDo you wish to accept?"),
- service->url->host, cert_str);
+ ssl->priv->expected_host, cert_str);
g_free (cert_str);
/* query the user to find out if we want to accept this certificate */
- accept = camel_session_alert_user (service->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE);
+ accept = camel_session_alert_user (ssl->priv->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE);
g_free(prompt);
if (accept) {
camel_certdb_nss_cert_set(certdb, ccert, cert);
@@ -876,7 +884,7 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
printf("unknown issuer, adding ... \n");
prompt = g_strdup_printf(_("Certificate problem: %s\nIssuer: %s"), cert->subjectName, cert->issuerName);
- if (camel_session_alert_user(service->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE)) {
+ if (camel_session_alert_user(ssl->priv->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE)) {
nick = get_nickname(cert);
if (NULL == nick) {
@@ -928,7 +936,7 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
prompt = g_strdup_printf(_("Bad certificate domain: %s\nIssuer: %s"), cert->subjectName, cert->issuerName);
- if (camel_session_alert_user (service->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE)) {
+ if (camel_session_alert_user (ssl->priv->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE)) {
host = SSL_RevealURL(sockfd);
status = CERT_AddOKDomainName(cert, host);
printf("add ok domain name : %s\n", status == SECFailure?"fail":"ok");
@@ -946,7 +954,7 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
prompt = g_strdup_printf(_("Certificate expired: %s\nIssuer: %s"), cert->subjectName, cert->issuerName);
- if (camel_session_alert_user(service->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE)) {
+ if (camel_session_alert_user(ssl->priv->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE)) {
cert->timeOK = PR_TRUE;
status = CERT_VerifyCertNow(cert->dbhandle, cert, TRUE, certUsageSSLClient, NULL);
error = PR_GetError();
@@ -963,7 +971,7 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
prompt = g_strdup_printf(_("Certificate revocation list expired: %s\nIssuer: %s"), cert->subjectName, cert->issuerName);
- if (camel_session_alert_user(service->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE)) {
+ if (camel_session_alert_user(ssl->priv->session, CAMEL_SESSION_ALERT_WARNING, prompt, TRUE)) {
host = SSL_RevealURL(sockfd);
status = CERT_AddOKDomainName(cert, host);
}
diff --git a/camel/camel-tcp-stream-ssl.h b/camel/camel-tcp-stream-ssl.h
index a2b6903aeb..d11c2efdcb 100644
--- a/camel/camel-tcp-stream-ssl.h
+++ b/camel/camel-tcp-stream-ssl.h
@@ -31,13 +31,14 @@ extern "C" {
#endif /* __cplusplus */
#include <camel/camel-tcp-stream.h>
-#include <camel/camel-service.h>
#define CAMEL_TCP_STREAM_SSL_TYPE (camel_tcp_stream_ssl_get_type ())
#define CAMEL_TCP_STREAM_SSL(obj) (CAMEL_CHECK_CAST((obj), CAMEL_TCP_STREAM_SSL_TYPE, CamelTcpStreamSSL))
#define CAMEL_TCP_STREAM_SSL_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_TCP_STREAM_SSL_TYPE, CamelTcpStreamSSLClass))
#define CAMEL_IS_TCP_STREAM_SSL(o) (CAMEL_CHECK_TYPE((o), CAMEL_TCP_STREAM_SSL_TYPE))
+struct _CamelSession;
+
enum {
CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 = (1 << 0),
CAMEL_TCP_STREAM_SSL_ENABLE_SSL3 = (1 << 1),
@@ -61,9 +62,9 @@ typedef struct {
CamelType camel_tcp_stream_ssl_get_type (void);
/* public methods */
-CamelStream *camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host, guint32 flags);
+CamelStream *camel_tcp_stream_ssl_new (struct _CamelSession *session, const char *expected_host, guint32 flags);
-CamelStream *camel_tcp_stream_ssl_new_raw (CamelService *service, const char *expected_host, guint32 flags);
+CamelStream *camel_tcp_stream_ssl_new_raw (struct _CamelSession *session, const char *expected_host, guint32 flags);
int camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *ssl);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index bd1daaf0a2..a1e206936a 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -567,10 +567,10 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE
#ifdef HAVE_SSL
if (ssl_mode != USE_SSL_NEVER) {
if (try_starttls) {
- tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host, STARTTLS_FLAGS);
+ tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
port = service->url->port ? service->url->port : 993;
- tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host, SSL_PORT_FLAGS);
+ tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
}
} else {
tcp_stream = camel_tcp_stream_raw_new ();
diff --git a/camel/providers/imapp/camel-imapp-store.c b/camel/providers/imapp/camel-imapp-store.c
index b3c8e57352..ae02bcb54e 100644
--- a/camel/providers/imapp/camel-imapp-store.c
+++ b/camel/providers/imapp/camel-imapp-store.c
@@ -214,10 +214,10 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls)
#ifdef HAVE_SSL
if (camel_url_get_param (service->url, "use_ssl")) {
if (try_starttls)
- tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host, STARTTLS_FLAGS);
+ tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
else {
port = service->url->port ? service->url->port : 995;
- tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host, SSL_PORT_FLAGS);
+ tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
}
} else {
tcp_stream = camel_tcp_stream_raw_new ();
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 7570f21e5e..82aa051015 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -164,10 +164,10 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE
#ifdef HAVE_SSL
if (camel_url_get_param (service->url, "use_ssl")) {
if (try_starttls) {
- tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host, STARTTLS_FLAGS);
+ tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
port = service->url->port ? service->url->port : 995;
- tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host, SSL_PORT_FLAGS);
+ tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
}
} else {
tcp_stream = camel_tcp_stream_raw_new ();
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 705fa2f5d8..504cbfa2b6 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -256,10 +256,10 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
#ifdef HAVE_SSL
if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL) {
if (try_starttls) {
- tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host, STARTTLS_FLAGS);
+ tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
port = service->url->port ? service->url->port : 465;
- tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host, SSL_PORT_FLAGS);
+ tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
}
} else {
tcp_stream = camel_tcp_stream_raw_new ();
diff --git a/camel/tests/smime/pgp-mime.c b/camel/tests/smime/pgp-mime.c
index 566ab6661f..86a81f82bf 100644
--- a/camel/tests/smime/pgp-mime.c
+++ b/camel/tests/smime/pgp-mime.c
@@ -131,7 +131,8 @@ int main (int argc, char **argv)
CamelMultipartSigned *mps;
CamelMultipartEncrypted *mpe;
GPtrArray *recipients;
-
+ int ret;
+
camel_test_init (argc, argv);
/* clear out any camel-test data */