[Python-checkins] [2.7] bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) (GH-7015)
Serhiy Storchaka
webhook-mailer at python.org
Sun May 20 18:50:36 EDT 2018
https://github.com/python/cpython/commit/ea9a0994cd0f4bd37799b045c34097eb21662b3d
commit: ea9a0994cd0f4bd37799b045c34097eb21662b3d
branch: 2.7
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018年05月21日T01:50:33+03:00
summary:
[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 c66c342cb42ab8a88884527ddfe3a5086bc06316)
Co-authored-by: CtrlZvi <viz+github at flippedperspective.com>
files:
A Misc/NEWS.d/next/Library/2018-05-16-09-30-27.bpo-33542.idNAcs.rst
M Lib/uuid.py
M Misc/ACKS
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 618bc6385cfc..973013c00636 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -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():
diff --git a/Misc/ACKS b/Misc/ACKS
index 394fbb93f2f1..295b933f4b95 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -381,6 +381,7 @@ Ulrich Eckhardt
David Edelsohn
John Edmonds
Grant Edwards
+Zvi Effron
John Ehresman
Tal Einat
Eric Eisner
diff --git a/Misc/NEWS.d/next/Library/2018-05-16-09-30-27.bpo-33542.idNAcs.rst b/Misc/NEWS.d/next/Library/2018-05-16-09-30-27.bpo-33542.idNAcs.rst
new file mode 100644
index 000000000000..16ba799131f4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-05-16-09-30-27.bpo-33542.idNAcs.rst
@@ -0,0 +1,2 @@
+Prevent ``uuid.get_node`` from using a DUID instead of a MAC on Windows.
+Patch by Zvi Effron
More information about the Python-checkins
mailing list