idmap

package
v0.0.0-...-e623927 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHostIdIsSubId = fmt.Errorf("Host id is in the range of subids")

Functions

func ShiftACL

func ShiftACL(path string, shiftIds func(uid int64, gid int64) (int64, int64)) error

ShiftACL updates uid and gid for file ACLs when entering/exiting a namespace

func ShiftOwner

func ShiftOwner(basepath string, path string, uid int, gid int) error

ShiftOwner updates uid and gid for a file when entering/exiting a namespace

Types

type ByHostid

type ByHostid []*IdmapEntry

func (ByHostid) Len

func (s ByHostid) Len() int

func (ByHostid) Less

func (s ByHostid) Less(i, j int) bool

func (ByHostid) Swap

func (s ByHostid) Swap(i, j int)

type IdRange

type IdRange struct {
	Isuid   bool
	Isgid   bool
	Startid int64
	Endid   int64
}

func (*IdRange) Contains

func (i *IdRange) Contains(id int64) bool

type IdmapEntry

type IdmapEntry struct {
	Isuid    bool
	Isgid    bool
	Hostid   int64 // id as seen on the host - i.e. 100000
	Nsid     int64 // id as seen in the ns - i.e. 0
	Maprange int64
}

* One entry in id mapping set - a single range of either * uid or gid mappings.

func Extend

func Extend(slice []IdmapEntry, element IdmapEntry) []IdmapEntry

taken from http://blog.golang.org/slices (which is under BSD licence)

func (*IdmapEntry) HostidsIntersect

func (e *IdmapEntry) HostidsIntersect(i IdmapEntry) bool

func (*IdmapEntry) Intersects

func (e *IdmapEntry) Intersects(i IdmapEntry) bool

func (*IdmapEntry) ToLxcString

func (e *IdmapEntry) ToLxcString() []string

func (*IdmapEntry) Usable

func (e *IdmapEntry) Usable() error

type IdmapSet

type IdmapSet struct {
	Idmap []IdmapEntry
}

func CurrentIdmapSet

func CurrentIdmapSet() (*IdmapSet, error)

* Create an idmap of the current allocation

func DefaultIdmapSet

func DefaultIdmapSet(username string) (*IdmapSet, error)

* Create a new default idmap

func (*IdmapSet) AddSafe

func (m *IdmapSet) AddSafe(i IdmapEntry) error

AddSafe adds an entry to the idmap set, breaking apart any ranges that the * new idmap intersects with in the process.

func (IdmapSet) Append

func (m IdmapSet) Append(s string) (IdmapSet, error)

func (IdmapSet) HostidsIntersect

func (m IdmapSet) HostidsIntersect(i IdmapEntry) bool

func (IdmapSet) Intersects

func (m IdmapSet) Intersects(i IdmapEntry) bool

func (IdmapSet) Len

func (m IdmapSet) Len() int

func (IdmapSet) Less

func (m IdmapSet) Less(i, j int) bool

func (*IdmapSet) ShiftFile

func (set *IdmapSet) ShiftFile(p string) error

func (IdmapSet) ShiftFromNs

func (m IdmapSet) ShiftFromNs(uid int64, gid int64) (int64, int64)

func (IdmapSet) ShiftIntoNs

func (m IdmapSet) ShiftIntoNs(uid int64, gid int64) (int64, int64)

func (*IdmapSet) ShiftRootfs

func (set *IdmapSet) ShiftRootfs(p string) error

func (IdmapSet) Swap

func (m IdmapSet) Swap(i, j int)

func (IdmapSet) ToLxcString

func (m IdmapSet) ToLxcString() []string

func (*IdmapSet) UidshiftFromContainer

func (set *IdmapSet) UidshiftFromContainer(dir string, testmode bool) error

func (*IdmapSet) UidshiftIntoContainer

func (set *IdmapSet) UidshiftIntoContainer(dir string, testmode bool) error

func (*IdmapSet) UnshiftRootfs

func (set *IdmapSet) UnshiftRootfs(p string) error

func (IdmapSet) Usable

func (m IdmapSet) Usable() error

func (IdmapSet) ValidRanges

func (m IdmapSet) ValidRanges() ([]*IdRange, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL