xref: /illumos-gate/usr/src/cmd/nscd/getrpc.c (revision 2a8bcb4e)
1*cb5caa98Sdjl /*
2*cb5caa98Sdjl  * CDDL HEADER START
3*cb5caa98Sdjl  *
4*cb5caa98Sdjl  * The contents of this file are subject to the terms of the
5*cb5caa98Sdjl  * Common Development and Distribution License (the "License").
6*cb5caa98Sdjl  * You may not use this file except in compliance with the License.
7*cb5caa98Sdjl  *
8*cb5caa98Sdjl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*cb5caa98Sdjl  * or http://www.opensolaris.org/os/licensing.
10*cb5caa98Sdjl  * See the License for the specific language governing permissions
11*cb5caa98Sdjl  * and limitations under the License.
12*cb5caa98Sdjl  *
13*cb5caa98Sdjl  * When distributing Covered Code, include this CDDL HEADER in each
14*cb5caa98Sdjl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*cb5caa98Sdjl  * If applicable, add the following below this CDDL HEADER, with the
16*cb5caa98Sdjl  * fields enclosed by brackets "[]" replaced with your own identifying
17*cb5caa98Sdjl  * information: Portions Copyright [yyyy] [name of copyright owner]
18*cb5caa98Sdjl  *
19*cb5caa98Sdjl  * CDDL HEADER END
20*cb5caa98Sdjl  */
21*cb5caa98Sdjl /*
22*cb5caa98Sdjl  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*cb5caa98Sdjl  * Use is subject to license terms.
24*cb5caa98Sdjl  */
25*cb5caa98Sdjl 
26*cb5caa98Sdjl /*
27*cb5caa98Sdjl  * Routines to handle getrpcby* calls in nscd
28*cb5caa98Sdjl  */
29*cb5caa98Sdjl 
30*cb5caa98Sdjl #include "cache.h"
31*cb5caa98Sdjl 
32*cb5caa98Sdjl #define	nam_db	ctx->nsc_db[0]
33*cb5caa98Sdjl #define	num_db	ctx->nsc_db[1]
34*cb5caa98Sdjl 
35*cb5caa98Sdjl #define	NSC_NAME_RPC_BYNAME	"getrpcbyname"
36*cb5caa98Sdjl #define	NSC_NAME_RPC_BYNUMBER	"getrpcbynumber"
37*cb5caa98Sdjl 
38*cb5caa98Sdjl void
rpc_init_ctx(nsc_ctx_t * ctx)39*cb5caa98Sdjl rpc_init_ctx(nsc_ctx_t *ctx) {
40*cb5caa98Sdjl 	ctx->dbname = NSS_DBNAM_RPC;
41*cb5caa98Sdjl 	ctx->file_name = "/etc/rpc";
42*cb5caa98Sdjl 	ctx->db_count = 2;
43*cb5caa98Sdjl 	nam_db = make_cache(nsc_key_ces,
44*cb5caa98Sdjl 			NSS_DBOP_RPC_BYNAME,
45*cb5caa98Sdjl 			NSC_NAME_RPC_BYNAME,
46*cb5caa98Sdjl 			NULL, NULL, NULL, nsc_ht_default, -1);
47*cb5caa98Sdjl 
48*cb5caa98Sdjl 	num_db = make_cache(nsc_key_int,
49*cb5caa98Sdjl 			NSS_DBOP_RPC_BYNUMBER,
50*cb5caa98Sdjl 			NSC_NAME_RPC_BYNUMBER,
51*cb5caa98Sdjl 			NULL, NULL, NULL, nsc_ht_default, -1);
52*cb5caa98Sdjl }
53