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.
@@ -11,25 +11,41 @@
11
11
  /* See the License for the specific language governing permissions and */
12
12
  /* limitations under the License. */
13
13
 
14
+ /* clang-format off */
15
+ /*
16
+ * Document-class: CapNG::State
17
+ *
18
+ * Handle CapNG state.
19
+ *
20
+ * @example
21
+ * require 'capng'
22
+ *
23
+ * @state = CapNG::State.new
24
+ * @state.save
25
+ * # Some capability operations
26
+ * @state.restore
27
+ */
28
+ /* clang-format on */
29
+
14
30
  #include <capng.h>
15
31
 
16
- struct CapNGState {
17
- void *state;
32
+ struct CapNGState
33
+ {
34
+ void* state;
18
35
  };
19
36
 
20
- static void capng_state_free(void* capng);
21
-
22
- static const rb_data_type_t rb_capng_state_type = {
23
- "capng/state",
24
- {
25
- 0,
26
- capng_state_free,
27
- 0,
28
- },
29
- NULL,
30
- NULL,
31
- RUBY_TYPED_FREE_IMMEDIATELY
32
- };
37
+ static void
38
+ capng_state_free(void* capng);
39
+
40
+ static const rb_data_type_t rb_capng_state_type = { "capng/state",
41
+ {
42
+ 0,
43
+ capng_state_free,
44
+ 0,
45
+ },
46
+ NULL,
47
+ NULL,
48
+ RUBY_TYPED_FREE_IMMEDIATELY };
33
49
 
34
50
  static void
35
51
  capng_state_free(void* ptr)
@@ -42,11 +58,17 @@ rb_capng_state_alloc(VALUE klass)
42
58
  {
43
59
  VALUE obj;
44
60
  struct CapNGState* capng_state;
45
- obj = TypedData_Make_Struct(
46
- klass, struct CapNGState, &rb_capng_state_type, capng_state);
61
+ obj =
62
+ TypedData_Make_Struct(klass, struct CapNGState, &rb_capng_state_type, capng_state);
47
63
  return obj;
48
64
  }
49
65
 
66
+ /*
67
+ * Initalize State class.
68
+ *
69
+ * @return [nil]
70
+ *
71
+ */
50
72
  static VALUE
51
73
  rb_capng_state_initialize(VALUE self)
52
74
  {
@@ -58,12 +80,17 @@ rb_capng_state_initialize(VALUE self)
58
80
  return Qnil;
59
81
  }
60
82
 
61
-
83
+ /*
84
+ * Save current capability state.
85
+ *
86
+ * @return [nil]
87
+ *
88
+ */
62
89
  static VALUE
63
90
  rb_capng_state_save(VALUE self)
64
91
  {
65
92
  struct CapNGState* capng_state;
66
- void *state = NULL;
93
+ void* state = NULL;
67
94
 
68
95
  TypedData_Get_Struct(self, struct CapNGState, &rb_capng_state_type, capng_state);
69
96
 
@@ -73,11 +100,18 @@ rb_capng_state_save(VALUE self)
73
100
  return Qnil;
74
101
  }
75
102
 
103
+ /*
104
+ * Restore saved capability state.
105
+ *
106
+ * @return [nil]
107
+ *
108
+ */
109
+
76
110
  static VALUE
77
111
  rb_capng_state_restore(VALUE self)
78
112
  {
79
113
  struct CapNGState* capng_state;
80
- void *state = NULL;
114
+ void* state = NULL;
81
115
 
82
116
  TypedData_Get_Struct(self, struct CapNGState, &rb_capng_state_type, capng_state);
83
117
 
@@ -14,7 +14,7 @@
14
14
  #include <capng.h>
15
15
 
16
16
  capng_select_t
17
- select_name_to_select_type(char *select_name)
17
+ select_name_to_select_type(char* select_name)
18
18
  {
19
19
  if (strcmp(select_name, "caps") == 0) {
20
20
  return CAPNG_SELECT_CAPS;
@@ -36,7 +36,7 @@ select_name_to_select_type(char *select_name)
36
36
  }
37
37
 
38
38
  capng_act_t
39
- action_name_to_action_type(char *action_name)
39
+ action_name_to_action_type(char* action_name)
40
40
  {
41
41
  if (strcmp(action_name, "drop") == 0) {
42
42
  return CAPNG_DROP;
@@ -48,7 +48,7 @@ action_name_to_action_type(char *action_name)
48
48
  }
49
49
 
50
50
  capng_print_t
51
- print_name_to_print_type(char *print_name)
51
+ print_name_to_print_type(char* print_name)
52
52
  {
53
53
  if (strcmp(print_name, "stdout") == 0) {
54
54
  return CAPNG_PRINT_STDOUT;
@@ -60,7 +60,7 @@ print_name_to_print_type(char *print_name)
60
60
  }
61
61
 
62
62
  capng_type_t
63
- capability_type_name_to_capability_type(char *capability_name)
63
+ capability_type_name_to_capability_type(char* capability_name)
64
64
  {
65
65
  if (strcmp(capability_name, "effective") == 0) {
66
66
  return CAPNG_EFFECTIVE;
@@ -2,11 +2,20 @@ require "capng/capng"
2
2
  require "capng/version"
3
3
 
4
4
  class CapNG
5
+ # Predefined Error class.
5
6
  class Error < StandardError; end
6
7
 
8
+ # :nodoc:
9
+ # @private
7
10
  alias_method :caps_file_raw, :caps_file
11
+ # :nodoc:
12
+ # @private
8
13
  alias_method :apply_caps_file_raw, :apply_caps_file
14
+ # :nodoc:
15
+ # @private
9
16
  alias_method :update_raw, :update
17
+ # :nodoc:
18
+ # @private
10
19
  alias_method :initialize_raw, :initialize
11
20
 
12
21
  def initialize(target = nil, pid_or_path = nil)
@@ -1,3 +1,3 @@
1
1
  class CapNG
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capng_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,6 +72,20 @@ dependencies:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: 3.3.3
75
+ - !ruby/object:Gem::Dependency
76
+ name: yard
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.9'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.9'
75
89
  description: libcap-ng bindings for Ruby.
76
90
  email:
77
91
  - cosmo0920.wp@gmail.com
@@ -80,7 +94,10 @@ extensions:
80
94
  - ext/capng/extconf.rb
81
95
  extra_rdoc_files: []
82
96
  files:
97
+ - ".clang-format"
98
+ - ".github/workflows/apt.yml"
83
99
  - ".github/workflows/linux.yml"
100
+ - ".github/workflows/yum.yml"
84
101
  - ".gitignore"
85
102
  - Gemfile
86
103
  - LICENSE
@@ -89,12 +106,19 @@ files:
89
106
  - bin/console
90
107
  - bin/setup
91
108
  - capng_c.gemspec
109
+ - ci/apt-test.sh
110
+ - ci/yum-test.sh
92
111
  - example/file_capability.rb
93
112
  - example/process_capability.rb
94
113
  - example/process_capability_without_root.rb
95
114
  - ext/capng/capability.c
96
115
  - ext/capng/capng.c
97
116
  - ext/capng/capng.h
117
+ - ext/capng/enum-action.c
118
+ - ext/capng/enum-flags.c
119
+ - ext/capng/enum-result.c
120
+ - ext/capng/enum-select.c
121
+ - ext/capng/enum-type.c
98
122
  - ext/capng/enum.c
99
123
  - ext/capng/extconf.rb
100
124
  - ext/capng/print.c
@@ -102,13 +126,13 @@ files:
102
126
  - ext/capng/utils.c
103
127
  - lib/capng.rb
104
128
  - lib/capng/version.rb
105
- homepage: https://github.com/cosmo0920/cap-ng_c
129
+ homepage: https://github.com/fluent-plugins-nursery/cap-ng_c
106
130
  licenses:
107
131
  - Apache-2.0
108
132
  metadata:
109
133
  allowed_push_host: https://rubygems.org
110
- homepage_uri: https://github.com/cosmo0920/cap-ng_c
111
- source_code_uri: https://github.com/cosmo0920/cap-ng_c
134
+ homepage_uri: https://github.com/fluent-plugins-nursery/cap-ng_c
135
+ source_code_uri: https://github.com/fluent-plugins-nursery/cap-ng_c
112
136
  post_install_message:
113
137
  rdoc_options: []
114
138
  require_paths: