From 34d3e2b948effc9622a09679baaf01c3148d4a7d Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Thu, 24 Sep 2015 18:44:01 -0400 Subject: [PATCH] Update github.com/syndtr/gocapability/capability to 2c00daeb6c3b45114c80ac44119e7b8801fdd852 This allows us to use the capability.List() function to construct capability list dynamically. Signed-off-by: Mrunal Patel --- Godeps/Godeps.json | 2 +- .../capability/capability_linux.go | 6 +- .../syndtr/gocapability/capability/enum.go | 83 +---------- .../gocapability/capability/enum_gen.go | 129 ++++++++++++++++++ .../gocapability/capability/enumgen/gen.go | 92 +++++++++++++ .../gocapability/capability/syscall_linux.go | 6 +- libcontainer/capabilities_linux.go | 58 +++----- 7 files changed, 246 insertions(+), 130 deletions(-) create mode 100644 Godeps/_workspace/src/github.com/syndtr/gocapability/capability/enum_gen.go create mode 100644 Godeps/_workspace/src/github.com/syndtr/gocapability/capability/enumgen/gen.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 7a50f301..ad21b5bf 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -62,7 +62,7 @@ }, { "ImportPath": "github.com/syndtr/gocapability/capability", - "Rev": "e55e5833692b49e49a0073ad5baf7803f21bebf4" + "Rev": "2c00daeb6c3b45114c80ac44119e7b8801fdd852" }, { "ImportPath": "github.com/vishvananda/netlink", diff --git a/Godeps/_workspace/src/github.com/syndtr/gocapability/capability/capability_linux.go b/Godeps/_workspace/src/github.com/syndtr/gocapability/capability/capability_linux.go index 24dc85fa..3dfcd398 100644 --- a/Godeps/_workspace/src/github.com/syndtr/gocapability/capability/capability_linux.go +++ b/Godeps/_workspace/src/github.com/syndtr/gocapability/capability/capability_linux.go @@ -417,10 +417,6 @@ func (c *capsV3) Load() (err error) { } func (c *capsV3) Apply(kind CapType) (err error) { - err = initLastCap() - if err != nil { - return - } if kind&BOUNDS == BOUNDS { var data [2]capData err = capget(&c.hdr, &data[0]) @@ -428,7 +424,7 @@ func (c *capsV3) Apply(kind CapType) (err error) { return } if (1< last { + continue + } + capKey := fmt.Sprintf("CAP_%s", strings.ToUpper(cap.String())) + capabilityMap[capKey] = cap + } } func newCapWhitelist(caps []string) (*whitelist, error) { l := []capability.Cap{} for _, c := range caps { - v, ok := capabilityList[c] + v, ok := capabilityMap[c] if !ok { return nil, fmt.Errorf("unknown capability %q", c) }