xref: /freebsd/contrib/pam-krb5/tests/tap/kadmin.h (revision ee3960cba1068e12fb032a68c46d74841d9edab3)
1 /*
2  * Utility functions for tests needing Kerberos admin actions.
3  *
4  * The canonical version of this file is maintained in the rra-c-util package,
5  * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
6  *
7  * Written by Russ Allbery <eagle@eyrie.org>
8  * Copyright 2011, 2013
9  *     The Board of Trustees of the Leland Stanford Junior University
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in
19  * all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  *
29  * SPDX-License-Identifier: MIT
30  */
31 
32 #ifndef TAP_KADMIN_H
33 #define TAP_KADMIN_H 1
34 
35 #include <config.h>
36 #include <portable/stdbool.h>
37 
38 #include <time.h>
39 
40 #include <tests/tap/macros.h>
41 
42 BEGIN_DECLS
43 
44 /*
45  * Given the principal to set an expiration on and the expiration time, set
46  * that principal's key to expire at that time.  Authentication is done using
47  * the keytab stored in config/admin-keytab.
48  *
49  * Returns true on success.  Returns false if necessary configuration is
50  * missing so that the caller can choose whether to call bail or skip_all.  If
51  * the configuration is present but the operation fails, bails.
52  */
53 bool kerberos_expire_password(const char *, time_t)
54     __attribute__((__nonnull__));
55 
56 END_DECLS
57 
58 #endif /* !TAP_KADMIN_H */
59