Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
5c856bcb
Unverified
Commit
5c856bcb
authored
Dec 08, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: cleanup set_config_idmaps()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
83332c24
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
+9
-16
confile.c
src/lxc/confile.c
+9
-16
No files found.
src/lxc/confile.c
View file @
5c856bcb
...
...
@@ -2042,29 +2042,27 @@ static int set_config_proc(const char *key, const char *value,
static
int
set_config_idmaps
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
__do_free
struct
lxc_list
*
idmaplist
=
NULL
;
__do_free
struct
id_map
*
idmap
=
NULL
;
unsigned
long
hostid
,
nsid
,
range
;
char
type
;
int
ret
;
struct
lxc_list
*
idmaplist
=
NULL
;
struct
id_map
*
idmap
=
NULL
;
if
(
lxc_config_value_empty
(
value
))
return
lxc_clear_idmaps
(
lxc_conf
);
idmaplist
=
malloc
(
sizeof
(
*
idmaplist
));
if
(
!
idmaplist
)
goto
on_error
;
return
ret_errno
(
ENOMEM
)
;
idmap
=
malloc
(
sizeof
(
*
idmap
));
if
(
!
idmap
)
goto
on_error
;
return
ret_errno
(
ENOMEM
)
;
memset
(
idmap
,
0
,
sizeof
(
*
idmap
));
ret
=
parse_idmaps
(
value
,
&
type
,
&
nsid
,
&
hostid
,
&
range
);
if
(
ret
<
0
)
{
ERROR
(
"Failed to parse id mappings"
);
goto
on_error
;
}
if
(
ret
<
0
)
return
log_error_errno
(
-
EINVAL
,
EINVAL
,
"Failed to parse id mappings"
);
INFO
(
"Read uid map: type %c nsid %lu hostid %lu range %lu"
,
type
,
nsid
,
hostid
,
range
);
if
(
type
==
'u'
)
...
...
@@ -2072,7 +2070,7 @@ static int set_config_idmaps(const char *key, const char *value,
else
if
(
type
==
'g'
)
idmap
->
idtype
=
ID_TYPE_GID
;
else
goto
on_error
;
return
ret_errno
(
EINVAL
)
;
idmap
->
hostid
=
hostid
;
idmap
->
nsid
=
nsid
;
...
...
@@ -2088,15 +2086,10 @@ static int set_config_idmaps(const char *key, const char *value,
if
(
idmap
->
nsid
==
0
)
lxc_conf
->
root_nsgid_map
=
idmap
;
idmap
=
NULL
;
move_ptr
(
idmap
);
move_ptr
(
idmaplist
);
return
0
;
on_error:
free
(
idmaplist
);
free
(
idmap
);
return
-
1
;
}
static
int
set_config_mount_fstab
(
const
char
*
key
,
const
char
*
value
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment