Revision 5f46b1bc
Added by Trey Dockendorf almost 10 years ago
modules/tftp/tftp_api.rb | ||
---|---|---|
require 'tftp/server'
|
||
require 'proxy/validations'
|
||
|
||
module Proxy::TFTP
|
||
class Api < ::Sinatra::Base
|
||
include ::Proxy::Log
|
||
helpers ::Proxy::Helpers
|
||
include ::Proxy::Validations
|
||
|
||
helpers do
|
||
def instantiate variant, mac=nil
|
||
# Filenames must end in a hex representation of a mac address but only if mac is not empty
|
||
log_halt 403, "Invalid MAC address: #{mac}" unless mac =~ /^(?:[\da-f][\da-f][:-]?){6}$/i or mac.nil?
|
||
log_halt 403, "Invalid MAC address: #{mac}" unless valid_mac?(mac)
|
||
log_halt 403, "Unrecognized pxeboot config type: #{variant}" unless defined? variant.capitalize
|
||
eval "Proxy::TFTP::#{variant.capitalize}.new"
|
||
end
|
Also available in: Unified diff
fixes #6341 - Add support for 64-bit MAC addresses