@@ -366,6 +366,7 @@ int pop3(ClientSession_T *session, const char *buffer)
366
366
int found = 0 ;
367
367
//int indx = 0;
368
368
int validate_result ;
369
+ bool login_disabled = FALSE;
369
370
uint64_t result , top_lines , top_messageid , user_idnr ;
370
371
unsigned char * md5_apop_he ;
371
372
struct message * msg ;
@@ -431,6 +432,15 @@ int pop3(ClientSession_T *session, const char *buffer)
431
432
}
432
433
}
433
434
435
+ if (state == CLIENTSTATE_INITIAL_CONNECT ) {
436
+ if (server_conf -> ssl ) {
437
+ Field_T val ;
438
+ GETCONFIGVALUE ("login_disabled" , "POP" , val );
439
+ if (SMATCH (val , "yes" ))
440
+ login_disabled = TRUE;
441
+ }
442
+ }
443
+
434
444
switch (cmdtype ) {
435
445
436
446
case POP3_QUIT :
@@ -459,6 +469,9 @@ int pop3(ClientSession_T *session, const char *buffer)
459
469
if (state != CLIENTSTATE_INITIAL_CONNECT )
460
470
return pop3_error (session , "-ERR wrong command mode\r\n" );
461
471
472
+ if (login_disabled && ! session -> ci -> sock -> ssl_state )
473
+ return pop3_error (session , "-ERR try STLS\r\n" );
474
+
462
475
if (session -> username != NULL ) {
463
476
/* reset username */
464
477
g_free (session -> username );
@@ -478,6 +491,9 @@ int pop3(ClientSession_T *session, const char *buffer)
478
491
if (state != CLIENTSTATE_INITIAL_CONNECT )
479
492
return pop3_error (session , "-ERR wrong command mode\r\n" );
480
493
494
+ if (login_disabled && ! session -> ci -> sock -> ssl_state )
495
+ return pop3_error (session , "-ERR try STLS\r\n" );
496
+
481
497
if (session -> password != NULL ) {
482
498
g_free (session -> password );
483
499
session -> password = NULL ;
0 commit comments