2012-03-13 01:22:16 +04:00
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2013-11-18 19:58:43 +04:00
# pragma once
2012-03-13 01:22:16 +04:00
/***
This file is part of systemd .
2012-04-10 15:39:02 +04:00
Copyright 2010 Lennart Poettering
2012-03-13 01:22:16 +04:00
systemd is free software ; you can redistribute it and / or modify it
2012-04-12 02:20:58 +04:00
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation ; either version 2.1 of the License , or
2012-03-13 01:22:16 +04:00
( at your option ) any later version .
systemd is distributed in the hope that it will be useful , but
WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
2012-04-12 02:20:58 +04:00
Lesser General Public License for more details .
2012-03-13 01:22:16 +04:00
2012-04-12 02:20:58 +04:00
You should have received a copy of the GNU Lesser General Public License
2012-03-13 01:22:16 +04:00
along with systemd ; If not , see < http : //www.gnu.org/licenses/>.
* * */
2012-05-24 06:00:56 +04:00
# include <inttypes.h>
# include <stdbool.h>
2014-01-01 07:35:54 +04:00
# include <sys/capability.h>
# include "util.h"
2012-05-24 06:00:56 +04:00
2012-04-10 15:39:02 +04:00
unsigned long cap_last_cap ( void ) ;
int have_effective_cap ( int value ) ;
2012-05-30 01:33:38 +04:00
int capability_bounding_set_drop ( uint64_t drop , bool right_now ) ;
int capability_bounding_set_drop_usermode ( uint64_t drop ) ;
2014-01-01 07:35:54 +04:00
2014-06-01 10:49:33 +04:00
int drop_privileges ( uid_t uid , gid_t gid , uint64_t keep_capabilites ) ;
2014-01-01 07:35:54 +04:00
DEFINE_TRIVIAL_CLEANUP_FUNC ( cap_t , cap_free ) ;
# define _cleanup_cap_free_ _cleanup_(cap_freep)
static inline void cap_free_charpp ( char * * p ) {
if ( * p )
cap_free ( * p ) ;
}
# define _cleanup_cap_free_charp_ _cleanup_(cap_free_charpp)