vacman_controller 0.2.1 → 0.2.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 -4
- data/lib/vacman_controller.rb +17 -0
- 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: 3d98133ea201d0ae3720517f298c719979a91fee
|
4
|
+
data.tar.gz: 1c6ae1f43a4cc27ff8285073ea9d789c0b5c6c62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c7e8cec7e94fab24bad7188374685263192721cf70ba66e751ef73e25dd24dbe0baaaed9e46b7a8d2e5fcc1e9f5055c4058857f85bf458e28297093312948e1
|
7
|
+
data.tar.gz: 862c00c0d793e934d9bdb88af6bd7f06ac5cae8264a77a63afd84563f4c642fa9c65a8f5373083fb7e0c4edfa0f126e890f460e2992a147eb7daa4518a09dd88
|
@@ -255,6 +255,33 @@ static VALUE vacman_set_token_property(VALUE module, VALUE token, VALUE property
|
|
255
255
|
}
|
256
256
|
|
257
257
|
|
258
|
+
/*
|
259
|
+
* Set token static password
|
260
|
+
*/
|
261
|
+
static VALUE vacman_set_token_pin(VALUE module, VALUE token, VALUE pin) {
|
262
|
+
TDigipassBlob dpdata;
|
263
|
+
|
264
|
+
if (!RB_TYPE_P(pin, T_STRING)) {
|
265
|
+
rb_raise(e_vacmanerror, "invalid pin given, requires a string");
|
266
|
+
return Qnil;
|
267
|
+
}
|
268
|
+
|
269
|
+
rbhash_to_digipass(token, &dpdata);
|
270
|
+
|
271
|
+
aat_ascii *passwd = StringValueCStr(pin);
|
272
|
+
aat_int32 result = AAL2ChangeStaticPassword(&dpdata, &KernelParms, passwd, passwd);
|
273
|
+
|
274
|
+
digipass_to_rbhash(&dpdata, token);
|
275
|
+
|
276
|
+
if (result == 0) {
|
277
|
+
return Qtrue;
|
278
|
+
} else {
|
279
|
+
vacman_raise_error("AAL2ChangeStaticPassword", result);
|
280
|
+
return Qnil;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
|
258
285
|
/*
|
259
286
|
* verify password
|
260
287
|
* this is the main usecase, check the use input for authentication
|
@@ -354,7 +381,7 @@ static struct kernel_property kernel_properties[] = {
|
|
354
381
|
{ "EventWindow", &KernelParms.EventWindow, 100 }, // Event Window size in nbr of iterations
|
355
382
|
{ "HSMSlotId", &KernelParms.HSMSlotId, 0 }, // HSM Slot id uses to store DB and Transport Key
|
356
383
|
};
|
357
|
-
static
|
384
|
+
static size_t kernel_properties_count = sizeof(kernel_properties)/sizeof(struct kernel_property);
|
358
385
|
|
359
386
|
/*
|
360
387
|
* Get kernel property names
|
@@ -377,7 +404,7 @@ static VALUE vacman_set_kernel_param(VALUE module, VALUE paramname, VALUE rbval)
|
|
377
404
|
char *name = StringValueCStr(paramname);
|
378
405
|
int value = rb_fix2int(rbval);
|
379
406
|
|
380
|
-
for (
|
407
|
+
for (size_t i = 0; i < kernel_properties_count; i++) {
|
381
408
|
if (strcmp(name, kernel_properties[i].name) == 0) {
|
382
409
|
*kernel_properties[i].value = value;
|
383
410
|
return Qtrue;
|
@@ -395,7 +422,7 @@ static VALUE vacman_set_kernel_param(VALUE module, VALUE paramname, VALUE rbval)
|
|
395
422
|
static VALUE vacman_get_kernel_param(VALUE module, VALUE paramname) {
|
396
423
|
char *name = StringValueCStr(paramname);
|
397
424
|
|
398
|
-
for (
|
425
|
+
for (size_t i = 0; i < kernel_properties_count; i++) {
|
399
426
|
if (strcmp(name, kernel_properties[i].name) == 0) {
|
400
427
|
return LONG2FIX(*kernel_properties[i].value);
|
401
428
|
}
|
@@ -413,7 +440,7 @@ static void init_kernel_params() {
|
|
413
440
|
|
414
441
|
KernelParms.ParmCount = 19; /* Number of valid parameters in this list */
|
415
442
|
|
416
|
-
for (
|
443
|
+
for (size_t i = 0; i < kernel_properties_count; i++) {
|
417
444
|
*kernel_properties[i].value = kernel_properties[i].deflt;
|
418
445
|
}
|
419
446
|
}
|
@@ -441,6 +468,8 @@ void Init_vacman_controller(void) {
|
|
441
468
|
rb_define_singleton_method(vacman_module, "get_token_property", vacman_get_token_property, 2);
|
442
469
|
rb_define_singleton_method(vacman_module, "set_token_property", vacman_set_token_property, 3);
|
443
470
|
|
471
|
+
rb_define_singleton_method(vacman_module, "set_token_pin", vacman_set_token_pin, 2);
|
472
|
+
|
444
473
|
rb_define_singleton_method(vacman_module, "token_property_names", vacman_get_token_property_names, 0);
|
445
474
|
rb_define_singleton_method(vacman_module, "kernel_property_names", vacman_get_kernel_property_names, 0);
|
446
475
|
}
|
data/lib/vacman_controller.rb
CHANGED
@@ -149,6 +149,23 @@ module VacmanController
|
|
149
149
|
|
150
150
|
|
151
151
|
|
152
|
+
# Set a token PIN
|
153
|
+
#
|
154
|
+
# == Parameters:
|
155
|
+
# hash::
|
156
|
+
# the hash for a specific token (you get these in import)
|
157
|
+
# pin::
|
158
|
+
# the new PIN. must be a string.
|
159
|
+
#
|
160
|
+
# possible names:
|
161
|
+
#
|
162
|
+
#
|
163
|
+
def set_token_pin(hash, pin)
|
164
|
+
VacmanLowLevel.set_token_pin(hash, pin)
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
|
152
169
|
# Returns all properties configured for a token
|
153
170
|
#
|
154
171
|
def get_token_all_properties(hash)
|