rpam-ruby19 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  = Rpam
2
2
 
3
- * http://rubyforge.org/projects/rpam
3
+ * https://github.com/canweriotnow/rpam-ruby19
4
4
 
5
5
  == DESCRIPTION:
6
6
 
@@ -14,17 +14,25 @@
14
14
 
15
15
  == SYNOPSIS:
16
16
 
17
- In a nutshell:
17
+ In a nutshell (using the 'rpam' PAM service):
18
18
 
19
19
  require 'rpam'
20
- include Rpam
21
20
 
22
- if authpam("user","password") == true
21
+ if Rpam.auth("user","password") == true
23
22
  puts "Authenticate Successful"
24
23
  else
25
- puts "Authenticate Failure"
24
+ puts "Authenticate Failure"
26
25
  end
27
26
 
27
+ Or, to use a different PAM service:
28
+
29
+ if Rpam.auth("user", "password", :service => 'my_foo') == true
30
+
31
+ This also supports compatibility with the original 'rpam':
32
+
33
+ include Rpam
34
+ if authpam("user","password") == true
35
+
28
36
  == REQUIREMENTS:
29
37
 
30
38
 
@@ -33,7 +41,7 @@ In a nutshell:
33
41
 
34
42
  == INSTALL:
35
43
 
36
- * gem install rpam (might need sudo privileges)
44
+ * gem install rpam-ruby19 (might need sudo privileges)
37
45
 
38
46
  Or, you can do it the hard way (without Rubygems):
39
47
 
@@ -19,4 +19,4 @@ have_func("pam_acct_mgmt")
19
19
  #have_func("pam_putenv")
20
20
  #have_func("pam_getenv")
21
21
 
22
- create_makefile("rpam")
22
+ create_makefile("rpam_ext")
@@ -26,12 +26,10 @@ typedef struct {
26
26
  char *name, *pw;
27
27
  } pam_auth_t;
28
28
 
29
- static const char
30
- *rpam_servicename = "rpam";
31
-
32
29
  VALUE Rpam;
30
+ VALUE Rpam_Ext;
33
31
 
34
- void Init_rpam();
32
+ void Init_rpam_ext();
35
33
 
36
34
  /*
37
35
  * auth_pam_talker: supply authentication information to PAM when asked
@@ -89,14 +87,16 @@ int auth_pam_talker(int num_msg,
89
87
  }
90
88
 
91
89
  /* Authenticates a user and returns TRUE on success, FALSE on failure */
