mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Add user struct based on spec implementation.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -49,7 +49,11 @@ user named `daemon` defined within that file-system.
|
||||
},
|
||||
"process": {
|
||||
"terminal": true,
|
||||
"user": "daemon",
|
||||
"user": {
|
||||
"uid": 0,
|
||||
"gid": 0,
|
||||
"additionalGids": null
|
||||
},
|
||||
"args": [
|
||||
"sh"
|
||||
],
|
||||
|
||||
@@ -7,6 +7,10 @@ import (
|
||||
"github.com/codegangsta/cli"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
NOTSUPPORTED string
|
||||
}
|
||||
|
||||
func getDefaultID() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ import (
|
||||
"github.com/codegangsta/cli"
|
||||
)
|
||||
|
||||
const cpuQuotaMultiplyer = 100000
|
||||
|
||||
type Mount struct {
|
||||
Type string `json:"type"`
|
||||
Source string `json:"source"`
|
||||
@@ -20,7 +18,7 @@ type Mount struct {
|
||||
|
||||
type Process struct {
|
||||
Terminal bool `json:"terminal"`
|
||||
User string `json:"user"`
|
||||
User User `json:"user"`
|
||||
Args []string `json:"args"`
|
||||
Env []string `json:"env"`
|
||||
Cwd string `json:"cwd"`
|
||||
@@ -61,7 +59,7 @@ var specCommand = cli.Command{
|
||||
},
|
||||
Process: Process{
|
||||
Terminal: true,
|
||||
User: "daemon",
|
||||
User: User{},
|
||||
Args: []string{
|
||||
"sh",
|
||||
},
|
||||
|
||||
+6
-4
@@ -30,6 +30,12 @@ type Linux struct {
|
||||
Devices []string `json:"devices"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Uid int32 `json:"uid"`
|
||||
Gid int32 `json:"gid"`
|
||||
AdditionalGids []int32 `json:"additionalGids"`
|
||||
}
|
||||
|
||||
type Namespace struct {
|
||||
Type string `json:"type"`
|
||||
Path string `json:"path"`
|
||||
@@ -273,10 +279,6 @@ func setReadonly(config *configs.Config) {
|
||||
}
|
||||
}
|
||||
|
||||
func getCPUQuota(cpus float64) int64 {
|
||||
return int64(cpus * cpuQuotaMultiplyer)
|
||||
}
|
||||
|
||||
func setupUserNamespace(spec *Spec, config *configs.Config) error {
|
||||
if len(spec.Linux.UserMapping) == 0 {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user