sergehuber commented on code in PR #715:
URL: https://github.com/apache/unomi/pull/715#discussion_r2428094420
##########
services/src/main/java/org/apache/unomi/services/impl/events/EventServiceImpl.java:
##########
@@ -127,10 +116,17 @@ public String authenticateThirdPartyServer(String key,
String ip) {
for (Map.Entry<String, ThirdPartyServer> entry :
thirdPartyServers.entrySet()) {
ThirdPartyServer server = entry.getValue();
if (server.getKey().equals(key)) {
- IPAddress ipAddress = new IPAddressString(ip).getAddress();
- for (IPAddress serverIpAddress : server.getIpAddresses()) {
- if (serverIpAddress.contains(ipAddress)) {
- return server.getId();
+ // This is a fix to support proper IPv6 parsing
+ if (ip != null) {
+ if (ip.startsWith("[") && ip.endsWith("]")) {
+ // This can happen with IPv6 addresses, we must
remove the markers since our IPAddress library doesn't support them.
+ ip = ip.substring(1, ip.length() - 1);
+ }
+ IPAddress ipAddress = new
IPAddressString(ip).getAddress();
+ for (IPAddress serverIpAddress :
server.getIpAddresses()) {
+ if (serverIpAddress.contains(ipAddress)) {
+ return server.getId();
+ }
Review Comment:
I've removed it from this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]