We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f6fa75 commit f736815Copy full SHA for f736815
backend/lib/ddns_resolver/ddns_resolver.js
@@ -50,12 +50,15 @@ const ddnsResolver = {
50
_queryHost: (host) => {
51
return utils.execSafe('getent', ['ahostsv4', host])
52
.then((result) => {
53
- if (result.length < 8 || !/^(\d{1,3}\.){3}\d{1,3}$/.test(result)) {
+ const ipv4Regex = /(\d{1,3}\.){3}\d{1,3}/;
54
+ const match = result.match(ipv4Regex);
55
+
56
+ if (!match) {
57
logger.error(`IPV4 lookup for ${host} returned invalid output: ${result}`);
58
throw error.ValidationError('Invalid output from getent hosts');
59
}
- const out = result.split(/\s+/);
- return out[0];
60
61
+ return match[0];
62
},
63
(error) => {
64
logger.error('Error looking up IP for ' + host + ': ', error);
0 commit comments