ruby-shadow 2.3.2 → 2.3.3

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.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/README +1 -0
  3. data/pwd/shadow.c +10 -9
  4. data/ruby-shadow.gemspec +1 -1
  5. data/shadow/shadow.c +21 -52
  6. metadata +12 -15
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 00dc5e2fb7b9124c5e9489f228d5d35ed06487d3
4
+ data.tar.gz: 18183d816f024a50f1bde785048d9476e4c893e7
5
+ SHA512:
6
+ metadata.gz: b3ad44e8ce154effe359199c0db55a90d88f9e8d57d6b5de84b96eca95eb20489604359288716f7062d2d53790e8994f57821401114b48f5bef3b3123ed41776
7
+ data.tar.gz: d60ce3599b533e8a54664184a3918a64b8cd9785a0f45d7f80fd4cb65e0a930a549cf458e661be115bf77333aac4e55308637828126583d0cdc91c36f8c0b1cb
data/README CHANGED
@@ -82,6 +82,7 @@ when you exit the iterator block.
82
82
 
83
83
  * man shadow
84
84
  * /usr/include/shadow.h
85
+ * Code at https://github.com/shadow-maint/shadow
85
86
 
86
87
 
87
88
  Original Author:
@@ -54,16 +54,17 @@ rb_shadow_endspent(VALUE self)
54
54
 
55
55
  static VALUE convert_pw_struct( struct passwd *entry )
56
56
  {
57
+ /* Hmm. Why custom pw_change instead of sp_lstchg? */
57
58
  return rb_struct_new(rb_sPasswdEntry,
58
- rb_tainted_str_new2(entry->pw_name),
59
- rb_tainted_str_new2(entry->pw_passwd),
60
- Qnil, /* date when the password was last changed (in days since Jan 1, 1970) */
61
- Qnil, /* days that password must stay same */
62
- Qnil, /* days until password changes. */
63
- Qnil, /* days before expiration where user is warned */
64
- Qnil, /* days after password expiration that account becomes inactive */
65
- INT2FIX(difftime(entry->pw_change, 0) / (24*60*60)),
66
- INT2FIX(difftime(entry->pw_expire, 0) / (24*60*60)),
59
+ rb_tainted_str_new2(entry->pw_name), /* sp_namp */
60
+ rb_tainted_str_new2(entry->pw_passwd), /* sp_pwdp, encryped password */
61
+ Qnil, /* sp_lstchg, date when the password was last changed (in days since Jan 1, 1970) */
62
+ Qnil, /* sp_min, days that password must stay same */
63
+ Qnil, /* sp_max, days until password changes. */
64
+ Qnil, /* sp_warn, days before expiration where user is warned */
65
+ Qnil, /* sp_inact, days after password expiration that account becomes inactive */
66
+ INT2FIX(difftime(entry->pw_change, 0) / (24*60*60)), /* pw_change */
67
+ INT2FIX(difftime(entry->pw_expire, 0) / (24*60*60)), /* sp_expire */
67
68
  Qnil, /* sp_flag */
68
69
  NULL);
69
70
  }
@@ -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.2'
22
+ spec.version = '2.3.3'
23
23
  spec.license = "Public Domain License"
24
24
  end
@@ -31,6 +31,21 @@ static VALUE rb_sGroupEntry;
31
31
  static VALUE rb_eFileLock;
32
32
 
33
33
 
34
+ static VALUE convert_pw_struct( struct spwd *entry )
35
+ {
36
+ return rb_struct_new(rb_sPasswdEntry,
37
+ rb_tainted_str_new2(entry->sp_namp),
38
+ rb_tainted_str_new2(entry->sp_pwdp),
39
+ INT2FIX(entry->sp_lstchg),
40
+ INT2FIX(entry->sp_min),
41
+ INT2FIX(entry->sp_max),
42
+ INT2FIX(entry->sp_warn),
43
+ INT2FIX(entry->sp_inact),
44
+ Qnil, /* used by BSD, pw_change, date when the password expires, in days since Jan 1, 1970 */
45
+ INT2FIX(entry->sp_expire),
46
+ INT2FIX(entry->sp_flag),
47
+ NULL);
48
+ };
34
49
  static VALUE
35
50
  rb_shadow_setspent(VALUE self)
36
51
  {
@@ -62,18 +77,7 @@ rb_shadow_sgetspent(VALUE self, VALUE str)
62
77
  if( entry == NULL )
63
78
  return Qnil;
64
79
 
65
- result = rb_struct_new(rb_sPasswdEntry,
66
- rb_tainted_str_new2(entry->sp_namp),
67
- rb_tainted_str_new2(entry->sp_pwdp),
68
- INT2FIX(entry->sp_lstchg),
69
- INT2FIX(entry->sp_min),
70
- INT2FIX(entry->sp_max),
71
- INT2FIX(entry->sp_warn),
72
- INT2FIX(entry->sp_inact),
73
- Qnil, /* used by BSD, pw_change, date when the password expires, in days since Jan 1, 1970 */
74
- INT2FIX(entry->sp_expire),
75
- INT2FIX(entry->sp_flag),
76
- NULL);
80
+ result = convert_pw_struct( entry );
77
81
  free(entry);
78
82
  return result;
79
83
  };
@@ -92,18 +96,7 @@ rb_shadow_fgetspent(VALUE self, VALUE file)
92
96
  if( entry == NULL )
93
97
  return Qnil;
94
98
 
95
- result = rb_struct_new(rb_sPasswdEntry,
96
- rb_tainted_str_new2(entry->sp_namp),
97
- rb_tainted_str_new2(entry->sp_pwdp),
98
- INT2FIX(entry->sp_lstchg),
99
- INT2FIX(entry->sp_min),
100
- INT2FIX(entry->sp_max),
101
- INT2FIX(entry->sp_warn),
102
- INT2FIX(entry->sp_inact),
103
- Qnil, /* used by BSD, pw_change, date when the password expires, in days since Jan 1, 1970 */
104
- INT2FIX(entry->sp_expire),
105
- INT2FIX(entry->sp_flag),
106
- NULL);
99
+ result = convert_pw_struct( entry );
107
100
  return result;
108
101
  };
109
102
 
@@ -118,19 +111,7 @@ rb_shadow_getspent(VALUE self)
118
111
  if( entry == NULL )
119
112
  return Qnil;
120
113
 
121
- result = rb_struct_new(rb_sPasswdEntry,
122
- rb_tainted_str_new2(entry->sp_namp),
123
- rb_tainted_str_new2(entry->sp_pwdp),
124
- INT2FIX(entry->sp_lstchg),
125
- INT2FIX(entry->sp_min),
126
- INT2FIX(entry->sp_max),
127
- INT2FIX(entry->sp_warn),
128
- INT2FIX(entry->sp_inact),
129
- Qnil, /* used by BSD, pw_change, date when the password expires, in days since Jan 1, 1970 */
130
- INT2FIX(entry->sp_expire),
131
- INT2FIX(entry->sp_flag),
132
- NULL);
133
- return result;
114
+ return convert_pw_struct( entry );
134
115
  };
135
116
 
136
117
  static VALUE
@@ -146,23 +127,11 @@ rb_shadow_getspnam(VALUE self, VALUE name)
146
127
 
147
128
  if( entry == NULL )
148
129
  return Qnil;
149
-
150
- result = rb_struct_new(rb_sPasswdEntry,
151
- rb_tainted_str_new2(entry->sp_namp),
152
- rb_tainted_str_new2(entry->sp_pwdp),
153
- INT2FIX(entry->sp_lstchg),
154
- INT2FIX(entry->sp_min),
155
- INT2FIX(entry->sp_max),
156
- INT2FIX(entry->sp_warn),
157
- INT2FIX(entry->sp_inact),
158
- Qnil, /* used by BSD, pw_change, date when the password expires, in days since Jan 1, 1970 */
159
- INT2FIX(entry->sp_expire),
160
- INT2FIX(entry->sp_flag),
161
- NULL);
162
- return result;
130
+ return convert_pw_struct( entry );
163
131
  };
164
132
 
165
133
 
134
+
166
135
  static VALUE
167
136
  rb_shadow_putspent(VALUE self, VALUE entry, VALUE file)
168
137
  {
@@ -274,7 +243,7 @@ Init_shadow()
274
243
  rb_sPasswdEntry = rb_struct_define("PasswdEntry",
275
244
  "sp_namp","sp_pwdp","sp_lstchg",
276
245
  "sp_min","sp_max","sp_warn",
277
- "sp_inact","sp_expire","sp_flag", NULL);
246
+ "sp_inact", "pw_change", "sp_expire","sp_flag", NULL);
278
247
  rb_sGroupEntry = rb_struct_define("GroupEntry",
279
248
  "sg_name","sg_passwd",
280
249
  "sg_adm","sg_mem",NULL);
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shadow
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
5
- prerelease:
4
+ version: 2.3.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Adam Palmblad
@@ -14,7 +13,7 @@ authors:
14
13
  autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
- date: 2013-12-18 00:00:00.000000000 Z
16
+ date: 2014-02-25 00:00:00.000000000 Z
18
17
  dependencies: []
19
18
  description: This module provides access to shadow passwords on Linux, OSX, FreeBSD,
20
19
  OpenBSD, and Solaris
@@ -25,41 +24,39 @@ extensions:
25
24
  - extconf.rb
26
25
  extra_rdoc_files: []
27
26
  files:
28
- - extconf.rb
29
27
  - HISTORY
30
28
  - LICENSE
31
29
  - MANIFEST
32
30
  - README
33
31
  - README.euc
34
- - ruby-shadow.gemspec
35
- - pwd/shadow.c
32
+ - extconf.rb
36
33
  - pwd/depend
37
- - shadow/shadow.c
34
+ - pwd/shadow.c
35
+ - ruby-shadow.gemspec
38
36
  - shadow/depend
37
+ - shadow/shadow.c
39
38
  homepage: https://github.com/apalmblad/ruby-shadow
40
39
  licenses:
41
40
  - Public Domain License
41
+ metadata: {}
42
42
  post_install_message:
43
43
  rdoc_options: []
44
44
  require_paths:
45
45
  - lib
46
46
  required_ruby_version: !ruby/object:Gem::Requirement
47
- none: false
48
47
  requirements:
49
- - - ! '>='
48
+ - - ">="
50
49
  - !ruby/object:Gem::Version
51
50
  version: '1.8'
52
51
  required_rubygems_version: !ruby/object:Gem::Requirement
53
- none: false
54
52
  requirements:
55
- - - ! '>='
53
+ - - ">="
56
54
  - !ruby/object:Gem::Version
57
55
  version: '0'
58
56
  requirements: []
59
57
  rubyforge_project:
60
- rubygems_version: 1.8.25
58
+ rubygems_version: 2.2.1
61
59
  signing_key:
62
- specification_version: 3
63
- summary: ! '*nix Shadow Password Module'
60
+ specification_version: 4
61
+ summary: "*nix Shadow Password Module"
64
62
  test_files: []
65
- has_rdoc: