capng_c 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a26ab3bf7c3169172ec3e2c162630f0079b161533ec473984e4d52737d522b91
4
- data.tar.gz: 9f378edbfb74593fc731acb2f4ead7b591207b0f358f9ce4e1caf28e747188d3
3
+ metadata.gz: de6f1d1c03adc792bf92f5da7f5c7ac85b35c3df5a155718b2b97abafa19d3be
4
+ data.tar.gz: 46c69dcfcea97099d5e64319a7ea9cf19a636fe8cf08e88d7b0bbc1f89e6a80e
5
5
  SHA512:
6
- metadata.gz: 92d50ae4dc1c276709d38a2bbac7421ac0ec68d8dee70d8f5d28c4b2aa3e33ef81ae179dafd7f214703d68a8eeda5b4f2220eca786f50fdd77838a88fec754fd
7
- data.tar.gz: 2f2f6cff1a51adeb4fe038871b3e3a5e5ec7b9075b18f31653000a5aea785e610bce39570cc4a2252c4dc4518ecd9f0be20436a28473d3769a4329fa98a912ae
6
+ metadata.gz: 1b8e5bddcfd632b9c3d3bd1716239079c4e8e85f72fe626a5d508d8c94f598875ccf7e155b3b7686ed63b538b8427e0bd3937609866ac3c07076a87b4e76be0f
7
+ data.tar.gz: 138eef80b0d44a7ba757909a8ceb2979a9cd642c33e1a457ed7da2494cee7d754e0f1b1658df92b87c9780d1df39ac4cd088b2e89cf390648630673c64db0ce0
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.4', '2.5', '2.6' , '2.7' ]
11
+ ruby: [ '2.5', '2.6' , '2.7', '3.0', '3.1', '3.2', '3.3', '3.4' ]
12
12
  os:
13
13
  - ubuntu-latest
14
14
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
@@ -25,6 +25,5 @@ jobs:
25
25
  env:
26
26
  CI: true
27
27
  run: |
28
- gem install bundler rake
29
28
  bundle install --jobs 4 --retry 3
30
- bundle exec rake
29
+ bundle exec rake
@@ -9,16 +9,16 @@ jobs:
9
9
  fail-fast: false
10
10
  matrix:
11
11
  label:
12
- - CentOS 7 x86_64
13
- - CentOS 8 x86_64
12
+ - RockyLinux 8 x86_64
13
+ - AlmaLinux 9 x86_64
14
14
  - Fedora 33 x86_64
15
15
  - AmazonLinux 2 x86_64
16
16
  include:
17
- - label: CentOS 7 x86_64
18
- test-docker-image: centos:7
17
+ - label: RockyLinux 8 x86_64
18
+ test-docker-image: rockylinux:8
19
19
  test-script: ci/yum-test.sh
20
- - label: CentOS 8 x86_64
21
- test-docker-image: centos:8
20
+ - label: AlmaLinux 9 x86_64
21
+ test-docker-image: almalinux:9
22
22
  test-script: ci/yum-test.sh
23
23
  - label: Fedora 33 x86_64
24
24
  test-docker-image: fedora:33
@@ -36,4 +36,4 @@ jobs:
36
36
  --tty \
37
37
  --volume ${PWD}:/capng \
38
38
  ${{ matrix.test-docker-image }} \
39
- /capng/${{ matrix.test-script }}
39
+ /capng/${{ matrix.test-script }}
data/README.md CHANGED
@@ -8,6 +8,9 @@ libcap-ng bindings for Ruby.
8
8
 
9
9
  ## Prerequisites
10
10
 
11
+ * Building C environment
12
+ * build-essential on Debian GNU/Linux and Ubuntu
13
+ * "Development Tools" package group on CentOS 7/8, Fedora 33, AmazonLinux 2
11
14
  * pkg-config package for linking libcap-ng library
12
15
  * libcap-ng and its development packages
13
16
  * libcap-ng-dev on Debian GNU/Linux and Ubuntu
data/Rakefile CHANGED
@@ -12,9 +12,7 @@ end
12
12
 
13
13
  require "rake/extensiontask"
14
14
 
15
- spec = eval File.read("capng_c.gemspec")
16
-
17
- Rake::ExtensionTask.new("capng", spec) do |ext|
15
+ Rake::ExtensionTask.new("capng") do |ext|
18
16
  ext.lib_dir = "lib/capng"
19
17
  end
20
18
 
data/capng_c.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4".freeze)
30
30
 
31
31
  spec.add_development_dependency "bundler", [">= 1.16", "< 3"]
32
- spec.add_development_dependency "rake", "~> 12.0"
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"
35
35
  spec.add_development_dependency "yard", "~> 0.9"
data/ci/apt-test.sh CHANGED
@@ -7,9 +7,9 @@ export DEBIAN_FRONTEND=noninteractive
7
7
  apt update
8
8
  apt install -V -y lsb-release
9
9
 
10
- apt install -V -y ruby-dev git build-essential pkg-config
10
+ apt install -V -y ruby-dev git build-essential pkg-config libyaml-dev
11
11
  apt install -V -y libcap-ng-dev
12
12
  cd /capng && \
13
- gem install bundler --no-document && \
13
+ gem install bundler -v 2.3.27 --no-document && \
14
14
  bundle install && \
