]> granicus.if.org Git - shadow/blob - libmisc/failure.h
(failcheck): The failed argument is a bool.
[shadow] / libmisc / failure.h
1 /*
2  * Copyright (c) 1990 - 1994, Julianne Frances Haugh
3  * Copyright (c) 1997 - 2000, Marek Michałkiewicz
4  * Copyright (c) 2005       , Tomasz Kłoczko
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the copyright holders or contributors may not be used to
16  *    endorse or promote products derived from this software without
17  *    specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
23  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 /* $Id$ */
33 #ifndef _FAILURE_H_
34 #define _FAILURE_H_
35
36 #include "defines.h"
37 #include "faillog.h"
38 #ifdef HAVE_UTMPX_H
39 #include <utmpx.h>
40 #else
41 #include <utmp.h>
42 #endif
43
44 /*
45  * failure - make failure entry
46  *
47  *      failure() creates a new (struct faillog) entry or updates an
48  *      existing one with the current failed login information.
49  */
50 extern void failure (uid_t, const char *, struct faillog *);
51
52 /*
53  * failcheck - check for failures > allowable
54  *
55  *      failcheck() is called AFTER the password has been validated.  If the
56  *      account has been "attacked" with too many login failures, failcheck()
57  *      returns FALSE to indicate that the login should be denied even though
58  *      the password is valid.
59  */
60 extern int failcheck (uid_t uid, struct faillog *fl, bool failed);
61
62 /*
63  * failprint - print line of failure information
64  *
65  *      failprint takes a (struct faillog) entry and formats it into a
66  *      message which is displayed at login time.
67  */
68 extern void failprint (const struct faillog *);
69
70 /*
71  * failtmp - update the cummulative failure log
72  *
73  *      failtmp updates the (struct utmp) formatted failure log which
74  *      maintains a record of all login failures.
75  */
76 #ifdef HAVE_UTMPX_H
77 extern void failtmp (const struct utmpx *);
78 #else
79 extern void failtmp (const struct utmp *);
80 #endif
81
82 #endif
83