92
- VALUE method_authpam(VALUE self, VALUE username, VALUE password) {
90
+ VALUE method_authpam(VALUE self, VALUE username, VALUE password, VALUE servicename) {
91
+ char* rpam_servicename;
93
92
  pam_auth_t userinfo = {NULL, NULL};
94
93
  struct pam_conv conv_info = {&auth_pam_talker, (void *) &userinfo};
95
94
  pam_handle_t *pamh = NULL;
96
95
  int result;
97
96
 
98
- userinfo.name = StringValuePtr(username);
99
- userinfo.pw = StringValuePtr(password);
97
+ rpam_servicename = StringValuePtr(servicename);
98
+ userinfo.name = StringValuePtr(username);
99
+ userinfo.pw = StringValuePtr(password);
100
100
 
101
101
  if ((result = pam_start(rpam_servicename, userinfo.name, &conv_info, &pamh))
102
102
  != PAM_SUCCESS) {
@@ -122,7 +122,8 @@ VALUE method_authpam(VALUE self, VALUE username, VALUE password) {
122
122
  }
123
123
 
124
124
  /* initialize */
125
- void Init_rpam() {
125
+ void Init_rpam_ext() {
126
126
  Rpam = rb_define_module("Rpam");
127
- rb_define_method(Rpam, "authpam", method_authpam, 2);
127
+ Rpam_Ext = rb_define_module_under(Rpam, "Ext");
128
+ rb_define_singleton_method(Rpam_Ext, "authpam", method_authpam, 3);
128
129
  }
@@ -0,0 +1,18 @@
1
+ require 'rpam_ext'
2
+
3
+ module Rpam
4
+ def authpam *args
5
+ ::Rpam.auth(*args)
6
+ end
7
+
8
+ class <<self
9
+ def auth user, password, options = {}
10
+ options = options.dup
11
+ options[:service] ||= 'rpam'
12
+
13
+ Rpam::Ext.authpam(user, password, options[:service])
14
+ end
15
+
16
+ alias :authpam :auth
17
+ end
18
+ end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{rpam-ruby19}
3
- s.version = "1.1.1"
4
- s.date = %q{2011-06-13}
3
+ s.version = "1.2.1"
4
+ s.date = %q{2011-08-16}
5
5
  s.summary = %q{PAM integration with ruby.}
6
6
  s.require_paths = ["lib"]
7
7
  s.email = %q{jasonlewis.x@gmail.com}
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
10
10
  Modules - integration}
11
11
  s.required_ruby_version = Gem::Version::Requirement.new(">= 1.9.1")
12
12
  s.extra_rdoc_files = ["README.rdoc"]
13
- s.authors = ["Andre Osti de Moura", "Jason Lewis"]
14
- s.files = ["ext/Rpam/rpam.c", "ext/Rpam/extconf.rb", "rpam.gemspec", "README.rdoc", "LICENSE"]
13
+ s.authors = ["Andre Osti de Moura", "Jason Lewis", "Fred Emmott"]
14
+ s.files = ["ext/Rpam/rpam_ext.c", "ext/Rpam/extconf.rb", "rpam.gemspec", "README.rdoc", "LICENSE", 'lib/rpam.rb']
15
15
  s.has_rdoc = true
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rpam", "--main", "README.rdoc"]
17
17
  s.extensions = ["ext/Rpam/extconf.rb"]
metadata CHANGED
@@ -1,66 +1,61 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rpam-ruby19
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
4
5
  prerelease:
5
- version: 1.1.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Andre Osti de Moura
9
9
  - Jason Lewis
10
+ - Fred Emmott
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
-
14
- date: 2011-06-13 00:00:00 Z
14
+ date: 2011-08-16 00:00:00.000000000Z
15
15
  dependencies: []
16
-
17
- description: |-
18
- This extension provides PAM - Pluggable Authentication
19
- Modules - integration
16
+ description: ! "This extension provides PAM - Pluggable Authentication\n Modules
17
+ - integration"
20
18
  email: jasonlewis.x@gmail.com
21
19
  executables: []
22
-
23
- extensions:
20
+ extensions:
24
21
  - ext/Rpam/extconf.rb
25
- extra_rdoc_files:
22
+ extra_rdoc_files:
26
23
  - README.rdoc
27
- files:
28
- - ext/Rpam/rpam.c
24
+ files:
25
+ - ext/Rpam/rpam_ext.c
29
26
  - ext/Rpam/extconf.rb
30
27
  - rpam.gemspec
31
28
  - README.rdoc
32
29
  - LICENSE
30
+ - lib/rpam.rb
33
31
  homepage: https://github.com/canweriotnow/rpam-ruby19
34
32
  licenses: []
35
-
36
33
  post_install_message:
37
- rdoc_options:
34
+ rdoc_options:
38
35
  - --line-numbers
39
36
  - --inline-source
40
37
  - --title
41
38
  - Rpam
42
39
  - --main
43
40
  - README.rdoc
44
- require_paths:
41
+ require_paths:
45
42
  - lib
46
- required_ruby_version: !ruby/object:Gem::Requirement
43
+ required_ruby_version: !ruby/object:Gem::Requirement
47
44
  none: false
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
51
48
  version: 1.9.1
52
- required_rubygems_version: !ruby/object:Gem::Requirement
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
58
55
  requirements: []
59
-
60
56
  rubyforge_project:
61
- rubygems_version: 1.7.2
57
+ rubygems_version: 1.8.10
62
58
  signing_key:
63
59
  specification_version: 3
64
60
  summary: PAM integration with ruby.
65
61
  test_files: []
66
-