secdb.h revision 12578:f9062c43c8bc
1112163Sdas/*
2112163Sdas * CDDL HEADER START
3112202Sobrien *
4112202Sobrien * The contents of this file are subject to the terms of the
5112202Sobrien * Common Development and Distribution License (the "License").
6124667Sdas * You may not use this file except in compliance with the License.
7140279Sdas *
8112163Sdas * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9140889Sdas * or http://www.opensolaris.org/os/licensing.
10112202Sobrien * See the License for the specific language governing permissions
11156613Sdeischen * and limitations under the License.
12156613Sdeischen *
13112202Sobrien * When distributing Covered Code, include this CDDL HEADER in each
14112202Sobrien * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15112163Sdas * If applicable, add the following below this CDDL HEADER, with the
16112163Sdas * fields enclosed by brackets "[]" replaced with your own identifying
17112163Sdas * information: Portions Copyright [yyyy] [name of copyright owner]
18112163Sdas *
19112163Sdas * CDDL HEADER END
20112163Sdas */
21/*
22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25#ifndef	_SECDB_H
26#define	_SECDB_H
27
28#ifdef	__cplusplus
29extern "C" {
30#endif
31
32
33#define	DEFAULT_POLICY		"solaris"
34#define	SUSER_POLICY		"suser"		/* fallback: old policy */
35
36#define	KV_ACTION		"act"
37#define	KV_COMMAND		"cmd"
38#define	KV_JAVA_CLASS		"java_class"
39#define	KV_JAVA_METHOD		"java_method"
40
41#define	KV_ASSIGN		"="
42#define	KV_DELIMITER		";"
43#define	KV_EMPTY		""
44#define	KV_ESCAPE		'\\'
45#define	KV_ADD_KEYS		16    /* number of key value pairs to realloc */
46#define	KV_SPECIAL		"=;:\\";
47#define	KV_TOKEN_DELIMIT	":"
48#define	KV_WILDCARD		"*"
49#define	KV_WILDCHAR		'*'
50#define	KV_ACTION_WILDCARD	"*;*;*;*;*"
51#define	KV_SEPCHAR		','
52#define	KV_SEPSTR		","
53#define	KV_OBJECTCHAR		'/'
54#define	KV_OBJECT		"/"
55
56#define	KV_FLAG_NONE		0x0000
57#define	KV_FLAG_REQUIRED	0x0001
58
59/*
60 * return status macros for all attribute databases
61 */
62#define	ATTR_FOUND		0	/* Authoritative found */
63#define	ATTR_NOT_FOUND		-1	/* Authoritative not found */
64#define	ATTR_NO_RECOVERY	-2	/* Non-recoverable errors */
65
66
67typedef struct kv_s {
68	char   *key;
69	char   *value;
70} kv_t;					/* A key-value pair */
71
72typedef struct kva_s {
73	int	length;			/* array length */
74	kv_t    *data;			/* array of key value pairs */
75} kva_t;				/* Key-value array */
76
77
78extern char *kva_match(kva_t *, char *);
79extern int _auth_match(const char *, const char *);
80extern char *_argv_to_csl(char **strings);
81extern char **_csl_to_argv(char *csl);
82extern char *_do_unescape(char *src);
83extern void _free_argv(char **p_argv);
84extern int _insert2kva(kva_t *, char *, char *);
85extern int _kva2str(kva_t *, char *, int, char *, char *);
86extern kva_t *_kva_dup(kva_t *);
87extern void _kva_free(kva_t *);
88extern kva_t *_new_kva(int size);
89extern kva_t *_str2kva(char *, char *, char *);
90extern int _enum_auths(const char *, int (*)(const char *, void *, void *),
91    void *ctxt, void *pres);
92extern int _enum_profs(const char *,
93    int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres);
94extern int _enum_attrs(const char *,
95    int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres);
96
97#ifdef	__cplusplus
98}
99#endif
100
101#endif	/* _SECDB_H */
102