1 /*
2 * Copyright (c) 2008 Thorsten Kukuk <kukuk@suse.de>
3 * Copyright (c) 2013 Red Hat, Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, and the entire permission notice in its entirety,
10 * including the disclaimer of warranties.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote
15 * products derived from this software without specific prior
16 * written permission.
17 *
18 * ALTERNATIVELY, this product may be distributed under the terms of
19 * the GNU Public License, in which case the provisions of the GPL are
20 * required INSTEAD OF the above restrictions. (This clause is
21 * necessary due to a potential bad interaction between the GPL and
22 * the restrictions contained in a BSD-style copyright.)
23 *
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
28 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34 * OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 #ifndef __OPASSWD_H__
38 #define __OPASSWD_H__
39
40 #define PAM_PWHISTORY_RUN_HELPER PAM_CRED_INSUFFICIENT
41
42 #ifdef WITH_SELINUX
43 #include <selinux/selinux.h>
44 #define SELINUX_ENABLED (is_selinux_enabled()>0)
45 #else
46 #define SELINUX_ENABLED 0
47 #endif
48
49 #ifdef HELPER_COMPILE
50 #define PAMH_ARG_DECL(fname, ...) fname(__VA_ARGS__)
51 #else
52 #define PAMH_ARG_DECL(fname, ...) fname(pam_handle_t *pamh, __VA_ARGS__)
53 #endif
54
55 #ifdef HELPER_COMPILE
56 void
57 helper_log_err(int err, const char *format, ...);
58 #endif
59
60 PAMH_ARG_DECL(int check_old_pass, const char *user, const char *newpass,
61 const char *filename, int debug);
62
63 PAMH_ARG_DECL(int save_old_pass, const char *user, int howmany,
64 const char *filename, int debug);
65
66 #endif /* __OPASSWD_H__ */