File tree Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,14 @@ incoming connections.
8787 1720: h323hostcall
8888 1723: pptp
8989 2049: nfs
90+ 3306: MySQL
91+ 3389: RDP / Windows Remote Desktop
9092 3659: apple-sasl / PasswordServer
9193 4045: lockd
9294 5060: sip
9395 5061: sips
96+ 5432: PostgreSQL
97+ 5900: VNC
9498 6000: X11
9599 6566: sane-port
96100 6665: Alternate IRC
@@ -100,6 +104,7 @@ incoming connections.
100104 6669: Alternate IRC
101105 6697: IRC + TLS
102106 10080: Amanda
107+ 27017: MongoDB
103108
104109For further information see:
105110
Original file line number Diff line number Diff line change @@ -921,10 +921,14 @@ bool IsBadPort(uint16_t port)
921921 case 1720 : // h323hostcall
922922 case 1723 : // pptp
923923 case 2049 : // nfs
924+ case 3306 : // MySQL
925+ case 3389 : // RDP / Windows Remote Desktop
924926 case 3659 : // apple-sasl / PasswordServer
925927 case 4045 : // lockd
926928 case 5060 : // sip
927929 case 5061 : // sips
930+ case 5432 : // PostgreSQL
931+ case 5900 : // VNC
928932 case 6000 : // X11
929933 case 6566 : // sane-port
930934 case 6665 : // Alternate IRC
@@ -934,6 +938,7 @@ bool IsBadPort(uint16_t port)
934938 case 6669 : // Alternate IRC
935939 case 6697 : // IRC + TLS
936940 case 10080 : // Amanda
941+ case 27017 : // MongoDB
937942 return true ;
938943 }
939944 return false ;
Original file line number Diff line number Diff line change 1414#include < util/translation.h>
1515
1616#include < string>
17+ #include < numeric>
1718
1819#include < boost/test/unit_test.hpp>
1920
@@ -603,14 +604,10 @@ BOOST_AUTO_TEST_CASE(isbadport)
603604 BOOST_CHECK (!IsBadPort (443 ));
604605 BOOST_CHECK (!IsBadPort (8333 ));
605606
606- // Check all ports, there must be 80 bad ports in total.
607- size_t total_bad_ports{0 };
608- for (uint16_t port = std::numeric_limits<uint16_t >::max (); port > 0 ; --port) {
609- if (IsBadPort (port)) {
610- ++total_bad_ports;
611- }
612- }
613- BOOST_CHECK_EQUAL (total_bad_ports, 80 );
607+ // Check all possible ports and ensure we only flag the expected amount as bad
608+ std::list<int > ports (std::numeric_limits<uint16_t >::max ());
609+ std::iota (ports.begin (), ports.end (), 1 );
610+ BOOST_CHECK_EQUAL (std::ranges::count_if (ports, IsBadPort), 85 );
614611}
615612
616613BOOST_AUTO_TEST_SUITE_END ()
You can’t perform that action at this time.
0 commit comments