This commit is contained in:
0x1eef 2024-03-10 10:57:39 -03:00
parent e311d78c7c
commit 04af09b700
3 changed files with 8 additions and 25 deletions

View file

@ -10,9 +10,7 @@ given file.
__Features__ __Features__
As a regular user account, you can obtain a list of available features. As a regular user account, you can obtain a list of available features:
But to enable, disable or query the status of a feature for a given file
a superuser account is required:
``` ruby ``` ruby
#!/usr/bin/env ruby #!/usr/bin/env ruby
@ -61,17 +59,14 @@ BSD::Control
A complete API reference is available at A complete API reference is available at
[0x1eef.github.io/x/hbsdctl.rb](https://0x1eef.github.io/x/hbsdctl.rb). [0x1eef.github.io/x/hbsdctl.rb](https://0x1eef.github.io/x/hbsdctl.rb).
## Sources
* [GitHub](https://github.com/0x1eef/hbsdctl.rb)
* [GitLab](https://gitlab.com/0x1eef/hbsdctl.rb)
* [git.hardenedbsd.org](https://git.hardenedbsd.org/0x1eef/hbsdctl.rb)
## Install ## Install
**Git**
hbsdctl.rb is distributed as a RubyGem through its git repositories. <br>
[git.hardenedbsd.org](https://git.hardenedbsd.org/0x1eef/hbsdctl.rb),
[GitHub](https://github.com/0x1eef/hbsdctl.rb),
and
[GitLab](https://gitlab.com/0x1eef/hbsdctl.rb)
are available as sources.
**Rubygems.org** **Rubygems.org**
hbsdctl.rb can also be installed via rubygems.org. hbsdctl.rb can also be installed via rubygems.org.

View file

@ -1,8 +1,6 @@
#include <libhbsdcontrol.h> #include <libhbsdcontrol.h>
#include <unistd.h>
#include <errno.h> #include <errno.h>
#include "include/feature.h" #include "include/feature.h"
static VALUE __rb_eError(void);
static VALUE __set(VALUE, VALUE, VALUE); static VALUE __set(VALUE, VALUE, VALUE);
/** /**
@ -33,13 +31,3 @@ __set(VALUE rb_path, VALUE rb_feature, VALUE rb_state)
rb_syserr_fail(errno, "hbsdcontrol_set_feature_state"); rb_syserr_fail(errno, "hbsdcontrol_set_feature_state");
} }
} }
static VALUE
__rb_eError(void)
{
VALUE rb_mBSD = rb_const_get(rb_cObject, rb_intern("BSD")),
rb_mControl = rb_const_get(rb_mBSD, rb_intern("Control")),
rb_eError = rb_const_get(rb_mControl, rb_intern("Error"));
return (rb_eError);
}

View file

@ -5,7 +5,7 @@ module BSD::Control
include FileUtils include FileUtils
def test_disable_mprotect_nonexistent_file def test_disable_mprotect_nonexistent_file
assert_raises Errno::ENOENT do assert_raises(Errno::ENOENT) do
BSD::Control.feature(:mprotect).disable!(file) BSD::Control.feature(:mprotect).disable!(file)
end end
end end