From 1cf19fd581f8323bf6fb6072f055bb5000d56b24 Mon Sep 17 00:00:00 2001 From: Kload Date: Sun, 7 Jul 2013 10:38:58 +0000 Subject: [PATCH] base64 dns key --- dynette.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dynette.rb b/dynette.rb index 353cfb2..630a6ad 100755 --- a/dynette.rb +++ b/dynette.rb @@ -109,6 +109,7 @@ end post '/key/:public_key' do + params[:public_key] = Base64.decode64(params[:public_key]) # Check params halt 400, { :error => "Please indicate a subdomain" }.to_json unless params.has_key?("subdomain") @@ -131,6 +132,7 @@ post '/key/:public_key' do end put '/key/:public_key' do + params[:public_key] = Base64.decode64(params[:public_key]) entry = Entry.first(:public_key => params[:public_key]) unless request.ip == entry.current_ip entry.ips << Ip.create(:ip_addr => request.ip) @@ -144,6 +146,7 @@ put '/key/:public_key' do end delete '/key/:public_key' do + params[:public_key] = Base64.decode64(params[:public_key]) if entry = Entry.first(:public_key => params[:public_key]) if entry.destroy halt 200, "OK".to_json @@ -174,6 +177,7 @@ get '/all/:domain' do end get '/ips/:public_key' do + params[:public_key] = Base64.decode64(params[:public_key]) unless ALLOWED_IP.include? request.ip status 403 return "Access denied"