xref: /titanic_41/usr/src/man/man3c/putspent.3c (revision 6a1af1a67532df169a657cce07140be64bdea084)
te
Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
Copyright 1989 AT&T
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
putspent 3C "23 Jan 2008" "SunOS 5.11" "Standard C Library Functions"
NAME
putspent - write shadow password file entry
SYNOPSIS

#include <shadow.h>

int putspent(const struct spwd *p, FILE *fp);
DESCRIPTION

The putspent() function is the inverse of getspent(). See getspnam(3C). Given a pointer to a spwd structure created by getspent() or getspnam(), putspent() writes a line on the stream fp that matches the format of /etc/shadow.

The spwd structure contains the following members:

char *sp_namp;
char *sp_pwdp;
int sp_lstchg;
int sp_min;
int sp_max;
int sp_warn;
int sp_inact;
int sp_expire;
unsigned int sp_flag;

If the sp_min, sp_max, sp_lstchg, sp_warn, sp_inact, or sp_expire member of the spwd structure is -1, or if sp_flag is 0, the corresponding /etc/shadow field is cleared.

RETURN VALUES

The putspent() function returns a non-zero value if an error was detected during its operation. Otherwise, it returns 0.

USAGE

Since this function is for internal use only, compatibility is not guaranteed. For this reason, its use is discouraged. If used at all, if should be used with putpwent(3C) to update the password file.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelUnsafe
SEE ALSO

getpwnam(3C), getspnam(3C), putpwent(3C), attributes(5)