10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 53179Sjeanm * Common Development and Distribution License (the "License"). 63179Sjeanm * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 2212273SCasper.Dik@Sun.COM * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate #ifndef _SECDB_H 260Sstevel@tonic-gate #define _SECDB_H 270Sstevel@tonic-gate 280Sstevel@tonic-gate #ifdef __cplusplus 290Sstevel@tonic-gate extern "C" { 300Sstevel@tonic-gate #endif 310Sstevel@tonic-gate 320Sstevel@tonic-gate 330Sstevel@tonic-gate #define DEFAULT_POLICY "solaris" 340Sstevel@tonic-gate #define SUSER_POLICY "suser" /* fallback: old policy */ 350Sstevel@tonic-gate 360Sstevel@tonic-gate #define KV_ACTION "act" 370Sstevel@tonic-gate #define KV_COMMAND "cmd" 380Sstevel@tonic-gate #define KV_JAVA_CLASS "java_class" 390Sstevel@tonic-gate #define KV_JAVA_METHOD "java_method" 400Sstevel@tonic-gate 410Sstevel@tonic-gate #define KV_ASSIGN "=" 420Sstevel@tonic-gate #define KV_DELIMITER ";" 430Sstevel@tonic-gate #define KV_EMPTY "" 440Sstevel@tonic-gate #define KV_ESCAPE '\\' 450Sstevel@tonic-gate #define KV_ADD_KEYS 16 /* number of key value pairs to realloc */ 4612788Sgary.winiger@oracle.com #define KV_SPECIAL "=;:\\" 470Sstevel@tonic-gate #define KV_TOKEN_DELIMIT ":" 480Sstevel@tonic-gate #define KV_WILDCARD "*" 490Sstevel@tonic-gate #define KV_WILDCHAR '*' 500Sstevel@tonic-gate #define KV_ACTION_WILDCARD "*;*;*;*;*" 5112273SCasper.Dik@Sun.COM #define KV_SEPCHAR ',' 5212273SCasper.Dik@Sun.COM #define KV_SEPSTR "," 5312578SGlenn.Faden@Sun.COM #define KV_OBJECTCHAR '/' 5412578SGlenn.Faden@Sun.COM #define KV_OBJECT "/" 5512788Sgary.winiger@oracle.com #define KV_AUDIT_DELIMIT ":" 560Sstevel@tonic-gate 570Sstevel@tonic-gate #define KV_FLAG_NONE 0x0000 580Sstevel@tonic-gate #define KV_FLAG_REQUIRED 0x0001 590Sstevel@tonic-gate 600Sstevel@tonic-gate /* 610Sstevel@tonic-gate * return status macros for all attribute databases 620Sstevel@tonic-gate */ 630Sstevel@tonic-gate #define ATTR_FOUND 0 /* Authoritative found */ 640Sstevel@tonic-gate #define ATTR_NOT_FOUND -1 /* Authoritative not found */ 650Sstevel@tonic-gate #define ATTR_NO_RECOVERY -2 /* Non-recoverable errors */ 660Sstevel@tonic-gate 670Sstevel@tonic-gate 680Sstevel@tonic-gate typedef struct kv_s { 690Sstevel@tonic-gate char *key; 700Sstevel@tonic-gate char *value; 710Sstevel@tonic-gate } kv_t; /* A key-value pair */ 720Sstevel@tonic-gate 730Sstevel@tonic-gate typedef struct kva_s { 740Sstevel@tonic-gate int length; /* array length */ 750Sstevel@tonic-gate kv_t *data; /* array of key value pairs */ 760Sstevel@tonic-gate } kva_t; /* Key-value array */ 770Sstevel@tonic-gate 780Sstevel@tonic-gate 790Sstevel@tonic-gate extern char *kva_match(kva_t *, char *); 800Sstevel@tonic-gate extern int _auth_match(const char *, const char *); 810Sstevel@tonic-gate extern char *_argv_to_csl(char **strings); 820Sstevel@tonic-gate extern char **_csl_to_argv(char *csl); 830Sstevel@tonic-gate extern char *_do_unescape(char *src); 840Sstevel@tonic-gate extern void _free_argv(char **p_argv); 850Sstevel@tonic-gate extern int _insert2kva(kva_t *, char *, char *); 860Sstevel@tonic-gate extern int _kva2str(kva_t *, char *, int, char *, char *); 870Sstevel@tonic-gate extern kva_t *_kva_dup(kva_t *); 880Sstevel@tonic-gate extern void _kva_free(kva_t *); 89*12918SJan.Friedel@Sun.COM extern void _kva_free_value(kva_t *, char *); 900Sstevel@tonic-gate extern kva_t *_new_kva(int size); 910Sstevel@tonic-gate extern kva_t *_str2kva(char *, char *, char *); 9212273SCasper.Dik@Sun.COM extern int _enum_auths(const char *, int (*)(const char *, void *, void *), 9312273SCasper.Dik@Sun.COM void *ctxt, void *pres); 9412273SCasper.Dik@Sun.COM extern int _enum_profs(const char *, 9512273SCasper.Dik@Sun.COM int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres); 9612273SCasper.Dik@Sun.COM extern int _enum_attrs(const char *, 9712273SCasper.Dik@Sun.COM int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres); 980Sstevel@tonic-gate 990Sstevel@tonic-gate #ifdef __cplusplus 1000Sstevel@tonic-gate } 1010Sstevel@tonic-gate #endif 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate #endif /* _SECDB_H */ 104