xref: /freebsd/lib/libulog/ulog_login.3 (revision c697fb7f)
1.\" Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd October 11, 2010
28.Dt ULOG_LOGIN 3
29.Os
30.Sh NAME
31.Nm ulog_login ,
32.Nm ulog_login_pseudo ,
33.Nm ulog_logout ,
34.Nm ulog_logout_pseudo
35.Nd manage user login records
36.Sh LIBRARY
37.Lb libulog
38.Sh SYNOPSIS
39.In ulog.h
40.Ft void
41.Fn ulog_login "const char *line" "const char *user" "const char *host"
42.Ft void
43.Fn ulog_login_pseudo "int fd" "const char *host"
44.Ft void
45.Fn ulog_logout "const char *line"
46.Ft void
47.Fn ulog_logout_pseudo "int fd"
48.Sh DESCRIPTION
49The
50.Fn ulog_login
51and
52.Fn ulog_login_pseudo
53functions register a login session on a TTY.
54The
55.Fn ulog_login
56function adds an entry for TTY
57.Fa line
58and username
59.Fa user .
60The
61.Fn ulog_login_pseudo
62function uses file descriptor to a pseudo-terminal master device
63.Fa fd
64to determine the TTY name, while using the username belonging to the
65real user ID of the calling process.
66The optional
67.Fa host
68argument denotes a remote hostname, in case the login session is
69provided by a network service.
70.Pp
71The
72.Fn ulog_logout
73and
74.Fn ulog_logout_pseudo
75functions mark the previously registered login session as being
76terminated.
77.Pp
78Because the
79.Fa line
80and
81.Fa user
82arguments of
83.Fn ulog_login
84and
85.Fn ulog_logout
86cannot be trusted, these functions require administrative privileges.
87The
88.Fn ulog_login_pseudo
89and
90.Fn ulog_logout_pseudo
91functions spawn a privileged process to perform the actual logging.
92.Sh SEE ALSO
93.Xr getuid 2 ,
94.Xr posix_openpt 2 ,
95.Xr ptsname 3 ,
96.Xr pututxline 3
97.Sh HISTORY
98These functions appeared in
99.Fx 9.0 .
100