]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/pop3/serv_pop3.c
For the SSL-only ports, if crypto negotiation fails,
[citadel.git] / citadel / modules / pop3 / serv_pop3.c
index c49c5cad98da96edb683b99bcc1135a0697fc2f9..fadb9f50cc15b0096111c3f147f096b7905d3aff 100644 (file)
@@ -56,9 +56,6 @@
 #include "serv_pop3.h"
 #include "md5.h"
 
-#ifdef HAVE_OPENSSL
-#include "serv_crypto.h"
-#endif
 
 
 #include "ctdl_module.h"
@@ -99,12 +96,11 @@ void pop3_greeting(void) {
 /*
  * POP3S is just like POP3, except it goes crypto right away.
  */
-#ifdef HAVE_OPENSSL
 void pop3s_greeting(void) {
-       CtdlStartTLS(NULL, NULL, NULL);
+       CtdlModuleStartCryptoMsgs(NULL, NULL, NULL);
+       if (!CC->redirect_ssl) CC->kill_me = 1;         /* kill session if no crypto */
        pop3_greeting();
 }
-#endif
 
 
 
@@ -589,7 +585,6 @@ void pop3_uidl(char *argbuf) {
 /*
  * implements the STLS command (Citadel API version)
  */
-#ifdef HAVE_OPENSSL
 void pop3_stls(void)
 {
        char ok_response[SIZ];
@@ -602,9 +597,8 @@ void pop3_stls(void)
                "-ERR TLS not supported here\r\n");
        sprintf(error_response,
                "-ERR Internal error\r\n");
-       CtdlStartTLS(ok_response, nosup_response, error_response);
+       CtdlModuleStartCryptoMsgs(ok_response, nosup_response, error_response);
 }
-#endif
 
 
 
@@ -709,6 +703,8 @@ void pop3_command_loop(void) {
 
 }
 
+const char *CitadelServicePop3="POP3";
+const char *CitadelServicePop3S="POP3S";
 
 
 CTDL_MODULE_INIT(pop3)
@@ -717,13 +713,15 @@ CTDL_MODULE_INIT(pop3)
                                NULL,
                                pop3_greeting,
                                pop3_command_loop,
-                               NULL);
+                               NULL,
+                               CitadelServicePop3);
 #ifdef HAVE_OPENSSL
        CtdlRegisterServiceHook(config.c_pop3s_port,
                                NULL,
                                pop3s_greeting,
                                pop3_command_loop,
-                               NULL);
+                               NULL,
+                               CitadelServicePop3S);
 #endif
        CtdlRegisterSessionHook(pop3_cleanup_function, EVT_STOP);