Commit ea9a0994 authored by Serhiy Storchaka's avatar Serhiy Storchaka Committed by GitHub

[2.7] bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) (GH-7015)

uuid._ipconfig_getnode did not validate the maximum length of the value,
so long as the value had the same type of formatting as a MAC address.
This let it select DUIDs as MAC addresses. It now requires an exact
length match..
(cherry picked from commit c66c342c)
Co-authored-by: default avatarCtrlZvi <viz+github@flippedperspective.com>
parent d13169fc
......@@ -419,7 +419,7 @@ def _ipconfig_getnode():
with pipe:
for line in pipe:
value = line.split(':')[-1].strip().lower()
if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value):
if re.match('(?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]$', value):
return int(value.replace('-', ''), 16)
def _netbios_getnode():
......
......@@ -381,6 +381,7 @@ Ulrich Eckhardt
David Edelsohn
John Edmonds
Grant Edwards
Zvi Effron
John Ehresman
Tal Einat
Eric Eisner
......
Prevent ``uuid.get_node`` from using a DUID instead of a MAC on Windows.
Patch by Zvi Effron
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment