capng_c 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.clang-format +5 -0
- data/.github/workflows/apt.yml +35 -0
- data/.github/workflows/linux.yml +1 -1
- data/.github/workflows/yum.yml +39 -0
- data/Gemfile +2 -0
- data/README.md +14 -2
- data/capng_c.gemspec +2 -1
- data/ci/apt-test.sh +15 -0
- data/ci/yum-test.sh +64 -0
- data/ext/capng/capability.c +352 -24
- data/ext/capng/capng.c +297 -126
- data/ext/capng/capng.h +15 -6
- data/ext/capng/enum-action.c +35 -0
- data/ext/capng/enum-flags.c +44 -0
- data/ext/capng/enum-result.c +38 -0
- data/ext/capng/enum-select.c +39 -0
- data/ext/capng/enum-type.c +42 -0
- data/ext/capng/enum.c +7 -45
- data/ext/capng/print.c +126 -75
- data/ext/capng/state.c +54 -20
- data/ext/capng/utils.c +4 -4
- data/lib/capng.rb +9 -0
- data/lib/capng/version.rb +1 -1
- metadata +29 -5
data/ext/capng/capng.c
CHANGED
@@ -13,21 +13,50 @@
|
|
13
13
|
|
14
14
|
#include <capng.h>
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
/* clang-format off */
|
17
|
+
/*
|
18
|
+
* Document-class: CapNG
|
19
|
+
*
|
20
|
+
* CapNG class.
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* # Current process capability example
|
24
|
+
* require 'capng'
|
25
|
+
*
|
26
|
+
* @capng = CapNG.new(:current_process)
|
27
|
+
* @capng.have_capability?(:effective, :dac_read_search)
|
28
|
+
*
|
29
|
+
* @example
|
30
|
+
* # Other process capability example
|
31
|
+
* require 'capng'
|
32
|
+
*
|
33
|
+
* @capng = CapNG.new(:other_process, 12345)
|
34
|
+
* @capng.have_capability?(:effective, :dac_override)
|
35
|
+
*
|
36
|
+
* @example
|
37
|
+
* # File capability example
|
38
|
+
* require 'capng'
|
39
|
+
*
|
40
|
+
* @capng = CapNG.new(:file, "/path/to/file")
|
41
|
+
* @capng.have_capability?(:effective, :chown)
|
42
|
+
*/
|
43
|
+
/* clang-format on */
|
44
|
+
|
45
|
+
struct CapNG
|
46
|
+
{};
|
47
|
+
|
48
|
+
static void
|
49
|
+
capng_free(void* capng);
|
50
|
+
|
51
|
+
static const rb_data_type_t rb_capng_type = { "capng/capng",
|
52
|
+
{
|
53
|
+
0,
|
54
|
+
capng_free,
|
55
|
+
0,
|
56
|
+
},
|
57
|
+
NULL,
|
58
|
+
NULL,
|
59
|
+
RUBY_TYPED_FREE_IMMEDIATELY };
|
31
60
|
|
32
61
|
static void
|
33
62
|
capng_free(void* ptr)
|
@@ -40,19 +69,27 @@ rb_capng_alloc(VALUE klass)
|
|
40
69
|
{
|
41
70
|
VALUE obj;
|
42
71
|
struct CapNG* capng;
|
43
|
-
obj = TypedData_Make_Struct(
|
44
|
-
klass, struct CapNG, &rb_capng_type, capng);
|
72
|
+
obj = TypedData_Make_Struct(klass, struct CapNG, &rb_capng_type, capng);
|
45
73
|
return obj;
|
46
74
|
}
|
47
75
|
|
76
|
+
/*
|
77
|
+
* Initalize CapNG class.
|
78
|
+
*
|
79
|
+
* @overload initialize(target=nil, pid_or_file=nil)
|
80
|
+
* @option param target [String or Symbol] Specify capability target.
|
81
|
+
* @option param pid_or_file [String or Symbol] Querying XPath.
|
82
|
+
* @return [nil]
|
83
|
+
*
|
84
|
+
*/
|
48
85
|
static VALUE
|
49
|
-
rb_capng_initialize(int argc, VALUE
|
86
|
+
rb_capng_initialize(int argc, VALUE* argv, VALUE self)
|
50
87
|
{
|
51
88
|
VALUE rb_target, rb_pid_or_file;
|
52
89
|
int result = 0;
|
53
|
-
char
|
90
|
+
char* target = NULL;
|
54
91
|
int pid = 0, fd = 0;
|
55
|
-
rb_io_t
|
92
|
+
rb_io_t* fptr = NULL;
|
56
93
|
|
57
94
|
rb_scan_args(argc, argv, "02", &rb_target, &rb_pid_or_file);
|
58
95
|
|
@@ -96,29 +133,46 @@ rb_capng_initialize(int argc, VALUE *argv, VALUE self)
|
|
96
133
|
return Qnil;
|
97
134
|
}
|
98
135
|
|
136
|
+
/*
|
137
|
+
* Retrieve capability API status code on [CapNG#initialize] and file capability target.
|
138
|
+
*
|
139
|
+
* @return [@return_code]
|
140
|
+
*
|
141
|
+
*/
|
99
142
|
static VALUE
|
100
143
|
rb_capng_return_code(VALUE self)
|
101
144
|
{
|
102
145
|
return rb_iv_get(self, "@return_code");
|
103
146
|
}
|
104
147
|
|
148
|
+
/*
|
149
|
+
* Clear capabilities on specified target.
|
150
|
+
*
|
151
|
+
* @param rb_select_name_or_enum [Symbol or String or Fixnum] targets are CAPS, BOUNDS,
|
152
|
+
* BOTH, and AMBIENT for supported platform.
|
153
|
+
*
|
154
|
+
* @return [nil]
|
155
|
+
*
|
156
|
+
*/
|
105
157
|
static VALUE
|
106
158
|
rb_capng_clear(VALUE self, VALUE rb_select_name_or_enum)
|
107
159
|
{
|
108
160
|
capng_select_t select = 0;
|
109
161
|
|
110
162
|
switch (TYPE(rb_select_name_or_enum)) {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
163
|
+
case T_SYMBOL:
|
164
|
+
select =
|
165
|
+
select_name_to_select_type(RSTRING_PTR(rb_sym2str(rb_select_name_or_enum)));
|
166
|
+
break;
|
167
|
+
case T_STRING:
|
168
|
+
select = select_name_to_select_type(StringValuePtr(rb_select_name_or_enum));
|
169
|
+
break;
|
170
|
+
case T_FIXNUM:
|
171
|
+
select = NUM2INT(rb_select_name_or_enum);
|
172
|
+
break;
|
173
|
+
default:
|
174
|
+
rb_raise(rb_eArgError,
|
175
|
+
"Expected a String or a Symbol instance, or a capability type constant");
|
122
176
|
}
|
123
177
|
|
124
178
|
capng_clear(select);
|
@@ -126,23 +180,34 @@ rb_capng_clear(VALUE self, VALUE rb_select_name_or_enum)
|
|
126
180
|
return Qnil;
|
127
181
|
}
|
128
182
|
|
183
|
+
/*
|
184
|
+
* Fill capabilities on specified target.
|
185
|
+
*
|
186
|
+
* @param rb_select_name_or_enum [Symbol or String or Fixnum] targets are CAPS, BOUNDS,
|
187
|
+
* BOTH, and AMBIENT for supported platform.
|
188
|
+
*
|
189
|
+
* @return [nil]
|
190
|
+
*
|
191
|
+
*/
|
129
192
|
static VALUE
|
130
193
|
rb_capng_fill(VALUE self, VALUE rb_select_name_or_enum)
|
131
194
|
{
|
132
195
|
capng_select_t select = 0;
|
133
196
|
|
134
197
|
switch (TYPE(rb_select_name_or_enum)) {
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
198
|
+
case T_SYMBOL:
|
199
|
+
select =
|
200
|
+
select_name_to_select_type(RSTRING_PTR(rb_sym2str(rb_select_name_or_enum)));
|
201
|
+
break;
|
202
|
+
case T_STRING:
|
203
|
+
select = select_name_to_select_type(StringValuePtr(rb_select_name_or_enum));
|
204
|
+
break;
|
205
|
+
case T_FIXNUM:
|
206
|
+
select = NUM2INT(rb_select_name_or_enum);
|
207
|
+
break;
|
208
|
+
default:
|
209
|
+
rb_raise(rb_eArgError,
|
210
|
+
"Expected a String or a Symbol instance, or a capability type constant");
|
146
211
|
}
|
147
212
|
|
148
213
|
capng_fill(select);
|
@@ -150,6 +215,14 @@ rb_capng_fill(VALUE self, VALUE rb_select_name_or_enum)
|
|
150
215
|
return Qnil;
|
151
216
|
}
|
152
217
|
|
218
|
+
/*
|
219
|
+
* Specify process ID to retrieve other process capabilities.
|
220
|
+
*
|
221
|
+
* @param rb_pid [Fixnum] Process ID.
|
222
|
+
*
|
223
|
+
* @return [nil]
|
224
|
+
*
|
225
|
+
*/
|
153
226
|
static VALUE
|
154
227
|
rb_capng_setpid(VALUE self, VALUE rb_pid)
|
155
228
|
{
|
@@ -160,6 +233,13 @@ rb_capng_setpid(VALUE self, VALUE rb_pid)
|
|
160
233
|
return Qnil;
|
161
234
|
}
|
162
235
|
|
236
|
+
/*
|
237
|
+
* Specify process ID to retrieve process capabilities. If not
|
238
|
+
* calling #setpid before, it returns current process' capabilities.
|
239
|
+
*
|
240
|
+
* @return [Boolean]
|
241
|
+
*
|
242
|
+
*/
|
163
243
|
static VALUE
|
164
244
|
rb_capng_get_caps_process(VALUE self)
|
165
245
|
{
|
@@ -172,9 +252,21 @@ rb_capng_get_caps_process(VALUE self)
|
|
172
252
|
return Qfalse;
|
173
253
|
}
|
174
254
|
|
255
|
+
/*
|
256
|
+
* Update capabilities.
|
257
|
+
*
|
258
|
+
* @param rb_action_name_or_action [Symbol or String or Fixnum] ADD or DROP.
|
259
|
+
* @param rb_capability_name_or_type [Symbol or String or Fixnum]
|
260
|
+
* Effective/Inheritable/Permitted/Ambient (If supported) or their combinations
|
261
|
+
* @param rb_capability_or_name [Symbol or String or Fixnum] Capability name or constants.
|
262
|
+
*
|
263
|
+
* @see: [CapNG::Capability])
|
264
|
+
*
|
265
|
+
* @return [Boolean]
|
266
|
+
*/
|
175
267
|
static VALUE
|
176
|
-
rb_capng_update(VALUE self,
|
177
|
-
VALUE
|
268
|
+
rb_capng_update(VALUE self, VALUE rb_action_name_or_action,
|
269
|
+
VALUE rb_capability_name_or_type, VALUE rb_capability_or_name)
|
178
270
|
{
|
179
271
|
int result = 0;
|
180
272
|
unsigned int capability = 0;
|
@@ -182,45 +274,52 @@ rb_capng_update(VALUE self,
|
|
182
274
|
capng_act_t action = 0;
|
183
275
|
|
184
276
|
switch (TYPE(rb_action_name_or_action)) {
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
277
|
+
case T_SYMBOL:
|
278
|
+
action =
|
279
|
+
action_name_to_action_type(RSTRING_PTR(rb_sym2str(rb_action_name_or_action)));
|
280
|
+
break;
|
281
|
+
case T_STRING:
|
282
|
+
action = action_name_to_action_type(StringValuePtr(rb_action_name_or_action));
|
283
|
+
break;
|
284
|
+
case T_FIXNUM:
|
285
|
+
action = NUM2INT(rb_action_name_or_action);
|
286
|
+
break;
|
287
|
+
default:
|
288
|
+
rb_raise(rb_eArgError,
|
289
|
+
"Expected a String or a Symbol instance, or a capability type constant");
|
196
290
|
}
|
197
291
|
|
198
292
|
switch (TYPE(rb_capability_name_or_type)) {
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
293
|
+
case T_SYMBOL:
|
294
|
+
capability_type = capability_type_name_to_capability_type(
|
295
|
+
RSTRING_PTR(rb_sym2str(rb_capability_name_or_type)));
|
296
|
+
break;
|
297
|
+
case T_STRING:
|
298
|
+
capability_type = capability_type_name_to_capability_type(
|
299
|
+
StringValuePtr(rb_capability_name_or_type));
|
300
|
+
break;
|
301
|
+
case T_FIXNUM:
|
302
|
+
capability_type = NUM2INT(rb_capability_name_or_type);
|
303
|
+
break;
|
304
|
+
default:
|
305
|
+
rb_raise(rb_eArgError,
|
306
|
+
"Expected a String or a Symbol instance, or a capability type constant");
|
210
307
|
}
|
211
308
|
|
212
309
|
switch (TYPE(rb_capability_or_name)) {
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
310
|
+
case T_SYMBOL:
|
311
|
+
capability =
|
312
|
+
capng_name_to_capability(RSTRING_PTR(rb_sym2str(rb_capability_or_name)));
|
313
|
+
break;
|
314
|
+
case T_STRING:
|
315
|
+
capability = capng_name_to_capability(StringValuePtr(rb_capability_or_name));
|
316
|
+
break;
|
317
|
+
case T_FIXNUM:
|
318
|
+
capability = NUM2INT(rb_capability_or_name);
|
319
|
+
break;
|
320
|
+
default:
|
321
|
+
rb_raise(rb_eArgError,
|
322
|
+
"Expected a String or a Symbol instance, or a capability constant");
|
224
323
|
}
|
225
324
|
|
226
325
|
result = capng_update(action, capability_type, capability);
|
@@ -231,6 +330,15 @@ rb_capng_update(VALUE self,
|
|
231
330
|
return Qfalse;
|
232
331
|
}
|
233
332
|
|
333
|
+
/*
|
334
|
+
* Apply capabilities on specified target.
|
335
|
+
*
|
336
|
+
* @param rb_select_name_or_enum [Symbol or String or Fixnum]
|
337
|
+
* targets are CAPS, BOUNDS, BOTH, and AMBIENT for supported platform.
|
338
|
+
*
|
339
|
+
* @return [Boolean]
|
340
|
+
*
|
341
|
+
*/
|
234
342
|
static VALUE
|
235
343
|
rb_capng_apply(VALUE self, VALUE rb_select_name_or_enum)
|
236
344
|
{
|
@@ -238,17 +346,19 @@ rb_capng_apply(VALUE self, VALUE rb_select_name_or_enum)
|
|
238
346
|
capng_select_t select = 0;
|
239
347
|
|
240
348
|
switch (TYPE(rb_select_name_or_enum)) {
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
349
|
+
case T_SYMBOL:
|
350
|
+
select =
|
351
|
+
select_name_to_select_type(RSTRING_PTR(rb_sym2str(rb_select_name_or_enum)));
|
352
|
+
break;
|
353
|
+
case T_STRING:
|
354
|
+
select = select_name_to_select_type(StringValuePtr(rb_select_name_or_enum));
|
355
|
+
break;
|
356
|
+
case T_FIXNUM:
|
357
|
+
select = NUM2INT(rb_select_name_or_enum);
|
358
|
+
break;
|
359
|
+
default:
|
360
|
+
rb_raise(rb_eArgError,
|
361
|
+
"Expected a String or a Symbol instance, or a capability type constant");
|
252
362
|
}
|
253
363
|
|
254
364
|
result = capng_apply(select);
|
@@ -259,6 +369,12 @@ rb_capng_apply(VALUE self, VALUE rb_select_name_or_enum)
|
|
259
369
|
return Qfalse;
|
260
370
|
}
|
261
371
|
|
372
|
+
/*
|
373
|
+
* Lock capabilities.
|
374
|
+
*
|
375
|
+
* @return [Boolean]
|
376
|
+
*
|
377
|
+
*/
|
262
378
|
static VALUE
|
263
379
|
rb_capng_lock(VALUE self)
|
264
380
|
{
|
@@ -272,6 +388,14 @@ rb_capng_lock(VALUE self)
|
|
272
388
|
return Qfalse;
|
273
389
|
}
|
274
390
|
|
391
|
+
/*
|
392
|
+
* Change the credentials retaining capabilities.
|
393
|
+
* @param rb_uid [Fixnum] User ID.
|
394
|
+
* @param rb_gid [Fixnum] Group ID.
|
395
|
+
* @param rb_flags [Fixnum] CapNG::Flags constants.
|
396
|
+
*
|
397
|
+
* @see: capng_change_id(3)
|
398
|
+
*/
|
275
399
|
static VALUE
|
276
400
|
rb_capng_change_id(VALUE self, VALUE rb_uid, VALUE rb_gid, VALUE rb_flags)
|
277
401
|
{
|
@@ -282,9 +406,20 @@ rb_capng_change_id(VALUE self, VALUE rb_uid, VALUE rb_gid, VALUE rb_flags)
|
|
282
406
|
if (result == 0)
|
283
407
|
return Qtrue;
|
284
408
|
else
|
285
|
-
rb_raise(rb_eRuntimeError,
|
409
|
+
rb_raise(rb_eRuntimeError,
|
410
|
+
"Calling capng_change_id is failed with: (exitcode: %d)\n",
|
411
|
+
result);
|
286
412
|
}
|
287
413
|
|
414
|
+
/*
|
415
|
+
* Check whether capabilities on specified target or not.
|
416
|
+
*
|
417
|
+
* @param rb_select_name_or_enum [Symbol or String or Fixnum]
|
418
|
+
* targets are CAPS, BOUNDS, BOTH, and AMBIENT for supported platform.
|
419
|
+
*
|
420
|
+
* @return [Integer]
|
421
|
+
*
|
422
|
+
*/
|
288
423
|
static VALUE
|
289
424
|
rb_capng_have_capabilities_p(VALUE self, VALUE rb_select_name_or_enum)
|
290
425
|
{
|
@@ -292,56 +427,77 @@ rb_capng_have_capabilities_p(VALUE self, VALUE rb_select_name_or_enum)
|
|
292
427
|
capng_select_t select = 0;
|
293
428
|
|
294
429
|
switch (TYPE(rb_select_name_or_enum)) {
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
430
|
+
case T_SYMBOL:
|
431
|
+
select =
|
432
|
+
select_name_to_select_type(RSTRING_PTR(rb_sym2str(rb_select_name_or_enum)));
|
433
|
+
break;
|
434
|
+
case T_STRING:
|
435
|
+
select = select_name_to_select_type(StringValuePtr(rb_select_name_or_enum));
|
436
|
+
break;
|
437
|
+
case T_FIXNUM:
|
438
|
+
select = NUM2INT(rb_select_name_or_enum);
|
439
|
+
break;
|
440
|
+
default:
|
441
|
+
rb_raise(rb_eArgError,
|
442
|
+
"Expected a String or a Symbol instance, or a capability type constant");
|
306
443
|
}
|
307
444
|
result = capng_have_capabilities(select);
|
308
445
|
|
309
446
|
return INT2NUM(result);
|
310
447
|
}
|
311
448
|
|
449
|
+
/*
|
450
|
+
* Check whether capabilities on specified target or not.
|
451
|
+
*
|
452
|
+
* @param rb_capability_name_or_type [Symbol or String or Fixnum] types are EFFECTIVE,
|
453
|
+
* INHERITABLE, PERMITTED, and AMBIENT for supported platform.
|
454
|
+
* @param rb_capability_or_name [Symbol or String or Fixnum]
|
455
|
+
* Capability name or constants.
|
456
|
+
*
|
457
|
+
* @see: [CapNG::Capability]
|
458
|
+
*
|
459
|
+
* @return [Boolean]
|
460
|
+
*
|
461
|
+
*/
|
312
462
|
static VALUE
|
313
|
-
rb_capng_have_capability_p(VALUE self, VALUE rb_capability_name_or_type,
|
463
|
+
rb_capng_have_capability_p(VALUE self, VALUE rb_capability_name_or_type,
|
464
|
+
VALUE rb_capability_or_name)
|
314
465
|
{
|
315
466
|
int result = 0;
|
316
467
|
unsigned int capability = 0;
|
317
468
|
capng_type_t capability_type = 0;
|
318
469
|
|
319
470
|
switch (TYPE(rb_capability_name_or_type)) {
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
471
|
+
case T_SYMBOL:
|
472
|
+
capability_type = capability_type_name_to_capability_type(
|
473
|
+
RSTRING_PTR(rb_sym2str(rb_capability_name_or_type)));
|
474
|
+
break;
|
475
|
+
case T_STRING:
|
476
|
+
capability_type = capability_type_name_to_capability_type(
|
477
|
+
StringValuePtr(rb_capability_name_or_type));
|
478
|
+
break;
|
479
|
+
case T_FIXNUM:
|
480
|
+
capability_type = NUM2INT(rb_capability_name_or_type);
|
481
|
+
break;
|
482
|
+
default:
|
483
|
+
rb_raise(rb_eArgError,
|
484
|
+
"Expected a String or a Symbol instance, or a capability type constant");
|
331
485
|
}
|
332
486
|
|
333
487
|
switch (TYPE(rb_capability_or_name)) {
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
488
|
+
case T_SYMBOL:
|
489
|
+
capability =
|
490
|
+
capng_name_to_capability(RSTRING_PTR(rb_sym2str(rb_capability_or_name)));
|
491
|
+
break;
|
492
|
+
case T_STRING:
|
493
|
+
capability = capng_name_to_capability(StringValuePtr(rb_capability_or_name));
|
494
|
+
break;
|
495
|
+
case T_FIXNUM:
|
496
|
+
capability = NUM2INT(rb_capability_or_name);
|
497
|
+
break;
|
498
|
+
default:
|
499
|
+
rb_raise(rb_eArgError,
|
500
|
+
"Expected a String or a Symbol instance, or a capability constant");
|
345
501
|
}
|
346
502
|
|
347
503
|
result = capng_have_capability(capability_type, capability);
|
@@ -352,11 +508,19 @@ rb_capng_have_capability_p(VALUE self, VALUE rb_capability_name_or_type, VALUE r
|
|
352
508
|
return Qfalse;
|
353
509
|
}
|
354
510
|
|
511
|
+
/*
|
512
|
+
* Retrieve capabilities from file.
|
513
|
+
*
|
514
|
+
* @param rb_file [File] target file object
|
515
|
+
*
|
516
|
+
* @return [Boolean]
|
517
|
+
*
|
518
|
+
*/
|
355
519
|
static VALUE
|
356
520
|
rb_capng_get_caps_file(VALUE self, VALUE rb_file)
|
357
521
|
{
|
358
522
|
int result = 0, fd = 0;
|
359
|
-
rb_io_t
|
523
|
+
rb_io_t* fptr = NULL;
|
360
524
|
|
361
525
|
Check_Type(rb_file, T_FILE);
|
362
526
|
|
@@ -373,11 +537,19 @@ rb_capng_get_caps_file(VALUE self, VALUE rb_file)
|
|
373
537
|
return Qfalse;
|
374
538
|
}
|
375
539
|
|
540
|
+
/*
|
541
|
+
* Apply capabilities on specified target (file specific version).
|
542
|
+
*
|
543
|
+
* @param rb_file [File] target file object
|
544
|
+
*
|
545
|
+
* @return [Boolean]
|
546
|
+
*
|
547
|
+
*/
|
376
548
|
static VALUE
|
377
549
|
rb_capng_apply_caps_file(VALUE self, VALUE rb_file)
|
378
550
|
{
|
379
551
|
int result = 0, fd = 0;
|
380
|
-
rb_io_t
|
552
|
+
rb_io_t* fptr = NULL;
|
381
553
|
|
382
554
|
Check_Type(rb_file, T_FILE);
|
383
555
|
|
@@ -395,7 +567,6 @@ rb_capng_apply_caps_file(VALUE self, VALUE rb_file)
|
|
395
567
|
return Qfalse;
|
396
568
|
}
|
397
569
|
|
398
|
-
|
399
570
|
void
|
400
571
|
Init_capng(void)
|
401
572
|
{
|