SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from OpenSuSE shadow-4.6-lp151.2.3.2.x86_64.rpm

SHADOW

Section: Library Calls (3)
Updated: 04/29/2018
Index 

NAME

shadow, getspnam - 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);

struct spwd *sgetspent(char*cp);

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

int lckpwdf();

int ulckpwdf(); 

DESCRIPTION

shadowmanipulates the contents of the shadow password file,/etc/shadow. The structure in the#includefile is:

struct spwd {      char              *sp_namp; /* user login name */      char              *sp_pwdp; /* encrypted password */      long int          sp_lstchg; /* last password change */      long int          sp_min; /* days until change allowed. */      long int          sp_max; /* days before change required */      long int          sp_warn; /* days warning for expiration */      long int          sp_inact; /* days before account inactive */      long int          sp_expire; /* date when account expires */      unsigned long int sp_flag; /* reserved for future use */}    

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_min - days before which password may not be changed

*sp_max - days after which password must be changed

*sp_warn - days before password is to expire that user is warned of pending password expiration

*sp_inact - days after password expires that account is considered inactive and disabled

*sp_expire - days since Jan 1, 1970 when account will be disabled

*sp_flag - reserved for future use
 

DESCRIPTION

getspent,getspname,fgetspent, andsgetspenteach return a pointer to astruct spwd.getspentreturns the next entry from the file, andfgetspentreturns the next entry from the given stream, which is assumed to be a file of the proper format.sgetspentreturns a pointer to astruct spwdusing the provided string as input.getspnamsearches from the current position in the file for an entry matchingname.

setspentandendspentmay be used to begin and end, respectively, access to the shadow password file.

Thelckpwdfandulckpwdfroutines should be used to insure exclusive access to the/etc/shadowfile.lckpwdfattempts to acquire a lock usingpw_lockfor up to 15 seconds. It continues by attempting to acquire a second lock usingspw_lockfor the remainder of the initial 15 seconds. Should either attempt fail after a total of 15 seconds,lckpwdfreturns -1. When both locks are acquired 0 is returned. 

DIAGNOSTICS

Routines return NULL if no more entries are available or if an error occurs during processing. Routines which haveintas the return value return 0 for success and -1 for failure. 

CAVEATS

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

FILES

/etc/shadow

Secure user account information.
 

SEE ALSO

getpwent(3),shadow(5).


 

Index

NAME
SYNTAX
DESCRIPTION
DESCRIPTION
DIAGNOSTICS
CAVEATS
FILES
SEE ALSO

This document was created byman2html,using the manual pages.