2018-02-05 16:05:59 -05:00
|
|
|
package idtools // import "github.com/docker/docker/pkg/idtools"
|
2015-10-14 14:35:48 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/system"
|
|
|
|
)
|
|
|
|
|
2021-06-18 04:37:04 -04:00
|
|
|
const (
|
|
|
|
SeTakeOwnershipPrivilege = "SeTakeOwnershipPrivilege"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
ContainerAdministratorSidString = "S-1-5-93-2-1"
|
|
|
|
ContainerUserSidString = "S-1-5-93-2-2"
|
|
|
|
)
|
|
|
|
|
2017-11-16 01:20:33 -05:00
|
|
|
// This is currently a wrapper around MkdirAll, however, since currently
|
|
|
|
// permissions aren't set through this path, the identity isn't utilized.
|
|
|
|
// Ownership is handled elsewhere, but in the future could be support here
|
|
|
|
// too.
|
|
|
|
func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error {
|
2019-08-08 05:51:00 -04:00
|
|
|
if err := system.MkdirAll(path, mode); err != nil {
|
2015-10-14 14:35:48 -04:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2016-08-23 12:49:13 -04:00
|
|
|
|
|
|
|
// CanAccess takes a valid (existing) directory and a uid, gid pair and determines
|
|
|
|
// if that uid, gid pair has access (execute bit) to the directory
|
|
|
|
// Windows does not require/support this function, so always return true
|
2017-11-16 01:20:33 -05:00
|
|
|
func CanAccess(path string, identity Identity) bool {
|
2016-08-23 12:49:13 -04:00
|
|
|
return true
|
|
|
|
}
|