libshadow 0.0.2 → 1.0.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.
- data/README.rdoc +15 -28
- data/ext/shadow/extconf.rb +4 -4
- data/ext/shadow/shadow.c +21 -7
- data/lib/libshadow.rb +1 -1
- metadata +5 -5
data/README.rdoc
CHANGED
|
@@ -1,48 +1,35 @@
|
|
|
1
1
|
= libshadow
|
|
2
2
|
|
|
3
|
-
* http://github.com
|
|
3
|
+
* http://github.com/railsmachine/libshadow
|
|
4
4
|
|
|
5
5
|
== DESCRIPTION:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Provides /etc/shadow password management.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Same code as what's in the libshadow-ruby or ruby-libshadow package that may
|
|
10
|
+
or may not be available from your package manager.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
== FEATURES:
|
|
13
|
+
|
|
14
|
+
* Compatible with Puppet and Chef!
|
|
15
|
+
* Doesn't require a specific version of ruby like some system packages!
|
|
12
16
|
|
|
13
17
|
== SYNOPSIS:
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
require 'shadow'
|
|
16
20
|
|
|
17
21
|
== REQUIREMENTS:
|
|
18
22
|
|
|
19
|
-
*
|
|
23
|
+
*NIX system with shadow.h
|
|
24
|
+
|
|
25
|
+
Will not work on OS X, sorry.
|
|
20
26
|
|
|
21
27
|
== INSTALL:
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
gem install libshadow
|
|
24
30
|
|
|
25
31
|
== LICENSE:
|
|
26
32
|
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
Copyright (c) 2010 FIXME full name
|
|
30
|
-
|
|
31
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
32
|
-
a copy of this software and associated documentation files (the
|
|
33
|
-
'Software'), to deal in the Software without restriction, including
|
|
34
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
35
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
36
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
37
|
-
the following conditions:
|
|
38
|
-
|
|
39
|
-
The above copyright notice and this permission notice shall be
|
|
40
|
-
included in all copies or substantial portions of the Software.
|
|
33
|
+
Copyright (C) 1998-1999 by Takaaki.Tateishi(ttate@jaist.ac.jp)
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
44
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
45
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
46
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
47
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
48
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
35
|
+
Free for any use with your own risk!
|
data/ext/shadow/extconf.rb
CHANGED
|
@@ -6,15 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
require 'mkmf'
|
|
8
8
|
|
|
9
|
-
$CFLAGS =
|
|
10
|
-
$LDFLAGS = "-lshadow"
|
|
9
|
+
$CFLAGS = RUBY_VERSION =~ /1\.9/ ? '-DRUBY19' : ''
|
|
11
10
|
|
|
12
11
|
if( ! (ok = have_library("shadow","getspent")) )
|
|
13
|
-
$LDFLAGS = ""
|
|
14
12
|
ok = have_func("getspent")
|
|
15
13
|
end
|
|
16
14
|
|
|
17
|
-
ok &= have_func("sgetspent")
|
|
18
15
|
ok &= have_func("fgetspent")
|
|
19
16
|
ok &= have_func("setspent")
|
|
20
17
|
ok &= have_func("endspent")
|
|
@@ -22,5 +19,8 @@ ok &= have_func("lckpwdf")
|
|
|
22
19
|
ok &= have_func("ulckpwdf")
|
|
23
20
|
|
|
24
21
|
if ok
|
|
22
|
+
if ! have_func("sgetspent")
|
|
23
|
+
$CFLAGS += '-DSOLARIS'
|
|
24
|
+
end
|
|
25
25
|
create_makefile("shadow")
|
|
26
26
|
end
|
data/ext/shadow/shadow.c
CHANGED
|
@@ -10,7 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
#include <shadow.h>
|
|
12
12
|
#include "ruby.h"
|
|
13
|
+
#ifdef RUBY19
|
|
14
|
+
#include <ruby/io.h>
|
|
15
|
+
#else
|
|
13
16
|
#include "rubyio.h"
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#ifdef RUBY19
|
|
20
|
+
#define file_ptr(x) (x)->stdio_file
|
|
21
|
+
#else
|
|
22
|
+
#define file_ptr(x) (x)->f
|
|
23
|
+
#endif
|
|
14
24
|
|
|
15
25
|
static VALUE rb_mShadow;
|
|
16
26
|
static VALUE rb_mPasswd;
|
|
@@ -36,6 +46,7 @@ rb_shadow_endspent(VALUE self)
|
|
|
36
46
|
};
|
|
37
47
|
|
|
38
48
|
|
|
49
|
+
#ifndef SOLARIS
|
|
39
50
|
static VALUE
|
|
40
51
|
rb_shadow_sgetspent(VALUE self, VALUE str)
|
|
41
52
|
{
|
|
@@ -45,7 +56,7 @@ rb_shadow_sgetspent(VALUE self, VALUE str)
|
|
|
45
56
|
if( TYPE(str) != T_STRING )
|
|
46
57
|
rb_raise(rb_eException,"argument must be a string.");
|
|
47
58
|
|
|
48
|
-
entry = sgetspent(
|
|
59
|
+
entry = sgetspent(StringValuePtr(str));
|
|
49
60
|
|
|
50
61
|
if( entry == NULL )
|
|
51
62
|
return Qnil;
|
|
@@ -64,6 +75,7 @@ rb_shadow_sgetspent(VALUE self, VALUE str)
|
|
|
64
75
|
free(entry);
|
|
65
76
|
return result;
|
|
66
77
|
};
|
|
78
|
+
#endif
|
|
67
79
|
|
|
68
80
|
static VALUE
|
|
69
81
|
rb_shadow_fgetspent(VALUE self, VALUE file)
|
|
@@ -74,7 +86,7 @@ rb_shadow_fgetspent(VALUE self, VALUE file)
|
|
|
74
86
|
if( TYPE(file) != T_FILE )
|
|
75
87
|
rb_raise(rb_eTypeError,"argument must be a File.");
|
|
76
88
|
|
|
77
|
-
entry = fgetspent((RFILE(file)->fptr)
|
|
89
|
+
entry = fgetspent(file_ptr(RFILE(file)->fptr));
|
|
78
90
|
|
|
79
91
|
if( entry == NULL )
|
|
80
92
|
return Qnil;
|
|
@@ -127,7 +139,7 @@ rb_shadow_getspnam(VALUE self, VALUE name)
|
|
|
127
139
|
if( TYPE(name) != T_STRING )
|
|
128
140
|
rb_raise(rb_eException,"argument must be a string.");
|
|
129
141
|
|
|
130
|
-
entry = getspnam(
|
|
142
|
+
entry = getspnam(StringValuePtr(name));
|
|
131
143
|
|
|
132
144
|
if( entry == NULL )
|
|
133
145
|
return Qnil;
|
|
@@ -157,11 +169,11 @@ rb_shadow_putspent(VALUE self, VALUE entry, VALUE file)
|
|
|
157
169
|
int result;
|
|
158
170
|
|
|
159
171
|
for(i=0; i<=8; i++)
|
|
160
|
-
val[i] =
|
|
161
|
-
cfile = RFILE(file)->fptr
|
|
172
|
+
val[i] = RSTRUCT_PTR(entry)[i];
|
|
173
|
+
cfile = file_ptr(RFILE(file)->fptr);
|
|
162
174
|
|
|
163
|
-
centry.sp_namp =
|
|
164
|
-
centry.sp_pwdp =
|
|
175
|
+
centry.sp_namp = StringValuePtr(val[0]);
|
|
176
|
+
centry.sp_pwdp = StringValuePtr(val[1]);
|
|
165
177
|
centry.sp_lstchg = FIX2INT(val[2]);
|
|
166
178
|
centry.sp_min = FIX2INT(val[3]);
|
|
167
179
|
centry.sp_max = FIX2INT(val[4]);
|
|
@@ -268,7 +280,9 @@ Init_shadow()
|
|
|
268
280
|
|
|
269
281
|
rb_define_module_function(rb_mPasswd,"setspent",rb_shadow_setspent,0);
|
|
270
282
|
rb_define_module_function(rb_mPasswd,"endspent",rb_shadow_endspent,0);
|
|
283
|
+
#ifndef SOLARIS
|
|
271
284
|
rb_define_module_function(rb_mPasswd,"sgetspent",rb_shadow_sgetspent,1);
|
|
285
|
+
#endif
|
|
272
286
|
rb_define_module_function(rb_mPasswd,"fgetspent",rb_shadow_fgetspent,1);
|
|
273
287
|
rb_define_module_function(rb_mPasswd,"getspent",rb_shadow_getspent,0);
|
|
274
288
|
rb_define_module_function(rb_mPasswd,"getspnam",rb_shadow_getspnam,1);
|
data/lib/libshadow.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: libshadow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 23
|
|
5
|
+
prerelease:
|
|
6
6
|
segments:
|
|
7
|
+
- 1
|
|
7
8
|
- 0
|
|
8
9
|
- 0
|
|
9
|
-
|
|
10
|
-
version: 0.0.2
|
|
10
|
+
version: 1.0.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Jesse Newland
|
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
66
|
requirements: []
|
|
67
67
|
|
|
68
68
|
rubyforge_project:
|
|
69
|
-
rubygems_version: 1.
|
|
69
|
+
rubygems_version: 1.4.2
|
|
70
70
|
signing_key:
|
|
71
71
|
specification_version: 3
|
|
72
72
|
summary: shadow.h
|