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
c7e426be
Commit
c7e426be
authored
Nov 20, 2013
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-usernsexec: fix the default map behavior
We were finding it, but not saving it. Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
2716b487
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
lxc_usernsexec.c
src/lxc/lxc_usernsexec.c
+13
-6
No files found.
src/lxc/lxc_usernsexec.c
View file @
c7e426be
...
@@ -158,9 +158,13 @@ out_free_map:
...
@@ -158,9 +158,13 @@ out_free_map:
}
}
/*
/*
* go through /etc/subuids and /etc/subgids to find this user's
* This is called if the user did not pass any uid ranges in
* allowed map. We only use the first one (bc otherwise we're
* through -m flags. It's called once to get the default uid
* not sure which ns ids he wants to use).
* map, and once for the default gid map.
* Go through /etc/subuids and /etc/subgids to find this user's
* allowed map. We only use the first one for each of uid and
* gid, because otherwise we're not sure which entries the user
* wanted.
*/
*/
static
int
read_default_map
(
char
*
fnam
,
char
which
,
char
*
username
)
static
int
read_default_map
(
char
*
fnam
,
char
which
,
char
*
username
)
{
{
...
@@ -168,7 +172,7 @@ static int read_default_map(char *fnam, char which, char *username)
...
@@ -168,7 +172,7 @@ static int read_default_map(char *fnam, char which, char *username)
char
*
line
=
NULL
;
char
*
line
=
NULL
;
size_t
sz
=
0
;
size_t
sz
=
0
;
struct
id_map
*
newmap
;
struct
id_map
*
newmap
;
char
*
p1
,
*
p2
;
char
*
p1
,
*
p2
;
fin
=
fopen
(
fnam
,
"r"
);
fin
=
fopen
(
fnam
,
"r"
);
if
(
!
fin
)
if
(
!
fin
)
...
@@ -185,8 +189,11 @@ static int read_default_map(char *fnam, char which, char *username)
...
@@ -185,8 +189,11 @@ static int read_default_map(char *fnam, char which, char *username)
if
(
!
p2
)
if
(
!
p2
)
continue
;
continue
;
newmap
=
malloc
(
sizeof
(
*
newmap
));
newmap
=
malloc
(
sizeof
(
*
newmap
));
if
(
!
newmap
)
if
(
!
newmap
)
{
fclose
(
fin
);
free
(
line
);
return
-
1
;
return
-
1
;
}
newmap
->
host_id
=
atol
(
p1
+
1
);
newmap
->
host_id
=
atol
(
p1
+
1
);
newmap
->
range
=
atol
(
p2
+
1
);
newmap
->
range
=
atol
(
p2
+
1
);
newmap
->
ns_id
=
0
;
newmap
->
ns_id
=
0
;
...
@@ -195,13 +202,13 @@ static int read_default_map(char *fnam, char which, char *username)
...
@@ -195,13 +202,13 @@ static int read_default_map(char *fnam, char which, char *username)
newmap
->
next
=
active_map
;
newmap
->
next
=
active_map
;
else
else
newmap
->
next
=
NULL
;
newmap
->
next
=
NULL
;
active_map
=
newmap
;
break
;
break
;
}
}
if
(
line
)
if
(
line
)
free
(
line
);
free
(
line
);
fclose
(
fin
);
fclose
(
fin
);
free
(
newmap
);
return
0
;
return
0
;
}
}
...
...
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