vacman_controller 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/ext/vacman_controller/vacman_controller.c +33 -2
- data/lib/vacman_controller.rb +55 -37
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70e83106c486e3e2055b0a10215f1895fceb4e2d
|
4
|
+
data.tar.gz: 3c57b77c49ac9cbc9b8baeaf0cc350d902abe489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a07e0dcce49bf04fd089be86472e35fc2ab5e5ed7fc01f724e6ded8173bde1edbd253d3890b86a2d578e430265b002b5693ad42455af26a25262c7ec7dd67e
|
7
|
+
data.tar.gz: 7ee6a428246bcee1c417cae5cf0c9ddc5180813efab448b793d7444813b9c737eef6913c0ab4a19ec77b32c5e0e9192d1c146c3dff7e7fbdd8a2305ec3b6a08c
|
@@ -159,13 +159,13 @@ static struct token_property token_properties[] = {
|
|
159
159
|
{"triple_des_used", TRIPLE_DES_USED },
|
160
160
|
};
|
161
161
|
|
162
|
-
static size_t
|
162
|
+
static size_t token_properties_count = sizeof(token_properties)/sizeof(struct token_property);
|
163
163
|
|
164
164
|
/*
|
165
165
|
* Convert property name to property ID
|
166
166
|
*/
|
167
167
|
static long vacman_get_property_id(char *property_name) {
|
168
|
-
for (size_t i = 0; i <
|
168
|
+
for (size_t i = 0; i < token_properties_count; i++) {
|
169
169
|
if (strcmp(property_name, token_properties[i].name) == 0) {
|
170
170
|
return token_properties[i].id;
|
171
171
|
}
|
@@ -175,6 +175,20 @@ static long vacman_get_property_id(char *property_name) {
|
|
175
175
|
return 0;
|
176
176
|
}
|
177
177
|
|
178
|
+
/*
|
179
|
+
* Get token property names
|
180
|
+
*/
|
181
|
+
static VALUE vacman_get_token_property_names(void) {
|
182
|
+
VALUE ret = rb_ary_new();
|
183
|
+
|
184
|
+
for (size_t i = 0; i < token_properties_count; i++) {
|
185
|
+
const char *name = token_properties[i].name;
|
186
|
+
rb_ary_push(ret, rb_str_new2(name));
|
187
|
+
}
|
188
|
+
|
189
|
+
return ret;
|
190
|
+
}
|
191
|
+
|
178
192
|
|
179
193
|
/*
|
180
194
|
* Get token properties
|
@@ -321,6 +335,20 @@ static struct kernel_property kernel_properties[] = {
|
|
321
335
|
};
|
322
336
|
static int kernel_properties_count = sizeof(kernel_properties)/sizeof(struct kernel_property);
|
323
337
|
|
338
|
+
/*
|
339
|
+
* Get kernel property names
|
340
|
+
*/
|
341
|
+
static VALUE vacman_get_kernel_property_names(void) {
|
342
|
+
VALUE ret = rb_ary_new();
|
343
|
+
|
344
|
+
for (size_t i = 0; i < kernel_properties_count; i++) {
|
345
|
+
const char *name = kernel_properties[i].name;
|
346
|
+
rb_ary_push(ret, rb_str_new2(name));
|
347
|
+
}
|
348
|
+
|
349
|
+
return ret;
|
350
|
+
}
|
351
|
+
|
324
352
|
/*
|
325
353
|
* Set kernel parameter
|
326
354
|
*/
|
@@ -391,4 +419,7 @@ void Init_vacman_controller(void) {
|
|
391
419
|
|
392
420
|
rb_define_singleton_method(vacman_module, "get_token_property", vacman_get_token_property, 2);
|
393
421
|
rb_define_singleton_method(vacman_module, "set_token_property", vacman_set_token_property, 3);
|
422
|
+
|
423
|
+
rb_define_singleton_method(vacman_module, "token_property_names", vacman_get_token_property_names, 0);
|
424
|
+
rb_define_singleton_method(vacman_module, "kernel_property_names", vacman_get_kernel_property_names, 0);
|
394
425
|
}
|
data/lib/vacman_controller.rb
CHANGED
@@ -64,6 +64,14 @@ module VacmanController
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
+
# Gets the available kernel property names
|
68
|
+
#
|
69
|
+
def kernel_property_names
|
70
|
+
@_kernel_property_names ||= VacmanLowLevel.kernel_property_names
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
|
67
75
|
# Get a kernel parameter, wich is a basically a setting for vacman controller
|
68
76
|
#
|
69
77
|
# == Parameters:
|
@@ -90,52 +98,62 @@ module VacmanController
|
|
90
98
|
|
91
99
|
|
92
100
|
|
101
|
+
# Returns all configured kernel parameters
|
102
|
+
#
|
103
|
+
def get_kernel_all_parameters
|
104
|
+
kernel_property_names.inject({}) do |h, name|
|
105
|
+
h.update(name => (get_kernel_param(name) rescue "ERROR: #$!"))
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
# Gets the available token property names
|
112
|
+
#
|
113
|
+
def token_property_names
|
114
|
+
@_token_property_names ||= VacmanLowLevel.token_property_names
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
|
93
119
|
# Get a token single property
|
94
120
|
#
|
95
121
|
# == Parameters:
|
96
122
|
# hash::
|
97
123
|
# the hash for a specific token (you get these in import)
|
98
124
|
# property::
|
99
|
-
# the property
|
125
|
+
# the property name. See +token_property_names+
|
126
|
+
#
|
127
|
+
def get_token_property(hash, property)
|
128
|
+
VacmanLowLevel.get_token_property(hash, property)
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
# Set a token single property
|
134
|
+
#
|
135
|
+
# == Parameters:
|
136
|
+
# hash::
|
137
|
+
# the hash for a specific token (you get these in import)
|
138
|
+
# property::
|
139
|
+
# the property name. See +token_property_names+
|
140
|
+
# value::
|
141
|
+
# the property value. Only values convertible to integer are supported.
|
100
142
|
#
|
101
143
|
# possible names:
|
102
144
|
#
|
103
|
-
# token_model
|
104
|
-
# use_count
|
105
|
-
# last_time_used
|
106
|
-
# last_time_shift
|
107
|
-
# time_based_algo
|
108
|
-
# event_based_algo
|
109
|
-
# pin_supported
|
110
|
-
# unlock_supported
|
111
|
-
# pin_change_enabled
|
112
|
-
# pin_length
|
113
|
-
# pin_minimum_length
|
114
|
-
# pin_enabled
|
115
|
-
# pin_change_forced
|
116
|
-
# virtual_token_type
|
117
|
-
# virtual_token_grace_period
|
118
|
-
# virtual_token_remain_use
|
119
|
-
# last_response_type
|
120
|
-
# error_count
|
121
|
-
# event_value
|
122
|
-
# last_event_value
|
123
|
-
# sync_windows
|
124
|
-
# primary_token_enabled
|
125
|
-
# virtual_token_supported
|
126
|
-
# virtual_token_enabled
|
127
|
-
# code_word
|
128
|
-
# auth_mode
|
129
|
-
# ocra_suite
|
130
|
-
# derivation_supported
|
131
|
-
# max_dtf_number
|
132
|
-
# response_length
|
133
|
-
# response_format
|
134
|
-
# response_checksum
|
135
|
-
# time_step
|
136
|
-
# use_3des
|
137
145
|
#
|
138
|
-
def
|
139
|
-
|
146
|
+
def set_token_property(hash, property, value)
|
147
|
+
VacmanLowlevel.set_token_property(hash, property, value)
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
# Returns all properties configured for a token
|
153
|
+
#
|
154
|
+
def get_token_all_properties(hash)
|
155
|
+
token_property_names.inject({}) do |h, name|
|
156
|
+
h.update(name => (get_token_property(hash, name) rescue "ERROR: #$!"))
|
157
|
+
end
|
140
158
|
end
|
141
159
|
end
|