icon Top 9 categories map      RocketAware > man pages >

pw_init(3)

Tips: Browse or Search all pages for efficient awareness of more than 6000 of the most popular reusable and open source applications, functions, libraries, and FAQs.


The "RKT couplings" below include links to source code, updates, additional information, advice, FAQs, and overviews.


Home

Search all pages


Subjects

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...

    

RocketLink!--> Man page versions: OpenBSD



PW_INIT(3)                OpenBSD Programmer's Manual               PW_INIT(3)

NAME
     pw_init, pw_setdir, pw_file, pw_edit, pw_prompt, pw_copy, pw_scan,
     pw_error - utility functions for interactive passwd file updates



SYNOPSIS
     #include <pwd.h>
     #include <util.h>

     void
     pw_init();

     void
     pw_setdir(const char *directory);

     char *
     pw_file(const char *filename);

     void
     pw_edit(int notsetuid, const char *filename);

     void
     pw_prompt();

     void
     pw_copy(int ffd, int tfd, struct passwd *pw);

     int
     pw_scan(char *bp, struct passwd *pw, int *flags);

     void
     pw_error(const char *name, int err, int eval);

DESCRIPTION
     These functions are designed as conveniences for interactive programs
     which update the passwd file and do nothing else.  They generally handle
     errors by printing out a message to the standard error stream and possi-
     bly aborting the process.

     The pw_init() function prepares for a passwd update by unlimiting all re-
     source constraints, disabling core dumps (thus preventing dumping the
     contents of the passwd database into a world-readable file), and dis-
     abling most signals.

     The pw_setdir() function sets an alternative directory where the rest of
     the functions looks for password-related files.  Use this if you are
     writing utilities that should be able to handle password files outside of
     /etc.

     The pw_file() function transforms filenames so that they end up in the
     directory specified to the latest pw_setdir() call.  The rule is that all
     directories are stripped off the given name and only the filename is ap-
     pended to the directory.

     The pw_edit() function runs an editor (named by the environment variable
     EDITOR, or /usr/bin/vi if EDITOR is not set) on the file filename (or
     /etc/ptmp if filename is NULL).  If notsetuid is nonzero, pw_edit() will
     set the effective user and group ID to the real user and group ID before
     running the editor.

     The pw_prompt() function asks the user whether he or she wants to re-edit
     the password file; if the answer is no, pw_prompt() deletes the lock file
     and exits the process.

     The pw_copy() function reads a passwd file from ffd and writes it to tfd,
     updating the entry corresponding to pw->pw_name with the information in
     pw.

     The pw_scan() function accepts in bp a passwd entry as it would be repre-
     sented in /etc/master.passwd and fills in pw with corresponding values;
     string fields in pw will be pointers into bp. Some characters in bp will
     be overwritten with 0s in order to terminate the strings pointed to by
     pw. If flags is non-null, it is filled in with the following flags:

     _PASSWORD_NOUID     The uid field of bp is empty.

     _PASSWORD_NOGID     The gid field of bp is empty.

     _PASSWD_NOCHG       The change field of bp is empty.

     _PASSWD_NOEXP       The expire field of bp is empty.

     The pw_error() function displays an error message, aborts the current
     passwd update, and exits the current process.  If err is non-zero, a
     warning message beginning with name is printed for the current value of
     errno. The process exits with status eval.

RETURN VALUES
     The pw_scan() function prints a warning message and returns 0 if the
     string in the bp argument is not a valid passwd string.  Otherwise,
     pw_scan() returns 1.

FILES
     /etc/master.passwd
     /etc/ptmp

SEE ALSO
     pw_lock(3),  passwd(5)

OpenBSD 2.6                    December 15, 1995                             2

Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY
SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts
Institute of Technology, Free Software Foundation, FreeBSD Inc., and others.



(Corrections, notes, and links courtesy of RocketAware.com)


[Detailed Topics]
OpenBSD sources for pw_init(3)


[Overview Topics]

Up to: Process Limits: Identity - Process ownership and Identity


RocketLink!--> Man page versions: OpenBSD






Rapid-Links: Search | About | Comments | Submit Path: RocketAware > man pages > pw_init.3/
RocketAware.com is a service of Mib Software
Copyright 1999, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments