ruby-shadow 2.3.3 → 2.5.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 +5 -5
- data/HISTORY +23 -2
- data/LICENSE +4 -0
- data/README +19 -15
- data/extconf.rb +4 -4
- data/pwd/shadow.c +5 -1
- data/ruby-shadow.gemspec +2 -2
- data/shadow/shadow.c +25 -13
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c76ae146558f0f3f822ab6482ce0c2de7050e91a77d02d565691f6a3d5a5d1c9
|
4
|
+
data.tar.gz: 10d1a37211ff98722dc3221b8320f3e79dd0686f9b4c3ed4f32a035fffb7df4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 463621432a64c0cd422b72aa0a43f55053a2865774296c29a1c20b552cd5a70b2bdc4a6305a867c17f736a97b6803d9bb456482942da76e807b060218da08103
|
7
|
+
data.tar.gz: 1075b834c3e21e513d5ca615a5fab2ad84a35fe150de00e3c466e59780db534dc25d1e895fae6889dff13178162e5adcfd12f67bf9be12ab7596444248c67125
|
data/HISTORY
CHANGED
@@ -1,6 +1,27 @@
|
|
1
|
+
[2021/12/01]
|
2
|
+
* Version 2.5.1
|
3
|
+
- fixes for compiling for Ruby 3
|
4
|
+
|
5
|
+
[2015/10/06]
|
6
|
+
* Version 2.5.0
|
7
|
+
- fixes for compiling for rubinius, at long last
|
8
|
+
- TESTS
|
9
|
+
- add a few method aliases
|
10
|
+
|
11
|
+
[2014/12/02]
|
12
|
+
* Version 2.4.1
|
13
|
+
- sp_loginclass support should NOT have been added to password implementation
|
14
|
+
[2014/12/01]
|
15
|
+
* Version 2.4.0
|
16
|
+
- Add support for sp_loginclass via pwd.h
|
17
|
+
[2014/04/28]
|
18
|
+
* Version 2.3.3
|
19
|
+
- Added support for more BSDs, thanks to https://github.com/bsiegert.
|
20
|
+
- Simplified compatibility check, removing check for function not actually used in pwd.h implementations.
|
21
|
+
[2014/02/25]
|
1
22
|
[2013/12/18]
|
2
|
-
* Version 2.3.
|
3
|
-
Fix
|
23
|
+
* Version 2.3.3
|
24
|
+
Fix bug in shadow implementations (Linux, solaris) where sp_expired field was incorrectly set as nil. -1 is used to indicate not set. This was introduced 2.3.0.
|
4
25
|
[2013/11/13]
|
5
26
|
* Version 2.3.1
|
6
27
|
- Caleb Land<caleb.land@gmail.com>
|
data/LICENSE
CHANGED
data/README
CHANGED
@@ -26,20 +26,23 @@ make # use gmake on FreeBSD
|
|
26
26
|
still present, but no promises about earlier versions of Ruby.
|
27
27
|
|
28
28
|
3. Shadow::Passwd module's methods
|
29
|
-
|
30
|
-
Method
|
31
|
-
|
32
|
-
getspent
|
33
|
-
getspnam(name)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
lock
|
42
|
-
|
29
|
+
________________________________________________________________________
|
30
|
+
Method | Linux | Solaris | OS X | *BSD
|
31
|
+
________________________________________________________________________
|
32
|
+
getspent | * | * | * | *
|
33
|
+
getspnam(name) | * | * | * | *
|
34
|
+
from_user_name(name) (alias of above) | * | * | * | *
|
35
|
+
setspent | * | * | * | *
|
36
|
+
endspent | * | * | * | *
|
37
|
+
fgetspent(file) | * | * | N | N
|
38
|
+
sgetspent(str) | * | N | N | N
|
39
|
+
putspent(entry,file) | * | * | N | N
|
40
|
+
add_password_entry (alias of above ) | * | * | N | N
|
41
|
+
lckpwdf,lock | * | * | N | N
|
42
|
+
ulckpwdf,unlock | * | * | N | N
|
43
|
+
lock? | * | * | N | N
|
44
|
+
|
45
|
+
Check the implementation in use via Shadow::IMPLEMENTATION.
|
43
46
|
|
44
47
|
4. Structure
|
45
48
|
|
@@ -56,6 +59,7 @@ Shadow::Passwd::Entry (Struct::PasswdEntry)
|
|
56
59
|
considered inactive and disabled.
|
57
60
|
sp_expire - days since Jan 1, 1970 when account will be
|
58
61
|
disabled
|
62
|
+
sp_loginclass - pointer to null-terminated user login class.
|
59
63
|
|
60
64
|
|
61
65
|
5. Description
|
@@ -82,7 +86,7 @@ when you exit the iterator block.
|
|
82
86
|
|
83
87
|
* man shadow
|
84
88
|
* /usr/include/shadow.h
|
85
|
-
* Code at https://github.com/
|
89
|
+
* Code at https://github.com/apalmblad/ruby-shadow
|
86
90
|
|
87
91
|
|
88
92
|
Original Author:
|
data/extconf.rb
CHANGED
@@ -10,16 +10,17 @@ require 'rbconfig'
|
|
10
10
|
$CFLAGS = case RUBY_VERSION
|
11
11
|
when /^1\.9/; '-DRUBY19'
|
12
12
|
when /^2\./; '-DRUBY19'
|
13
|
+
when /^3\./; '-DRUBY19'
|
13
14
|
else; ''
|
14
15
|
end
|
15
16
|
|
16
17
|
implementation = case CONFIG['host_os']
|
17
18
|
when /linux/i; 'shadow'
|
18
19
|
when /sunos|solaris/i; 'shadow'
|
19
|
-
when /freebsd|openbsd/i; 'pwd'
|
20
|
+
when /freebsd|mirbsd|netbsd|openbsd/i; 'pwd'
|
20
21
|
when /darwin/i; 'pwd'
|
21
22
|
else; nil
|
22
|
-
"This library works on OS X, FreeBSD, OpenBSD, Solaris and Linux."
|
23
|
+
"This library works on OS X, FreeBSD, MirBSD, NetBSD, OpenBSD, Solaris and Linux."
|
23
24
|
end
|
24
25
|
|
25
26
|
ok = true
|
@@ -48,7 +49,6 @@ when 'pwd'
|
|
48
49
|
ok &= have_func("endpwent")
|
49
50
|
ok &= have_func("getpwent")
|
50
51
|
ok &= have_func("getpwnam")
|
51
|
-
ok &= have_func("getpwnam_r")
|
52
52
|
ok &= have_func("getpwuid")
|
53
53
|
ok &= have_func("setpassent")
|
54
54
|
ok &= have_func("setpwent")
|
@@ -65,5 +65,5 @@ if ok
|
|
65
65
|
|
66
66
|
create_makefile("shadow", implementation)
|
67
67
|
else
|
68
|
-
raise "You are missing some of the required functions from either shadow.h on Linux/Solaris, or pwd.h on FreeBSD/OpenBSD/OS X."
|
68
|
+
raise "You are missing some of the required functions from either shadow.h on Linux/Solaris, or pwd.h on FreeBSD/MirBSD/NetBSD/OpenBSD/OS X."
|
69
69
|
end
|
data/pwd/shadow.c
CHANGED
@@ -66,6 +66,7 @@ static VALUE convert_pw_struct( struct passwd *entry )
|
|
66
66
|
INT2FIX(difftime(entry->pw_change, 0) / (24*60*60)), /* pw_change */
|
67
67
|
INT2FIX(difftime(entry->pw_expire, 0) / (24*60*60)), /* sp_expire */
|
68
68
|
Qnil, /* sp_flag */
|
69
|
+
rb_tainted_str_new2(entry->pw_class), /* sp_loginclass, user access class */
|
69
70
|
NULL);
|
70
71
|
}
|
71
72
|
|
@@ -107,12 +108,14 @@ Init_shadow()
|
|
107
108
|
"sp_namp","sp_pwdp","sp_lstchg",
|
108
109
|
"sp_min","sp_max","sp_warn",
|
109
110
|
"sp_inact","pw_change",
|
110
|
-
"sp_expire","sp_flag",
|
111
|
+
"sp_expire","sp_flag",
|
112
|
+
"sp_loginclass", NULL);
|
111
113
|
rb_sGroupEntry = rb_struct_define("GroupEntry",
|
112
114
|
"sg_name","sg_passwd",
|
113
115
|
"sg_adm","sg_mem",NULL);
|
114
116
|
|
115
117
|
rb_mShadow = rb_define_module("Shadow");
|
118
|
+
rb_define_const( rb_mShadow, "IMPLEMENTATION", rb_str_new_cstr( "PWD" ) );
|
116
119
|
rb_eFileLock = rb_define_class_under(rb_mShadow,"FileLock",rb_eException);
|
117
120
|
rb_mPasswd = rb_define_module_under(rb_mShadow,"Passwd");
|
118
121
|
rb_define_const(rb_mPasswd,"Entry",rb_sPasswdEntry);
|
@@ -123,4 +126,5 @@ Init_shadow()
|
|
123
126
|
rb_define_module_function(rb_mPasswd,"endspent",rb_shadow_endspent,0);
|
124
127
|
rb_define_module_function(rb_mPasswd,"getspent",rb_shadow_getspent,0);
|
125
128
|
rb_define_module_function(rb_mPasswd,"getspnam",rb_shadow_getspnam,1);
|
129
|
+
rb_define_module_function(rb_mPasswd,"from_user_name",rb_shadow_getspnam,1);
|
126
130
|
}
|
data/ruby-shadow.gemspec
CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.name = 'ruby-shadow'
|
20
20
|
spec.required_ruby_version = ['>= 1.8']
|
21
21
|
spec.summary = '*nix Shadow Password Module'
|
22
|
-
spec.version = '2.
|
23
|
-
spec.license = "
|
22
|
+
spec.version = '2.5.1'
|
23
|
+
spec.license = "Unlicense"
|
24
24
|
end
|
data/shadow/shadow.c
CHANGED
@@ -44,6 +44,7 @@ static VALUE convert_pw_struct( struct spwd *entry )
|
|
44
44
|
Qnil, /* used by BSD, pw_change, date when the password expires, in days since Jan 1, 1970 */
|
45
45
|
INT2FIX(entry->sp_expire),
|
46
46
|
INT2FIX(entry->sp_flag),
|
47
|
+
Qnil,
|
47
48
|
NULL);
|
48
49
|
};
|
49
50
|
static VALUE
|
@@ -143,21 +144,27 @@ rb_shadow_putspent(VALUE self, VALUE entry, VALUE file)
|
|
143
144
|
|
144
145
|
if( TYPE(file) != T_FILE )
|
145
146
|
rb_raise(rb_eTypeError,"argument must be a File.");
|
146
|
-
|
147
|
+
/*
|
147
148
|
for(i=0; i<NUM_FIELDS; i++)
|
148
|
-
|
149
|
+
{
|
150
|
+
val[i] = rb_ary_entry( entry, i ); //val[i] = RSTRUCT(entry)->ptr[i];
|
151
|
+
i//val[i] = rb_struct_aref( entry, i );
|
152
|
+
}
|
153
|
+
*/
|
149
154
|
cfile = file_ptr( RFILE(file)->fptr );
|
150
155
|
|
151
|
-
|
152
|
-
centry.sp_namp = StringValuePtr(
|
153
|
-
|
154
|
-
centry.
|
155
|
-
centry.
|
156
|
-
centry.
|
157
|
-
centry.
|
158
|
-
centry.
|
159
|
-
centry.
|
160
|
-
|
156
|
+
VALUE x = rb_ary_entry( entry, 0 );
|
157
|
+
centry.sp_namp = StringValuePtr( x );
|
158
|
+
x = rb_ary_entry( entry, 1 );
|
159
|
+
centry.sp_pwdp = StringValuePtr( x );
|
160
|
+
centry.sp_lstchg = FIX2INT( rb_ary_entry( entry, 2) );
|
161
|
+
centry.sp_min = FIX2INT( rb_ary_entry( entry, 3 ) );
|
162
|
+
centry.sp_max = FIX2INT( rb_ary_entry( entry, 4 ) );
|
163
|
+
centry.sp_warn = FIX2INT( rb_ary_entry( entry, 5 ));
|
164
|
+
centry.sp_inact = FIX2INT( rb_ary_entry( entry, 6 ) );
|
165
|
+
// missing 7 I think is put in to deal with beign similar to BSD returns, for the value pw_change.
|
166
|
+
centry.sp_expire = FIX2INT( rb_ary_entry( entry, 8 ) );
|
167
|
+
centry.sp_flag = FIX2INT( rb_ary_entry( entry, 9 ) );
|
161
168
|
|
162
169
|
result = putspent(¢ry,cfile);
|
163
170
|
|
@@ -243,12 +250,15 @@ Init_shadow()
|
|
243
250
|
rb_sPasswdEntry = rb_struct_define("PasswdEntry",
|
244
251
|
"sp_namp","sp_pwdp","sp_lstchg",
|
245
252
|
"sp_min","sp_max","sp_warn",
|
246
|
-
"sp_inact", "pw_change",
|
253
|
+
"sp_inact", "pw_change",
|
254
|
+
"sp_expire","sp_flag",
|
255
|
+
"sp_loginclass", NULL);
|
247
256
|
rb_sGroupEntry = rb_struct_define("GroupEntry",
|
248
257
|
"sg_name","sg_passwd",
|
249
258
|
"sg_adm","sg_mem",NULL);
|
250
259
|
|
251
260
|
rb_mShadow = rb_define_module("Shadow");
|
261
|
+
rb_define_const( rb_mShadow, "IMPLEMENTATION", rb_str_new_cstr( "SHADOW" ) );
|
252
262
|
rb_eFileLock = rb_define_class_under(rb_mShadow,"FileLock",rb_eException);
|
253
263
|
rb_mPasswd = rb_define_module_under(rb_mShadow,"Passwd");
|
254
264
|
rb_define_const(rb_mPasswd,"Entry",rb_sPasswdEntry);
|
@@ -263,7 +273,9 @@ Init_shadow()
|
|
263
273
|
rb_define_module_function(rb_mPasswd,"fgetspent",rb_shadow_fgetspent,1);
|
264
274
|
rb_define_module_function(rb_mPasswd,"getspent",rb_shadow_getspent,0);
|
265
275
|
rb_define_module_function(rb_mPasswd,"getspnam",rb_shadow_getspnam,1);
|
276
|
+
rb_define_module_function(rb_mPasswd,"from_user_name",rb_shadow_getspnam,1);
|
266
277
|
rb_define_module_function(rb_mPasswd,"putspent",rb_shadow_putspent,2);
|
278
|
+
rb_define_module_function(rb_mPasswd,"add_password_entry",rb_shadow_putspent,2);
|
267
279
|
rb_define_module_function(rb_mPasswd,"lckpwdf",rb_shadow_lckpwdf,0);
|
268
280
|
rb_define_module_function(rb_mPasswd,"lock",rb_shadow_lock,0);
|
269
281
|
rb_define_module_function(rb_mPasswd,"ulckpwdf",rb_shadow_ulckpwdf,0);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-shadow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Palmblad
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
17
17
|
dependencies: []
|
18
18
|
description: This module provides access to shadow passwords on Linux, OSX, FreeBSD,
|
19
19
|
OpenBSD, and Solaris
|
@@ -37,7 +37,7 @@ files:
|
|
37
37
|
- shadow/shadow.c
|
38
38
|
homepage: https://github.com/apalmblad/ruby-shadow
|
39
39
|
licenses:
|
40
|
-
-
|
40
|
+
- Unlicense
|
41
41
|
metadata: {}
|
42
42
|
post_install_message:
|
43
43
|
rdoc_options: []
|
@@ -54,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
|
58
|
-
rubygems_version: 2.2.1
|
57
|
+
rubygems_version: 3.1.4
|
59
58
|
signing_key:
|
60
59
|
specification_version: 4
|
61
60
|
summary: "*nix Shadow Password Module"
|