4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
25 * files/getrpcent.c -- "files" backend for nsswitch "rpc" database
28 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include <rpc/rpcent.h>
31 #include "files_common.h"
38 files_backend_ptr_t be
;
41 nss_XbyY_args_t
*argp
= (nss_XbyY_args_t
*)a
;
43 return (_nss_files_XY_all(be
, argp
, 1, argp
->key
.name
,
44 _nss_files_check_name_aliases
));
48 check_rpcnum(nss_XbyY_args_t
*argp
, const char *line
, int linelen
)
51 const char *limit
, *linep
;
54 limit
= line
+ linelen
;
57 while (linep
< limit
&& !isspace(*linep
))
59 /* skip the delimiting spaces */
60 while (linep
< limit
&& isspace(*linep
))
64 r_number
= (int)strtol(linep
, NULL
, 10);
65 return (r_number
== argp
->key
.number
);
71 files_backend_ptr_t be
;
74 nss_XbyY_args_t
*argp
= (nss_XbyY_args_t
*)a
;
77 (void) snprintf(numstr
, 12, "%d", argp
->key
.number
);
78 return (_nss_files_XY_all(be
, argp
, 1, numstr
, check_rpcnum
));
81 static files_backend_op_t rpc_ops
[] = {
85 _nss_files_getent_netdb
,
92 _nss_files_rpc_constr(dummy1
, dummy2
, dummy3
)
93 const char *dummy1
, *dummy2
, *dummy3
;
95 return (_nss_files_constr(rpc_ops
,
96 sizeof (rpc_ops
) / sizeof (rpc_ops
[0]),