SHADOW

Section: C Library Functions (3)
Index Return to Main Contents
 

NAME

shadow - encrypted password file routines  

Syntax

#include <shadow.h>
struct spwd *getspent();
struct spwd *getspnam(char * name);
void setspent();
void endspent();
struct spwd *fgetspent(FILE *fp);
int putspent(struct spwd *p,FILE *fp);
 

DESCRIPTION

shadow manipulates the contents of the shadow password file, /etc/shadow. The structure in the #include file is
struct spwd {
       char    *sp_namp; /* user login name */

       char    *sp_pwdp; /* encrypted password */

       long    sp_lstchg; /* last password change */

       int     sp_max; /* days before change required */

       int     sp_min; /* days until change allowed. */

}

The meanings of each field are

sp_namp - pointer to null-terminated user name.
sp_pwdp - pointer to null-terminated password.
sp_lstchg - days since Jan 1, 1970 password was last changed.
sp_max - days after which password must be changed
sp_min - days before which password may not be changed.
 

Description

getspent, getspname, and fgetspent each return a pointer to a struct spent. getspent returns the next entry from the file, and fgetspent returns the next entry from the given stream, which is assumed to be a file of the proper format. getspnam searches from the current position in the file for an entry matching name.

setspent and endspent may be used to begin and end, respectively, access to the shadow password file.  

Diagnostics

Routines return NULL if no more entries are available or if an error occurs during processing.  

Caveats

These routines may only be used by the super user as access to the shadow password file is restricted.  

Files

/etc/shadow - encrypted user passwords  

See Also

getpwent(3), shadow(4)


 

Index

NAME
Syntax
DESCRIPTION
Description
Diagnostics
Caveats
Files
See Also

This document was created by man2html, using the manual pages.
Time: 06:55:55 GMT, December 12, 2024