[Bug 1367455] [NEW] MAC address for node's IPMI is reversed looked up to yield IP address using case sensitive comparison

2014-09-09 Thread Alan Mimms
Public bug reported:

The comparison used in provisioningserver/utils/__init__.py:
find_ip_via_arp(mac) compares MAC addresses to the output of an arp -n
command using case sensitive comparison. This MAC address may be entered
by a user in a web UI and often is NOT cut/pasted from ARP but rather
from the IPMI vendor's display, which may display the MAC address in
uppercase.

For a fix, I strongly recommend doing these things to make this more
friendly:

1. Trim all whitespace from the supplied MAC address before comparison.

2. Trim all delimiters too - both on the supplied MAC address and from
the output column of the arp -n it's being compared with.

3. Translate both the supplied MAC address and the arp -n column data
to lowercase or uppercase for comparison or use a case-insensitive match
in the for loop.

- DIFF -

diff /usr/lib/python2.7/dist-packages/provisioningserver/utils/__init__.py 
__init__.py
46a47
 import re
824a826,827
 mac = mac.lower()
 mac = re.sub('[^0-9a-f]', '', mac)
829c832,833
 if len(columns) == 5 and columns[2] == mac:
---
 col = re.sub('[^0-9a-f]', '', columns[2])
 if len(columns) == 5 and col == mac:

** Affects: maas (Ubuntu)
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to maas in Ubuntu.
https://bugs.launchpad.net/bugs/1367455

Title:
  MAC address for node's IPMI is reversed looked up to yield IP address
  using case sensitive comparison

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/maas/+bug/1367455/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs


[Bug 1367455] Re: MAC address for node's IPMI is reversed looked up to yield IP address using case sensitive comparison

2014-09-09 Thread Alan Mimms
OK the diff was useless, and I'm sorry. But I'm not a python weenie, nor
do I do diffs everyday for bug reports. The code, which is trivial to
someone who writes python all the time, is easy in any case. Thank you
for playing.

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to maas in Ubuntu.
https://bugs.launchpad.net/bugs/1367455

Title:
  MAC address for node's IPMI is reversed looked up to yield IP address
  using case sensitive comparison

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/maas/+bug/1367455/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs


[Bug 1367455] Re: MAC address for node's IPMI is reversed looked up to yield IP address using case sensitive comparison

2014-09-09 Thread Alan Mimms
Oh and the proposed code has a bug too - don't look at columns[2]
without checking for len(columns) == 5. Sheesh.

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to maas in Ubuntu.
https://bugs.launchpad.net/bugs/1367455

Title:
  MAC address for node's IPMI is reversed looked up to yield IP address
  using case sensitive comparison

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/maas/+bug/1367455/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs