linux-pam (1.5.3)
1 /*
2 * Copyright (C) 2005, 2006, 2008, 2009 Thorsten Kukuk.
3 *
4 * <security/pam_ext.h>
5 *
6 * This header file collects definitions for the extended PAM API.
7 * This is a public interface of the PAM library for PAM modules,
8 * which makes the life of PAM developers easier, but are not documented
9 * in any standard and are not portable between different PAM
10 * implementations.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, and the entire permission notice in its entirety,
17 * including the disclaimer of warranties.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. The name of the author may not be used to endorse or promote
22 * products derived from this software without specific prior
23 * written permission.
24 *
25 * ALTERNATIVELY, this product may be distributed under the terms of
26 * the GNU Public License, in which case the provisions of the GPL are
27 * required INSTEAD OF the above restrictions. (This clause is
28 * necessary due to a potential bad interaction between the GPL and
29 * the restrictions contained in a BSD-style copyright.)
30 *
31 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
32 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
33 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
41 * OF THE POSSIBILITY OF SUCH DAMAGE.
42 */
43
44 #ifndef _SECURITY__PAM_EXT_H_
45 #define _SECURITY__PAM_EXT_H_
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51 #include <security/_pam_types.h>
52 #include <stdarg.h>
53
54 extern void PAM_FORMAT((printf, 3, 0)) PAM_NONNULL((3))
55 pam_vsyslog (const pam_handle_t *pamh, int priority,
56 const char *fmt, va_list args);
57
58 extern void PAM_FORMAT((printf, 3, 4)) PAM_NONNULL((3))
59 pam_syslog (const pam_handle_t *pamh, int priority, const char *fmt, ...);
60
61 extern int PAM_FORMAT((printf, 4, 0)) PAM_NONNULL((1,4))
62 pam_vprompt (pam_handle_t *pamh, int style, char **response,
63 const char *fmt, va_list args);
64
65 extern int PAM_FORMAT((printf, 4, 5)) PAM_NONNULL((1,4))
66 pam_prompt (pam_handle_t *pamh, int style, char **response,
67 const char *fmt, ...);
68
69 #define pam_error(pamh, fmt...) \
70 pam_prompt(pamh, PAM_ERROR_MSG, NULL, fmt)
71 #define pam_verror(pamh, fmt, args) \
72 pam_vprompt(pamh, PAM_ERROR_MSG, NULL, fmt, args)
73
74 #define pam_info(pamh, fmt...) pam_prompt(pamh, PAM_TEXT_INFO, NULL, fmt)
75 #define pam_vinfo(pamh, fmt, args) pam_vprompt(pamh, PAM_TEXT_INFO, NULL, fmt, args)
76
77 extern int PAM_NONNULL((1,3))
78 pam_get_authtok (pam_handle_t *pamh, int item, const char **authtok,
79 const char *prompt);
80 extern int PAM_NONNULL((1,2))
81 pam_get_authtok_noverify (pam_handle_t *pamh, const char **authtok,
82 const char *prompt);
83 extern int PAM_NONNULL((1,2))
84 pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok,
85 const char *prompt);
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif