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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
30 #pragma weak _getpwnam = getpwnam
31 #pragma weak _getpwuid = getpwuid
34 #include <sys/types.h>
36 #include <nss_dbdefs.h>
40 void _nss_initf_passwd(nss_db_params_t
*p
);
41 void _nss_XbyY_fgets(FILE *, nss_XbyY_args_t
*);
42 int str2passwd(const char *, int, void *, char *, int);
44 static struct passwd _pw_passwd
;
45 static char _pw_buf
[NSS_BUFLEN_PASSWD
];
46 static DEFINE_NSS_DB_ROOT(db_root
);
47 static DEFINE_NSS_GETENT(context
);
52 struct passwd
*result
;
54 if ((ret
= getpwuid_r(uid
, &_pw_passwd
, _pw_buf
, sizeof (_pw_buf
),
61 getpwnam(const char *nam
)
63 struct passwd
*result
;
65 if ((ret
= getpwnam_r(nam
, &_pw_passwd
, _pw_buf
, sizeof (_pw_buf
),
75 NSS_XbyY_INIT(&arg
, &_pw_passwd
, _pw_buf
, sizeof(_pw_buf
), str2passwd
);
76 (void) nss_getent(&db_root
, _nss_initf_passwd
, &context
, &arg
);
77 return (NSS_XbyY_FINI(&arg
));
84 NSS_XbyY_INIT(&arg
, &_pw_passwd
, _pw_buf
, sizeof(_pw_buf
), str2passwd
);
85 (void) _nss_XbyY_fgets(f
, &arg
);
86 return (NSS_XbyY_FINI(&arg
));