1 /*
2 * Copyright information at end of file.
3 */
4
5 #include <sys/types.h>
6 #include <pwd.h>
7 #include <security/pam_modules.h>
8
9 #define PAM_UNIX_RUN_HELPER PAM_CRED_INSUFFICIENT
10
11 #define OLD_PASSWORDS_FILE SCONFIGDIR "/opasswd"
12
13 int
14 is_pwd_shadowed(const struct passwd *pwd);
15
16 char *
17 crypt_md5_wrapper(const char *pass_new);
18
19 int
20 unix_selinux_confined(void);
21
22 int
23 lock_pwdf(void);
24
25 void
26 unlock_pwdf(void);
27
28 #ifdef HELPER_COMPILE
29 int
30 save_old_password(const char *forwho, const char *oldpass,
31 int howmany);
32 #else
33 int
34 save_old_password(pam_handle_t *pamh, const char *forwho, const char *oldpass,
35 int howmany);
36 #endif
37
38 #ifdef HELPER_COMPILE
39 void
40 helper_log_err(int err, const char *format,...);
41
42 int
43 helper_verify_password(const char *name, const char *p, int nullok);
44
45 void
46 setup_signals(void);
47
48 char *
49 getuidname(uid_t uid);
50
51 #endif
52
53 #ifdef HELPER_COMPILE
54 #define PAMH_ARG_DECL(fname, ...) fname(__VA_ARGS__)
55 #define PAMH_ARG(...) __VA_ARGS__
56 #else
57 #define PAMH_ARG_DECL(fname, ...) fname(pam_handle_t *pamh, __VA_ARGS__)
58 #define PAMH_ARG(...) pamh, __VA_ARGS__
59 #endif
60
61 PAMH_ARG_DECL(int verify_pwd_hash,
62 const char *p, char *hash, unsigned int nullok);
63
64 PAMH_ARG_DECL(char * create_password_hash,
65 const char *password, unsigned long long ctrl, int rounds);
66
67 PAMH_ARG_DECL(int get_account_info,
68 const char *name, struct passwd **pwd, struct spwd **spwdent);
69
70 PAMH_ARG_DECL(int get_pwd_hash,
71 const char *name, struct passwd **pwd, char **hash);
72
73 PAMH_ARG_DECL(int check_shadow_expiry,
74 struct spwd *spent, int *daysleft);
75
76 PAMH_ARG_DECL(int unix_update_passwd,
77 const char *forwho, const char *towhat);
78
79 PAMH_ARG_DECL(int unix_update_shadow,
80 const char *forwho, char *towhat);
81
82 /* ****************************************************************** *
83 * Copyright (c) Red Hat, Inc. 2007.
84 *
85 * Redistribution and use in source and binary forms, with or without
86 * modification, are permitted provided that the following conditions
87 * are met:
88 * 1. Redistributions of source code must retain the above copyright
89 * notice, and the entire permission notice in its entirety,
90 * including the disclaimer of warranties.
91 * 2. Redistributions in binary form must reproduce the above copyright
92 * notice, this list of conditions and the following disclaimer in the
93 * documentation and/or other materials provided with the distribution.
94 * 3. The name of the author may not be used to endorse or promote
95 * products derived from this software without specific prior
96 * written permission.
97 *
98 * ALTERNATIVELY, this product may be distributed under the terms of
99 * the GNU Public License, in which case the provisions of the GPL are
100 * required INSTEAD OF the above restrictions. (This clause is
101 * necessary due to a potential bad interaction between the GPL and
102 * the restrictions contained in a BSD-style copyright.)
103 *
104 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
105 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
106 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
107 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
108 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
109 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
110 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
111 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
112 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
113 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
114 * OF THE POSSIBILITY OF SUCH DAMAGE.
115 */