radiustar 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,7 @@ Ruby Radius Library
22
22
  require 'radiustar'
23
23
 
24
24
  # Load dictionaries from freeradius directory
25
+ # NOTICE: here the Dictionary.new() only accept a parameter of "folder name" but not the dictionary file
25
26
  dict = Radiustar::Dictionary.new('/usr/share/freeradius/')
26
27
 
27
28
  # Lets get authenticated
@@ -36,21 +37,21 @@ Ruby Radius Library
36
37
 
37
38
  if reply[:code] == 'Access-Accept'
38
39
  req = Radiustar::Request.new('127.0.0.1:1813', { :dict => dict })
39
-
40
+
40
41
  acct_custom_attr = {
41
42
  'Framed-Address' => '127.0.0.1',
42
43
  'NAS-Port' => 0,
43
44
  'NAS-Port-Type' => 'Ethernet',
44
45
  'Acct-Session-Time' => 0
45
46
  }
46
-
47
+
47
48
  timings = Time.now
48
49
  reply = req.accounting_start('John Doe', 'testing123', '123456', acct_custom_attr)
49
-
50
+
50
51
  sleep(rand 5)
51
52
  acct_custom_attr['Acct-Session-Time'] = Time.now - timings
52
53
  reply = req.accounting_update('John Doe', 'testing123', '123456', acct_custom_attr)
53
-
54
+
54
55
  sleep(rand 5)
55
56
  acct_custom_attr['Acct-Session-Time'] = Time.now - timings
56
57
  reply = req.accounting_stop('John Doe', 'testing123', '123456', acct_custom_attr)
@@ -76,6 +77,7 @@ Thanks to everyone who has contributed to this project. Without your help and su
76
77
  * mkocher
77
78
  * bwlang
78
79
  * cbascom
80
+ * Paulche
79
81
 
80
82
  == LICENSE:
81
83
 
@@ -1,12 +1,14 @@
1
- #
2
- # Monkey-patch the default ruby version < 1.9.0 Hash class to provide
3
- # the same interface to the radiustar libs.
4
- #
5
- class Hash
6
- # Implementation of the ruby-1.9.x key function:
7
- # http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-key
8
- def key(value)
9
- self.index value
1
+ # only patch for ruby 1.8
2
+ if (RUBY_VERSION =~ /^1\.8/) == 0
3
+ #
4
+ # Monkey-patch the default ruby version < 1.9.0 Hash class to provide
5
+ # the same interface to the radiustar libs.
6
+ #
7
+ class Hash
8
+ # Implementation of the ruby-1.9.x key function:
9
+ # http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-key
10
+ def key(value)
11
+ self.index value
12
+ end
10
13
  end
11
14
  end
12
-
@@ -5,14 +5,14 @@ module Radiustar
5
5
  class Request
6
6
 
7
7
  def initialize(server, options = {})
8
+ @host, @port = server.split(":")
9
+
8
10
  @dict = options[:dict].nil? ? Dictionary.default : options[:dict]
9
11
  @nas_ip = options[:nas_ip] || get_my_ip(@host)
10
12
  @nas_identifier = options[:nas_identifier] || @nas_ip
11
13
  @reply_timeout = options[:reply_timeout].nil? ? 60 : options[:reply_timeout].to_i
12
14
  @retries_number = options[:retries_number].nil? ? 1 : options[:retries_number].to_i
13
15
 
14
- @host, @port = server.split(":")
15
-
16
16
  @port = Socket.getservbyname("radius", "udp") unless @port
17
17
  @port = 1812 unless @port
18
18
  @port = @port.to_i # just in case
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "radiustar"
5
- s.version = "0.0.7"
5
+ s.version = "0.0.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["PJ Davis"]
@@ -23,14 +23,14 @@ Gem::Specification.new do |s|
23
23
  s.specification_version = 3
24
24
 
25
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<ipaddr_extensions>, [">= 2012.1.13"])
26
+ s.add_runtime_dependency(%q<ipaddr_extensions>, ["~> 1.0.0"])
27
27
  s.add_development_dependency(%q<bones>, [">= 3.7.3"])
28
28
  else
29
- s.add_dependency(%q<ipaddr_extensions>, [">= 2012.1.13"])
29
+ s.add_dependency(%q<ipaddr_extensions>, ["~> 1.0.0"])
30
30
  s.add_dependency(%q<bones>, [">= 3.7.3"])
31
31
  end
32
32
  else
33
- s.add_dependency(%q<ipaddr_extensions>, [">= 2012.1.13"])
33
+ s.add_dependency(%q<ipaddr_extensions>, ["~> 1.0.0"])
34
34
  s.add_dependency(%q<bones>, [">= 3.7.3"])
35
35
  end
36
36
  end
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
metadata CHANGED
@@ -1,61 +1,57 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: radiustar
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 7
9
- version: 0.0.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - PJ Davis
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-07-23 00:00:00 -05:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-07-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: ipaddr_extensions
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 2012
29
- - 1
30
- - 13
31
- version: 2012.1.13
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: bones
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 3
43
- - 7
44
- - 3
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: bones
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
45
37
  version: 3.7.3
46
38
  type: :development
47
- version_requirements: *id002
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 3.7.3
48
46
  description: Ruby Radius Library
49
47
  email: pj.davis@gmail.com
50
48
  executables: []
51
-
52
49
  extensions: []
53
-
54
- extra_rdoc_files:
50
+ extra_rdoc_files:
55
51
  - History.txt
56
52
  - README.rdoc
57
53
  - templates/default.txt
58
- files:
54
+ files:
59
55
  - History.txt
60
56
  - README.rdoc
61
57
  - Rakefile
@@ -78,36 +74,32 @@ files:
78
74
  - templates/gandalf.dictionary
79
75
  - test/test_radiustar.rb
80
76
  - version.txt
81
- has_rdoc: true
82
77
  homepage: http://github.com/pjdavis/radiustar
83
78
  licenses: []
84
-
85
79
  post_install_message:
86
- rdoc_options:
80
+ rdoc_options:
87
81
  - --main
88
82
  - README.rdoc
89
- require_paths:
83
+ require_paths:
90
84
  - lib
91
- required_ruby_version: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- segments:
96
- - 0
97
- version: "0"
98
- required_rubygems_version: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- segments:
103
- - 0
104
- version: "0"
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
105
97
  requirements: []
106
-
107
98
  rubyforge_project: radiustar
108
- rubygems_version: 1.3.6
99
+ rubygems_version: 1.8.25
109
100
  signing_key:
110
101
  specification_version: 3
111
102
  summary: .
112
- test_files:
103
+ test_files:
113
104
  - test/test_radiustar.rb
105
+ has_rdoc: