]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - lib/libulog/ulog_login.3
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / lib / libulog / ulog_login.3
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
49 The
50 .Fn ulog_login
51 and
52 .Fn ulog_login_pseudo
53 functions register a login session on a TTY.
54 The
55 .Fn ulog_login
56 function adds an entry for TTY
57 .Fa line
58 and username
59 .Fa user .
60 The
61 .Fn ulog_login_pseudo
62 function uses file descriptor to a pseudo-terminal master device
63 .Fa fd
64 to determine the TTY name, while using the username belonging to the
65 real user ID of the calling process.
66 The optional
67 .Fa host
68 argument denotes a remote hostname, in case the login session is
69 provided by a network service.
70 .Pp
71 The
72 .Fn ulog_logout
73 and
74 .Fn ulog_logout_pseudo
75 functions mark the previously registered login session as being
76 terminated.
77 .Pp
78 Because the
79 .Fa line
80 and
81 .Fa user
82 arguments of
83 .Fn ulog_login
84 and
85 .Fn ulog_logout
86 cannot be trusted, these functions require administrative privileges.
87 The
88 .Fn ulog_login_pseudo
89 and
90 .Fn ulog_logout_pseudo
91 functions 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
98 These functions appeared in
99 .Fx 9.0 .