xref: /onnv-gate/usr/src/lib/nsswitch/files/common/getuserattr.c (revision 2830:5228d1267a01)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*2830Sdjl  * Common Development and Distribution License (the "License").
6*2830Sdjl  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*2830Sdjl  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*2830Sdjl  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate 
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include "files_common.h"
300Sstevel@tonic-gate #include <user_attr.h>
310Sstevel@tonic-gate #include <string.h>
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
340Sstevel@tonic-gate  *    files/getuserattr.c --
350Sstevel@tonic-gate  *           "files" backend for nsswitch "user_attr" database
360Sstevel@tonic-gate  */
370Sstevel@tonic-gate 
380Sstevel@tonic-gate static nss_status_t
getbyname(files_backend_ptr_t be,void * a)390Sstevel@tonic-gate getbyname(files_backend_ptr_t be, void *a)
400Sstevel@tonic-gate {
410Sstevel@tonic-gate 	nss_XbyY_args_t *argp = (nss_XbyY_args_t *)a;
420Sstevel@tonic-gate 
43*2830Sdjl 	return (_nss_files_XY_all(be, argp, 1, argp->key.name,
44*2830Sdjl 			_nss_files_check_name_colon));
450Sstevel@tonic-gate }
460Sstevel@tonic-gate 
470Sstevel@tonic-gate static files_backend_op_t userattr_ops[] = {
480Sstevel@tonic-gate 	_nss_files_destr,
490Sstevel@tonic-gate 	_nss_files_endent,
500Sstevel@tonic-gate 	_nss_files_setent,
510Sstevel@tonic-gate 	_nss_files_getent_netdb,
520Sstevel@tonic-gate 	getbyname
530Sstevel@tonic-gate };
540Sstevel@tonic-gate 
55*2830Sdjl /*ARGSUSED*/
560Sstevel@tonic-gate nss_backend_t *
_nss_files_user_attr_constr(const char * dummy1,const char * dummy2,const char * dummy3,const char * dummy4,const char * dummy5)570Sstevel@tonic-gate _nss_files_user_attr_constr(const char *dummy1,
580Sstevel@tonic-gate     const char *dummy2,
590Sstevel@tonic-gate     const char *dummy3,
600Sstevel@tonic-gate     const char *dummy4,
610Sstevel@tonic-gate     const char *dummy5)
620Sstevel@tonic-gate {
630Sstevel@tonic-gate 	return (_nss_files_constr(userattr_ops,
640Sstevel@tonic-gate 	    sizeof (userattr_ops) / sizeof (userattr_ops[0]),
650Sstevel@tonic-gate 	    USERATTR_FILENAME,
660Sstevel@tonic-gate 	    NSS_LINELEN_USERATTR,
670Sstevel@tonic-gate 	    NULL));
680Sstevel@tonic-gate }
69