Ignore:
Timestamp:
Nov 11, 2007 4:44:42 AM (6 years ago)
Author:
dkg
Message:

vblade-persist: verify that the mac addresses are legitimate before adding them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/vblade-persist/src/vblade-persist

    r695 r696  
    4141} 
    4242 
     43verify_mac_address() { 
     44    echo "$1" | tr -d ':' | egrep -q '^[[:xdigit:]]{12}$' 
     45} 
     46 
    4347# shelf identifiers should be integers: 
    4448# FIXME: check that they're in a certain range?  
     
    187191            shift 
    188192            for mac in "$@"; do  
    189                 if [ ! -e "$DPATH/macs/$mac" ] ; then 
     193                if ( ! verify_mac_address "$mac" ) ; then 
     194                    error "Not a valid MAC address: '$mac'" 
     195                elif [ ! -e "$DPATH/macs/$mac" ] ; then 
    190196                    touch "$DPATH/macs/$mac" 
    191197                    CHANGES=yes 
Note: See TracChangeset for help on using the changeset viewer.