Changeset 3011


Ignore:
Timestamp:
2006-01-18T02:44:21+01:00 (12 years ago)
Author:
nbd
Message:

add wep key validation fix from #222

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/whiterussian/openwrt/package/webif/files/usr/lib/webif/validate.awk

    r3009 r3011  
    3939$1 == "wep" { 
    4040        valid_type = 1 
    41         if (value !~ /^[0-9A-Fa-f]*$/) { 
     41        if ((length(value) != 0) && (length(value) != 5) && (length(value) != 10) && (length(value) != 13) && (length(value) != 26)) { 
    4242                valid = 0 
    43                 verr = "Invalid value" 
    44         } else if ((length(value) != 0) && (length(value) != 10) && (length(value) != 26)) { 
     43                verr = "Invalid key length: Hex keys must be 10 or 26 hexdigits; Ascii keys must be 5 or 13 chars." 
     44        } else if (((length(value) == 10) || (length(value) == 26)) && (value !~ /^[0-9A-Fa-f]*$/)) { 
    4545                valid = 0 
    46                 verr = "Invalid key length" 
     46                verr = "Invalid key: Hex keys may only contain hexdigits (0-9,A-F,a-f)" 
    4747        } else if (value ~ /0$/) { 
    4848                valid = 0 
    49                 verr = "key must not end with '0'" 
     49                verr = "Key must not end with '0'" 
    5050        } 
    5151} 
Note: See TracChangeset for help on using the changeset viewer.