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.
87
87
1720: h323hostcall
88
88
1723: pptp
89
89
2049: nfs
90
+ 3306: MySQL
91
+ 3389: RDP / Windows Remote Desktop
90
92
3659: apple-sasl / PasswordServer
91
93
4045: lockd
92
94
5060: sip
93
95
5061: sips
96
+ 5432: PostgreSQL
97
+ 5900: VNC
94
98
6000: X11
95
99
6566: sane-port
96
100
6665: Alternate IRC
@@ -100,6 +104,7 @@ incoming connections.
100
104
6669: Alternate IRC
101
105
6697: IRC + TLS
102
106
10080: Amanda
107
+ 27017: MongoDB
103
108
104
109
For further information see:
105
110
Original file line number Diff line number Diff line change @@ -921,10 +921,14 @@ bool IsBadPort(uint16_t port)
921
921
case 1720 : // h323hostcall
922
922
case 1723 : // pptp
923
923
case 2049 : // nfs
924
+ case 3306 : // MySQL
925
+ case 3389 : // RDP / Windows Remote Desktop
924
926
case 3659 : // apple-sasl / PasswordServer
925
927
case 4045 : // lockd
926
928
case 5060 : // sip
927
929
case 5061 : // sips
930
+ case 5432 : // PostgreSQL
931
+ case 5900 : // VNC
928
932
case 6000 : // X11
929
933
case 6566 : // sane-port
930
934
case 6665 : // Alternate IRC
@@ -934,6 +938,7 @@ bool IsBadPort(uint16_t port)
934
938
case 6669 : // Alternate IRC
935
939
case 6697 : // IRC + TLS
936
940
case 10080 : // Amanda
941
+ case 27017 : // MongoDB
937
942
return true ;
938
943
}
939
944
return false ;
Original file line number Diff line number Diff line change 14
14
#include < util/translation.h>
15
15
16
16
#include < string>
17
+ #include < numeric>
17
18
18
19
#include < boost/test/unit_test.hpp>
19
20
@@ -603,14 +604,10 @@ BOOST_AUTO_TEST_CASE(isbadport)
603
604
BOOST_CHECK (!IsBadPort (443 ));
604
605
BOOST_CHECK (!IsBadPort (8333 ));
605
606
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 );
614
611
}
615
612
616
613
BOOST_AUTO_TEST_SUITE_END ()
You can’t perform that action at this time.
0 commit comments