xref: /titanic_44/usr/src/head/secdb.h (revision 07925104db56e5c3eacc4865b918bd16af5cec59)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5d3186a0eSjeanm  * Common Development and Distribution License (the "License").
6d3186a0eSjeanm  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22134a1f4eSCasper H.S. Dik  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef	_SECDB_H
267c478bd9Sstevel@tonic-gate #define	_SECDB_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
297c478bd9Sstevel@tonic-gate extern "C" {
307c478bd9Sstevel@tonic-gate #endif
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #define	DEFAULT_POLICY		"solaris"
347c478bd9Sstevel@tonic-gate #define	SUSER_POLICY		"suser"		/* fallback: old policy */
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #define	KV_ACTION		"act"
377c478bd9Sstevel@tonic-gate #define	KV_COMMAND		"cmd"
387c478bd9Sstevel@tonic-gate #define	KV_JAVA_CLASS		"java_class"
397c478bd9Sstevel@tonic-gate #define	KV_JAVA_METHOD		"java_method"
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #define	KV_ASSIGN		"="
427c478bd9Sstevel@tonic-gate #define	KV_DELIMITER		";"
437c478bd9Sstevel@tonic-gate #define	KV_EMPTY		""
447c478bd9Sstevel@tonic-gate #define	KV_ESCAPE		'\\'
457c478bd9Sstevel@tonic-gate #define	KV_ADD_KEYS		16    /* number of key value pairs to realloc */
4607925104Sgww #define	KV_SPECIAL		"=;:\\"
477c478bd9Sstevel@tonic-gate #define	KV_TOKEN_DELIMIT	":"
487c478bd9Sstevel@tonic-gate #define	KV_WILDCARD		"*"
497c478bd9Sstevel@tonic-gate #define	KV_WILDCHAR		'*'
507c478bd9Sstevel@tonic-gate #define	KV_ACTION_WILDCARD	"*;*;*;*;*"
51134a1f4eSCasper H.S. Dik #define	KV_SEPCHAR		','
52134a1f4eSCasper H.S. Dik #define	KV_SEPSTR		","
53*cb8a054bSGlenn Faden #define	KV_OBJECTCHAR		'/'
54*cb8a054bSGlenn Faden #define	KV_OBJECT		"/"
5507925104Sgww #define	KV_AUDIT_DELIMIT	":"
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate #define	KV_FLAG_NONE		0x0000
587c478bd9Sstevel@tonic-gate #define	KV_FLAG_REQUIRED	0x0001
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate  * return status macros for all attribute databases
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate #define	ATTR_FOUND		0	/* Authoritative found */
647c478bd9Sstevel@tonic-gate #define	ATTR_NOT_FOUND		-1	/* Authoritative not found */
657c478bd9Sstevel@tonic-gate #define	ATTR_NO_RECOVERY	-2	/* Non-recoverable errors */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate typedef struct kv_s {
697c478bd9Sstevel@tonic-gate 	char   *key;
707c478bd9Sstevel@tonic-gate 	char   *value;
717c478bd9Sstevel@tonic-gate } kv_t;					/* A key-value pair */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate typedef struct kva_s {
747c478bd9Sstevel@tonic-gate 	int	length;			/* array length */
757c478bd9Sstevel@tonic-gate 	kv_t    *data;			/* array of key value pairs */
767c478bd9Sstevel@tonic-gate } kva_t;				/* Key-value array */
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate extern char *kva_match(kva_t *, char *);
807c478bd9Sstevel@tonic-gate extern int _auth_match(const char *, const char *);
817c478bd9Sstevel@tonic-gate extern char *_argv_to_csl(char **strings);
827c478bd9Sstevel@tonic-gate extern char **_csl_to_argv(char *csl);
837c478bd9Sstevel@tonic-gate extern char *_do_unescape(char *src);
847c478bd9Sstevel@tonic-gate extern void _free_argv(char **p_argv);
857c478bd9Sstevel@tonic-gate extern int _insert2kva(kva_t *, char *, char *);
867c478bd9Sstevel@tonic-gate extern int _kva2str(kva_t *, char *, int, char *, char *);
877c478bd9Sstevel@tonic-gate extern kva_t *_kva_dup(kva_t *);
887c478bd9Sstevel@tonic-gate extern void _kva_free(kva_t *);
897c478bd9Sstevel@tonic-gate extern kva_t *_new_kva(int size);
907c478bd9Sstevel@tonic-gate extern kva_t *_str2kva(char *, char *, char *);
91134a1f4eSCasper H.S. Dik extern int _enum_auths(const char *, int (*)(const char *, void *, void *),
92134a1f4eSCasper H.S. Dik     void *ctxt, void *pres);
93134a1f4eSCasper H.S. Dik extern int _enum_profs(const char *,
94134a1f4eSCasper H.S. Dik     int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres);
95134a1f4eSCasper H.S. Dik extern int _enum_attrs(const char *,
96134a1f4eSCasper H.S. Dik     int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres);
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
997c478bd9Sstevel@tonic-gate }
1007c478bd9Sstevel@tonic-gate #endif
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate #endif	/* _SECDB_H */
103