vacman_controller 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92b34885a3a724c1c9d8add45e77e7e353a1c175
4
- data.tar.gz: 0dc4ab2d9c9b49eceb24fd0bd24997470905ca98
3
+ metadata.gz: 70e83106c486e3e2055b0a10215f1895fceb4e2d
4
+ data.tar.gz: 3c57b77c49ac9cbc9b8baeaf0cc350d902abe489
5
5
  SHA512:
6
- metadata.gz: 882fb127b512ba307f48fdfd59910f8016291554fe24e6899daf5a6584e474eb802434b9e448dc295573cc582146b03e1166b6b3827e277fae5fc15ae8cc95e8
7
- data.tar.gz: 681c13bec4ff4452a3720ee5a069232de829776449f7587acacd7781027932bf4c45ee7a885d554a87cb403f2e16c23e3425740047b66b34c248379be571b37d
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 properties_count = sizeof(token_properties)/sizeof(struct token_property);
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 < properties_count; 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
  }
@@ -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 names
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 get_token_property(hash, property)
139
- VacmanLowLevel.get_token_property(hash, property)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vacman_controller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Lankenau