summaryrefslogtreecommitdiffstats
path: root/lib/privs.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-16/+1
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: add SYS_RAWIO to the capabilities definitionsAnuradha Karuppiah2022-06-271-0/+1
| | | | Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
* lib: Add ZCAP_IPC_LOCKDonald Sharp2021-05-121-0/+1
| | | | | | | We'll need ZCAP_IPC_LOCK for future work coming down the pike related to dataplane work being done. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: have a lib_privs for ... lib privsDavid Lamparter2021-02-121-0/+2
| | | | | | Logging code might want to raise privs for file operations. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib, zebra: Add SR-TE policy infrastructure to zebraSebastien Merle2020-08-071-0/+1
| | | | | | | | | | | | | | | | | | | | For the sake of Segment Routing (SR) and Traffic Engineering (TE) Policies there's a need for additional infrastructure within zebra. The infrastructure in this PR is supposed to manage such policies in terms of installing binding SIDs and LSPs. Also it is capable of managing MPLS labels using the label manager, keeping track of nexthops (for resolving labels) and notifying interested parties about changes of a policy/LSP state. Further it enables a route map mechanism for BGP and SR-TE colors such that learned BGP routes can be mapped onto SR-TE Policies. This PR does not introduce any usable features by now, it is just infrastructure for other upcoming PRs which will introduce 'pathd', a new SR-TE daemon. Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
* *: frr_elevate_privs -> frr_with_privsDavid Lamparter2019-09-031-4/+4
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* libs: control privs changes with refcountMark Stapp2019-04-221-4/+15
| | | | | | | Use a refcount to control privs changes. Support process-wide privs apis, as well as per-pthread apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* libs: make privilege escalation thread-safeMark Stapp2019-03-051-0/+10
| | | | | | | | | Privs escalation is process-wide, and a multi-threaded process can deadlock. This adds a mutex and a counter to the privs object, preventing multiple threads from making the privs escalation system call. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: add extern "C" {} blocks to all libfrr headersRenato Westphal2019-02-121-0/+8
| | | | | | | These are necessary to use functions defined in these headers from C++. Signed-off-by: David Lamparter <equinox@diac24.net> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: add frr_elevate_privs() wrapperDavid Lamparter2018-08-141-0/+39
| | | | | | | | | | | | | Used as: frr_elevate_privs(&my_privs) { ... code ... } and handles privilege raise/lower automatically in conjunction with the C expression block. This makes it impossible to accidentally exit a function with privileges raised (and then running a whole bunch of other code with privs.) Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: privs: make uid/gid accessible before setuidDavid Lamparter2017-08-021-0/+1
| | | | | | | | This splits off privs_preinit(), which does the lookups for user and group IDs. This is so the init code can create state directories while still running as root. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-51/+45
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* 2005-09-29 Paul Jakma <paul.jakma@sun.com>paul2005-09-291-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Add the test for Solaris least-privileges. Set defines for whether capabilities are supported and whether of the linux or solaris variety. Add missing-prototypes, missing-declarations, char-subscripts and cast-qual warnings to default cflags, cause Hasso enjoys warnings, and we really should clean the remaining ones up. (ie isisd..). * (*/*main.c) Update the zebra_capabilities_t arrays in the various daemons to match the changes made in lib/privs.h. * zebra.h: Solaris capabilities requires priv.h to be included. * privs.{c,h}: Add support for Solaris Least-Privileges. privs.h: Reduce some of the abstract capabilities, which do not have rough equivalents on both systems. Rename the net related caps to _NET, as they should have been in first place. (zprivs_terminate) should take the zebra_privs_t as argument so that it can update change pointer. Add an additional privilege state, ZPRIVS_UNKNOWN. * privs.c: (various capability functions) Add Solaris privileges variants. (zprivs_state) Use privs.c specific generic types to represent various capability/privilege related types, so that each can be typedef'd as appropriate on each platform. (zprivs_null_state) static added, to hold the state the null method should report (should be raised by default, and LOWERED if zprivs_terminate has been called) (zprivs_state_null) Report back the zprivs_null_state. (cap_map) Make it able to map abstract capability to multiple system capabilities. (zcaps2sys) Map to abstract capabilities to multiple system privileges/capabilities. (zprivs_init) move capability related init to seperate function, zprivs_caps_init. (zprivs_terminate) ditto, moved to zprivs_caps_terminate. Set the change_state callback to the NULL state, so the user can continue to run and use the callbacks.
* 2005-05-06 Paul Jakma <paul@dishone.st>paul2005-05-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
* Number of warnings is down to 3 again in lib directory. A lot of const'shasso2004-10-051-3/+3
| | | | added to strings and a lot of int -> unsigned int changes.
* Paul forgot probably to commit privs.[c|h] changes. Had to reorder includeshasso2003-06-041-1/+13
| | | | in zebra.h to make it compile in debian.
* Add additional system capabilitiespaul2003-05-221-0/+4
|
* Privilege support files for zebra.paul2003-05-201-0/+75
Linux capabilities enabled (if libcap is enabled).