1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate /* 28*0Sstevel@tonic-gate * nis_common.h 29*0Sstevel@tonic-gate * 30*0Sstevel@tonic-gate * Common code and structures used by name-service-switch "nis" backends. 31*0Sstevel@tonic-gate */ 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate #ifndef _NIS_COMMON_H 34*0Sstevel@tonic-gate #define _NIS_COMMON_H 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #include <nss_dbdefs.h> 39*0Sstevel@tonic-gate #include <signal.h> 40*0Sstevel@tonic-gate #include <rpcsvc/ypclnt.h> 41*0Sstevel@tonic-gate #include <rpcsvc/yp_prot.h> 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate #ifdef __cplusplus 44*0Sstevel@tonic-gate extern "C" { 45*0Sstevel@tonic-gate #endif 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate #define NIS_MAP_AUDITUSER "audit_user" 48*0Sstevel@tonic-gate #define NIS_MAP_AUTHATTR "auth_attr" 49*0Sstevel@tonic-gate #define NIS_MAP_EXECATTR "exec_attr" 50*0Sstevel@tonic-gate #define NIS_MAP_PROFATTR "prof_attr" 51*0Sstevel@tonic-gate #define NIS_MAP_USERATTR "user_attr" 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate typedef struct nis_backend *nis_backend_ptr_t; 55*0Sstevel@tonic-gate typedef nss_status_t (*nis_backend_op_t)(nis_backend_ptr_t, void *); 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate struct nis_backend { 58*0Sstevel@tonic-gate nis_backend_op_t *ops; 59*0Sstevel@tonic-gate nss_dbop_t n_ops; 60*0Sstevel@tonic-gate const char *domain; 61*0Sstevel@tonic-gate const char *enum_map; 62*0Sstevel@tonic-gate char *enum_key; 63*0Sstevel@tonic-gate int enum_keylen; 64*0Sstevel@tonic-gate }; 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate /* 67*0Sstevel@tonic-gate * Iterator function for _nss_nis_do_all(), which probably calls yp_all(). 68*0Sstevel@tonic-gate * NSS_NOTFOUND means "keep enumerating", NSS_SUCCESS means"return now", 69*0Sstevel@tonic-gate * other values don't make much sense. In other words we're abusing 70*0Sstevel@tonic-gate * (overloading) the meaning of nss_status_t, but hey... 71*0Sstevel@tonic-gate * _nss_nis_XY_all() is a wrapper around _nss_nis_do_all() that does the 72*0Sstevel@tonic-gate * generic work for nss_XbyY_args_t backends (calls cstr2ent etc). 73*0Sstevel@tonic-gate */ 74*0Sstevel@tonic-gate typedef nss_status_t (*nis_do_all_func_t)(const char *, int, void *priv); 75*0Sstevel@tonic-gate typedef int (*nis_XY_check_func)(nss_XbyY_args_t *); 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate extern nss_backend_t *_nss_nis_constr(nis_backend_op_t *ops, 78*0Sstevel@tonic-gate int n_ops, 79*0Sstevel@tonic-gate const char *map); 80*0Sstevel@tonic-gate extern nss_status_t _nss_nis_destr(nis_backend_ptr_t, void *dummy); 81*0Sstevel@tonic-gate extern nss_status_t _nss_nis_setent(nis_backend_ptr_t, void *dummy); 82*0Sstevel@tonic-gate extern nss_status_t _nss_nis_endent(nis_backend_ptr_t, void *dummy); 83*0Sstevel@tonic-gate extern nss_status_t _nss_nis_getent_rigid(nis_backend_ptr_t, void *); 84*0Sstevel@tonic-gate extern nss_status_t _nss_nis_getent_netdb(nis_backend_ptr_t, void *); 85*0Sstevel@tonic-gate extern nss_status_t _nss_nis_do_all(nis_backend_ptr_t, 86*0Sstevel@tonic-gate void *func_priv, 87*0Sstevel@tonic-gate const char *filter, 88*0Sstevel@tonic-gate nis_do_all_func_t func); 89*0Sstevel@tonic-gate extern nss_status_t _nss_nis_XY_all(nis_backend_ptr_t, 90*0Sstevel@tonic-gate nss_XbyY_args_t *check_args, 91*0Sstevel@tonic-gate int netdb, 92*0Sstevel@tonic-gate const char *filter, 93*0Sstevel@tonic-gate nis_XY_check_func check); 94*0Sstevel@tonic-gate extern nss_status_t _nss_nis_lookup(nis_backend_ptr_t, 95*0Sstevel@tonic-gate nss_XbyY_args_t *args, 96*0Sstevel@tonic-gate int netdb, 97*0Sstevel@tonic-gate const char *map, 98*0Sstevel@tonic-gate const char *key, 99*0Sstevel@tonic-gate int *yp_statusp); 100*0Sstevel@tonic-gate extern nss_status_t _nss_nis_lookup_rsvdport(nis_backend_ptr_t be, 101*0Sstevel@tonic-gate nss_XbyY_args_t *args, 102*0Sstevel@tonic-gate int netdb, 103*0Sstevel@tonic-gate const char *map, 104*0Sstevel@tonic-gate const char *key, 105*0Sstevel@tonic-gate int *ypstatusp); 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate /* Lower-level interface */ 108*0Sstevel@tonic-gate extern nss_status_t _nss_nis_ypmatch(const char *domain, 109*0Sstevel@tonic-gate const char *map, 110*0Sstevel@tonic-gate const char *key, 111*0Sstevel@tonic-gate char **valp, 112*0Sstevel@tonic-gate int *vallenp, 113*0Sstevel@tonic-gate int *yp_statusp); 114*0Sstevel@tonic-gate extern const char *_nss_nis_domain(); 115*0Sstevel@tonic-gate extern int __nss2herrno(nss_status_t nsstat); 116*0Sstevel@tonic-gate extern int _thr_sigsetmask(int how, const sigset_t *set, sigset_t *oset); 117*0Sstevel@tonic-gate extern int _mutex_lock(mutex_t *mp); 118*0Sstevel@tonic-gate extern int _mutex_unlock(mutex_t *mp); 119*0Sstevel@tonic-gate 120*0Sstevel@tonic-gate /* private yp "configurable lookup persistence" interface in libnsl */ 121*0Sstevel@tonic-gate extern int __yp_match_cflookup(char *, char *, char *, int, char **, 122*0Sstevel@tonic-gate int *, int *); 123*0Sstevel@tonic-gate extern int __yp_match_rsvdport_cflookup(char *, char *, char *, int, char **, 124*0Sstevel@tonic-gate int *, int *); 125*0Sstevel@tonic-gate extern int __yp_first_cflookup(char *, char *, char **, int *, char **, 126*0Sstevel@tonic-gate int *, int); 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate extern int __yp_next_cflookup(char *, char *, char *, int, char **, int *, 129*0Sstevel@tonic-gate char **, int *, int); 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate extern int __yp_all_cflookup(char *, char *, struct ypall_callback *, int); 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gate #ifdef __cplusplus 134*0Sstevel@tonic-gate } 135*0Sstevel@tonic-gate #endif 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate #endif /* _NIS_COMMON_H */ 138