]> granicus.if.org Git - linux-pam/blob - libpam/include/security/pam_modules.h
PAM_EXTERN isn't needed anymore, but don't remove it to not break lot of
[linux-pam] / libpam / include / security / pam_modules.h
1 /*
2  * <security/pam_modules.h>
3  *
4  * This header file collects definitions for the PAM API --- that is,
5  * public interface between the PAM library and PAM modules.
6  *
7  * Note, the copyright information is at end of file.
8  */
9
10 #ifndef _SECURITY_PAM_MODULES_H
11 #define _SECURITY_PAM_MODULES_H
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #include <security/_pam_types.h>      /* Linux-PAM common defined types */
18
19 /* -------------- The Linux-PAM Module PI ------------- */
20
21 extern int PAM_NONNULL((1,2))
22 pam_set_data(pam_handle_t *pamh, const char *module_data_name, void *data,
23              void (*cleanup)(pam_handle_t *pamh, void *data,
24                              int error_status));
25
26 extern int PAM_NONNULL((1,2,3))
27 pam_get_data(const pam_handle_t *pamh, const char *module_data_name,
28              const void **data);
29
30 extern int PAM_NONNULL((1,2))
31 pam_get_user(pam_handle_t *pamh, const char **user, const char *prompt);
32
33 /* Authentication API's */
34 int pam_sm_authenticate(pam_handle_t *pamh, int flags,
35                         int argc, const char **argv);
36 int pam_sm_setcred(pam_handle_t *pamh, int flags,
37                    int argc, const char **argv);
38
39 /* Account Management API's */
40 int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
41                      int argc, const char **argv);
42
43 /* Session Management API's */
44 int pam_sm_open_session(pam_handle_t *pamh, int flags,
45                         int argc, const char **argv);
46
47 int pam_sm_close_session(pam_handle_t *pamh, int flags,
48                          int argc, const char **argv);
49
50 /* Password Management API's */
51 int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
52                      int argc, const char **argv);
53
54 /* The following two flags are for use across the Linux-PAM/module
55  * interface only. The Application is not permitted to use these
56  * tokens.
57  *
58  * The password service should only perform preliminary checks.  No
59  * passwords should be updated. */
60 #define PAM_PRELIM_CHECK                0x4000
61
62 /* The password service should update passwords Note: PAM_PRELIM_CHECK
63  * and PAM_UPDATE_AUTHTOK cannot both be set simultaneously! */
64 #define PAM_UPDATE_AUTHTOK              0x2000
65
66
67 /*
68  * here are some proposed error status definitions for the
69  * 'error_status' argument used by the cleanup function associated
70  * with data items they should be logically OR'd with the error_status
71  * of the latest return from libpam -- new with .52 and positive
72  * impression from Sun although not official as of 1996/9/4 there are
73  * others in _pam_types.h -- they are for common module/app use.
74  */
75
76 #define PAM_DATA_REPLACE   0x20000000     /* used when replacing a data item */
77
78 /* PAM_EXTERN isn't needed anymore, but don't remove it to not break
79    lot of external code using it. */
80 #define PAM_EXTERN extern
81
82 /* take care of any compatibility issues */
83 #include <security/_pam_compat.h>
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89 /* Copyright (C) Theodore Ts'o, 1996.
90  * Copyright (C) Andrew Morgan, 1996-8.
91  *                                                All rights reserved.
92  *
93  * Redistribution and use in source and binary forms, with or without
94  * modification, are permitted provided that the following conditions
95  * are met:
96  * 1. Redistributions of source code must retain the above copyright
97  *    notice, and the entire permission notice in its entirety,
98  *    including the disclaimer of warranties.
99  * 2. Redistributions in binary form must reproduce the above copyright
100  *    notice, this list of conditions and the following disclaimer in the
101  *    documentation and/or other materials provided with the distribution.
102  * 3. The name of the author may not be used to endorse or promote
103  *    products derived from this software without specific prior
104  *    written permission.
105  *
106  * ALTERNATIVELY, this product may be distributed under the terms of
107  * the GNU General Public License, in which case the provisions of the
108  * GNU GPL are required INSTEAD OF the above restrictions.  (This
109  * clause is necessary due to a potential bad interaction between the
110  * GNU GPL and the restrictions contained in a BSD-style copyright.)
111  *
112  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
113  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
114  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
115  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
116  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
117  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
118  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
119  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
120  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
121  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
122  * OF THE POSSIBILITY OF SUCH DAMAGE.  */
123
124 #endif /* _SECURITY_PAM_MODULES_H */