소스 검색

fix(resolving): support domain names that start with a number

Domains are allowed to start with numbers and are currently not resolved
because of the current simple regex.

The new regexes better cover the IPv4 and IPv6 address (with optional
netmask)
pull/28/head
Paul 3 년 전
부모
커밋
d8ca0a2a92
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. +6
    -2
      _states/ufw.py

+ 6
- 2
_states/ufw.py 파일 보기

@@ -20,8 +20,12 @@ def _changed(name, msg, **changes):


def _resolve(host):
# let's just see if it starts with a number or a colon, for simplicity
if re.match(r'^[0-9:]', host):
# pure IP address / netmask IPv4?
if re.match(r'^([0-9\.])+(/[0-9]+)?$', host):
return host

# pure IPv6 address / netmask?
if re.match(r'^([0-9a-f:]+)(/[0-9]+)?$', host):
return host

return socket.gethostbyname(host)

Loading…
취소
저장