2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A /* In getXXent_r(), protect the unsuspecting caller from +/- entries */ 2N/A /* No key to fill in */ 2N/A /* ... but in fgetXXent_r, the caller deserves any +/- entry he gets */ 2N/A /* No key to fill in */ 2N/Astatic int /* 1 means success and more input, 0 means error or no more */ 2N/A char numbuf[
12];
/* Holds -2^31 and trailing ':' */ 2N/A * We want to use strtol() and we have a readonly non-zero-terminated 2N/A * string, so first we copy and terminate the interesting bit. 2N/A * Ugh. (It's convenient to terminate with a colon rather than \0). 2N/A /* Error -- field is too big to be a legit number */ 2N/A /* Error -- expected <integer><colon> */ 2N/A /* Error -- expected <integer><colon> */ 2N/A * str2spwd() -- convert a string to a shadow passwd entry. The parser is 2N/A * more liberal than the passwd or group parsers; since it's legitimate 2N/A * for almost all the fields here to be blank, the parser lets one omit 2N/A * any number of blank fields at the end of the entry. The acceptable 2N/A * forms for '+' and '-' entries are the same as those for normal entries. 2N/A * === Is this likely to do more harm than good? 2N/A * Return values: 0 = success, 1 = parse error, 2 = erange ... 2N/A * The structure pointer passed in is a structure in the caller's space 2N/A * wherein the field pointers would be set to areas in the buffer if 2N/A * need be. instring and buffer should be separate areas. 2N/A /* Overlapping buffer copies are OK */ 2N/A /* quick exit do not entry fill if not needed */ 2N/A }
/* else p was set when we copied name and passwd into the buffer */ 2N/A /* Syntax error -- garbage at end of line */