1*1676Sjpk /* 2*1676Sjpk * CDDL HEADER START 3*1676Sjpk * 4*1676Sjpk * The contents of this file are subject to the terms of the 5*1676Sjpk * Common Development and Distribution License (the "License"). 6*1676Sjpk * You may not use this file except in compliance with the License. 7*1676Sjpk * 8*1676Sjpk * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*1676Sjpk * or http://www.opensolaris.org/os/licensing. 10*1676Sjpk * See the License for the specific language governing permissions 11*1676Sjpk * and limitations under the License. 12*1676Sjpk * 13*1676Sjpk * When distributing Covered Code, include this CDDL HEADER in each 14*1676Sjpk * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*1676Sjpk * If applicable, add the following below this CDDL HEADER, with the 16*1676Sjpk * fields enclosed by brackets "[]" replaced with your own identifying 17*1676Sjpk * information: Portions Copyright [yyyy] [name of copyright owner] 18*1676Sjpk * 19*1676Sjpk * CDDL HEADER END 20*1676Sjpk */ 21*1676Sjpk /* 22*1676Sjpk * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*1676Sjpk * Use is subject to license terms. 24*1676Sjpk */ 25*1676Sjpk 26*1676Sjpk #pragma ident "%Z%%M% %I% %E% SMI" 27*1676Sjpk 28*1676Sjpk #include "files_common.h" 29*1676Sjpk #include <sys/tsol/tndb.h> 30*1676Sjpk #include <string.h> 31*1676Sjpk 32*1676Sjpk /* 33*1676Sjpk * files/tsol_gettpent.c -- 34*1676Sjpk * "files" backend for nsswitch "tnrhtp" database 35*1676Sjpk */ 36*1676Sjpk static int 37*1676Sjpk check_name(nss_XbyY_args_t *args) 38*1676Sjpk { 39*1676Sjpk tsol_tpstr_t *tpstrp = (tsol_tpstr_t *)args->returnval; 40*1676Sjpk const char *name = args->key.name; 41*1676Sjpk 42*1676Sjpk if (strcmp(tpstrp->template, name) == 0) 43*1676Sjpk return (1); 44*1676Sjpk 45*1676Sjpk return (0); 46*1676Sjpk } 47*1676Sjpk 48*1676Sjpk static nss_status_t 49*1676Sjpk getbyname(be, a) 50*1676Sjpk files_backend_ptr_t be; 51*1676Sjpk void *a; 52*1676Sjpk { 53*1676Sjpk nss_XbyY_args_t *argp = (nss_XbyY_args_t *)a; 54*1676Sjpk 55*1676Sjpk return (_nss_files_XY_all(be, argp, 1, argp->key.name, check_name)); 56*1676Sjpk } 57*1676Sjpk 58*1676Sjpk static files_backend_op_t tsol_tp_ops[] = { 59*1676Sjpk _nss_files_destr, 60*1676Sjpk _nss_files_endent, 61*1676Sjpk _nss_files_setent, 62*1676Sjpk _nss_files_getent_netdb, 63*1676Sjpk getbyname 64*1676Sjpk }; 65*1676Sjpk 66*1676Sjpk nss_backend_t * 67*1676Sjpk _nss_files_tnrhtp_constr(dummy1, dummy2, dummy3) 68*1676Sjpk const char *dummy1, *dummy2, *dummy3; 69*1676Sjpk { 70*1676Sjpk return (_nss_files_constr(tsol_tp_ops, 71*1676Sjpk sizeof (tsol_tp_ops) / sizeof (tsol_tp_ops[0]), 72*1676Sjpk "/etc/security/tsol/tnrhtp", 73*1676Sjpk NSS_LINELEN_TSOL_TP, 74*1676Sjpk NULL)); 75*1676Sjpk } 76