key_control 0.0.1 → 0.0.2
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/lib/key_control/system.rb +7 -4
- data/lib/key_control/version.rb +1 -1
- data/lib/key_control.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a784b53837348d3fcba7ffc9f84e65c6a9d040b
|
4
|
+
data.tar.gz: 229ba84f2e41c534c7097295c94d7bf6b97e2ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb8c382abdfaf975048c30b55067a7d0ab08ff920545eb900ef180b4ffd9b8044284d7d1d4349a1802d4fd7639ed2a759864832c106f457cff640ec3ec72b7ee
|
7
|
+
data.tar.gz: 88eac2321abe8781fda47e4e04d05f83875d241a2bc11294288ce0dffb77199705402c871cfa4b0a5a125d634c44ab3adddd2cd42005d6156f41de2a4aaf9235
|
data/lib/key_control/system.rb
CHANGED
@@ -47,13 +47,16 @@ module KeyControl
|
|
47
47
|
|
48
48
|
# Private: Get a handle representing the system calls available through
|
49
49
|
# libkeyutils.so.
|
50
|
-
# TODO: For now, we assume that the shared object file is in the default
|
51
|
-
# location for CentOS installations. It would be nice to make this more
|
52
|
-
# flexible.
|
53
50
|
#
|
54
51
|
# Returns a Fiddle::Handle.
|
55
52
|
def keyutils
|
56
|
-
@keyutils ||=
|
53
|
+
@keyutils ||= KeyControl::LIBRARIES.map do |library|
|
54
|
+
begin
|
55
|
+
Fiddle::Handle.new(library)
|
56
|
+
rescue Fiddle::DLError
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
end.compact.first
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|
data/lib/key_control/version.rb
CHANGED
data/lib/key_control.rb
CHANGED
@@ -4,10 +4,25 @@ require "key_control/key_ring"
|
|
4
4
|
|
5
5
|
module KeyControl
|
6
6
|
|
7
|
+
# Constants for special keyring identifiers. For more information, see:
|
8
|
+
# http://manpages.ubuntu.com/manpages/oneiric/man1/keyctl.1.html
|
7
9
|
THREAD = -1
|
8
10
|
PROCESS = -2
|
9
11
|
SESSION = -3
|
10
12
|
USER = -4
|
11
13
|
DEFAULT = -5
|
12
14
|
GROUP = -6
|
15
|
+
|
16
|
+
# A list of potential library paths. Currently points to the default path for
|
17
|
+
# CentOS installations.
|
18
|
+
# TODO: Track down and add the default library paths for more distros.
|
19
|
+
LIBRARIES = %w(
|
20
|
+
/lib64/libkeyutils.so.1 )
|
21
|
+
|
22
|
+
# Public: Does KeyControl detect any known keyutils libraries?
|
23
|
+
#
|
24
|
+
# Returns a boolean.
|
25
|
+
def self.available?
|
26
|
+
LIBRARIES.any? { |library| File.exists?(library) }
|
27
|
+
end
|
13
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: key_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Horner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.2.2
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: A simple wrapper for the `keyctl` utility.
|