HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)
g
getspwent(3X) getspwent(3X)
NAME
getspwent(), getspwuid(), getspwaid(), getspwnam(), setspwent(), endspwent(), fgetspwent(), getspwent_r(),
getspwuid_r(), getspwaid_r(), getspwnam_r(), setspwent_r(), endspwent_r(), fgetspwent_r() - get secure
password file entry on trusted systems
SYNOPSIS
#include <pwd.h>
struct s_passwd *getspwent(void);
struct s_passwd *getspwuid(uid_t uid);
struct s_passwd *getspwaid(aid_t aid);
struct s_passwd *getspwnam(const char *name);
void setspwent(void);
void endspwent(void);
struct s_passwd *fgetspwent(FILE *stream);
Obsolescent Interfaces
The following re-entrant interfaces are to be obsoleted:
getspwent_r(), getspwuid_r()
, getspwaid_r(), getspwnam_r()
, setspwent_r(),
endspwent_r(), fgetspwent_r()
.
#include <pwd.h>
int getspwent_r(struct s_passwd *result, char *buffer, int buflen,
FILE **pwfp);
int getspwuid_r(uid_t uid, struct s_passwd *result,
char *buffer, int buflen);
int getspwaid_r(aid_t aid, struct s_passwd *result,
char *buffer, int buflen);
int getspwnam_r(char *name, struct s_passwd *result,
char *buffer, int buflen);
void setspwent_r(FILE **pwfp);
void endspwent_r(FILE **pwfp);
int fgetspwent_r(FILE *f, struct s_passwd *result,
char *buffer, int buflen);
DESCRIPTION
These privileged routines provide access to the protected password database in a manner similar to the way
getpwent(3C) routines handle the regular password file, /etc/passwd .
These routines are particularly useful in situations where it is not necessary to get information from the
regular password file. getspwent(3X) can be used on a trusted system to return the password, audit ID, and
audit flag information. Programs using these routines must be linked with the security library, libsec.
Note that getspwent() routines are no longer supported. They are temporarily available for backward
compatibility. New applications accessing the protected password database on trusted systems should use
the getprpwent() routines. See getprpwent(3).
getspwent() , getspwuid() , getspwaid() , and getspwnam() each returns a pointer to an
object of s_passwd structure. The s_passwd structure is maintained for compatibility with existing
software and consists of five fields as follows:
struct s_passwd {
char *pw_name; /* login name */
char *pw_passwd; /* encrypted password */
char *pw_age; /* password age */
int pw_audid; /* audit ID */
int pw_audflg; /* audit flag 1=on, 0=off */
};
544 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: December 2007 Update