rpam2 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rpam2/extconf.rb +2 -1
- data/ext/rpam2/rpam2.c +0 -9
- data/lib/rpam2.rb +15 -7
- data/rpam2.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4de60837bda2784d6e3520925472e446f731837e7b411c80f830965ca49569c5
|
4
|
+
data.tar.gz: 27a46170ba7fba4f51258a10d2880d43dc8fd39552b99b6fc42620f12ba759c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02b2fc48fa2cf0605dc5aa2afde93c64d7326a2aa0e15cf41bb21e0f1f0e4ed3fecb79063e641cb79f60c7923cd811274984d07b8d6d7e04ef346b145e746d6b
|
7
|
+
data.tar.gz: 73b2c944a0d37715966cf22e4ec03bcb0db2a6184d03d847dd956456016b2f5415f7c38a92d9e785f8e9edb66114404e709ea8665e9720f17b4d0eec90713acb
|
data/ext/rpam2/extconf.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
-
|
3
|
+
# use "and" here to have both errors in error case, helps admins to fix it faster
|
4
|
+
pam_installed = have_library("pam","pam_start") and have_header("security/pam_appl.h")
|
4
5
|
#pam_installed = false
|
5
6
|
|
6
7
|
|
data/ext/rpam2/rpam2.c
CHANGED
@@ -195,9 +195,6 @@ static VALUE method_authpam(VALUE self, VALUE servicename, VALUE username, VALUE
|
|
195
195
|
unsigned int result = 0;
|
196
196
|
struct pam_conv auth_c = {0,0};
|
197
197
|
|
198
|
-
Check_Type(username, T_STRING);
|
199
|
-
Check_Type(password, T_STRING);
|
200
|
-
|
201
198
|
result = pam_start(rpam_default_servicename, StringValueCStr(username), &auth_c, &pamh);
|
202
199
|
if (result != PAM_SUCCESS) {
|
203
200
|
rb_warn("INIT: %s", pam_strerror(pamh, result));
|
@@ -223,8 +220,6 @@ static VALUE method_accountpam(VALUE self, VALUE servicename, VALUE username) {
|
|
223
220
|
unsigned int result=0;
|
224
221
|
struct pam_conv auth_c = {0,0};
|
225
222
|
|
226
|
-
Check_Type(username, T_STRING);
|
227
|
-
|
228
223
|
result = pam_start(rpam_default_servicename, StringValueCStr(username), &auth_c, &pamh);
|
229
224
|
if (result != PAM_SUCCESS) {
|
230
225
|
rb_warn("INIT: %s", pam_strerror(pamh, result));
|
@@ -251,10 +246,6 @@ static VALUE method_getenvpam(VALUE self, VALUE servicename, VALUE username, VAL
|
|
251
246
|
unsigned int result = 0;
|
252
247
|
struct pam_conv auth_c = {0,0};
|
253
248
|
|
254
|
-
Check_Type(username, T_STRING);
|
255
|
-
Check_Type(password, T_STRING);
|
256
|
-
Check_Type(envname, T_STRING);
|
257
|
-
|
258
249
|
result = pam_start(rpam_default_servicename, StringValueCStr(username), &auth_c, &pamh);
|
259
250
|
if (result != PAM_SUCCESS) {
|
260
251
|
rb_warn("INIT: %s", pam_strerror(pamh, result));
|
data/lib/rpam2.rb
CHANGED
@@ -52,31 +52,39 @@ module Rpam2
|
|
52
52
|
|
53
53
|
private
|
54
54
|
|
55
|
-
def
|
55
|
+
def use_fake?(servicename)
|
56
56
|
return false unless self.fake_data
|
57
57
|
self.fake_data.fetch(:servicenames, Set.new).include?(servicename)
|
58
58
|
end
|
59
59
|
|
60
60
|
def _auth(servicename, username, password, ruser, rhost)
|
61
|
-
|
61
|
+
raise TypeError unless username.is_a? String
|
62
|
+
raise TypeError unless password.is_a? String
|
63
|
+
return _authc(servicename, username, password, ruser, rhost) unless use_fake?(servicename)
|
62
64
|
self.fake_data[:password] == password && self.fake_data.fetch(:usernames, Set.new).include?(username)
|
63
65
|
end
|
64
66
|
|
65
67
|
def _account(servicename, username)
|
66
|
-
|
68
|
+
raise TypeError unless username.is_a? String
|
69
|
+
return _accountc(servicename, username) unless use_fake?(servicename)
|
67
70
|
self.fake_data.fetch(:usernames, Set.new).include?(username)
|
68
71
|
end
|
69
72
|
|
70
73
|
def _getenv(servicename, username, password, opensession, varname, ruser, rhost)
|
71
|
-
|
74
|
+
raise TypeError unless username.is_a? String
|
75
|
+
raise TypeError unless password.is_a? String
|
76
|
+
raise TypeError unless varname.is_a? String
|
77
|
+
return _getenvc(servicename, username, password, opensession, varname, ruser, rhost) unless use_fake?(servicename)
|
72
78
|
return nil unless self.fake_data.fetch(:usernames, Set.new).include?(username)
|
73
|
-
return nil
|
79
|
+
return nil unless self.fake_data[:env] && self.fake_data[:password] == password
|
74
80
|
self.fake_data[:env].fetch(varname, nil)
|
75
81
|
end
|
76
82
|
|
77
83
|
def _listenv(servicename, username, password, opensession, ruser, rhost)
|
78
|
-
|
79
|
-
|
84
|
+
raise TypeError unless username.is_a? String
|
85
|
+
raise TypeError unless password.is_a? String
|
86
|
+
return _listenvc(servicename, username, password, opensession, ruser, rhost) unless use_fake?(servicename)
|
87
|
+
return nil unless self.fake_data[:password] == password && self.fake_data.fetch(:usernames, Set.new).include?(username)
|
80
88
|
self.fake_data.fetch(:env, {})
|
81
89
|
end
|
82
90
|
end
|
data/rpam2.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "rpam2"
|
3
|
-
s.version = "4.0.
|
4
|
-
s.date = "
|
3
|
+
s.version = "4.0.1"
|
4
|
+
s.date = "2018-03-23"
|
5
5
|
s.summary = "PAM integration with ruby."
|
6
6
|
s.email = "devkral@web.de"
|
7
7
|
s.description = "Ruby PAM (Pluggable Authentication Modules) integration"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpam2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kaftan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby PAM (Pluggable Authentication Modules) integration
|
14
14
|
email: devkral@web.de
|