diff options
author | Andrew Morgan <morgan@kernel.org> | 2007-07-21 22:18:02 -0700 |
---|---|---|
committer | Jorge Lucangeli Obes <jorgelo@google.com> | 2015-09-03 14:13:03 -0700 |
commit | ed81ba2ae0fbcd36a6f10c2ed59984643a1778e7 (patch) | |
tree | ae1ac515ffb749ccf39abb0990ce6f9f040c515d /libcap | |
parent | 7ad0c9424a86470cd62687c6666ad1c878de9393 (diff) | |
download | libcap-ed81ba2ae0fbcd36a6f10c2ed59984643a1778e7.tar.gz |
Revived old setcap/getcap manual pages and added support for removing file caps
Diffstat (limited to 'libcap')
-rw-r--r-- | libcap/Makefile | 2 | ||||
-rw-r--r-- | libcap/cap_file.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/libcap/Makefile b/libcap/Makefile index c492559..f875c33 100644 --- a/libcap/Makefile +++ b/libcap/Makefile @@ -46,7 +46,7 @@ $(MINLIBNAME): $(OBJS) <<<<<<< HEAD:libcap/Makefile ======= cap_sys.o: cap_sys.c $(INCLS) - $(CC) $(IPATH) -fPIC -Wall -O2 -c $< -o $@ + $(CC) -include $(SYSTEM_HEADERS)/linux/unistd.h $(IPATH) -fPIC -Wall -O2 -c $< -o $@ >>>>>>> Add tentitive support for filesystem capabilities with 2.6.23-mm kernels:libcap/Makefile install: all diff --git a/libcap/cap_file.c b/libcap/cap_file.c index b452b9c..90a2c40 100644 --- a/libcap/cap_file.c +++ b/libcap/cap_file.c @@ -134,7 +134,10 @@ int cap_set_fd(int fildes, cap_t cap_d) { struct vfs_cap_data rawvfscap; - if (_fcaps_save(&rawvfscap, cap_d) != 0) { + if (cap_d == NULL) { + _cap_debug("deleting fildes capabilities"); + return fremovexattr(fildes, XATTR_NAME_CAPS); + } else if (_fcaps_save(&rawvfscap, cap_d) != 0) { return -1; } @@ -152,7 +155,10 @@ int cap_set_file(const char *filename, cap_t cap_d) { struct vfs_cap_data rawvfscap; - if (_fcaps_save(&rawvfscap, cap_d) != 0) { + if (cap_d == NULL) { + _cap_debug("removing filename capabilities"); + return removexattr(filename, XATTR_NAME_CAPS); + } else if (_fcaps_save(&rawvfscap, cap_d) != 0) { return -1; } |