Fossil SCM

Break out SMTP faults as a separate category on the Error Log.

drh 2025-04-16 00:58 trunk
Commit 2d3ace5a9fb4de5cd37ce2fdff0012cb438986ddeb3f866d172b7a3a3b453056
1 file changed +15 -2
--- src/security_audit.c
+++ src/security_audit.c
@@ -815,10 +815,11 @@
815815
** y=0x01 Show only hack attempts
816816
** y=0x02 Show only panics and assertion faults
817817
** y=0x04 Show hung backoffice processes
818818
** y=0x08 Show POST requests from a different origin
819819
** y=0x10 Show SQLITE_AUTH and similar
820
+** y=0x20 Show SMTP error reports
820821
** y=0x40 Show other uncategorized messages
821822
**
822823
** If y is omitted or is zero, a count of the various message types is
823824
** shown.
824825
*/
@@ -825,20 +826,21 @@
825826
void errorlog_page(void){
826827
i64 szFile;
827828
FILE *in;
828829
char *zLog;
829830
const char *zType = P("y");
830
- static const int eAllTypes = 0x5f;
831
+ static const int eAllTypes = 0x7f;
831832
long eType = 0;
832833
int bOutput = 0;
833834
int prevWasTime = 0;
834835
int nHack = 0;
835836
int nPanic = 0;
836837
int nOther = 0;
837838
int nHang = 0;
838839
int nXPost = 0;
839840
int nAuth = 0;
841
+ int nSmtp = 0;
840842
char z[10000];
841843
char zTime[10000];
842844
843845
login_check_credentials();
844846
if( !g.perm.Admin ){
@@ -911,10 +913,13 @@
911913
@ <li>POST requests from different origin
912914
}
913915
if( eType & 0x10 ){
914916
@ <li>SQLITE_AUTH and similar errors
915917
}
918
+ if( eType & 0x20 ){
919
+ @ <li>SMTP malfunctions
920
+ }
916921
if( eType & 0x40 ){
917922
@ <li>Other uncategorized messages
918923
}
919924
@ </ul>
920925
}
@@ -929,10 +934,14 @@
929934
nHack++;
930935
}else
931936
if( (strncmp(z,"panic: ", 7)==0 || strstr(z," assertion fault ")!=0) ){
932937
bOutput = (eType & 0x02)!=0;
933938
nPanic++;
939
+ }else
940
+ if( strncmp(z,"SMTP:", 5)==0 ){
941
+ bOutput = (eType & 0x20)!=0;
942
+ nSmtp++;
934943
}else
935944
if( sqlite3_strglob("warning: backoffice process * still *",z)==0 ){
936945
bOutput = (eType & 0x04)!=0;
937946
nHang++;
938947
}else
@@ -969,11 +978,11 @@
969978
fclose(in);
970979
if( eType ){
971980
@ </pre>
972981
}
973982
if( eType==0 ){
974
- int nNonHack = nPanic + nHang + nAuth + nOther;
983
+ int nNonHack = nPanic + nHang + nAuth + nSmtp + nOther;
975984
int nTotal = nNonHack + nHack + nXPost;
976985
@ <p><table border="a" cellspacing="0" cellpadding="5">
977986
if( nPanic>0 ){
978987
@ <tr><td align="right">%d(nPanic)</td>
979988
@ <td><a href="./errorlog?y=2">Panics</a></td>
@@ -992,10 +1001,14 @@
9921001
}
9931002
if( nAuth>0 ){
9941003
@ <tr><td align="right">%d(nAuth)</td>
9951004
@ <td><a href="./errorlog?y=16">SQLITE_AUTH and similar</a></td>
9961005
}
1006
+ if( nSmtp>0 ){
1007
+ @ <tr><td align="right">%d(nSmtp)</td>
1008
+ @ <td><a href="./errorlog?y=32">SMTP faults</a></td>
1009
+ }
9971010
if( nOther>0 ){
9981011
@ <tr><td align="right">%d(nOther)</td>
9991012
@ <td><a href="./errorlog?y=64">Other</a></td>
10001013
}
10011014
@ <tr><td align="right">%d(nTotal)</td>
10021015
--- src/security_audit.c
+++ src/security_audit.c
@@ -815,10 +815,11 @@
815 ** y=0x01 Show only hack attempts
816 ** y=0x02 Show only panics and assertion faults
817 ** y=0x04 Show hung backoffice processes
818 ** y=0x08 Show POST requests from a different origin
819 ** y=0x10 Show SQLITE_AUTH and similar
 
820 ** y=0x40 Show other uncategorized messages
821 **
822 ** If y is omitted or is zero, a count of the various message types is
823 ** shown.
824 */
@@ -825,20 +826,21 @@
825 void errorlog_page(void){
826 i64 szFile;
827 FILE *in;
828 char *zLog;
829 const char *zType = P("y");
830 static const int eAllTypes = 0x5f;
831 long eType = 0;
832 int bOutput = 0;
833 int prevWasTime = 0;
834 int nHack = 0;
835 int nPanic = 0;
836 int nOther = 0;
837 int nHang = 0;
838 int nXPost = 0;
839 int nAuth = 0;
 
840 char z[10000];
841 char zTime[10000];
842
843 login_check_credentials();
844 if( !g.perm.Admin ){
@@ -911,10 +913,13 @@
911 @ <li>POST requests from different origin
912 }
913 if( eType & 0x10 ){
914 @ <li>SQLITE_AUTH and similar errors
915 }
 
 
 
916 if( eType & 0x40 ){
917 @ <li>Other uncategorized messages
918 }
919 @ </ul>
920 }
@@ -929,10 +934,14 @@
929 nHack++;
930 }else
931 if( (strncmp(z,"panic: ", 7)==0 || strstr(z," assertion fault ")!=0) ){
932 bOutput = (eType & 0x02)!=0;
933 nPanic++;
 
 
 
 
934 }else
935 if( sqlite3_strglob("warning: backoffice process * still *",z)==0 ){
936 bOutput = (eType & 0x04)!=0;
937 nHang++;
938 }else
@@ -969,11 +978,11 @@
969 fclose(in);
970 if( eType ){
971 @ </pre>
972 }
973 if( eType==0 ){
974 int nNonHack = nPanic + nHang + nAuth + nOther;
975 int nTotal = nNonHack + nHack + nXPost;
976 @ <p><table border="a" cellspacing="0" cellpadding="5">
977 if( nPanic>0 ){
978 @ <tr><td align="right">%d(nPanic)</td>
979 @ <td><a href="./errorlog?y=2">Panics</a></td>
@@ -992,10 +1001,14 @@
992 }
993 if( nAuth>0 ){
994 @ <tr><td align="right">%d(nAuth)</td>
995 @ <td><a href="./errorlog?y=16">SQLITE_AUTH and similar</a></td>
996 }
 
 
 
 
997 if( nOther>0 ){
998 @ <tr><td align="right">%d(nOther)</td>
999 @ <td><a href="./errorlog?y=64">Other</a></td>
1000 }
1001 @ <tr><td align="right">%d(nTotal)</td>
1002
--- src/security_audit.c
+++ src/security_audit.c
@@ -815,10 +815,11 @@
815 ** y=0x01 Show only hack attempts
816 ** y=0x02 Show only panics and assertion faults
817 ** y=0x04 Show hung backoffice processes
818 ** y=0x08 Show POST requests from a different origin
819 ** y=0x10 Show SQLITE_AUTH and similar
820 ** y=0x20 Show SMTP error reports
821 ** y=0x40 Show other uncategorized messages
822 **
823 ** If y is omitted or is zero, a count of the various message types is
824 ** shown.
825 */
@@ -825,20 +826,21 @@
826 void errorlog_page(void){
827 i64 szFile;
828 FILE *in;
829 char *zLog;
830 const char *zType = P("y");
831 static const int eAllTypes = 0x7f;
832 long eType = 0;
833 int bOutput = 0;
834 int prevWasTime = 0;
835 int nHack = 0;
836 int nPanic = 0;
837 int nOther = 0;
838 int nHang = 0;
839 int nXPost = 0;
840 int nAuth = 0;
841 int nSmtp = 0;
842 char z[10000];
843 char zTime[10000];
844
845 login_check_credentials();
846 if( !g.perm.Admin ){
@@ -911,10 +913,13 @@
913 @ <li>POST requests from different origin
914 }
915 if( eType & 0x10 ){
916 @ <li>SQLITE_AUTH and similar errors
917 }
918 if( eType & 0x20 ){
919 @ <li>SMTP malfunctions
920 }
921 if( eType & 0x40 ){
922 @ <li>Other uncategorized messages
923 }
924 @ </ul>
925 }
@@ -929,10 +934,14 @@
934 nHack++;
935 }else
936 if( (strncmp(z,"panic: ", 7)==0 || strstr(z," assertion fault ")!=0) ){
937 bOutput = (eType & 0x02)!=0;
938 nPanic++;
939 }else
940 if( strncmp(z,"SMTP:", 5)==0 ){
941 bOutput = (eType & 0x20)!=0;
942 nSmtp++;
943 }else
944 if( sqlite3_strglob("warning: backoffice process * still *",z)==0 ){
945 bOutput = (eType & 0x04)!=0;
946 nHang++;
947 }else
@@ -969,11 +978,11 @@
978 fclose(in);
979 if( eType ){
980 @ </pre>
981 }
982 if( eType==0 ){
983 int nNonHack = nPanic + nHang + nAuth + nSmtp + nOther;
984 int nTotal = nNonHack + nHack + nXPost;
985 @ <p><table border="a" cellspacing="0" cellpadding="5">
986 if( nPanic>0 ){
987 @ <tr><td align="right">%d(nPanic)</td>
988 @ <td><a href="./errorlog?y=2">Panics</a></td>
@@ -992,10 +1001,14 @@
1001 }
1002 if( nAuth>0 ){
1003 @ <tr><td align="right">%d(nAuth)</td>
1004 @ <td><a href="./errorlog?y=16">SQLITE_AUTH and similar</a></td>
1005 }
1006 if( nSmtp>0 ){
1007 @ <tr><td align="right">%d(nSmtp)</td>
1008 @ <td><a href="./errorlog?y=32">SMTP faults</a></td>
1009 }
1010 if( nOther>0 ){
1011 @ <tr><td align="right">%d(nOther)</td>
1012 @ <td><a href="./errorlog?y=64">Other</a></td>
1013 }
1014 @ <tr><td align="right">%d(nTotal)</td>
1015

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button