capng_c 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +23 -0
- data/.github/workflows/apt.yml +5 -5
- data/.github/workflows/linux.yml +17 -5
- data/.github/workflows/yum.yml +1 -1
- data/Gemfile +4 -0
- data/README.md +3 -3
- data/Rakefile +7 -0
- data/capng_c.gemspec +1 -1
- data/ext/capng/capng.c +1 -1
- data/ext/capng/extconf.rb +4 -0
- data/ext/capng/print.c +10 -4
- data/ext/capng/state.c +21 -7
- data/lib/capng/version.rb +1 -1
- metadata +6 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0105fa2095d7aa7ae42d367d00931c5c0ddf7b3a008b15b973bb830e6c68c3e1
|
|
4
|
+
data.tar.gz: 8a23e8b4f859ee8299a79790f45809c55d776c650635d9a5a3dc84e73fb6eab1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3be8cd98b0d17043f5988d156118d068ea3e1e96a605b93f5e676300bb7d093ff9b2cc22ac211dc19dff042e3a1af2a415867ac9454dab4b86739ac98d460d3
|
|
7
|
+
data.tar.gz: 2c3892a0c6a6e6a5ab52c1d175bf93e4451d1d12fb94bc8c8e698e453465b1d5e9954eb782d16236eb28a100abef673298e48e714bf6a45359b0b3a3b2ed5987
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: 'github-actions'
|
|
4
|
+
directory: '/'
|
|
5
|
+
schedule:
|
|
6
|
+
interval: 'monthly'
|
|
7
|
+
groups:
|
|
8
|
+
# PR: "Security update [package] from [old] to [new]"
|
|
9
|
+
# This PR should be merged in hurry
|
|
10
|
+
security-updates:
|
|
11
|
+
applies-to: security-updates
|
|
12
|
+
patterns:
|
|
13
|
+
- '*'
|
|
14
|
+
|
|
15
|
+
# PR: "Bump [package] from [old] to [new]"
|
|
16
|
+
# No need to be merged this PR in hurry. It is enough to merge
|
|
17
|
+
# once in a month.
|
|
18
|
+
monthly-updates:
|
|
19
|
+
applies-to: version-updates
|
|
20
|
+
patterns:
|
|
21
|
+
- '*'
|
|
22
|
+
# Allow to create PR both of security and normal updates.
|
|
23
|
+
open-pull-requests-limit: 1
|
data/.github/workflows/apt.yml
CHANGED
|
@@ -9,12 +9,12 @@ jobs:
|
|
|
9
9
|
fail-fast: false
|
|
10
10
|
matrix:
|
|
11
11
|
label:
|
|
12
|
-
- Debian GNU/Linux
|
|
12
|
+
- Debian GNU/Linux Bookworm amd64
|
|
13
13
|
- Ubuntu Bionic amd64
|
|
14
14
|
- Ubuntu Focal amd64
|
|
15
15
|
include:
|
|
16
|
-
- label: Debian GNU/Linux
|
|
17
|
-
test-docker-image: debian:
|
|
16
|
+
- label: Debian GNU/Linux Bookworm amd64
|
|
17
|
+
test-docker-image: debian:bookworm
|
|
18
18
|
test-script: ci/apt-test.sh
|
|
19
19
|
- label: Ubuntu Bionic amd64
|
|
20
20
|
test-docker-image: ubuntu:bionic
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
test-script: ci/apt-test.sh
|
|
25
25
|
runs-on: ubuntu-latest
|
|
26
26
|
steps:
|
|
27
|
-
- uses: actions/checkout@
|
|
27
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
28
28
|
- name: rake compile & rake test
|
|
29
29
|
run: |
|
|
30
30
|
docker run \
|
|
@@ -32,4 +32,4 @@ jobs:
|
|
|
32
32
|
--tty \
|
|
33
33
|
--volume ${PWD}:/capng \
|
|
34
34
|
${{ matrix.test-docker-image }} \
|
|
35
|
-
/capng/${{ matrix.test-script }}
|
|
35
|
+
/capng/${{ matrix.test-script }}
|
data/.github/workflows/linux.yml
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
name: Multiple Ruby version tests
|
|
2
2
|
on:
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [main]
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '0 0 1 * *'
|
|
5
9
|
jobs:
|
|
10
|
+
ruby-versions:
|
|
11
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
|
12
|
+
with:
|
|
13
|
+
engine: cruby
|
|
14
|
+
min_version: 2.5
|
|
6
15
|
build:
|
|
16
|
+
needs: ruby-versions
|
|
7
17
|
runs-on: ${{ matrix.os }}
|
|
8
18
|
strategy:
|
|
9
19
|
fail-fast: false
|
|
10
20
|
matrix:
|
|
11
|
-
ruby:
|
|
21
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
|
22
|
+
exclude:
|
|
23
|
+
- ruby: head
|
|
12
24
|
os:
|
|
13
25
|
- ubuntu-latest
|
|
14
26
|
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
15
27
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
28
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
17
29
|
- name: Install dependencies
|
|
18
30
|
run: |
|
|
19
31
|
sudo apt update
|
|
20
32
|
sudo apt -V install libcap-ng-dev
|
|
21
|
-
- uses: ruby/setup-ruby@v1
|
|
33
|
+
- uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
|
|
22
34
|
with:
|
|
23
35
|
ruby-version: ${{ matrix.ruby }}
|
|
24
36
|
- name: unit testing
|
data/.github/workflows/yum.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Capng_c
|
|
2
2
|
|
|
3
|
-
](https://github.com/fluent-plugins-nursery/capng_c/actions/workflows/linux.yml)
|
|
4
|
+
[](https://github.com/fluent-plugins-nursery/capng_c/actions/workflows/apt.yml)
|
|
5
|
+
[](https://github.com/fluent-plugins-nursery/capng_c/actions/workflows/yum.yml)
|
|
6
6
|
|
|
7
7
|
libcap-ng bindings for Ruby.
|
|
8
8
|
|
data/Rakefile
CHANGED
|
@@ -18,4 +18,11 @@ end
|
|
|
18
18
|
|
|
19
19
|
CLEAN.include('lib/capng/capng.*')
|
|
20
20
|
|
|
21
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0') && RUBY_PLATFORM.include?('linux')
|
|
22
|
+
require 'ruby_memcheck'
|
|
23
|
+
namespace :test do
|
|
24
|
+
RubyMemcheck::TestTask.new(valgrind: :compile)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
21
28
|
task :default => [:clobber, :compile, :test]
|
data/capng_c.gemspec
CHANGED
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
spec.extensions = ["ext/capng/extconf.rb"]
|
|
29
29
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4".freeze)
|
|
30
30
|
|
|
31
|
-
spec.add_development_dependency "bundler"
|
|
31
|
+
spec.add_development_dependency "bundler"
|
|
32
32
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
33
33
|
spec.add_development_dependency "rake-compiler", "~> 1.0"
|
|
34
34
|
spec.add_development_dependency "test-unit", "~> 3.3.3"
|
data/ext/capng/capng.c
CHANGED
data/ext/capng/extconf.rb
CHANGED
|
@@ -20,6 +20,10 @@ includedir = RbConfig::CONFIG["includedir"]
|
|
|
20
20
|
|
|
21
21
|
dir_config("capng", includedir, libdir)
|
|
22
22
|
|
|
23
|
+
unless find_executable("pkg-config")
|
|
24
|
+
raise "Require pkg-config due to install capng_c gem. Please install pkg-config."
|
|
25
|
+
end
|
|
26
|
+
|
|
23
27
|
pkg_config("libcap-ng")
|
|
24
28
|
$CFLAGS << " -Wall -std=c99 -fPIC "
|
|
25
29
|
# $CFLAGS << " -g -O0"
|
data/ext/capng/print.c
CHANGED
|
@@ -129,8 +129,11 @@ rb_capng_print_caps_text(VALUE self, VALUE rb_where_name_or_type,
|
|
|
129
129
|
result = capng_print_caps_text(CAPNG_PRINT_BUFFER, capability_type);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
if (result)
|
|
133
|
-
|
|
132
|
+
if (result) {
|
|
133
|
+
VALUE obj = rb_str_new2(result);
|
|
134
|
+
free(result);
|
|
135
|
+
return obj;
|
|
136
|
+
}
|
|
134
137
|
else
|
|
135
138
|
return rb_str_new2("none");
|
|
136
139
|
}
|
|
@@ -191,8 +194,11 @@ rb_capng_print_caps_numeric(VALUE self, VALUE rb_where_name_or_type,
|
|
|
191
194
|
result = capng_print_caps_numeric(CAPNG_PRINT_BUFFER, select);
|
|
192
195
|
}
|
|
193
196
|
|
|
194
|
-
if (result)
|
|
195
|
-
|
|
197
|
+
if (result) {
|
|
198
|
+
VALUE obj = rb_str_new2(result);
|
|
199
|
+
free(result);
|
|
200
|
+
return obj;
|
|
201
|
+
}
|
|
196
202
|
else
|
|
197
203
|
return rb_str_new2("none");
|
|
198
204
|
}
|
data/ext/capng/state.c
CHANGED
|
@@ -52,7 +52,14 @@ capng_state_free(void* ptr)
|
|
|
52
52
|
{
|
|
53
53
|
struct CapNGState* state = (struct CapNGState*)ptr;
|
|
54
54
|
if (state) {
|
|
55
|
-
state
|
|
55
|
+
/* Release any saved libcap-ng state that was never restored, otherwise the
|
|
56
|
+
* heap block returned by capng_save_state() leaks on GC. capng_c never
|
|
57
|
+
* stages additional groups, so the saved state owns no nested allocations
|
|
58
|
+
* and a plain free() fully releases it. */
|
|
59
|
+
if (state->state) {
|
|
60
|
+
free(state->state);
|
|
61
|
+
state->state = NULL;
|
|
62
|
+
}
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
xfree(ptr);
|
|
@@ -95,12 +102,16 @@ static VALUE
|
|
|
95
102
|
rb_capng_state_save(VALUE self)
|
|
96
103
|
{
|
|
97
104
|
struct CapNGState* capng_state;
|
|
98
|
-
void* state = NULL;
|
|
99
105
|
|
|
100
106
|
TypedData_Get_Struct(self, struct CapNGState, &rb_capng_state_type, capng_state);
|
|
101
107
|
|
|
102
|
-
state
|
|
103
|
-
capng_state->state
|
|
108
|
+
/* Free any previously saved state so repeated #save does not leak. */
|
|
109
|
+
if (capng_state->state) {
|
|
110
|
+
free(capng_state->state);
|
|
111
|
+
capng_state->state = NULL;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
capng_state->state = capng_save_state();
|
|
104
115
|
|
|
105
116
|
return Qnil;
|
|
106
117
|
}
|
|
@@ -116,12 +127,15 @@ static VALUE
|
|
|
116
127
|
rb_capng_state_restore(VALUE self)
|
|
117
128
|
{
|
|
118
129
|
struct CapNGState* capng_state;
|
|
119
|
-
void* state = NULL;
|
|
120
130
|
|
|
121
131
|
TypedData_Get_Struct(self, struct CapNGState, &rb_capng_state_type, capng_state);
|
|
122
132
|
|
|
123
|
-
|
|
124
|
-
|
|
133
|
+
/* Pass the struct field itself so capng_restore_state() frees the block and
|
|
134
|
+
* resets our pointer to NULL. Passing a local copy (the previous behaviour)
|
|
135
|
+
* left capng_state->state dangling, causing a use-after-free / double-free on
|
|
136
|
+
* a second #restore. With the field NULLed, a repeated #restore is a safe
|
|
137
|
+
* no-op because libcap-ng ignores a NULL saved state. */
|
|
138
|
+
capng_restore_state(&capng_state->state);
|
|
125
139
|
|
|
126
140
|
return Qnil;
|
|
127
141
|
}
|
data/lib/capng/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capng_c
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hiroshi Hatake
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bundler
|
|
@@ -16,20 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
- - "<"
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: '3'
|
|
18
|
+
version: '0'
|
|
23
19
|
type: :development
|
|
24
20
|
prerelease: false
|
|
25
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
22
|
requirements:
|
|
27
23
|
- - ">="
|
|
28
24
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
30
|
-
- - "<"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '3'
|
|
25
|
+
version: '0'
|
|
33
26
|
- !ruby/object:Gem::Dependency
|
|
34
27
|
name: rake
|
|
35
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -95,6 +88,7 @@ extensions:
|
|
|
95
88
|
extra_rdoc_files: []
|
|
96
89
|
files:
|
|
97
90
|
- ".clang-format"
|
|
91
|
+
- ".github/dependabot.yml"
|
|
98
92
|
- ".github/workflows/apt.yml"
|
|
99
93
|
- ".github/workflows/linux.yml"
|
|
100
94
|
- ".github/workflows/yum.yml"
|
|
@@ -134,7 +128,6 @@ metadata:
|
|
|
134
128
|
allowed_push_host: https://rubygems.org
|
|
135
129
|
homepage_uri: https://github.com/fluent-plugins-nursery/capng_c
|
|
136
130
|
source_code_uri: https://github.com/fluent-plugins-nursery/capng_c
|
|
137
|
-
post_install_message:
|
|
138
131
|
rdoc_options: []
|
|
139
132
|
require_paths:
|
|
140
133
|
- lib
|
|
@@ -149,8 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
149
142
|
- !ruby/object:Gem::Version
|
|
150
143
|
version: '0'
|
|
151
144
|
requirements: []
|
|
152
|
-
rubygems_version:
|
|
153
|
-
signing_key:
|
|
145
|
+
rubygems_version: 4.0.16
|
|
154
146
|
specification_version: 4
|
|
155
147
|
summary: libcap-ng bindings for Ruby.
|
|
156
148
|
test_files: []
|