hbsdctl.rb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 203f2dd1be3a149109afe3b9df5238d2864d2a62e5fb719aaa805d238dcc9f50
4
+ data.tar.gz: 13483282dd8fd3dfe9737b06f97b893b07991301371b15b64fb1c4bb2a894a26
5
+ SHA512:
6
+ metadata.gz: 9bff5a1b54943ed556b1128914383562b89bc9df011ecd685733d4046b43e301cea9f589b57d3be2c5f076d4984a9572a15b5f6d00e47a0a3957a69471df03c8
7
+ data.tar.gz: 680c2d5b74f0c7739abf0bbd99fd34ede735528f94fa182bcf5d2a89e9133fec785831c3c087d81ad076b5d14704cbd3769f72822cc8305c4f79c75262ea8a15
data/.bundle/config ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_PATH: ".gems"
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ /.gems/
2
+ /tmp/
3
+ *.so
data/.projectile ADDED
@@ -0,0 +1,2 @@
1
+ -/.gems/
2
+ -/tmp/
data/.styleguide.cfg ADDED
@@ -0,0 +1,380 @@
1
+ # Uncrustify 0.55
2
+ # Loosely based on the FreeBSD style guide
3
+ newlines = lf
4
+ input_tab_size = 2
5
+ output_tab_size = 2
6
+ string_escape_char = 94
7
+ string_escape_char2 = 0
8
+ indent_columns = 2
9
+ indent_continue = 2
10
+ indent_with_tabs = 0
11
+ indent_align_string = false
12
+ indent_xml_string = 0
13
+ indent_brace = 0
14
+ indent_braces = false
15
+ indent_braces_no_func = false
16
+ indent_brace_parent = false
17
+ indent_namespace = false
18
+ indent_namespace_level = 0
19
+ indent_namespace_limit = 0
20
+ indent_extern = false
21
+ indent_class = true
22
+ indent_class_colon = true
23
+ indent_else_if = false
24
+ indent_var_def_blk = 0
25
+ indent_func_call_param = false
26
+ indent_func_def_param = false
27
+ indent_func_proto_param = false
28
+ indent_func_class_param = false
29
+ indent_func_ctor_var_param = false
30
+ indent_template_param = false
31
+ indent_func_param_double = false
32
+ indent_func_const = 0
33
+ indent_func_throw = 0
34
+ indent_member = 0
35
+ indent_relative_single_line_comments = false
36
+ indent_switch_case = 0
37
+ indent_case_shift = 0
38
+ indent_case_brace = 0
39
+ indent_col1_comment = false
40
+ indent_label = 1
41
+ indent_access_spec = 1
42
+ indent_access_spec_body = false
43
+ indent_paren_nl = false
44
+ indent_paren_close = 0
45
+ indent_comma_paren = 0
46
+ indent_bool_paren = 0
47
+ indent_square_nl = false
48
+ indent_preserve_sql = false
49
+ indent_align_assign = true
50
+ indent_off_after_assign = false
51
+ sp_arith = ignore
52
+ sp_assign = force
53
+ sp_before_assign = ignore
54
+ sp_after_assign = ignore
55
+ sp_enum_assign = ignore
56
+ sp_enum_before_assign = ignore
57
+ sp_enum_after_assign = ignore
58
+ sp_pp_concat = add
59
+ sp_pp_stringify = add
60
+ sp_bool = force
61
+ sp_compare = force
62
+ sp_inside_paren = remove
63
+ sp_paren_paren = remove
64
+ sp_balance_nested_parens = false
65
+ sp_paren_brace = ignore
66
+ sp_before_ptr_star = force
67
+ sp_before_unnamed_ptr_star = ignore
68
+ sp_between_ptr_star = remove
69
+ sp_after_ptr_star = remove
70
+ sp_after_ptr_star_func = ignore
71
+ sp_before_ptr_star_func = ignore
72
+ sp_before_byref = remove
73
+ sp_before_unnamed_byref = ignore
74
+ sp_after_byref = force
75
+ sp_after_byref_func = ignore
76
+ sp_before_byref_func = ignore
77
+ sp_after_type = force
78
+ sp_template_angle = ignore
79
+ sp_before_angle = remove
80
+ sp_inside_angle = remove
81
+ sp_after_angle = force
82
+ sp_angle_paren = ignore
83
+ sp_angle_word = ignore
84
+ sp_before_sparen = force
85
+ sp_inside_sparen = remove
86
+ sp_inside_sparen_close = ignore
87
+ sp_after_sparen = force
88
+ sp_sparen_brace = add
89
+ sp_invariant_paren = ignore
90
+ sp_after_invariant_paren = ignore
91
+ sp_special_semi = ignore
92
+ sp_before_semi = remove
93
+ sp_before_semi_for = ignore
94
+ sp_before_semi_for_empty = force
95
+ sp_after_semi = add
96
+ sp_after_semi_for = force
97
+ sp_after_semi_for_empty = ignore
98
+ sp_before_square = ignore
99
+ sp_before_squares = ignore
100
+ sp_inside_square = remove
101
+ sp_after_comma = force
102
+ sp_before_comma = remove
103
+ sp_before_ellipsis = ignore
104
+ sp_after_class_colon = ignore
105
+ sp_before_class_colon = ignore
106
+ sp_before_case_colon = remove
107
+ sp_after_operator = ignore
108
+ sp_after_operator_sym = ignore
109
+ sp_after_cast = remove
110
+ sp_inside_paren_cast = ignore
111
+ sp_cpp_cast_paren = ignore
112
+ sp_sizeof_paren = remove
113
+ sp_after_tag = ignore
114
+ sp_inside_braces_enum = force
115
+ sp_inside_braces_struct = force
116
+ sp_inside_braces = force
117
+ sp_inside_braces_empty = ignore
118
+ sp_type_func = force
119
+ sp_func_proto_paren = remove
120
+ sp_func_def_paren = remove
121
+ sp_inside_fparens = ignore
122
+ sp_inside_fparen = remove
123
+ sp_square_fparen = ignore
124
+ sp_fparen_brace = add
125
+ sp_func_call_paren = remove
126
+ sp_func_call_user_paren = ignore
127
+ sp_func_class_paren = remove
128
+ sp_return_paren = force
129
+ sp_attribute_paren = ignore
130
+ sp_defined_paren = ignore
131
+ sp_throw_paren = ignore
132
+ sp_macro = ignore
133
+ sp_macro_func = ignore
134
+ sp_else_brace = ignore
135
+ sp_brace_else = ignore
136
+ sp_brace_typedef = force
137
+ sp_catch_brace = ignore
138
+ sp_brace_catch = ignore
139
+ sp_finally_brace = ignore
140
+ sp_brace_finally = ignore
141
+ sp_try_brace = ignore
142
+ sp_getset_brace = ignore
143
+ sp_before_dc = remove
144
+ sp_after_dc = remove
145
+ sp_d_array_colon = ignore
146
+ sp_not = remove
147
+ sp_inv = remove
148
+ sp_addr = remove
149
+ sp_member = remove
150
+ sp_deref = remove
151
+ sp_sign = remove
152
+ sp_incdec = remove
153
+ sp_before_nl_cont = add
154
+ sp_after_oc_scope = ignore
155
+ sp_after_oc_colon = ignore
156
+ sp_before_oc_colon = ignore
157
+ sp_after_send_oc_colon = ignore
158
+ sp_before_send_oc_colon = ignore
159
+ sp_after_oc_type = ignore
160
+ sp_after_oc_return_type = ignore
161
+ sp_after_oc_at_sel = ignore
162
+ sp_before_oc_block_caret = ignore
163
+ sp_after_oc_block_caret = ignore
164
+ sp_cond_colon = ignore
165
+ sp_cond_question = ignore
166
+ sp_case_label = remove
167
+ sp_range = ignore
168
+ sp_cmt_cpp_start = ignore
169
+ sp_endif_cmt = ignore
170
+ force_tab_after_define = true
171
+ align_keep_tabs = false
172
+ align_with_tabs = false
173
+ align_on_tabstop = false
174
+ align_number_right = false
175
+ align_func_params = false
176
+ align_same_func_call_params = false
177
+ align_same_func_call_params_span = 0
178
+ align_same_func_call_params_thresh = 0
179
+ align_var_def_span = 0
180
+ align_var_def_star_style = 0
181
+ align_var_def_amp_style = 0
182
+ align_var_def_thresh = 0
183
+ align_var_def_gap = 0
184
+ align_var_def_colon = false
185
+ align_var_def_attribute = false
186
+ align_var_def_inline = false
187
+ align_assign_span = 0
188
+ align_assign_thresh = 12
189
+ align_enum_equ_span = 16
190
+ align_enum_equ_thresh = 0
191
+ align_var_struct_span = 99
192
+ align_var_struct_thresh = 0
193
+ align_var_struct_gap = 0
194
+ align_struct_init_span = 3
195
+ align_typedef_gap = 3
196
+ align_typedef_span = 5
197
+ align_typedef_func = 0
198
+ align_typedef_star_style = 0
199
+ align_typedef_amp_style = 0
200
+ align_right_cmt_span = 3
201
+ align_right_cmt_mix = false
202
+ align_right_cmt_gap = 0
203
+ align_right_cmt_at_col = 0
204
+ align_func_proto_span = 0
205
+ align_func_proto_gap = 0
206
+ align_on_operator = false
207
+ align_mix_var_proto = false
208
+ align_single_line_func = false
209
+ align_single_line_brace = false
210
+ align_single_line_brace_gap = 0
211
+ align_oc_msg_spec_span = 0
212
+ align_nl_cont = 1
213
+ align_pp_define_gap = 4
214
+ align_pp_define_span = 3
215
+ align_left_shift = true
216
+ align_oc_msg_colon_span = 0
217
+ nl_collapse_empty_body = false
218
+ nl_assign_leave_one_liners = true
219
+ nl_class_leave_one_liners = true
220
+ nl_enum_leave_one_liners = false
221
+ nl_getset_leave_one_liners = false
222
+ nl_func_leave_one_liners = true
223
+ nl_if_leave_one_liners = false
224
+ nl_start_of_file = remove
225
+ nl_start_of_file_min = 0
226
+ nl_end_of_file = force
227
+ nl_end_of_file_min = 1
228
+ nl_assign_brace = add
229
+ nl_assign_square = ignore
230
+ nl_after_square_assign = ignore
231
+ nl_fcall_brace = add
232
+ nl_enum_brace = remove
233
+ nl_struct_brace = remove
234
+ nl_union_brace = remove
235
+ nl_if_brace = remove
236
+ nl_brace_else = remove
237
+ nl_elseif_brace = ignore
238
+ nl_else_brace = remove
239
+ nl_else_if = remove
240
+ nl_brace_finally = ignore
241
+ nl_finally_brace = ignore
242
+ nl_try_brace = ignore
243
+ nl_getset_brace = force
244
+ nl_for_brace = add
245
+ nl_catch_brace = ignore
246
+ nl_brace_catch = ignore
247
+ nl_while_brace = add
248
+ nl_brace_brace = ignore
249
+ nl_do_brace = add
250
+ nl_brace_while = remove
251
+ nl_switch_brace = add
252
+ nl_multi_line_cond = false
253
+ nl_multi_line_define = true
254
+ nl_before_case = true
255
+ nl_before_throw = ignore
256
+ nl_after_case = true
257
+ nl_namespace_brace = ignore
258
+ nl_template_class = ignore
259
+ nl_class_brace = ignore
260
+ nl_class_init_args = ignore
261
+ nl_func_type_name = ignore
262
+ nl_func_type_name_class = ignore
263
+ nl_func_scope_name = ignore
264
+ nl_func_proto_type_name = ignore
265
+ nl_func_paren = ignore
266
+ nl_func_decl_start = ignore
267
+ nl_func_decl_start_single = ignore
268
+ nl_func_decl_args = ignore
269
+ nl_func_decl_end = ignore
270
+ nl_func_decl_end_single = ignore
271
+ nl_func_decl_empty = ignore
272
+ nl_fdef_brace = add
273
+ nl_after_return = true
274
+ nl_return_expr = ignore
275
+ nl_after_semicolon = true
276
+ nl_after_brace_open = true
277
+ nl_after_brace_open_cmt = false
278
+ nl_after_vbrace_open = false
279
+ nl_after_vbrace_open_empty = false
280
+ nl_after_brace_close = true
281
+ nl_define_macro = false
282
+ nl_squeeze_ifdef = true
283
+ nl_before_if = ignore
284
+ nl_after_if = ignore
285
+ nl_before_for = ignore
286
+ nl_after_for = ignore
287
+ nl_before_while = ignore
288
+ nl_after_while = ignore
289
+ nl_before_switch = ignore
290
+ nl_after_switch = ignore
291
+ nl_before_do = ignore
292
+ nl_after_do = ignore
293
+ nl_ds_struct_enum_cmt = false
294
+ nl_ds_struct_enum_close_brace = false
295
+ nl_class_colon = ignore
296
+ nl_create_if_one_liner = false
297
+ nl_create_for_one_liner = false
298
+ nl_create_while_one_liner = false
299
+ pos_arith = ignore
300
+ pos_assign = ignore
301
+ pos_bool = trail
302
+ pos_compare = ignore
303
+ pos_conditional = ignore
304
+ pos_comma = ignore
305
+ pos_class_comma = ignore
306
+ pos_class_colon = ignore
307
+ code_width = 90
308
+ ls_for_split_full = false
309
+ ls_func_split_full = false
310
+ nl_max = 4
311
+ nl_after_func_proto = 0
312
+ nl_after_func_proto_group = 2
313
+ nl_after_func_body = 3
314
+ nl_after_func_body_one_liner = 0
315
+ nl_before_block_comment = 2
316
+ nl_before_c_comment = 0
317
+ nl_before_cpp_comment = 0
318
+ nl_after_multiline_comment = false
319
+ nl_before_access_spec = 0
320
+ nl_after_access_spec = 0
321
+ nl_comment_func_def = 1
322
+ nl_after_try_catch_finally = 0
323
+ nl_around_cs_property = 0
324
+ nl_between_get_set = 0
325
+ eat_blanks_after_open_brace = true
326
+ eat_blanks_before_close_brace = true
327
+ mod_full_brace_do = add
328
+ mod_full_brace_for = add
329
+ mod_full_brace_function = ignore
330
+ mod_full_brace_if = add
331
+ mod_full_brace_if_chain = 0
332
+ mod_full_brace_nl = 0
333
+ mod_full_brace_while = add
334
+ mod_paren_on_return = add
335
+ mod_pawn_semicolon = false
336
+ mod_full_paren_if_bool = true
337
+ mod_remove_extra_semicolon = true
338
+ mod_add_long_function_closebrace_comment = 0
339
+ mod_add_long_switch_closebrace_comment = 0
340
+ mod_add_long_ifdef_endif_comment = 0
341
+ mod_add_long_ifdef_else_comment = 0
342
+ mod_sort_import = false
343
+ mod_sort_using = false
344
+ mod_sort_include = false
345
+ mod_sort_incl_import_prioritize_filename = false
346
+ mod_sort_incl_import_prioritize_extensionless = false
347
+ mod_sort_incl_import_prioritize_angle_over_quotes = false
348
+ mod_sort_incl_import_ignore_extension = false
349
+ mod_sort_incl_import_grouping_enabled = false
350
+ mod_move_case_break = false
351
+ mod_case_brace = remove
352
+ mod_remove_empty_return = true
353
+ cmt_width = 0
354
+ cmt_reflow_mode = 0
355
+ cmt_indent_multi = true
356
+ cmt_c_group = false
357
+ cmt_c_nl_start = false
358
+ cmt_c_nl_end = false
359
+ cmt_cpp_group = false
360
+ cmt_cpp_nl_start = false
361
+ cmt_cpp_nl_end = false
362
+ cmt_cpp_to_c = false
363
+ cmt_star_cont = true
364
+ cmt_sp_before_star_cont = 0
365
+ cmt_sp_after_star_cont = 0
366
+ cmt_multi_check_last = true
367
+ cmt_insert_file_header = ""
368
+ cmt_insert_file_footer = ""
369
+ cmt_insert_func_header = ""
370
+ cmt_insert_class_header = ""
371
+ cmt_insert_before_preproc = false
372
+ pp_indent = remove
373
+ pp_indent_at_level = false
374
+ pp_indent_count = 1
375
+ pp_space_count = 0
376
+ pp_indent_region = 0
377
+ pp_region_indent_code = false
378
+ pp_indent_if = 0
379
+ pp_if_indent_code = false
380
+ pp_define_at_level = false
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hbsdctl.rb (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ power_assert (2.0.3)
10
+ rake (13.1.0)
11
+ rake-compiler (1.2.0)
12
+ rake
13
+ test-unit (3.6.2)
14
+ power_assert
15
+
16
+ PLATFORMS
17
+ amd64-freebsd-14
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ hbsdctl.rb!
22
+ rake-compiler (= 1.2.0)
23
+ test-unit (~> 3.6)
24
+
25
+ BUNDLED WITH
26
+ 2.5.3
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Copyright (C) 2023 by 0x1eef <0x1eef@protonmail.com>
2
+
3
+ Permission to use, copy, modify, and/or distribute this
4
+ software for any purpose with or without fee is hereby
5
+ granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS
8
+ ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
9
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
10
+ EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
12
+ RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
14
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
15
+ OF THIS SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,82 @@
1
+ ## About
2
+
3
+ hbsdctl.rb provides Ruby bindings for libhbsdcontrol from the
4
+ [hardenedbsd](https://hardenedbsd.org) project. Through
5
+ this library, you can query what features are available and if
6
+ root: enable, disable or query the status of a feature for a
7
+ given file.
8
+
9
+ ## Examples
10
+
11
+ __Features__
12
+
13
+ As an unprivileged user or as a superuser, you can obtain a list of
14
+ available features:
15
+
16
+ ``` ruby
17
+ #!/usr/bin/env ruby
18
+ # Required privileges: unprivileged user or superuser.
19
+ require "hbsdctl"
20
+ BSD::Control
21
+ .available_features
22
+ .each do
23
+ print "The ", _1.name, " feature is available", "\n"
24
+ end
25
+ ```
26
+
27
+ __Enable__
28
+
29
+ As a superuser, you can enable or disable a feature for a given file.
30
+ The example enables the mprotect feature for the emacs binary:
31
+
32
+ ``` ruby
33
+ #!/usr/bin/env ruby
34
+ # Required privileges: superuser.
35
+ require "hbsdctl"
36
+ BSD::Control
37
+ .feature(:mprotect)
38
+ .enable!("/usr/local/bin/emacs-29.2")
39
+ ```
40
+
41
+ __Status__
42
+
43
+ As a superuser, you can query the status of a feature for a given file.
44
+ There are four statuses that can be returned: `conflict`, `sysdef`,
45
+ `enabled`, and `disabled`. The first status (conflict) is rare and indicates that a
46
+ feature is both enabled and disabled. The other three are more common. The `sysdef`
47
+ status indicates that a feature takes its settings from the system default (sysctl):
48
+
49
+ ``` ruby
50
+ #!/usr/bin/env ruby
51
+ # Required privileges: superuser.
52
+ require "hbsdctl"
53
+ BSD::Control
54
+ .feature(:mprotect)
55
+ .status("/bin/ls") # => :sysdef
56
+ ```
57
+
58
+ ## Documentation
59
+
60
+ A complete API reference is available at
61
+ [0x1eef.github.io/x/hbsdctl.rb](https://0x1eef.github.io/x/hbsdctl.rb).
62
+
63
+ ## Install
64
+
65
+ **Rubygems.org**
66
+
67
+ hbsdctl.rb can be installed via rubygems.org.
68
+
69
+ gem install hbsdctl.rb
70
+
71
+ ## Sources
72
+
73
+ * [GitHub](https://github.com/0x1eef/hbsdctl.rb)
74
+ * [GitLab](https://gitlab.com/0x1eef/hbsdctl.rb)
75
+ * [git.hardenedbsd.org](https://git.hardenedbsd.org/0x1eef/hbsdctl.rb)
76
+
77
+ ## License
78
+
79
+ [BSD Zero Clause](https://choosealicense.com/licenses/0bsd/).
80
+ <br>
81
+ See [LICENSE](./LICENSE).
82
+
data/Rakefile.rb ADDED
@@ -0,0 +1,21 @@
1
+ require "bundler/setup"
2
+ require "rake/extensiontask"
3
+ Rake::ExtensionTask.new("hbsdctl.rb")
4
+ task default: %w[clobber compile test]
5
+
6
+ desc "Run C linter"
7
+ task :styleguide do
8
+ sh "uncrustify -c .styleguide.cfg --no-backup ext/hbsdctl.rb/*.c"
9
+ end
10
+
11
+ namespace :test do
12
+ desc "Run unprivileged tests"
13
+ task :unprivileged do
14
+ sh "./bin/run-unprivileged-tests"
15
+ end
16
+
17
+ desc "Run superuser tests"
18
+ task :superuser do
19
+ sh "./bin/run-superuser-tests"
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+ set -e
3
+ if [ $(id -u) = 0 ]; then
4
+ rake clean clobber compile
5
+ rm -rf tmp/
6
+ for file in test/superuser/*_test.rb; do
7
+ ruby -Ilib ${file} --no-use-color
8
+ done
9
+ else
10
+ echo "You must be the root user to run these tests."
11
+ exit 1
12
+ fi
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+ set -e
3
+ if [ $(id -u) -ne 0 ]; then
4
+ rake clean clobber compile
5
+ for file in test/unprivileged/*_test.rb; do
6
+ ruby -Ilib ${file} --no-use-color
7
+ done
8
+ else
9
+ echo "You must be an unprivileged user to run these tests."
10
+ exit 1
11
+ fi
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+ $LIBS << ' -lsbuf -lhbsdcontrol'
3
+ create_makefile("hbsdctl.rb")
@@ -0,0 +1,34 @@
1
+ #include <libhbsdcontrol.h>
2
+ #include <errno.h>
3
+ #include "include/feature.h"
4
+ static VALUE __set(VALUE, VALUE, VALUE);
5
+
6
+ /**
7
+ * BSD::Control::Feature#set!
8
+ **/
9
+ VALUE
10
+ feature_set(VALUE self, VALUE rb_path, VALUE rb_state)
11
+ {
12
+ Check_Type(rb_path, T_STRING);
13
+ Check_Type(rb_state, T_FIXNUM);
14
+ VALUE rb_feature = rb_funcall(self, rb_intern("name"), 0);
15
+ Check_Type(rb_feature, T_STRING);
16
+ return (__set(rb_path, rb_feature, rb_state));
17
+ }
18
+
19
+
20
+ static VALUE
21
+ __set(VALUE rb_path, VALUE rb_feature, VALUE rb_state)
22
+ {
23
+ errno = 0;
24
+ int result = hbsdcontrol_set_feature_state(
25
+ RSTRING_PTR(rb_path),
26
+ RSTRING_PTR(rb_feature),
27
+ NUM2INT(rb_state)
28
+ );
29
+ if (result == 0) {
30
+ return (Qtrue);
31
+ } else {
32
+ rb_syserr_fail(errno, "hbsdcontrol_set_feature_state");
33
+ }
34
+ }