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