rkerberos 0.1.5 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0d897e8c2ed3d3508c09e319b88cac0c1822d8da
4
- data.tar.gz: 17a003387c3845fdf1de23630936e0254c90c0f5
2
+ SHA256:
3
+ metadata.gz: 5a969c8a989d5d310bd6906a8023acdd1bd511524cdf85e1b8df35b9e51a424e
4
+ data.tar.gz: 8792c83e657bd1ddc3da150a2989906050ea48bc2631a2de9e95fe5a8983f2c1
5
5
  SHA512:
6
- metadata.gz: 267b4c8f68541e0df99abc42c02fb5a2056d7a038f896966d13d22c25fae24017870cc7fda4df608c0be74c9780650f0e8c056d81afbfc0d5a42d35cd09f4cae
7
- data.tar.gz: e96e6dc43c144b7c3b1075c0f9deb6c7471007aac66b6f30ab59d41b2ac2c361c3f84eb90089a03bb1c2d89e86257ba7875d77cec8691c00640e4f63492caac7
6
+ metadata.gz: 41e50b69c30e64a0ca78548cb189ad6627b41b951abb906caac1e27d2746afbd81df6b96e1cbb1910b1b0c535c5fddd752e5246ff4eab16af860e1797b599374
7
+ data.tar.gz: 1b3a230983ff08f515412a0bf2055f1152c8e3d757cda4d017d2ec72a53210c077a4874117a0d56256b42535b83d5495c4ec0e315d02cf2e6be9220384d0ac8f
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ = 0.2.0 - 14-Feb-2026
2
+ * Added Docker and Podman support for running tests in isolated environments with Kerberos and OpenLDAP services.
3
+ * Updated documentation with modern testing and development workflows, including container-based instructions.
4
+ * Improved compatibility for Ruby 3.4 and later.
5
+ * Enhanced build and test automation using docker-compose and podman-compose.
6
+ * Various bug fixes, code cleanups, and test improvements.
7
+
1
8
  = 0.1.5 - 17-Oct-2016
2
9
  * Fix build error on Ruby 2.0.0/2.1 with CFLAGS concatenation
3
10
 
data/Dockerfile ADDED
@@ -0,0 +1,42 @@
1
+ # Dockerfile for rkerberos Ruby gem testing
2
+ FROM ruby:3.4
3
+
4
+ # Install MIT Kerberos, KDC, admin server, and build tools
5
+ RUN apt-get update && \
6
+ apt-get install -y --no-install-recommends \
7
+ libkrb5-dev krb5-user krb5-kdc krb5-admin-server rake build-essential && \
8
+ rm -rf /var/lib/apt/lists/*
9
+
10
+ # Set up a working directory
11
+ WORKDIR /app
12
+
13
+ # Set admin credentials for tests (matches docker-compose.yml)
14
+ ENV KRB5_ADMIN_PRINCIPAL=admin/admin@EXAMPLE.COM
15
+ ENV KRB5_ADMIN_PASSWORD=adminpassword
16
+
17
+ # Copy the gemspec and Gemfile for dependency installation
18
+ COPY Gemfile rkerberos.gemspec ./
19
+
20
+
21
+ # Install gem dependencies and RSpec
22
+ RUN bundle install && gem install rspec
23
+
24
+
25
+ # Create a more complete krb5.conf for testing (with kadmin support)
26
+ RUN echo "[libdefaults]\n default_realm = EXAMPLE.COM\n dns_lookup_realm = false\n dns_lookup_kdc = false\n ticket_lifetime = 24h\n renew_lifetime = 7d\n forwardable = true\n[realms]\n EXAMPLE.COM = {\n kdc = kerberos-kdc\n admin_server = kerberos-kdc\n default_domain = example.com\n }\n[domain_realm]\n .example.com = EXAMPLE.COM\n example.com = EXAMPLE.COM\n[kadmin]\n default_keys = des-cbc-crc:normal des-cbc-md5:normal aes256-cts:normal aes128-cts:normal rc4-hmac:normal\n admin_server = kerberos-kdc\n" > /etc/krb5.conf
27
+
28
+
29
+ # Create a minimal KDC and admin server config, and a permissive ACL for kadmin
30
+ RUN mkdir -p /etc/krb5kdc && \
31
+ echo "[kdcdefaults]\n kdc_ports = 88\n[kdc]\n profile = /etc/krb5.conf\n" > /etc/krb5kdc/kdc.conf && \
32
+ echo "admin/admin@EXAMPLE.COM *" > /etc/krb5kdc/kadm5.acl
33
+
34
+
35
+ # Copy the rest of the code
36
+ COPY . .
37
+
38
+ # Compile the C extension
39
+ RUN rake compile
40
+
41
+ # Run RSpec tests
42
+ CMD ["bundle", "exec", "rspec"]
data/README.md CHANGED
@@ -2,48 +2,99 @@
2
2
  The rkerberos library provides a Ruby interface for Kerberos.
3
3
 
4
4
  # Requirements
5
+
6
+ # Linux
7
+ Install krb5 development libraries using your package manager. For example:
8
+
9
+ # Debian/Ubuntu
10
+ sudo apt-get install libkrb5-dev
11
+
12
+ # Fedora/RHEL
13
+ sudo dnf install krb5-devel
14
+
15
+ Then install this gem:
16
+
17
+ gem install rkerberos
18
+
19
+ or if using bundler:
20
+
21
+ bundle install
22
+
5
23
  Kerberos 1.7.0 or later, including admin header and library files.
6
24
 
7
- # OS X (10.11)
8
- krb5 must be installed from source before installing the rkerberos gem:
9
- ```
10
- brew install openssl
11
- curl -0 http://web.mit.edu/kerberos/dist/krb5/1.14/krb5-1.14.tar.gz
12
- tar -xzf krb5-1.14.tar.gz
13
- cd krb5-1.14/src
14
- export CPPFLAGS='-I/usr/local/opt/openssl/include'
15
- export LDFLAGS='-L/usr/local/opt/openssl/lib'
16
- ./configure
17
- make
18
- make install
19
- ```
20
- latest release is here: http://web.mit.edu/kerberos/dist/index.html
21
-
22
- # Synopsis
23
- ```ruby
24
- require 'rkerberos'
25
-
26
- # Get the default realm name
27
- krb5 = Kerberos::Krb5.new
28
- puts krb5.default_realm
29
- krb5.close
30
-
31
- # Get the default keytab name
32
- keytab = Kerberos::Krb5::Keytab.new
33
- puts keytab.default_name
34
- keytab.close
35
-
36
- # Set the password for a given principal
37
- kadm5 = Kerberos::Kadm5.new(:principal => 'foo/admin', :password => 'xxxx')
38
- kadm5.set_password('someuser', 'abc123')
39
- kadm5.close
40
-
41
- # Using the block form
42
- Kerberos::Kadm5.new(:principal => 'foo/admin', :password => 'xxxx') do |kadm5|
43
- p kadm5.get_principal('someuser')
44
- kadm5.set_password('someuser', 'abc123')
45
- end
46
- ```
25
+ # OS X
26
+ Install krb5 using homebrew:
27
+
28
+ `brew install krb5`
29
+
30
+ then install this gem using the homebrew version of krb5:
31
+
32
+ # Or '/opt/homebrew/opt/krb' depending on your system
33
+ `gem install rkerberos -- --with-rkerberos-dir=/usr/local/opt/krb5`
34
+
35
+ or if using bundler:
36
+
37
+ `bundle config --global build.rkerberos --with-rkerberos-dir=/usr/local/opt/krb5`
38
+ `bundle install`
39
+
40
+ # Testing
41
+
42
+ ## Prerequisites
43
+ - Ruby 3.4 or later
44
+ - Docker or Podman
45
+ - docker-compose or podman-compose
46
+
47
+ ## Running Tests with Docker
48
+ 1. Start the Kerberos and LDAP services:
49
+ ```bash
50
+ docker-compose up -d
51
+ ```
52
+
53
+ 2. Run the test suite:
54
+ ```bash
55
+ docker-compose run --rm rkerberos-test bundle exec rspec
56
+ ```
57
+
58
+ 3. Stop the services when done:
59
+ ```bash
60
+ docker-compose down
61
+ ```
62
+
63
+ Add the `--remove-orphans` switch if it's being a pain.
64
+
65
+ ## Running Tests with Podman
66
+ 1. Start the Kerberos and LDAP services:
67
+ ```bash
68
+ podman-compose up -d
69
+ ```
70
+
71
+ 2. Run the test suite:
72
+ ```bash
73
+ podman-compose run --rm rkerberos-test
74
+ ```
75
+
76
+ 3. Stop the services when done:
77
+ ```bash
78
+ podman-compose down
79
+ ```
80
+
81
+ ## Local Development
82
+ If you make changes to the Ruby code or C extensions:
83
+
84
+ 1. Rebuild the test container:
85
+ ```bash
86
+ podman-compose build --no-cache rkerberos-test
87
+ ```
88
+
89
+ 2. Run the tests again:
90
+ ```bash
91
+ podman-compose run --rm rkerberos-test
92
+ ```
93
+
94
+ The test environment includes:
95
+ - MIT Kerberos KDC (Key Distribution Center)
96
+ - OpenLDAP server for directory services
97
+ - Pre-configured test principals and keytabs
47
98
 
48
99
  # Notes
49
100
  The rkerberos library is a repackaging of my custom branch of the krb5_auth
@@ -65,4 +116,4 @@
65
116
  * Simon Levermann (maintainer)
66
117
 
67
118
  # License
68
- rkerberos is distributed under the Artistic 2.0 license.
119
+ rkerberos is distributed under the Artistic-2.0 license.
data/Rakefile CHANGED
@@ -1,10 +1,17 @@
1
1
  require 'rake'
2
- require 'rake/testtask'
2
+ begin
3
+ require 'rspec/core/rake_task'
4
+ rescue LoadError
5
+ # RSpec not available
6
+ end
3
7
  require 'rake/extensiontask'
4
8
  require 'rake/clean'
5
9
  require 'rbconfig'
6
10
  require 'rubygems/package'
7
11
 
12
+ # Windows one-click
13
+ require 'devkit' if RbConfig::CONFIG['host_os'] =~ /cygwin|mingw/i
14
+
8
15
  Rake::ExtensionTask.new('rkerberos')
9
16
 
10
17
  CLEAN.include(
@@ -30,9 +37,9 @@ end
30
37
  namespace :gem do
31
38
  desc 'Delete any existing gem files in the project.'
32
39
  task :clean do
33
- Dir['*.gem'].each{ |f| File.delete(f) }
40
+ Dir['*.gem'].each{ |f| File.delete(f) }
34
41
  rm_rf 'lib'
35
- end
42
+ end
36
43
 
37
44
  desc 'Create the gem'
38
45
  task :create => [:clean] do
@@ -43,7 +50,7 @@ namespace :gem do
43
50
  desc 'Install the gem'
44
51
  task :install => [:create] do
45
52
  file = Dir["*.gem"].first
46
- sh "gem install #{file}"
53
+ sh "gem install #{file}"
47
54
  end
48
55
 
49
56
  desc 'Create a binary gem'
@@ -64,86 +71,15 @@ namespace :sample do
64
71
  end
65
72
  end
66
73
 
67
- namespace 'test' do
68
- Rake::TestTask.new('all') do |t|
69
- task :all => [:clean, :compile]
70
- t.libs << 'ext'
71
- t.warning = true
72
- t.verbose = true
73
- end
74
-
75
- Rake::TestTask.new('context') do |t|
76
- task :context => [:clean, :compile]
77
- t.libs << 'ext'
78
- t.test_files = FileList['test/test_context.rb']
79
- t.warning = true
80
- t.verbose = true
81
- end
82
-
83
- Rake::TestTask.new('ccache') do |t|
84
- task :ccache => [:clean, :compile]
85
- t.libs << 'ext'
86
- t.test_files = FileList['test/test_credentials_cache.rb']
87
- t.warning = true
88
- t.verbose = true
89
- end
90
-
91
- Rake::TestTask.new('krb5') do |t|
92
- task :krb5 => [:clean, :compile]
93
- t.libs << 'ext'
94
- t.test_files = FileList['test/test_krb5.rb']
95
- t.warning = true
96
- t.verbose = true
97
- end
98
-
99
- Rake::TestTask.new('keytab') do |t|
100
- task :keytab => [:clean, :compile]
101
- t.libs << 'ext'
102
- t.test_files = FileList['test/test_krb5_keytab.rb']
103
- t.warning = true
104
- t.verbose = true
105
- end
106
-
107
- Rake::TestTask.new('keytab_entry') do |t|
108
- task :keytab_entry => [:clean, :compile]
109
- t.libs << 'ext'
110
- t.test_files = FileList['test/test_keytab_entry.rb']
111
- t.warning = true
112
- t.verbose = true
113
- end
114
-
115
- Rake::TestTask.new('principal') do |t|
116
- task :principal => [:clean, :compile]
117
- t.libs << 'ext'
118
- t.test_files = FileList['test/test_principal.rb']
119
- t.warning = true
120
- t.verbose = true
121
- end
122
-
123
- Rake::TestTask.new('kadm5') do |t|
124
- task :kadm5 => [:clean, :compile]
125
- t.libs << 'ext'
126
- t.test_files = FileList['test/test_kadm5.rb']
127
- t.warning = true
128
- t.verbose = true
129
- end
130
-
131
- Rake::TestTask.new('config') do |t|
132
- task :config => [:clean, :compile]
133
- t.libs << 'ext'
134
- t.test_files = FileList['test/test_config.rb']
135
- t.warning = true
136
- t.verbose = true
137
- end
74
+ # RSpec tasks
75
+ desc 'Run all specs'
76
+ RSpec::Core::RakeTask.new(:spec) do |t|
77
+ t.pattern = 'spec/**/*_spec.rb'
78
+ end
138
79
 
139
- Rake::TestTask.new('policy') do |t|
140
- task :policy => [:clean, :compile]
141
- t.libs << 'ext'
142
- t.test_files = FileList['test/test_policy.rb']
143
- t.warning = true
144
- t.verbose = true
145
- end
80
+ # Clean up afterwards
81
+ Rake::Task[:spec].enhance do
82
+ Rake::Task[:clean].invoke
146
83
  end
147
84
 
148
- task :default => ['test:all']
149
- task :test => ['test:all']
85
+ task :default => [:compile, :spec]
@@ -0,0 +1,16 @@
1
+ FROM debian:bullseye
2
+
3
+ RUN apt-get update && \
4
+ apt-get install -y krb5-kdc krb5-admin-server krb5-user krb5-kdc-ldap ldap-utils expect && \
5
+ rm -rf /var/lib/apt/lists/*
6
+
7
+ # Copy configuration files
8
+ COPY krb5.conf /etc/krb5.conf
9
+ COPY kdc.conf /etc/krb5kdc/kdc.conf
10
+ COPY kadm5.acl /etc/krb5kdc/kadm5.acl
11
+
12
+ # Copy entrypoint
13
+ COPY docker-entrypoint.sh /docker-entrypoint.sh
14
+ RUN chmod +x /docker-entrypoint.sh
15
+
16
+ ENTRYPOINT ["/docker-entrypoint.sh"]
@@ -0,0 +1,23 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Initialize KDC DB if not already present
5
+ if [ ! -f /etc/krb5kdc/.k5.EXAMPLE.COM ]; then
6
+ printf "masterpassword\nmasterpassword\n" | krb5_newrealm
7
+ kadmin.local -q "addprinc -pw adminpassword admin/admin"
8
+ fi
9
+
10
+ # Create standard test principals for keytab/credential cache tests
11
+ kadmin.local -q "addprinc -pw changeme testuser1@EXAMPLE.COM"
12
+ kadmin.local -q "addprinc -pw changeme zztop@EXAMPLE.COM"
13
+ kadmin.local -q "addprinc -pw changeme martymcfly@EXAMPLE.COM"
14
+ kadmin.local -q "ktadd -k /etc/krb5.keytab testuser1@EXAMPLE.COM"
15
+ kadmin.local -q "ktadd -k /etc/krb5.keytab zztop@EXAMPLE.COM"
16
+ kadmin.local -q "ktadd -k /etc/krb5.keytab martymcfly@EXAMPLE.COM"
17
+
18
+ # Start KDC and admin server
19
+ krb5kdc
20
+ kadmind
21
+
22
+ # Keep container running
23
+ trap : TERM INT; sleep infinity & wait
data/docker/kadm5.acl ADDED
@@ -0,0 +1 @@
1
+ admin/admin@EXAMPLE.COM *
data/docker/kdc.conf ADDED
@@ -0,0 +1,13 @@
1
+ [kdcdefaults]
2
+ kdc_ports = 88
3
+
4
+ [realms]
5
+ EXAMPLE.COM = {
6
+ admin_keytab = /etc/krb5kdc/kadm5.keytab
7
+ acl_file = /etc/krb5kdc/kadm5.acl
8
+ dict_file = /usr/share/dict/words
9
+ key_stash_file = /etc/krb5kdc/.k5.EXAMPLE.COM
10
+ kdc_ports = 88
11
+ max_life = 10h 0m 0s
12
+ max_renewable_life = 7d 0h 0m 0s
13
+ }
data/docker/krb5.conf ADDED
@@ -0,0 +1,14 @@
1
+ [libdefaults]
2
+ default_realm = EXAMPLE.COM
3
+ dns_lookup_realm = false
4
+ dns_lookup_kdc = false
5
+
6
+ [realms]
7
+ EXAMPLE.COM = {
8
+ kdc = kerberos-kdc
9
+ admin_server = kerberos-kdc
10
+ }
11
+
12
+ [domain_realm]
13
+ .example.com = EXAMPLE.COM
14
+ example.com = EXAMPLE.COM
@@ -0,0 +1,44 @@
1
+ version: '3.8'
2
+ services:
3
+ kerberos-kdc:
4
+ build:
5
+ context: ./docker
6
+ dockerfile: Dockerfile.kdc
7
+ container_name: kerberos-kdc
8
+ ports:
9
+ - "1088:88"
10
+ - "1749:749"
11
+ volumes:
12
+ - krb5-keytab:/etc/krb5.keytab
13
+ depends_on:
14
+ - ldap
15
+
16
+ rkerberos-test:
17
+ build: .
18
+ container_name: rkerberos-test
19
+ environment:
20
+ - LANG=C.UTF-8
21
+ - KRB5_CONFIG=/etc/krb5.conf
22
+ - KRB5_ADMIN_PRINCIPAL=admin/admin@EXAMPLE.COM
23
+ - KRB5_ADMIN_PASSWORD=adminpassword
24
+ # LDAP test variables for integration tests
25
+ - KRB5_LDAP_PRINCIPAL=admin@ldap
26
+ - KRB5_LDAP_PASSWORD=admin
27
+ - KRB5_LDAP_DRIVER=ou=People,dc=example,dc=com:foobar:uid
28
+ working_dir: /app
29
+ depends_on:
30
+ - kerberos-kdc
31
+
32
+ ldap:
33
+ image: osixia/openldap:latest
34
+ container_name: ldap
35
+ environment:
36
+ LDAP_ORGANISATION: "Example Org"
37
+ LDAP_DOMAIN: "example.com"
38
+ LDAP_BASE_DN: "dc=example,dc=com"
39
+ LDAP_ADMIN_PASSWORD: "admin"
40
+ ports:
41
+ - "1389:389"
42
+
43
+ volumes:
44
+ krb5-keytab:
@@ -2,28 +2,35 @@
2
2
 
3
3
  VALUE cKrb5CCache;
4
4
 
5
- // Free function for the Kerberos::Krb5::CCache class.
6
- static void rkrb5_ccache_free(RUBY_KRB5_CCACHE* ptr){
7
- if(!ptr)
8
- return;
9
5
 
10
- if(ptr->ccache)
11
- krb5_cc_close(ptr->ctx, ptr->ccache);
12
-
13
- if(ptr->principal)
14
- krb5_free_principal(ptr->ctx, ptr->principal);
15
-
16
- if(ptr->ctx)
17
- krb5_free_context(ptr->ctx);
6
+ // TypedData functions for RUBY_KRB5_CCACHE
7
+ static void rkrb5_ccache_typed_free(void *ptr) {
8
+ if (!ptr) return;
9
+ RUBY_KRB5_CCACHE *c = (RUBY_KRB5_CCACHE *)ptr;
10
+ if (c->ccache)
11
+ krb5_cc_close(c->ctx, c->ccache);
12
+ if (c->principal)
13
+ krb5_free_principal(c->ctx, c->principal);
14
+ if (c->ctx)
15
+ krb5_free_context(c->ctx);
16
+ free(c);
17
+ }
18
18
 
19
- free(ptr);
19
+ static size_t rkrb5_ccache_typed_size(const void *ptr) {
20
+ return sizeof(RUBY_KRB5_CCACHE);
20
21
  }
21
22
 
23
+ const rb_data_type_t rkrb5_ccache_data_type = {
24
+ "RUBY_KRB5_CCACHE",
25
+ {NULL, rkrb5_ccache_typed_free, rkrb5_ccache_typed_size,},
26
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
27
+ };
28
+
22
29
  // Allocation function for the Kerberos::Krb5::CCache class.
23
30
  static VALUE rkrb5_ccache_allocate(VALUE klass){
24
- RUBY_KRB5_CCACHE* ptr = malloc(sizeof(RUBY_KRB5_CCACHE));
31
+ RUBY_KRB5_CCACHE* ptr = ALLOC(RUBY_KRB5_CCACHE);
25
32
  memset(ptr, 0, sizeof(RUBY_KRB5_CCACHE));
26
- return Data_Wrap_Struct(klass, 0, rkrb5_ccache_free, ptr);
33
+ return TypedData_Wrap_Struct(klass, &rkrb5_ccache_data_type, ptr);
27
34
  }
28
35
 
29
36
  /*
@@ -46,7 +53,7 @@ static VALUE rkrb5_ccache_initialize(int argc, VALUE* argv, VALUE self){
46
53
  krb5_error_code kerror;
47
54
  VALUE v_principal, v_name;
48
55
 
49
- Data_Get_Struct(self, RUBY_KRB5_CCACHE, ptr);
56
+ TypedData_Get_Struct(self, RUBY_KRB5_CCACHE, &rkrb5_ccache_data_type, ptr);
50
57
 
51
58
  rb_scan_args(argc, argv, "02", &v_principal, &v_name);
52
59
 
@@ -92,14 +99,14 @@ static VALUE rkrb5_ccache_initialize(int argc, VALUE* argv, VALUE self){
92
99
  if(kerror)
93
100
  rb_raise(cKrb5Exception, "krb5_cc_initialize: %s", error_message(kerror));
94
101
  }
95
-
102
+
96
103
  return self;
97
104
  }
98
105
 
99
106
  /*
100
107
  * call-seq:
101
108
  * ccache.close
102
- *
109
+ *
103
110
  * Closes the ccache object. Once the ccache object is closed no more
104
111
  * methods may be called on it, or an exception will be raised.
105
112
  *
@@ -108,7 +115,7 @@ static VALUE rkrb5_ccache_initialize(int argc, VALUE* argv, VALUE self){
108
115
  static VALUE rkrb5_ccache_close(VALUE self){
109
116
  RUBY_KRB5_CCACHE* ptr;
110
117
 
111
- Data_Get_Struct(self, RUBY_KRB5_CCACHE, ptr);
118
+ TypedData_Get_Struct(self, RUBY_KRB5_CCACHE, &rkrb5_ccache_data_type, ptr);
112
119
 
113
120
  if(!ptr->ctx)
114
121
  return self;
@@ -141,7 +148,7 @@ static VALUE rkrb5_ccache_close(VALUE self){
141
148
  static VALUE rkrb5_ccache_default_name(VALUE self){
142
149
  RUBY_KRB5_CCACHE* ptr;
143
150
 
144
- Data_Get_Struct(self, RUBY_KRB5_CCACHE, ptr);
151
+ TypedData_Get_Struct(self, RUBY_KRB5_CCACHE, &rkrb5_ccache_data_type, ptr);
145
152
 
146
153
  if(!ptr->ctx)
147
154
  rb_raise(cKrb5Exception, "no context has been established");
@@ -160,7 +167,7 @@ static VALUE rkrb5_ccache_primary_principal(VALUE self){
160
167
  krb5_error_code kerror;
161
168
  char* name;
162
169
 
163
- Data_Get_Struct(self, RUBY_KRB5_CCACHE, ptr);
170
+ TypedData_Get_Struct(self, RUBY_KRB5_CCACHE, &rkrb5_ccache_data_type, ptr);
164
171
 
165
172
  if(!ptr->ctx)
166
173
  rb_raise(cKrb5Exception, "no context has been established");
@@ -193,7 +200,7 @@ static VALUE rkrb5_ccache_destroy(VALUE self){
193
200
  krb5_error_code kerror;
194
201
  VALUE v_bool = Qtrue;
195
202
 
196
- Data_Get_Struct(self, RUBY_KRB5_CCACHE, ptr);
203
+ TypedData_Get_Struct(self, RUBY_KRB5_CCACHE, &rkrb5_ccache_data_type, ptr);
197
204
 
198
205
  if(!ptr->ctx)
199
206
  rb_raise(cKrb5Exception, "no context has been established");
@@ -229,7 +236,7 @@ static VALUE rkrb5_ccache_destroy(VALUE self){
229
236
  return v_bool;
230
237
  }
231
238
 
232
- void Init_ccache(){
239
+ void Init_ccache(void){
233
240
  /* The Kerberos::Krb5::CredentialsCache class encapsulates a Kerberos credentials cache. */
234
241
  cKrb5CCache = rb_define_class_under(cKrb5, "CredentialsCache", rb_cObject);
235
242