]>
git.proxmox.com Git - mirror_frr.git/blob - lib/privs.h
2 * Zebra privileges header.
4 * Copyright (C) 2003 Paul Jakma.
6 * This file is part of GNU Zebra.
8 * GNU Zebra is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * GNU Zebra is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef _ZEBRA_PRIVS_H
24 #define _ZEBRA_PRIVS_H
26 /* list of zebra capabilities */
40 } zebra_capabilities_t
;
46 } zebra_privs_current_t
;
53 struct zebra_privs_t
{
54 zebra_capabilities_t
*caps_p
; /* caps required for operation */
55 zebra_capabilities_t
*caps_i
; /* caps to allow inheritance of */
56 int cap_num_p
; /* number of caps in arrays */
58 const char *user
; /* user and group to run as */
60 const char *vty_group
; /* group to chown vty socket to */
62 int (*change
)(zebra_privs_ops_t
); /* change privileges, 0 on success */
63 zebra_privs_current_t (*current_state
)(
64 void); /* current privilege state */
69 uid_t uid_priv
; /* privileged uid */
70 uid_t uid_normal
; /* normal uid */
71 gid_t gid_priv
; /* privileged uid */
72 gid_t gid_normal
; /* normal uid */
73 gid_t gid_vty
; /* vty gid */
76 /* initialise zebra privileges */
77 extern void zprivs_preinit(struct zebra_privs_t
*zprivs
);
78 extern void zprivs_init(struct zebra_privs_t
*zprivs
);
79 /* drop all and terminate privileges */
80 extern void zprivs_terminate(struct zebra_privs_t
*);
81 /* query for runtime uid's and gid's, eg vty needs this */
82 extern void zprivs_get_ids(struct zprivs_ids_t
*);
84 #endif /* _ZEBRA_PRIVS_H */