1 .\" Copyright (c) 1995 David Nugent <davidn@blaze.net.au>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, is permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice immediately at the beginning of the file, without modification,
9 .\" this list of conditions, and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. This work was done expressly for inclusion into FreeBSD. Other use
14 .\" is permitted provided this notation is included.
15 .\" 4. Absolutely no warranty of function or purpose is made by the author
17 .\" 5. Modifications may be freely made to this file providing the above
18 .\" conditions are met.
20 .\" $FreeBSD: head/lib/libutil/login_ok.3 206622 2010-04-14 19:08:06Z uqs $
29 .Nd functions for checking login class based login restrictions
37 .Fn auth_ttyok "login_cap_t *lc" "const char *tty"
39 .Fn auth_hostok "login_cap_t *lc" "const char *host" "char const *ip"
41 .Fn auth_timeok "login_cap_t *lc" "time_t t"
43 This set of functions checks to see if login is allowed based on login
44 class capability entries in the login database,
49 function checks to see if the named tty is available to users of a specific
50 class, and is either in the
52 access list, and not in
58 list (or if no such capability exists for
59 the given login class) logins via any tty device are allowed unless
62 list exists and is non-empty, and the device or its
66 Access to ttys may be allowed or restricted specifically by tty device
67 name, a device name which includes a wildcard (e.g.\& ttyD* or cuaD*),
68 or may name a ttygroup, when group=<name> tags have been assigned in
70 Matching of ttys and ttygroups is case sensitive.
73 or empty string as the
75 parameter causes the function to return a non-zero value.
79 function checks for any host restrictions for remote logins.
80 The function checks on both a host name and IP address (given in its
81 text form, typically n.n.n.n) against the
85 login class capabilities.
86 As with ttys and their groups, wildcards and character classes may be
87 used in the host allow and deny capability records.
90 function is used for matching, and the matching on hostnames is case
92 Note that this function expects that the hostname is fully expanded
93 (i.e., the local domain name added if necessary) and the IP address
94 is in its canonical form.
95 No hostname or address lookups are attempted.
97 It is possible to call this function with either the hostname or
98 the IP address missing (i.e.\&
100 and matching will be performed
101 only on the basis of the parameter given.
104 or empty strings in both parameters will result in
105 a non-zero return value.
109 function checks to see that a given time value is within the
111 login class capability and not within the
114 An empty or non-existent
116 list allows access at any
117 time, except if a given time is falls within a period in the
120 The format of time period records contained in both
124 capability fields is explained in detail in the
128 A non-zero return value from any of these functions indicates that
129 login access is granted.
130 A zero return value means either that the item being tested is not
133 access list, or is within the