summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv.h
blob: 1da00b647f54098190b272792baf22469bb9c364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* Declarations of privilege functions and types.
   Copyright (C) 2008 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it 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 (at your option) any later version.

   The GNU C Library 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
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#ifndef _SYS_PRIV_H
#define _SYS_PRIV_H

#include <sys/types.h>
#include <sys/priv_names.h>

/* privsys codes */
#define	PRIVSYS_SETPPRIV	0
#define	PRIVSYS_GETPPRIV	1
#define	PRIVSYS_GETIMPLINFO	2
#define	PRIVSYS_SETPFLAGS	3
#define	PRIVSYS_GETPFLAGS	4
#define	PRIVSYS_ISSETUGID	5
#define	PRIVSYS_KLPD_REG	6
#define	PRIVSYS_KLPD_UNREG	7

typedef enum priv_op
{
	PRIV_ON,
	PRIV_OFF,
	PRIV_SET
} priv_op_t;

typedef uint32_t priv_chunk_t;
typedef struct priv_set priv_set_t;
typedef const char *priv_ptype_t;
typedef const char *priv_t;

typedef struct priv_impl_info
{
	uint32_t priv_headersize;
	uint32_t priv_flags;
	uint32_t priv_nsets;
	uint32_t priv_setsize;
	uint32_t priv_max;
	uint32_t priv_infosize;
	uint32_t priv_globalinfosize;
} priv_impl_info_t;

#define PRIV_DEBUG		0x0001
#define PRIV_AWARE		0x0002
#define PRIV_AWARE_INHERIT	0x0004
#define __PROC_PROTECT		0x0008
#define NET_MAC_AWARE		0x0010
#define NET_MAC_AWARE_INHERIT	0x0020
#define PRIV_XPOLICY		0x0080
#define PRIV_USER		(PRIV_DEBUG | NET_MAC_AWARE | \
	NET_MAC_AWARE_INHERIT |  PRIV_XPOLICY)

#define PRIV_IMPL_INFO_SIZE(p) \
	((p)->priv_headersize + (p)->priv_globalinfosize)

typedef struct priv_info
{
	uint32_t priv_info_type;
	uint32_t priv_info_size;
} priv_info_t;

typedef struct priv_info_uint
{
	priv_info_t info;
	uint_t val;
} priv_info_uint_t;

typedef struct priv_info_set
{
	priv_info_t info;
	priv_chunk_t set[1];
} priv_info_set_t;

typedef struct priv_info_names
{
	priv_info_t info;
	int cnt;
	char names[1];
} priv_info_names_t;

#define PRIV_PRPRIV_INFO_OFFSET(p) \
	(sizeof (prpriv_t) + sizeof (priv_chunk_t)) * \
	((p)->pr_nsets * (p)->pr_setsize - 1)

#define PRIV_PRPRIV_SIZE(p) \
	(PRIV_PRPRIV_INFO_OFFSET(p) + (p)->pr_infosize)

#define PRIV_ALL	(-1)
#define PRIV_MULTIPLE	(-2)
#define PRIV_NONE	(-3)
#define PRIV_ALLZONE	(-4)
#define PRIV_GLOBAL	(-5)

#define PRIV_INFO_SETNAMES	1
#define PRIV_INFO_PRIVNAMES	2
#define PRIV_INFO_BASICPRIVS	3
#define PRIV_INFO_FLAGS		4

#endif /* _SYS_PRIV_H */