utmpd_library(3) DG/UX B2 Security R4.12MU02 utmpd_library(3)
NAME
utmpdlibrary: dgutmpdaddrecord, dgutmpdremoverecord,
dgrunningwithutmpd - utmp server interface routines in libsm.a
SYNOPSIS
#include <dgutmpdinterface.h>
dgutmpdstatust dgutmpdaddrecord (
char * username,
int usernamel,
char * ttyname,
int ttynamel,
char * hostname,
int hostnamel,
char * idprefix,
int idprefixl,
int sync )
dgutmpdstatust dgutmpdremoverecord (
short termination,
short exitstatus,
pidt pid,
int sync )
int dgrunningwithutmpd ( )
DESCRIPTION
The functions in utmpdlibrary provide support for manipulating the
system utmp and wtmp files via the utmp server (daemon) utmpd(1). No
privilege is required to use these functions, but utmpd will enforce
certain constraints on the supplied arguments, described below.
dgutmpdaddrecord
This function causes a record to be added to the system utmp file,
and a corresponding one to be added to the system wtmp file. The
username, ttyname, and hostname arguments should contain the values
desired for the ut_user, ut_line, and ut_host fields of the utmp
structure. The corresponding username_l, ttyname_l, and hostname_l
arguments are the lengths of the strings, not including any
terminating NULL. This number can be obtained with the strlen(3C)
function. The username can be no more than 8 characters, the ttyname
no more than 12 characters, and the hostname no more than 16
characters. The system will reject the request if the username does
not match the calling process' actual username, or if the ttyname
does not match the pathname of the process' actual controlling tty.
The hostname may only contain printable characters which are not
control codes. The id_prefix is a one or two character identifier
which uniquely identifies the calling program (e.g., xterm(1) uses
"xt", telnetd(1M) uses "tn"). This prevents collisions in the utmp
file. Finally, the sync option indicates whether or not the utmp
server should operate synchronously with regard to this request. If
this argument is 0 (the normally recommended value), this function
will return to the caller as soon as the request has been submitted
to the server. The request has not necessarily been processed yet,
but this way the client need not wait until the server has gotten to
it before proceeding to its next task. If the sync argument is 1,
the function will not return until it receives acknowledgement from
the server that the request has been processed.
This function returns DG_UTMPD_STATUS_OK on success, or an enum value
that indicates what error occurred on failure. These enum values are
defined in dgutmpdinterface.h.
dgutmpdremoverecord
This function causes a record to be removed from the system utmp
file, and the corresponding wtmp record to be updated to indicate
that the specified process has terminated. The arguments,
termination and exit_status, are the termination and exit_status
values for the process. The pid argument identifies the process
whose entry is to be removed. Only the process which initially
submitted the entry or that process' parent is allowed to remove an
entry. Finally, the sync option has the same meaning as it does for
dgutmpdaddrecord()-- If 1, the function will not return until it
receives confirmation from the utmp server that the request has been
processed; if 0 the function returns as soon as it has submitted the
request.
The function returns DG_UTMPD_STATUS_OK on success, or an enum value
as defined in dgutmpdinterface.h on error.
dgrunningwithutmpd
This function returns 1 if the utmp server utmpd is present and
operating on the system, and 0 if it is not. The routines,
dgutmpdaddrecord and dgutmpdremoverecord, should only be used
if this function returns 1. If it returns 0, the traditional
routines described on getut(3C) should be used instead.
SEE ALSO
utmpd(1M), getut(3C).
Licensed material--property of copyright holder(s)