1cb5caa98Sdjl /* 2cb5caa98Sdjl * CDDL HEADER START 3cb5caa98Sdjl * 4cb5caa98Sdjl * The contents of this file are subject to the terms of the 5cb5caa98Sdjl * Common Development and Distribution License (the "License"). 6cb5caa98Sdjl * You may not use this file except in compliance with the License. 7cb5caa98Sdjl * 8cb5caa98Sdjl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9cb5caa98Sdjl * or http://www.opensolaris.org/os/licensing. 10cb5caa98Sdjl * See the License for the specific language governing permissions 11cb5caa98Sdjl * and limitations under the License. 12cb5caa98Sdjl * 13cb5caa98Sdjl * When distributing Covered Code, include this CDDL HEADER in each 14cb5caa98Sdjl * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15cb5caa98Sdjl * If applicable, add the following below this CDDL HEADER, with the 16cb5caa98Sdjl * fields enclosed by brackets "[]" replaced with your own identifying 17cb5caa98Sdjl * information: Portions Copyright [yyyy] [name of copyright owner] 18cb5caa98Sdjl * 19cb5caa98Sdjl * CDDL HEADER END 20cb5caa98Sdjl */ 21cb5caa98Sdjl /* 22cb5caa98Sdjl * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23cb5caa98Sdjl * Use is subject to license terms. 24cb5caa98Sdjl */ 25cb5caa98Sdjl 26cb5caa98Sdjl #ifndef _NSCD_FRONTEND_H 27cb5caa98Sdjl #define _NSCD_FRONTEND_H 28cb5caa98Sdjl 29cb5caa98Sdjl #pragma ident "%Z%%M% %I% %E% SMI" 30cb5caa98Sdjl 31cb5caa98Sdjl #ifdef __cplusplus 32cb5caa98Sdjl extern "C" { 33cb5caa98Sdjl #endif 34cb5caa98Sdjl 35cb5caa98Sdjl #include "cache.h" 36cb5caa98Sdjl 37cb5caa98Sdjl #define NSCD_LOOKUP_BUFSIZE 1024 * 16 38cb5caa98Sdjl #define NSCD_DOORBUF_MAXLEN 1024 * 512 39cb5caa98Sdjl #define NSCD_PHDR_LEN(hdrp) ((hdrp)->data_off) 40cb5caa98Sdjl #define NSCD_DATA_LEN(hdrp) ((hdrp)->data_len) 41cb5caa98Sdjl 42cb5caa98Sdjl #define NSCD_ALLOC_LOOKUP_BUFFER(bufp, bufsiz, hdrp, space, spsiz) \ 43cb5caa98Sdjl if ((hdrp)->pbufsiz <= spsiz) { \ 44cb5caa98Sdjl (void) memcpy(space, (hdrp), NSCD_PHDR_LEN((hdrp))); \ 45cb5caa98Sdjl bufp = space; \ 46cb5caa98Sdjl bufsiz = spsiz; \ 47cb5caa98Sdjl hdrp = (nss_pheader_t *)(void *)space; \ 48cb5caa98Sdjl } else { \ 49cb5caa98Sdjl (bufp) = NULL; \ 50cb5caa98Sdjl bufsiz = (hdrp)->pbufsiz; \ 51cb5caa98Sdjl if (bufsiz > spsiz) \ 52cb5caa98Sdjl bufsiz = NSCD_DOORBUF_MAXLEN; \ 53cb5caa98Sdjl (bufp) = alloca(bufsiz); \ 54cb5caa98Sdjl if ((bufp) != NULL) { \ 55cb5caa98Sdjl (void) memcpy((bufp), (hdrp), NSCD_PHDR_LEN(hdrp)); \ 56cb5caa98Sdjl (hdrp) = (nss_pheader_t *)(void *)(bufp); \ 57cb5caa98Sdjl } else { \ 58cb5caa98Sdjl NSCD_SET_STATUS((hdrp), NSS_ERROR, ENOMEM); \ 59cb5caa98Sdjl (void) door_return((char *)(hdrp), \ 60cb5caa98Sdjl NSCD_PHDR_LEN(hdrp), NULL, 0); \ 61cb5caa98Sdjl } \ 62cb5caa98Sdjl } 63cb5caa98Sdjl 64cb5caa98Sdjl #define NSCD_SET_RETURN_ARG(hdrp, arg_size) \ 65cb5caa98Sdjl if (NSCD_STATUS_IS_OK((nss_pheader_t *)(hdrp))) \ 66cb5caa98Sdjl arg_size = NSCD_PHDR_LEN(hdrp) + (NSCD_DATA_LEN(hdrp) > 0 ? \ 67cb5caa98Sdjl NSCD_DATA_LEN(hdrp) + 1 : 0); \ 68cb5caa98Sdjl else \ 69cb5caa98Sdjl arg_size = NSCD_PHDR_LEN(hdrp); 70cb5caa98Sdjl 71cb5caa98Sdjl /* prototypes */ 72cb5caa98Sdjl uid_t _nscd_get_client_euid(); 73cb5caa98Sdjl int _nscd_setup_server(char *execname, char **argv); 74cb5caa98Sdjl int _nscd_setup_child_server(int did); 75cb5caa98Sdjl int _nscd_get_clearance(sema_t *sema); 76cb5caa98Sdjl int _nscd_release_clearance(sema_t *sema); 77cb5caa98Sdjl void _nscd_init_cache_sema(sema_t *sema, char *cache_name); 78cb5caa98Sdjl nscd_rc_t _nscd_alloc_frontend_cfg(); 79*e37190e5Smichen void _nscd_APP_check_cred(void *buf, pid_t *pidp, char *dc_str, 80*e37190e5Smichen int log_comp, int log_level); 81cb5caa98Sdjl #ifdef __cplusplus 82cb5caa98Sdjl } 83cb5caa98Sdjl #endif 84cb5caa98Sdjl 85cb5caa98Sdjl #endif /* _NSCD_FRONTEND_H */ 86