engines/adva_user/vendor/plugins/authentication/lib/radius/auth.rb
def gen_authenticator
      # get authenticator data from /dev/urandom if possible
       if (File.exist?("/dev/urandom"))
 	File.open("/dev/urandom") {
 	  |urandom|
 	  @packet.authenticator = urandom.read(16)
 	}
       else
	# use the Kernel:rand method.  This is quite probably not
	# as secure as using /dev/urandom, be wary...
	@packet.authenticator = [rand(65536), rand(65536), rand(65536),
	  rand(65536), rand(65536), rand(65536), rand(65536),
	  rand(65536)].pack("n8")
      end
      return(@packet.authenticator)
    end
# Generate an authenticator, placing it in the @packet object's
# authenticator attribute.  It will try to use /dev/urandom if
# possible, or the system rand call if that's not available.
Generate an authenticator, placing it in the @packet object's
authenticator attribute.  It will try to use /dev/urandom if
possible, or the system rand call if that's not available.
Generate an authenticator placing it in the @packet object ' s authenticator attribute . It will try to use / dev / urandom if possible or the system rand call if that ' s not available .
def gen_authenticator
       if (File.exist?("/dev/urandom"))
 	File.open("/dev/urandom") {
 	  |urandom|
 	  @packet.authenticator = urandom.read(16)
 	}
       else
	@packet.authenticator = [rand(65536), rand(65536), rand(65536),
	  rand(65536), rand(65536), rand(65536), rand(65536),
	  rand(65536)].pack("n8")
      end
      return(@packet.authenticator)
    end
def gen_authenticator if ( File . exist? ( "/dev/urandom" ) ) File . open ( "/dev/urandom" ) { | urandom | @packet . authenticator = urandom . read ( 16 ) } else @packet . authenticator = [ rand ( 65536 ) , rand ( 65536 ) , rand ( 65536 ) , rand ( 65536 ) , rand ( 65536 ) , rand ( 65536 ) , rand ( 65536 ) , rand ( 65536 ) ] . pack ( "n8" ) end return ( @packet . authenticator ) end
Generate an authenticator, placing it in the @packet object's
authenticator attribute.
Generate an authenticator placing it in the @packet object ' s authenticator attribute .
# get authenticator data from /dev/urandom if possible # use the Kernel:rand method.  This is quite probably not # as secure as using /dev/urandom, be wary...