aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog10
-rw-r--r--camel/camel-session.c35
-rw-r--r--camel/camel-session.h27
-rw-r--r--camel/camel.c47
4 files changed, 36 insertions, 83 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 0e324f855c..247986ca05 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,13 @@
+2001-03-09 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-session.c (camel_session_query_authenticator): Created a
+ new mode (CAMEL_AUTHENTICATOR_ACCEPT) which is a Yes/No prompt to
+ the user. This will be needed by the SSL/TLS code to come. Also
+ changed the return value to a gpointer rather than a char* to
+ allow the returning of TRUE/FALSE values.
+
+ * camel.c: Wrap stuff with HAVE_NSS
+
2001-03-09 Dan Winship <danw@ximian.com>
* providers/sendmail/camel-sendmail-transport.c (sendmail_send,
diff --git a/camel/camel-session.c b/camel/camel-session.c
index f8e27c382b..6fed6bfb9f 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -151,7 +151,7 @@ camel_session_new (const char *storage_path,
CamelSession *session = CAMEL_SESSION (camel_object_new (CAMEL_SESSION_TYPE));
session->storage_path = g_strdup (storage_path);
- session->authenticator = authenticator;
+ session->authenticator = authenticator;
session->registrar = registrar;
session->remover = remover;
@@ -427,7 +427,7 @@ camel_session_get_storage_path (CamelSession *session, CamelService *service,
/**
* camel_session_query_authenticator: query the session authenticator
* @session: session object
- * @mode: %CAMEL_AUTHENTICATOR_ASK or %CAMEL_AUTHENTICATOR_TELL
+ * @mode: %CAMEL_AUTHENTICATOR_ASK, %CAMEL_AUTHENTICATOR_TELL or CAMEL_AUTHENTICATOR_ACCEPT
* @data: prompt to query user with, or data to cache
* @secret: whether or not the data is secret (eg, a password)
* @service: the service this query is being made by
@@ -453,9 +453,14 @@ camel_session_get_storage_path (CamelSession *session, CamelService *service,
* caching anything about that datum (eg, because the data is a
* password that turned out to be incorrect).
*
+ * If @mode is %CAMEL_AUTHENTICATOR_ACCEPT, then @data is a YES/NO
+ * question to ask the user (if the application doesn't already have
+ * the answer cached). Return GINT_TO_POINTER(TRUE) on accept, or
+ * GINT_TO_POINTER(FALSE) to decline.
+ *
* Return value: the authentication information or %NULL.
**/
-char *
+gpointer
camel_session_query_authenticator (CamelSession *session,
CamelAuthCallbackMode mode,
char *prompt, gboolean secret,
@@ -466,30 +471,6 @@ camel_session_query_authenticator (CamelSession *session,
service, item, ex);
}
-#ifdef U_CANT_TOUCH_THIS
-/**
- * camel_session_query_cert_authenticator:
- * @session: session object
- * @prompt: prompt to query user with
- *
- * This function is used by SSL to discuss certificate authentication
- * information with the application and/or user. Allows the user to
- * override the SSL certificate authenticator, which, at this point,
- * must have failed to authenticate the server.
- *
- * UI should be a Yes/No prompt probably defaulting to No.
- *
- * Return value: TRUE if the user decides that the SSL connection
- * should continue with the untrusted server or FALSE otherwise.
- **/
-gboolean
-camel_session_query_cert_authenticator (CamelSession *session,
- char *prompt)
-{
- return session->cert_authenticator (prompt);
-}
-#endif /* U_CANT_TOUCH_THIS */
-
/**
* camel_session_register_timeout: Register a timeout to be called
diff --git a/camel/camel-session.h b/camel/camel-session.h
index c530c6ffe6..39b65f7da6 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -44,18 +44,15 @@ extern "C" {
typedef enum {
- CAMEL_AUTHENTICATOR_ASK, CAMEL_AUTHENTICATOR_TELL
+ CAMEL_AUTHENTICATOR_ASK,
+ CAMEL_AUTHENTICATOR_TELL,
+ CAMEL_AUTHENTICATOR_ACCEPT
} CamelAuthCallbackMode;
-typedef char *(*CamelAuthCallback) (CamelAuthCallbackMode mode,
- char *data, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex);
-
-#ifdef U_CANT_TOUCH_THIS
-/* this is just a guess as to what we'll actually need */
-typedef gboolean (*CamelBadCertCallback) (char *data);
-#endif
+typedef gpointer (*CamelAuthCallback) (CamelAuthCallbackMode mode,
+ char *data, gboolean secret,
+ CamelService *service, char *item,
+ CamelException *ex);
typedef gboolean (*CamelTimeoutCallback) (gpointer data);
typedef guint (*CamelTimeoutRegisterCallback) (guint32 interval,
@@ -70,9 +67,6 @@ struct _CamelSession
char *storage_path;
CamelAuthCallback authenticator;
-#ifdef U_CANT_TOUCH_THIS
- CamelBadCertCallback cert_authenticator;
-#endif
CamelTimeoutRegisterCallback registrar;
CamelTimeoutRemoveCallback remover;
@@ -119,7 +113,7 @@ char * camel_session_get_storage_path (CamelSession *session,
CamelService *service,
CamelException *ex);
-char * camel_session_query_authenticator (CamelSession *session,
+gpointer camel_session_query_authenticator (CamelSession *session,
CamelAuthCallbackMode mode,
char *prompt,
gboolean secret,
@@ -127,11 +121,6 @@ char * camel_session_query_authenticator (CamelSession *session,
char *item,
CamelException *ex);
-#ifdef U_CANT_TOUCH_THIS
-gboolean camel_session_query_cert_authenticator (CamelSession *session,
- char *prompt);
-#endif
-
guint camel_session_register_timeout (CamelSession *session,
guint32 interval,
CamelTimeoutCallback callback,
diff --git a/camel/camel.c b/camel/camel.c
index 5383c4d32a..c451045c32 100644
--- a/camel/camel.c
+++ b/camel/camel.c
@@ -26,40 +26,22 @@
#include <config.h>
#include "camel.h"
#include <unicode.h>
+#ifdef HAVE_NSS
+#include <mozilla/nspr.h>
+#include <nss.h>
+#include <ssl.h>
+#endif /* HAVE_NSS */
gboolean camel_verbose_debug = FALSE;
gint
-camel_init(void)
-{
-#ifdef ENABLE_THREADS
-#ifdef G_THREADS_ENABLED
- /*g_thread_init (NULL);*/
-#else /* G_THREADS_ENABLED */
- printf ("Threads are not supported by your version of glib\n");
-#endif /* G_THREADS_ENABLED */
-#endif /* ENABLE_THREADS */
-
- if (getenv ("CAMEL_VERBOSE_DEBUG"))
- camel_verbose_debug = TRUE;
-
- unicode_init ();
-
- return 0;
-}
-
-#ifdef U_CANT_TOUCH_THIS
-#include <ssl.h>
-#include <nss.h>
-
-gint
-camel_ssl_init (char *configdir, gboolean nss_init)
+camel_init (void)
{
#ifdef ENABLE_THREADS
#ifdef G_THREADS_ENABLED
/*g_thread_init (NULL);*/
-#else /* G_THREADS_ENABLED */
- printf ("Threads are not supported by your version of glib\n");
+#else /* G_THREADS_ENABLED */
+ g_warning ("Threads are not supported by your version of glib\n");
#endif /* G_THREADS_ENABLED */
#endif /* ENABLE_THREADS */
@@ -68,21 +50,12 @@ camel_ssl_init (char *configdir, gboolean nss_init)
unicode_init ();
- if (nss_init) {
- PR_init ();
-
- if (NSS_init (configdir) == SECFailure)
- return -1;
-
- /* FIXME: Erm, use appropriate policy? */
- NSS_SetDomesticPolicy ();
- }
-
+#ifdef HAVE_NSS
SSL_OptionSetDefault (SSL_ENABLE_SSL2, PR_TRUE);
SSL_OptionSetDefault (SSL_ENABLE_SSL3, PR_TRUE);
SSL_OptionSetDefault (SSL_ENABLE_TLS, PR_TRUE);
SSL_OptionSetDefault (SSL_V2_COMPATIBLE_HELLO, PR_TRUE /* maybe? */);
+#endif /* HAVE_NSS */
return 0;
}
-#endif