Fossil

Check-in [06507038]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Pop3 server sends a final +OK after QUIT.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 065070385a51e584d4ba8e45b043c7841c837474c49e8b341c716d110a211f3c
User & Date: drh 2018-07-18 02:19:26
Context
2018-07-18
16:58
Add the concept of "backoffice" processing, used to do background cleanup operations after repository changes, such sending alerts and/or syncing to peer repositories. check-in: 947081aa user: drh tags: trunk
16:43
Add the backoffice module for doing post-processing actions such as sending alerts and/or syncing repositories. check-in: 86b43a46 user: drh tags: backoffice
02:19
Pop3 server sends a final +OK after QUIT. check-in: 06507038 user: drh tags: trunk
02:14
Enhance the pop3 TOP command so that the second argument can be zero. check-in: 64493163 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/smtp.c.

  1395   1395     pop3_print(pLog, "+OK POP3 server ready");
  1396   1396     while( fgets(zIn, sizeof(zIn), stdin) ){
  1397   1397       if( pLog ) fprintf(pLog, "C: %s", zIn);
  1398   1398       zCmd = zIn;
  1399   1399       zA1 = pop3d_arg(zCmd);
  1400   1400       zA2 = zA1 ? pop3d_arg(zA1) : 0;
  1401   1401       for(i=0; zCmd[i]; i++){ zCmd[i] = fossil_tolower(zCmd[i]); }
         1402  +    if( strcmp(zCmd,"quit")==0 ){
         1403  +      if( !inAuth ){
         1404  +        db_multi_exec(
         1405  +          "UPDATE emailbox SET estate=2"
         1406  +          " WHERE estate<2 AND ebid IN (SELECT ebid FROM pop3 WHERE isDel);"
         1407  +        );
         1408  +      }
         1409  +      pop3_print(pLog, "+OK");
         1410  +      break;
         1411  +    }
  1402   1412       if( strcmp(zCmd,"capa")==0 ){
  1403   1413         static const char *azCap[] = {
  1404   1414             "TOP", "USER", "UIDL",
  1405   1415         };
  1406   1416         int i;
  1407   1417         pop3_print(pLog, "+OK");
  1408   1418         for(i=0; i<sizeof(azCap)/sizeof(azCap[0]); i++){
................................................................................
  1436   1446               "  WHERE emailid=emsgid AND euser=%Q AND estate<=1"
  1437   1447               "  ORDER BY edate;",
  1438   1448               zUser
  1439   1449             );
  1440   1450             goto cmd_ok;
  1441   1451           }   
  1442   1452         }
  1443         -      if( strcmp(zCmd,"quit")==0 ) break;
  1444   1453         /* Fossil cannot process APOP since the users clear-text password is
  1445   1454         ** unknown. */
  1446   1455         goto cmd_error;
  1447   1456       }else{
  1448         -      if( strcmp(zCmd,"quit")==0 ){
  1449         -        db_multi_exec(
  1450         -          "UPDATE emailbox SET estate=2"
  1451         -          " WHERE estate<2 AND ebid IN (SELECT ebid FROM pop3 WHERE isDel);"
  1452         -        );
  1453         -        break;
  1454         -      }
  1455   1457         if( strcmp(zCmd,"stat")==0 ){
  1456   1458           db_prepare(&q, "SELECT count(*), sum(esz) FROM pop3 WHERE NOT isDel");
  1457   1459           if( db_step(&q)==SQLITE_ROW ){
  1458   1460             pop3_print(pLog, "+OK %d %d",
  1459   1461                        db_column_int(&q,0), db_column_int(&q,1));
  1460   1462           }else{
  1461   1463             pop3_print(pLog,"-ERR");