xref: /illumos-gate/usr/src/lib/nsswitch/nis/common/getauthattr.c (revision a5f69788de7ac07553de47f7fec8c05a9a94c105)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <sys/types.h>
30 #include <auth_attr.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include "nis_common.h"
34 
35 static nss_status_t
36 getbynam(nis_backend_ptr_t be, void *a)
37 {
38 	nss_XbyY_args_t *argp = (nss_XbyY_args_t *)a;
39 
40 	return (_nss_nis_lookup(be,
41 		argp, 0, NIS_MAP_AUTHATTR, argp->key.name, 0));
42 }
43 
44 static nis_backend_op_t authattr_ops[] = {
45 	_nss_nis_destr,
46 	_nss_nis_endent,
47 	_nss_nis_setent,
48 	_nss_nis_getent_netdb,
49 	getbynam
50 };
51 
52 nss_backend_t  *
53 _nss_nis_auth_attr_constr(const char *dummy1,
54     const char *dummy2,
55     const char *dummy3,
56     const char *dummy4,
57     const char *dummy5,
58     const char *dummy6)
59 {
60 	return (_nss_nis_constr(authattr_ops,
61 		sizeof (authattr_ops)/sizeof (authattr_ops[0]),
62 		NIS_MAP_AUTHATTR));
63 }
64