ruby-shadow 2.4.1 → 2.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d5753f3a919b10c965a820c66df3d7f7cb9f80e
4
- data.tar.gz: 12bd84a043a09aecf505d1daf15a050813615fc9
3
+ metadata.gz: c1de672d3098aaa075b6e6a56256d320a5b5b98e
4
+ data.tar.gz: ed35c6a88d87c0633d5e93a6520da7918618d53e
5
5
  SHA512:
6
- metadata.gz: 35151b1f476afc8a109f727205c80c9323b4efb5d346358c8f28322dddbd093da40c5c5e100c0a07005fa2c4a8b73d4a14a69e2464bf5f55569c2384c247d0ff
7
- data.tar.gz: 11b1ebc1806a81bca965778b7e59bceb54afdf10087b06bc60c30f83e8f9c20697845e26a0ce10e439c320721e72d3aff96e5b7db4242d5144fd2420e2376149
6
+ metadata.gz: 098561c08e3037f7b08dff37c8af296918e42748bbfc55ff5849121d74c37884f3706276ab32986866a29e55130d92e116094e653244c624fe87d8c2f1e61864
7
+ data.tar.gz: 76202564ea9ef353e7f7c699a66d6c1c050e7698965db32ffcbae6365e33ad055a7d558f51626397a52ea4c74a6b1894020f728cf0e5e479f6ee75ae4c1876e3
data/HISTORY CHANGED
@@ -1,3 +1,9 @@
1
+ [2015/10/06]
2
+ * Version 2.5.0
3
+ - fixes for compiling for rubinius, at long last
4
+ - TESTS
5
+ - add a few method aliases
6
+
1
7
  [2014/12/02]
2
8
  * Version 2.4.1
3
9
  - sp_loginclass support should NOT have been added to password implementation
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 | Linux | Solaris | OS X | *BSD
31
- _________________________________________________________
32
- getspent | * | * | * | *
33
- getspnam(name) | * | * | * | *
34
- setspent | * | * | * | *
35
- endspent | * | * | * | *
36
- fgetspent(file) | * | * | N | N
37
- sgetspent(str) | * | N | N | N
38
- putspent(entry,file) | * | * | N | N
39
- lckpwdf,lock | * | * | N | N
40
- ulckpwdf,unlock | * | * | N | N
41
- lock? | * | * | N | N
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
 
@@ -83,7 +86,7 @@ when you exit the iterator block.
83
86
 
84
87
  * man shadow
85
88
  * /usr/include/shadow.h
86
- * Code at https://github.com/shadow-maint/shadow
89
+ * Code at https://github.com/apalmblad/ruby-shadow
87
90
 
88
91
 
89
92
  Original Author:
@@ -115,6 +115,7 @@ Init_shadow()
115
115
  "sg_adm","sg_mem",NULL);
116
116
 
117
117
  rb_mShadow = rb_define_module("Shadow");
118
+ rb_define_const( rb_mShadow, "IMPLEMENTATION", rb_str_new_cstr( "PWD" ) );
118
119
  rb_eFileLock = rb_define_class_under(rb_mShadow,"FileLock",rb_eException);
119
120
  rb_mPasswd = rb_define_module_under(rb_mShadow,"Passwd");
120
121
  rb_define_const(rb_mPasswd,"Entry",rb_sPasswdEntry);
@@ -125,4 +126,5 @@ Init_shadow()
125
126
  rb_define_module_function(rb_mPasswd,"endspent",rb_shadow_endspent,0);
126
127
  rb_define_module_function(rb_mPasswd,"getspent",rb_shadow_getspent,0);
127
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);
128
130
  }
@@ -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.4.1'
22
+ spec.version = '2.5.0'
23
23
  spec.license = "Public Domain License"
24
24
  end
@@ -144,21 +144,27 @@ rb_shadow_putspent(VALUE self, VALUE entry, VALUE file)
144
144
 
145
145
  if( TYPE(file) != T_FILE )
146
146
  rb_raise(rb_eTypeError,"argument must be a File.");
147
-
147
+ /*
148
148
  for(i=0; i<NUM_FIELDS; i++)
149
- val[i] = RSTRUCT_PTR( entry )[i]; //val[i] = RSTRUCT(entry)->ptr[i];
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
+ */
150
154
  cfile = file_ptr( RFILE(file)->fptr );
151
155
 
152
-
153
- centry.sp_namp = StringValuePtr(val[0]);
154
- centry.sp_pwdp = StringValuePtr(val[1]);
155
- centry.sp_lstchg = FIX2INT(val[2]);
156
- centry.sp_min = FIX2INT(val[3]);
157
- centry.sp_max = FIX2INT(val[4]);
158
- centry.sp_warn = FIX2INT(val[5]);
159
- centry.sp_inact = FIX2INT(val[6]);
160
- centry.sp_expire = FIX2INT(val[8]);
161
- centry.sp_flag = FIX2INT(val[9]);
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 ) );
162
168
 
163
169
  result = putspent(&centry,cfile);
164
170
 
@@ -252,6 +258,7 @@ Init_shadow()
252
258
  "sg_adm","sg_mem",NULL);
253
259
 
254
260
  rb_mShadow = rb_define_module("Shadow");
261
+ rb_define_const( rb_mShadow, "IMPLEMENTATION", rb_str_new_cstr( "SHADOW" ) );
255
262
  rb_eFileLock = rb_define_class_under(rb_mShadow,"FileLock",rb_eException);
256
263
  rb_mPasswd = rb_define_module_under(rb_mShadow,"Passwd");
257
264
  rb_define_const(rb_mPasswd,"Entry",rb_sPasswdEntry);
@@ -266,7 +273,9 @@ Init_shadow()
266
273
  rb_define_module_function(rb_mPasswd,"fgetspent",rb_shadow_fgetspent,1);
267
274
  rb_define_module_function(rb_mPasswd,"getspent",rb_shadow_getspent,0);
268
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);
269
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);
270
279
  rb_define_module_function(rb_mPasswd,"lckpwdf",rb_shadow_lckpwdf,0);
271
280
  rb_define_module_function(rb_mPasswd,"lock",rb_shadow_lock,0);
272
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.1
4
+ version: 2.5.0
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: 2014-12-02 00:00:00.000000000 Z
16
+ date: 2015-10-06 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
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  version: '0'
56
56
  requirements: []
57
57
  rubyforge_project:
58
- rubygems_version: 2.4.2
58
+ rubygems_version: 2.4.8
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: "*nix Shadow Password Module"