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
1f14c2ea
Commit
1f14c2ea
authored
Feb 12, 2017
by
Christian Brauner
Committed by
GitHub
Feb 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1430 from ffontaine/master
Add HAVE_LIBCAP
parents
3a5cb1af
e37dda71
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
12 deletions
+13
-12
configure.ac
configure.ac
+3
-2
caps.c
src/lxc/caps.c
+1
-1
caps.h
src/lxc/caps.h
+1
-1
conf.c
src/lxc/conf.c
+3
-3
start.c
src/lxc/start.c
+5
-5
No files found.
configure.ac
View file @
1f14c2ea
...
@@ -370,7 +370,8 @@ fi
...
@@ -370,7 +370,8 @@ fi
AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"])
AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"])
AM_COND_IF([ENABLE_CAP],
AM_COND_IF([ENABLE_CAP],
[AC_CHECK_LIB(cap,cap_set_proc,[true],[AC_MSG_ERROR([You are missing libcap support.])])
[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_SUBST([CAP_LIBS], [-lcap])])
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
...
@@ -638,7 +639,7 @@ AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
...
@@ -638,7 +639,7 @@ AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
# Check for some headers
# Check for some headers
AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/
capability.h sys/
memfd.h sys/personality.h utmpx.h sys/timerfd.h])
AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/memfd.h sys/personality.h utmpx.h sys/timerfd.h])
# lookup major()/minor()/makedev()
# lookup major()/minor()/makedev()
AC_HEADER_MAJOR
AC_HEADER_MAJOR
...
...
src/lxc/caps.c
View file @
1f14c2ea
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
lxc_log_define
(
lxc_caps
,
lxc
);
lxc_log_define
(
lxc_caps
,
lxc
);
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
#ifndef PR_CAPBSET_READ
#ifndef PR_CAPBSET_READ
#define PR_CAPBSET_READ 23
#define PR_CAPBSET_READ 23
...
...
src/lxc/caps.h
View file @
1f14c2ea
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#ifndef __LXC_CAPS_H
#ifndef __LXC_CAPS_H
#define __LXC_CAPS_H
#define __LXC_CAPS_H
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
#include <sys/capability.h>
#include <sys/capability.h>
extern
int
lxc_caps_down
(
void
);
extern
int
lxc_caps_down
(
void
);
...
...
src/lxc/conf.c
View file @
1f14c2ea
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
#include "utils.h"
#include "utils.h"
#include "lsm/lsm.h"
#include "lsm/lsm.h"
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
#include <sys/capability.h>
#include <sys/capability.h>
#endif
#endif
...
@@ -107,7 +107,7 @@
...
@@ -107,7 +107,7 @@
lxc_log_define
(
lxc_conf
,
lxc
);
lxc_log_define
(
lxc_conf
,
lxc
);
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
#ifndef CAP_SETFCAP
#ifndef CAP_SETFCAP
#define CAP_SETFCAP 31
#define CAP_SETFCAP 31
#endif
#endif
...
@@ -316,7 +316,7 @@ static struct mount_opt mount_opt[] = {
...
@@ -316,7 +316,7 @@ static struct mount_opt mount_opt[] = {
{
NULL
,
0
,
0
},
{
NULL
,
0
,
0
},
};
};
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
static
struct
caps_opt
caps_opt
[]
=
{
static
struct
caps_opt
caps_opt
[]
=
{
{
"chown"
,
CAP_CHOWN
},
{
"chown"
,
CAP_CHOWN
},
{
"dac_override"
,
CAP_DAC_OVERRIDE
},
{
"dac_override"
,
CAP_DAC_OVERRIDE
},
...
...
src/lxc/start.c
View file @
1f14c2ea
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
#include <sys/un.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <sys/wait.h>
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
#include <sys/capability.h>
#include <sys/capability.h>
#endif
#endif
...
@@ -375,7 +375,7 @@ int lxc_poll(const char *name, struct lxc_handler *handler)
...
@@ -375,7 +375,7 @@ int lxc_poll(const char *name, struct lxc_handler *handler)
}
}
if
(
handler
->
conf
->
need_utmp_watch
)
{
if
(
handler
->
conf
->
need_utmp_watch
)
{
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
if
(
lxc_utmp_mainloop_add
(
&
descr
,
handler
))
{
if
(
lxc_utmp_mainloop_add
(
&
descr
,
handler
))
{
ERROR
(
"Failed to add utmp handler to LXC mainloop."
);
ERROR
(
"Failed to add utmp handler to LXC mainloop."
);
goto
out_mainloop_open
;
goto
out_mainloop_open
;
...
@@ -787,7 +787,7 @@ static int do_start(void *data)
...
@@ -787,7 +787,7 @@ static int do_start(void *data)
goto
out_warn_father
;
goto
out_warn_father
;
}
}
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
if
(
handler
->
conf
->
need_utmp_watch
)
{
if
(
handler
->
conf
->
need_utmp_watch
)
{
if
(
prctl
(
PR_CAPBSET_DROP
,
CAP_SYS_BOOT
,
0
,
0
,
0
))
{
if
(
prctl
(
PR_CAPBSET_DROP
,
CAP_SYS_BOOT
,
0
,
0
,
0
))
{
SYSERROR
(
"Failed to remove the CAP_SYS_BOOT capability."
);
SYSERROR
(
"Failed to remove the CAP_SYS_BOOT capability."
);
...
@@ -898,7 +898,7 @@ static int do_start(void *data)
...
@@ -898,7 +898,7 @@ static int do_start(void *data)
* further above. Only drop groups if we can, so ensure that we
* further above. Only drop groups if we can, so ensure that we
* have necessary privilege.
* have necessary privilege.
*/
*/
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
have_cap_setgid
=
lxc_cap_is_set
(
CAP_SETGID
,
CAP_EFFECTIVE
);
have_cap_setgid
=
lxc_cap_is_set
(
CAP_SETGID
,
CAP_EFFECTIVE
);
#else
#else
have_cap_setgid
=
false
;
have_cap_setgid
=
false
;
...
@@ -1337,7 +1337,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
...
@@ -1337,7 +1337,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
handler
->
netnsfd
=
-
1
;
handler
->
netnsfd
=
-
1
;
if
(
must_drop_cap_sys_boot
(
handler
->
conf
))
{
if
(
must_drop_cap_sys_boot
(
handler
->
conf
))
{
#if HAVE_
SYS_CAPABILITY_H
#if HAVE_
LIBCAP
DEBUG
(
"Dropping CAP_SYS_BOOT capability."
);
DEBUG
(
"Dropping CAP_SYS_BOOT capability."
);
#else
#else
DEBUG
(
"Not dropping CAP_SYS_BOOT capability as capabilities aren't supported."
);
DEBUG
(
"Not dropping CAP_SYS_BOOT capability as capabilities aren't supported."
);
...
...
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