xref: /freebsd/lib/libulog/ulog_login.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
12208eadfSEd Schouten.\" Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
22208eadfSEd Schouten.\" All rights reserved.
32208eadfSEd Schouten.\"
42208eadfSEd Schouten.\" Redistribution and use in source and binary forms, with or without
52208eadfSEd Schouten.\" modification, are permitted provided that the following conditions
62208eadfSEd Schouten.\" are met:
72208eadfSEd Schouten.\" 1. Redistributions of source code must retain the above copyright
82208eadfSEd Schouten.\"    notice, this list of conditions and the following disclaimer.
92208eadfSEd Schouten.\" 2. Redistributions in binary form must reproduce the above copyright
102208eadfSEd Schouten.\"    notice, this list of conditions and the following disclaimer in the
112208eadfSEd Schouten.\"    documentation and/or other materials provided with the distribution.
122208eadfSEd Schouten.\"
132208eadfSEd Schouten.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
142208eadfSEd Schouten.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
152208eadfSEd Schouten.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
162208eadfSEd Schouten.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
172208eadfSEd Schouten.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
182208eadfSEd Schouten.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
192208eadfSEd Schouten.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
202208eadfSEd Schouten.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
212208eadfSEd Schouten.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
222208eadfSEd Schouten.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
232208eadfSEd Schouten.\" SUCH DAMAGE.
242208eadfSEd Schouten.\"
25*eaeeb89eSEd Schouten.Dd October 11, 2010
262208eadfSEd Schouten.Dt ULOG_LOGIN 3
27aa12cea2SUlrich Spörlein.Os
282208eadfSEd Schouten.Sh NAME
292208eadfSEd Schouten.Nm ulog_login ,
302208eadfSEd Schouten.Nm ulog_login_pseudo ,
312208eadfSEd Schouten.Nm ulog_logout ,
322208eadfSEd Schouten.Nm ulog_logout_pseudo
332208eadfSEd Schouten.Nd manage user login records
342208eadfSEd Schouten.Sh LIBRARY
352208eadfSEd Schouten.Lb libulog
362208eadfSEd Schouten.Sh SYNOPSIS
372208eadfSEd Schouten.In ulog.h
382208eadfSEd Schouten.Ft void
392208eadfSEd Schouten.Fn ulog_login "const char *line" "const char *user" "const char *host"
402208eadfSEd Schouten.Ft void
412208eadfSEd Schouten.Fn ulog_login_pseudo "int fd" "const char *host"
422208eadfSEd Schouten.Ft void
432208eadfSEd Schouten.Fn ulog_logout "const char *line"
442208eadfSEd Schouten.Ft void
452208eadfSEd Schouten.Fn ulog_logout_pseudo "int fd"
462208eadfSEd Schouten.Sh DESCRIPTION
472208eadfSEd SchoutenThe
482208eadfSEd Schouten.Fn ulog_login
492208eadfSEd Schoutenand
502208eadfSEd Schouten.Fn ulog_login_pseudo
512208eadfSEd Schoutenfunctions register a login session on a TTY.
522208eadfSEd SchoutenThe
532208eadfSEd Schouten.Fn ulog_login
542208eadfSEd Schoutenfunction adds an entry for TTY
552208eadfSEd Schouten.Fa line
562208eadfSEd Schoutenand username
572208eadfSEd Schouten.Fa user .
582208eadfSEd SchoutenThe
592208eadfSEd Schouten.Fn ulog_login_pseudo
602208eadfSEd Schoutenfunction uses file descriptor to a pseudo-terminal master device
612208eadfSEd Schouten.Fa fd
622208eadfSEd Schoutento determine the TTY name, while using the username belonging to the
632208eadfSEd Schoutenreal user ID of the calling process.
642208eadfSEd SchoutenThe optional
652208eadfSEd Schouten.Fa host
662208eadfSEd Schoutenargument denotes a remote hostname, in case the login session is
672208eadfSEd Schoutenprovided by a network service.
682208eadfSEd Schouten.Pp
692208eadfSEd SchoutenThe
702208eadfSEd Schouten.Fn ulog_logout
712208eadfSEd Schoutenand
722208eadfSEd Schouten.Fn ulog_logout_pseudo
732208eadfSEd Schoutenfunctions mark the previously registered login session as being
742208eadfSEd Schoutenterminated.
752208eadfSEd Schouten.Pp
762208eadfSEd SchoutenBecause the
772208eadfSEd Schouten.Fa line
782208eadfSEd Schoutenand
792208eadfSEd Schouten.Fa user
802208eadfSEd Schoutenarguments of
812208eadfSEd Schouten.Fn ulog_login
822208eadfSEd Schoutenand
832208eadfSEd Schouten.Fn ulog_logout
842208eadfSEd Schoutencannot be trusted, these functions require administrative privileges.
852208eadfSEd SchoutenThe
862208eadfSEd Schouten.Fn ulog_login_pseudo
872208eadfSEd Schoutenand
882208eadfSEd Schouten.Fn ulog_logout_pseudo
892208eadfSEd Schoutenfunctions spawn a privileged process to perform the actual logging.
902208eadfSEd Schouten.Sh SEE ALSO
91*eaeeb89eSEd Schouten.Xr getuid 2 ,
922208eadfSEd Schouten.Xr posix_openpt 2 ,
932208eadfSEd Schouten.Xr ptsname 3 ,
94691ac623SEd Schouten.Xr pututxline 3
952208eadfSEd Schouten.Sh HISTORY
962208eadfSEd SchoutenThese functions appeared in
972208eadfSEd Schouten.Fx 9.0 .
98