summaryrefslogtreecommitdiff
path: root/lib/libc/gen/getpwent.3
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>1999-05-29 19:11:12 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>1999-05-29 19:11:12 +0000
commitb2a110ce8991f3cd33c033c6958e5eddfc745d25 (patch)
treeff5df48915789b9684e897566ab951b011c428d7 /lib/libc/gen/getpwent.3
parent289bd574ed697e90163fa7f9ceaeff389a7a4dd1 (diff)
repairs
Diffstat (limited to 'lib/libc/gen/getpwent.3')
-rw-r--r--lib/libc/gen/getpwent.358
1 files changed, 28 insertions, 30 deletions
diff --git a/lib/libc/gen/getpwent.3 b/lib/libc/gen/getpwent.3
index 746f3e11d4e..c0de291a2ae 100644
--- a/lib/libc/gen/getpwent.3
+++ b/lib/libc/gen/getpwent.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getpwent.3,v 1.5 1997/07/15 16:30:59 deraadt Exp $
+.\" $OpenBSD: getpwent.3,v 1.6 1999/05/29 19:11:11 aaron Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -60,13 +60,11 @@
.Sh DESCRIPTION
These functions
operate on the password database file
-which is described
-in
+which is described in
.Xr passwd 5 .
Each entry in the database is defined by the structure
-.Ar passwd
-found in the include
-file
+.Em passwd
+found in the include file
.Aq Pa pwd.h :
.Bd -literal -offset indent
struct passwd {
@@ -87,22 +85,20 @@ The functions
.Fn getpwnam
and
.Fn getpwuid
-search the password database for the given login name or user uid,
+search the password database for the given login name or user ID,
respectively, always returning the first one encountered.
.Pp
-The
.Fn getpwent
-function
sequentially reads the password database and is intended for programs
that wish to process the complete list of users.
.Pp
-The
.Fn setpassent
-function
accomplishes two purposes.
First, it causes
.Fn getpwent
-to ``rewind'' to the beginning of the database.
+to
+.Dq rewind
+to the beginning of the database.
Additionally, if
.Fa stayopen
is non-zero, file descriptors are left open, significantly speeding
@@ -115,9 +111,7 @@ It is dangerous for long-running programs to keep the file descriptors
open as the database will become out of date if it is updated while the
program is running.
.Pp
-The
.Fn setpwent
-function
is equivalent to
.Fn setpassent
with an argument of zero.
@@ -127,9 +121,11 @@ The
function
closes any open files.
.Pp
-These routines have been written to ``shadow'' the password file, e.g.
+These routines have been written to
+.Dq shadow
+the password file, e.g.,
allow only certain programs to have access to the encrypted password.
-If the process which calls them has an effective uid of 0, the encrypted
+If the process which calls them has an effective UID of 0, the encrypted
password will be returned, otherwise, the password field of the returned
structure will point to the string
.Ql * .
@@ -138,12 +134,14 @@ The functions
.Fn getpwent ,
.Fn getpwnam ,
and
-.Fn getpwuid ,
+.Fn getpwuid
return a valid pointer to a passwd structure on success
-and a null pointer if end-of-file is reached or an error occurs.
+or a
+.Dv NULL
+pointer if end-of-file is reached or an error occurs.
The
.Fn setpassent
-function returns 0 on failure and 1 on success.
+function returns 0 on failure or 1 on success.
The
.Fn endpwent
and
@@ -153,13 +151,13 @@ have no return value.
.Sh FILES
.Bl -tag -width /etc/master.passwd -compact
.It Pa /etc/pwd.db
-The insecure password database file
+insecure password database file
.It Pa /etc/spwd.db
-The secure password database file
+secure password database file
.It Pa /etc/master.passwd
-The current password file
+current password file
.It Pa /etc/passwd
-A Version 7 format password file
+a Version 7 format password file
.El
.Sh SEE ALSO
.Xr getlogin 2 ,
@@ -169,16 +167,16 @@ A Version 7 format password file
.Xr vipw 8
.Sh HISTORY
The
-.Nm getpwent ,
-.Nm getpwnam ,
-.Nm getpwuid ,
-.Nm setpwent,
+.Fn getpwent ,
+.Fn getpwnam ,
+.Fn getpwuid ,
+.Fn setpwent,
and
-.Nm endpwent
+.Fn endpwent
functions appeared in
.At v7 .
The
-.Nm setpassent
+.Fn setpassent
function appeared in
.Bx 4.3 Reno .
.Sh BUGS
@@ -186,7 +184,7 @@ The functions
.Fn getpwent ,
.Fn getpwnam ,
and
-.Fn getpwuid ,
+.Fn getpwuid
leave their results in an internal static object and return
a pointer to that object. Subsequent calls to
any of these functions