15
15
  bundle exec rake
data/ci/yum-test.sh CHANGED
@@ -23,7 +23,7 @@ case ${distribution} in
23
23
  USE_SCL=1
24
24
  ;;
25
25
  *)
26
- DNF="dnf --enablerepo=PowerTools"
26
+ DNF="dnf --enablerepo=powertools"
27
27
  ;;
28
28
  esac
29
29
  ;;
@@ -34,6 +34,12 @@ case ${distribution} in
34
34
  ;;
35
35
  esac
36
36
  ;;
37
+ rocky)
38
+ DNF="dnf --enablerepo=powertools"
39
+ ;;
40
+ almalinux)
41
+ DNF="dnf --enablerepo=crb"
42
+ ;;
37
43
  esac
38
44
 
39
45
  ${DNF} groupinstall -y "Development Tools"
@@ -53,6 +59,7 @@ else
53
59
  rubygems \
54
60
  rpm-build
55
61
  fi
62
+ ${DNF} install -y libyaml-devel
56
63
  ${DNF} install -y libcap-ng-devel
57
64
 
58
65
  if [ $USE_SCL -eq 1 ]; then
@@ -60,5 +67,5 @@ if [ $USE_SCL -eq 1 ]; then
60
67
  export MANPATH=
61
68
  cd /capng && source /opt/rh/rh-ruby26/enable && gem install bundler --no-document && bundle install && bundle exec rake
62
69
  else
63
- cd /capng && gem install bundler --no-document && bundle install && bundle exec rake
70
+ cd /capng && gem install bundler -v 2.3.27 --no-document && bundle install && bundle exec rake
64
71
  fi
data/ext/capng/capng.c CHANGED
@@ -67,6 +67,19 @@ rb_capng_alloc(VALUE klass)
67
67
  return obj;
68
68
  }
69
69
 
70
+ static int
71
+ capng_get_file_descriptor(VALUE rb_file)
72
+ {
73
+ #ifdef HAVE_RB_IO_DESCRIPTOR
74
+ return rb_io_descriptor(rb_file);
75
+ #else
76
+ rb_io_t* fptr = NULL;
77
+
78
+ fptr = RFILE(rb_file)->fptr;
79
+ return fptr->fd;
80
+ #endif
81
+ }
82
+
70
83
  /*
71
84
  * Initalize CapNG class.
72
85
  *
@@ -500,15 +513,13 @@ static VALUE
500
513
  rb_capng_get_caps_file(VALUE self, VALUE rb_file)
501
514
  {
502
515
  int result = 0, fd = 0;
503
- rb_io_t* fptr = NULL;
504
516
 
505
517
  Check_Type(rb_file, T_FILE);
506
518
 
507
519
  if (NIL_P(rb_file)) {
508
520
  return Qfalse;
509
521
  }
510
- fptr = RFILE(rb_file)->fptr;
511
- fd = fptr->fd;
522
+ fd = capng_get_file_descriptor(rb_file);
512
523
  result = capng_get_caps_fd(fd);
513
524
 
514
525
  if (result == 0)
@@ -529,7 +540,6 @@ static VALUE
529
540
  rb_capng_apply_caps_file(VALUE self, VALUE rb_file)
530
541
  {
531
542
  int result = 0, fd = 0;
532
- rb_io_t* fptr = NULL;
533
543
 
534
544
  Check_Type(rb_file, T_FILE);
535
545
 
@@ -537,8 +547,7 @@ rb_capng_apply_caps_file(VALUE self, VALUE rb_file)
537
547
  return Qfalse;
538
548
  }
539
549
 
540
- fptr = RFILE(rb_file)->fptr;
541
- fd = fptr->fd;
550
+ fd = capng_get_file_descriptor(rb_file);
542
551
  result = capng_apply_caps_fd(fd);
543
552
 
544
553
  if (result == 0)
data/ext/capng/extconf.rb CHANGED
@@ -29,5 +29,6 @@ have_const("CAPNG_SELECT_ALL", "cap-ng.h")
29
29
  have_const("CAPNG_AMBIENT", "cap-ng.h")
30
30
  have_const("CAPNG_INIT_SUPP_GRP", "cap-ng.h")
31
31
  have_func("rb_sym2str", "ruby.h")
32
+ have_func("rb_io_descriptor", "ruby.h")
32
33
  have_func("capng_get_caps_fd", "cap-ng.h")
33
34
  create_makefile("capng/capng")
data/ext/capng/state.c CHANGED
@@ -50,6 +50,11 @@ static const rb_data_type_t rb_capng_state_type = { "capng/state",
50
50
  static void
51
51
  capng_state_free(void* ptr)
52
52
  {
53
+ struct CapNGState* state = (struct CapNGState*)ptr;
54
+ if (state) {
55
+ state->state = NULL;
56
+ }
57
+
53
58
  xfree(ptr);
54
59
  }
55
60
 
data/lib/capng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class CapNG
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.3"
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.2.1
4
+ version: 0.2.3
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-16 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '12.0'
39
+ version: '13.0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '12.0'
46
+ version: '13.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake-compiler
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.0.3
152
+ rubygems_version: 3.3.5
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: libcap-ng bindings for Ruby.