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
68a1e26c
Commit
68a1e26c
authored
Apr 18, 2017
by
Serge Hallyn
Committed by
GitHub
Apr 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1514 from brauner/2017-04-18/autoconf_cap_get_file
autotools: check for cap_get_file
parents
c69ab769
c61079a4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
8 deletions
+14
-8
configure.ac
configure.ac
+3
-1
caps.c
src/lxc/caps.c
+4
-4
caps.h
src/lxc/caps.h
+2
-2
conf.c
src/lxc/conf.c
+5
-1
No files found.
configure.ac
View file @
68a1e26c
...
@@ -372,7 +372,9 @@ AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"])
...
@@ -372,7 +372,9 @@ AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"])
AM_COND_IF([ENABLE_CAP],
AM_COND_IF([ENABLE_CAP],
[AC_CHECK_HEADER([sys/capability.h],[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
[AC_CHECK_HEADER([sys/capability.h],[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
AC_CHECK_LIB(cap,cap_set_proc,[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
AC_CHECK_LIB(cap,cap_set_proc,[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
AC_SUBST([CAP_LIBS], [-lcap])])
# Test whether we support getting file capabilities via cap_get_file().
AC_CHECK_LIB(cap,cap_get_file, AC_DEFINE(LIBCAP_SUPPORTS_FILE_CAPABILITIES,1,[Have cap_get_file]),[],[])
AC_SUBST([CAP_LIBS], [-lcap])])
# HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
# HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
OLD_CFLAGS="$CFLAGS"
OLD_CFLAGS="$CFLAGS"
...
...
src/lxc/caps.c
View file @
68a1e26c
...
@@ -225,10 +225,7 @@ static bool lxc_cap_is_set(cap_t caps, cap_value_t cap, cap_flag_t flag)
...
@@ -225,10 +225,7 @@ static bool lxc_cap_is_set(cap_t caps, cap_value_t cap, cap_flag_t flag)
bool
lxc_file_cap_is_set
(
const
char
*
path
,
cap_value_t
cap
,
cap_flag_t
flag
)
bool
lxc_file_cap_is_set
(
const
char
*
path
,
cap_value_t
cap
,
cap_flag_t
flag
)
{
{
/* Android's bionic currently seems to lack support for cap_get_file(). */
#if LIBCAP_SUPPORTS_FILE_CAPABILITIES
#if IS_BIONIC
return
true
;
#else
bool
cap_is_set
;
bool
cap_is_set
;
cap_t
caps
;
cap_t
caps
;
...
@@ -247,6 +244,9 @@ bool lxc_file_cap_is_set(const char *path, cap_value_t cap, cap_flag_t flag)
...
@@ -247,6 +244,9 @@ bool lxc_file_cap_is_set(const char *path, cap_value_t cap, cap_flag_t flag)
cap_is_set
=
lxc_cap_is_set
(
caps
,
cap
,
flag
);
cap_is_set
=
lxc_cap_is_set
(
caps
,
cap
,
flag
);
cap_free
(
caps
);
cap_free
(
caps
);
return
cap_is_set
;
return
cap_is_set
;
#else
errno
=
ENODATA
;
return
false
;
#endif
#endif
}
}
...
...
src/lxc/caps.h
View file @
68a1e26c
...
@@ -56,11 +56,11 @@ static inline int lxc_caps_last_cap(void) {
...
@@ -56,11 +56,11 @@ static inline int lxc_caps_last_cap(void) {
typedef
int
cap_value_t
;
typedef
int
cap_value_t
;
typedef
int
cap_flag_t
;
typedef
int
cap_flag_t
;
static
inline
bool
lxc_proc_cap_is_set
(
cap_value_t
cap
,
cap_flag_t
flag
)
{
static
inline
bool
lxc_proc_cap_is_set
(
cap_value_t
cap
,
cap_flag_t
flag
)
{
return
tru
e
;
return
fals
e
;
}
}
static
inline
bool
lxc_file_cap_is_set
(
const
char
*
path
,
cap_value_t
cap
,
cap_flag_t
flag
)
{
static
inline
bool
lxc_file_cap_is_set
(
const
char
*
path
,
cap_value_t
cap
,
cap_flag_t
flag
)
{
return
tru
e
;
return
fals
e
;
}
}
#endif
#endif
...
...
src/lxc/conf.c
View file @
68a1e26c
...
@@ -3353,7 +3353,7 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap)
...
@@ -3353,7 +3353,7 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap)
goto
cleanup
;
goto
cleanup
;
}
}
#if HAVE_LIBCAP &&
!IS_BIONIC
#if HAVE_LIBCAP &&
LIBCAP_SUPPORTS_FILE_CAPABILITIES
/* Check if it has the CAP_SETUID capability. */
/* Check if it has the CAP_SETUID capability. */
if
((
cap
&
CAP_SETUID
)
&&
if
((
cap
&
CAP_SETUID
)
&&
lxc_file_cap_is_set
(
path
,
CAP_SETUID
,
CAP_EFFECTIVE
)
&&
lxc_file_cap_is_set
(
path
,
CAP_SETUID
,
CAP_EFFECTIVE
)
&&
...
@@ -3374,6 +3374,10 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap)
...
@@ -3374,6 +3374,10 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap)
goto
cleanup
;
goto
cleanup
;
}
}
#else
#else
/* If we cannot check for file capabilities we need to give the benefit
* of the doubt. Otherwise we might fail even though all the necessary
* file capabilities are set.
*/
DEBUG
(
"Cannot check for file capabilites as full capability support is "
DEBUG
(
"Cannot check for file capabilites as full capability support is "
"missing. Manual intervention needed."
);
"missing. Manual intervention needed."
);
fret
=
1
;
fret
=
1
;
...
...
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