amirayoussef7 / munki

Automatically exported from code.google.com/p/munki
Other
0 stars 0 forks source link

[MWA] error in estimate_manufactured_date if serial number is invalid #242

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1. Have a Mac report an invalid serial number (I think we had our logic board 
repaired)
2. Access the lookup/detail/00:00:00:00:00:00 page

What is the expected output? What do you see instead?
Instead of the report page, we get an error 500 page (with details because of 
DEBUG=true)

What version of the Munki tools/InstallOSpkg tools are you using? On what
version of OS X?
Munki 0.8.3, Mac OS 10.6 and 10.7

Please provide any additional information below.

Since some of our Mac report "System Serial#", "SystemSerialNum" or 
"SystemSerialNumb" as serial numbers, the estimate_manufactured_date function 
fails at line 334:est_week = week_code.index(week) + (est_half * 26).
Week is 'e' (since serial is invalid) and 'e' is not a possible value in 
week_code.
A validation of week_code should be done before trying to get the index, and 
return some random value (0?) instead. The date won't be accurate, but at least 
the report will show until we have the time to correct the serial number on the 
computer.

Here are the local vars:
week: u'e' 
est_half: 0 
est_year: 2017 
year: u't' 
week_code: ' 123456789cdfghjklmnpqrtvwxy' 
serial: u'System Serial#' 
year_code: 'cdfghjklmnpqrstvwxyz' 

Original issue reported on code.google.com by iceman.g...@gmail.com on 2 May 2013 at 2:58

GoogleCodeExporter commented 8 years ago
A fix for this issue has just been accepted. Please update to the latest 
version of MWA.

The patch hardens the parsing of serial numbers by limiting the check to only 
serials that are 11 or 12 characters long, and then within those serials it 
will not fault if it's in an invalid format.

This should resolve the issue you were seeing, and some other potential edge 
cases.

Can you let us know if this resolves the problems you were seeing?

Original comment by adamjr...@gmail.com on 3 May 2013 at 1:15

GoogleCodeExporter commented 8 years ago
It is resolved. 
Thanks for the fast patch, I should have reported it weeks ago!

Original comment by iceman.g...@gmail.com on 3 May 2013 at 1:52

GoogleCodeExporter commented 8 years ago
Closing.

Original comment by gregnea...@mac.com on 8 May 2013 at 2:02