sys-admin 1.5.1 → 1.5.2
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/CHANGES +4 -0
- data/README +0 -2
- data/ext/sys/admin.c +13 -3
- data/ext/sys/admin.h +3 -3
- data/test/test_sys_admin.rb +1 -1
- data/test/test_sys_admin_windows.rb +2 -2
- metadata +14 -5
data/CHANGES
CHANGED
data/README
CHANGED
data/ext/sys/admin.c
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
#include "ruby.h"
|
2
2
|
#include "admin.h"
|
3
3
|
|
4
|
+
#ifndef RSTRING_PTR
|
5
|
+
#define RSTRING_PTR(v) (RSTRING(v)->ptr)
|
6
|
+
#define RSTRING_LEN(v) (RSTRING(v)->len)
|
7
|
+
#endif
|
8
|
+
|
9
|
+
#ifndef RARRAY_PTR
|
10
|
+
#define RARRAY_PTR(v) (RARRAY(v)->ptr)
|
11
|
+
#define RARRAY_LEN(v) (RARRAY(v)->len)
|
12
|
+
#endif
|
13
|
+
|
4
14
|
/*
|
5
15
|
* call-seq:
|
6
16
|
* User.new
|
@@ -290,8 +300,8 @@ static VALUE user_groups(VALUE self){
|
|
290
300
|
* the user name, we have a match.
|
291
301
|
*/
|
292
302
|
if(!NIL_P(v_groups)){
|
293
|
-
for(i = 0; i <
|
294
|
-
v_group =
|
303
|
+
for(i = 0; i < RARRAY_LEN(v_groups); i++){
|
304
|
+
v_group = RARRAY_PTR(v_groups)[i];
|
295
305
|
v_users = rb_funcall(v_group, rb_intern("members"), 0, 0);
|
296
306
|
|
297
307
|
if(RTEST(rb_funcall(v_users, rb_intern("include?"), 1, v_name))){
|
@@ -404,6 +414,6 @@ void Init_admin(){
|
|
404
414
|
|
405
415
|
/* Constants */
|
406
416
|
|
407
|
-
/* 1.5.
|
417
|
+
/* 1.5.2: The version of this library */
|
408
418
|
rb_define_const(cAdmin, "VERSION", rb_str_new2(SYS_ADMIN_VERSION));
|
409
419
|
}
|
data/ext/sys/admin.h
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
#include <errno.h>
|
9
9
|
#include <string.h>
|
10
10
|
|
11
|
-
#define SYS_ADMIN_VERSION "1.5.
|
11
|
+
#define SYS_ADMIN_VERSION "1.5.2"
|
12
12
|
|
13
13
|
#if defined(__MACH__) || defined(__APPLE__)
|
14
14
|
#define __BSD__
|
@@ -111,7 +111,7 @@ static VALUE get_user_by_name(VALUE v_name){
|
|
111
111
|
struct passwd pwd;
|
112
112
|
struct passwd* pwdbuf;
|
113
113
|
|
114
|
-
if(getpwnam_r(
|
114
|
+
if(getpwnam_r(RSTRING_PTR(v_name), &pwd, buf, sizeof(buf), &pwdbuf) != 0)
|
115
115
|
rb_raise(cAdminError, "%s", strerror(errno));
|
116
116
|
|
117
117
|
if(!pwdbuf)
|
@@ -178,7 +178,7 @@ static VALUE get_group_by_name(VALUE v_name){
|
|
178
178
|
struct group grp;
|
179
179
|
struct group* grpbuf;
|
180
180
|
|
181
|
-
if(getgrnam_r(
|
181
|
+
if(getgrnam_r(RSTRING_PTR(v_name), &grp, buf, sizeof(buf), &grpbuf) != 0)
|
182
182
|
rb_raise(cAdminError, "%s", strerror(errno));
|
183
183
|
|
184
184
|
if(!grpbuf)
|
data/test/test_sys_admin.rb
CHANGED
@@ -262,8 +262,8 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
262
262
|
end
|
263
263
|
|
264
264
|
def test_user_dir
|
265
|
-
assert_nothing_raised{ Admin.get_user(@user_name, :localaccount => true) }
|
266
|
-
assert_kind_of(String, @
|
265
|
+
assert_nothing_raised{ @user = Admin.get_user(@user_name, :localaccount => true) }
|
266
|
+
assert_kind_of([String, NilClass], @user.dir)
|
267
267
|
end
|
268
268
|
|
269
269
|
# Group class
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-02 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: test-unit
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.0.3
|
24
|
+
version:
|
16
25
|
description: " The sys-admin library is a unified, cross platform replacement for the\n 'etc' library that ships as part of the Ruby standard library. It\n provides a common interface for all platforms, including MS Windows. In\n addition, it provides an interface for adding, deleting and configuring\n users on MS Windows.\n"
|
17
26
|
email: djberg96@gmail.com
|
18
27
|
executables: []
|
@@ -62,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
71
|
requirements: []
|
63
72
|
|
64
73
|
rubyforge_project: sysutils
|
65
|
-
rubygems_version: 1.3.
|
74
|
+
rubygems_version: 1.3.5
|
66
75
|
signing_key:
|
67
76
|
specification_version: 3
|
68
77
|
summary: A unified, cross platform replacement for the "etc" library.
|