]> git.sur5r.net Git - bacula/bacula/commit
Implement support of keeping readall capabilities after UID/GID switch
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 18 Sep 2009 16:32:38 +0000 (16:32 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 19 Sep 2009 17:15:37 +0000 (19:15 +0200)
commitdfd9567cb9c0fd3e2d753b5a2b856155cd4ab006
tree67e33f55893beb84cd2ab06bca6a1bf52d311fcb
parentae2def87b828329e5334db5b1d6539e3b53ebb9c
Implement support of keeping readall capabilities after UID/GID switch

Extend drop() function interface to accept 3rd parameter specifying
whether process should keep capabilities required to read and search
files and directories regardless of their access permissions.

Introduce new bacula-fd option (-k) specifying that readall capabilities
should be kept after UID/GID switch.

The change moves drop() definition from bsys.c to new file priv.c,
which is necessary to avoid linking every bacula executable with -lcap.
If drop() would remain in bsys.c, then every executable which directly
or indirectly uses other functions defined in bsys.c would have to be
linked with -lcap, unless libbac is built as a shared library.

While the change itself is portable, the implementation is Linux
specific, it uses libcap to keep CAP_DAC_READ_SEARCH capability.
If libcap is not available, or OS does not have sys/prctl.h,
sys/capability.h, prctl(2), setreuid(2) and PR_SET_KEEPCAPS, then
this change is almost noop.
bacula/autoconf/configure.in
bacula/src/dird/Makefile.in
bacula/src/dird/dird.c
bacula/src/filed/Makefile.in
bacula/src/filed/filed.c
bacula/src/lib/Makefile.in
bacula/src/lib/bsys.c
bacula/src/lib/priv.c [new file with mode: 0644]
bacula/src/lib/protos.h
bacula/src/stored/Makefile.in
bacula/src/stored/stored.c