DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

dblock(S-osr5)


dblock: enter_quiet_zone, exit_quiet_zone, make_transition_files, replace_file -- authentication database locking routines

Syntax

cc . . . -lprot -lx

#include <sys/types.h>
#include <prot.h>

void enter_quiet_zone ()

void exit_quiet_zone ()

int make_transition_files (pathname, ptempp, poldp) register char *pathname; register char **ptempp; register char **poldp;

int replace_file (tempp, pathname, oldp) register char *tempp; register char *pathname; register char *oldp;

Description

The enter_quiet_zone(S-osr5) and exit_quiet_zone(S-osr5) routines provide a way to enter and exit regions of code where the process is undisturbed by all external signals. This is helpful on sensitive regions of code where the security state is being altered and to disrupt the entire operation would leave the system in an insecure state or a state from which it is hard to recover.

enter_quiet_zone( ) blocks off all keyboard signals, including SIGHUP, SIGINT, and SIGQUIT. The result of this blocking is that delivery of any signals will be delayed until they are unblocked in the call to exit_quiet_zone( ).

Pairs of calls to enter_quiet_zone( ) and exit_quiet_zone( ) may be nested, but it is important that the number of exit_quiet_zone( ) calls match the number of enter_quiet_zone( ) calls. Signals are blocked on the first call to enter_quiet_zone( ), and only unblocked on the last call to exit_quiet_zone( ).

The routines make_transition_files(S-osr5) and replace_file(S-osr5) are used together to update one of the authentication database files.

make_transition_files( ) takes the input argument pathname and generates two new file names. Pointers to the new file names are stored in the locations referenced by the pointers poldp and ptempp. The pointer referenced by poldp points to the name used to rename the existing file referenced by pathname so that it may be recovered if the update fails. The pointer referenced by ptempp points to the name to be used for the new file intended to replace the existing file referenced by pathname. Note that malloc(S-osr5) is used to create space for poldp and ptempp, and that files are not actually opened or otherwise referenced by make_transition_files( ).

replace_file( ) uses the same arguments (those given to and modified by a previous call to make_transition_files( )) to manipulate the actual files. It expects that pathname references the existing file, tempp references the newly created file, and oldp references the place that the existing file is to be moved to should an error occur in placing the new file in pathname. replace_file( ) frees the space allocated for the names in make_transition_files( ).

Notes

Any program calling these routines should call set_auth_parameters(S-osr5) as the first action in main().

Return values

make_transition_files( ) returns a value of 1 if the names were generated, and 0 if they were not.

replace_file( ) returns a value of 1 if the file operations were successful and 0 if they were not.

See also

identity(S-osr5), sigprocmask(S-osr5), malloc(S-osr5)

Standards conformance

The dblock routines are extensions of AT&T System V provided by the Santa Cruz Operation.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005