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 /* 22*134a1f4eSCasper 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 */ 467c478bd9Sstevel@tonic-gate #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 "*;*;*;*;*" 51*134a1f4eSCasper H.S. Dik #define KV_SEPCHAR ',' 52*134a1f4eSCasper H.S. Dik #define KV_SEPSTR "," 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #define KV_FLAG_NONE 0x0000 557c478bd9Sstevel@tonic-gate #define KV_FLAG_REQUIRED 0x0001 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* 587c478bd9Sstevel@tonic-gate * return status macros for all attribute databases 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate #define ATTR_FOUND 0 /* Authoritative found */ 617c478bd9Sstevel@tonic-gate #define ATTR_NOT_FOUND -1 /* Authoritative not found */ 627c478bd9Sstevel@tonic-gate #define ATTR_NO_RECOVERY -2 /* Non-recoverable errors */ 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate typedef struct kv_s { 667c478bd9Sstevel@tonic-gate char *key; 677c478bd9Sstevel@tonic-gate char *value; 687c478bd9Sstevel@tonic-gate } kv_t; /* A key-value pair */ 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate typedef struct kva_s { 717c478bd9Sstevel@tonic-gate int length; /* array length */ 727c478bd9Sstevel@tonic-gate kv_t *data; /* array of key value pairs */ 737c478bd9Sstevel@tonic-gate } kva_t; /* Key-value array */ 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate extern char *kva_match(kva_t *, char *); 777c478bd9Sstevel@tonic-gate extern int _auth_match(const char *, const char *); 787c478bd9Sstevel@tonic-gate extern char *_argv_to_csl(char **strings); 797c478bd9Sstevel@tonic-gate extern char **_csl_to_argv(char *csl); 807c478bd9Sstevel@tonic-gate extern char *_do_unescape(char *src); 817c478bd9Sstevel@tonic-gate extern void _free_argv(char **p_argv); 827c478bd9Sstevel@tonic-gate extern int _insert2kva(kva_t *, char *, char *); 837c478bd9Sstevel@tonic-gate extern int _kva2str(kva_t *, char *, int, char *, char *); 847c478bd9Sstevel@tonic-gate extern kva_t *_kva_dup(kva_t *); 857c478bd9Sstevel@tonic-gate extern void _kva_free(kva_t *); 867c478bd9Sstevel@tonic-gate extern kva_t *_new_kva(int size); 877c478bd9Sstevel@tonic-gate extern kva_t *_str2kva(char *, char *, char *); 88*134a1f4eSCasper H.S. Dik extern int _enum_auths(const char *, int (*)(const char *, void *, void *), 89*134a1f4eSCasper H.S. Dik void *ctxt, void *pres); 90*134a1f4eSCasper H.S. Dik extern int _enum_profs(const char *, 91*134a1f4eSCasper H.S. Dik int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres); 92*134a1f4eSCasper H.S. Dik extern int _enum_attrs(const char *, 93*134a1f4eSCasper H.S. Dik int (*)(const char *, kva_t *, void *, void *), void *ctxt, void *pres); 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate #ifdef __cplusplus 967c478bd9Sstevel@tonic-gate } 977c478bd9Sstevel@tonic-gate #endif 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate #endif /* _SECDB_H */ 100