ruby-shadow 2.3.4 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7db5aeea67878e55dc91619492ad2de445594199
4
- data.tar.gz: caa37b71c62ba1ba18b46d19c97ef4ce522c3aa6
3
+ metadata.gz: c1de672d3098aaa075b6e6a56256d320a5b5b98e
4
+ data.tar.gz: ed35c6a88d87c0633d5e93a6520da7918618d53e
5
5
  SHA512:
6
- metadata.gz: a53e3f71cf061a5250389757c223526f3fd34413b3159e06592622576ffdc67054e51751b083a3ed4839586d017359a087c49f6d065d9aed94e945c1848c48a2
7
- data.tar.gz: bc2490b6eb0ba432b33636f3036322229e7964403428e4f1b88caae0223ce3d73644a2e5d5da44c1109a1143ad8c50c51ba60008a05e04d605ff72b927c402c1
6
+ metadata.gz: 098561c08e3037f7b08dff37c8af296918e42748bbfc55ff5849121d74c37884f3706276ab32986866a29e55130d92e116094e653244c624fe87d8c2f1e61864
7
+ data.tar.gz: 76202564ea9ef353e7f7c699a66d6c1c050e7698965db32ffcbae6365e33ad055a7d558f51626397a52ea4c74a6b1894020f728cf0e5e479f6ee75ae4c1876e3
data/HISTORY CHANGED
@@ -1,6 +1,19 @@
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
+
7
+ [2014/12/02]
8
+ * Version 2.4.1
9
+ - sp_loginclass support should NOT have been added to password implementation
10
+ [2014/12/01]
11
+ * Version 2.4.0
12
+ - Add support for sp_loginclass via pwd.h
1
13
  [2014/04/28]
2
- * Added support for more BSDs, thanks to https://github.com/bsiegert.
3
- * Simplified compatibility check, removing check for function not actually used in pwd.h implementations.
14
+ * Version 2.3.3
15
+ - Added support for more BSDs, thanks to https://github.com/bsiegert.
16
+ - Simplified compatibility check, removing check for function not actually used in pwd.h implementations.
4
17
  [2014/02/25]
5
18
  [2013/12/18]
6
19
  * Version 2.3.3
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
 
@@ -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/shadow-maint/shadow
89
+ * Code at https://github.com/apalmblad/ruby-shadow
86
90
 
87
91
 
88
92
  Original Author:
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", NULL);
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.3.4'
22
+ spec.version = '2.5.0'
23
23
  spec.license = "Public Domain License"
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
- 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
+ */
149
154
  cfile = file_ptr( RFILE(file)->fptr );
150
155
 
151
-
152
- centry.sp_namp = StringValuePtr(val[0]);
153
- centry.sp_pwdp = StringValuePtr(val[1]);
154
- centry.sp_lstchg = FIX2INT(val[2]);
155
- centry.sp_min = FIX2INT(val[3]);
156
- centry.sp_max = FIX2INT(val[4]);
157
- centry.sp_warn = FIX2INT(val[5]);
158
- centry.sp_inact = FIX2INT(val[6]);
159
- centry.sp_expire = FIX2INT(val[8]);
160
- 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 ) );
161
168
 
162
169
  result = putspent(&centry,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", "sp_expire","sp_flag", NULL);
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.3.4
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-04-28 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.2.1
58
+ rubygems_version: 2.4.8
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: "*nix Shadow Password Module"