Permalink
Browse files

Fix scoping and method vs. local variable issues

  • Loading branch information...
up_the_irons committed Sep 14, 2011
1 parent 10dceaf commit 5f632558aafa227dc2e2981048a56a212fe738ed
Showing with 5 additions and 3 deletions.
  1. +5 −3 radius/packet.rb
View
@@ -553,20 +553,22 @@ def generate_random_authenticator
# be unpredictable and unique over the lifetime of a secret (the
# password shared between the client and the RADIUS server)
+ @auth = nil
+
# Get authenticator data from /dev/urandom if possible
if (File.exist?("/dev/urandom"))
File.open("/dev/urandom") { |urandom|
- authenticator = urandom.read(16)
+ @auth = urandom.read(16)
}
else
# use the Kernel:rand method. This is quite probably not
# as secure as using /dev/urandom, be wary...
- authenticator = [rand(65536), rand(65536), rand(65536),
+ @auth = [rand(65536), rand(65536), rand(65536),
rand(65536), rand(65536), rand(65536), rand(65536),
rand(65536)].pack("n8")
end
- authenticator
+ @auth
end
end
end

0 comments on commit 5f63255

Please sign in to comment.