source: openpam/trunk/include/security/pam_appl.h @ 913

Last change on this file since 913 was 913, checked in by Dag-Erling Smørgrav, 4 years ago

Newer versions of clang take nonnull annotations into account not only
when compiling code that calls the function, but also when compiling the
function itself. This means that NULL checks in the function trigger
condition-always-false warnings. We have a choice between disabling these
warnings, removing the nonnull annotations, or removing the NULL checks.
We prefer to keep the annotations and warnings and remove the checks. In
all cases, passing NULL to the function in question will result in a
segmentation fault, which is often easier to debug than an error return,
especially when most of these checks were for the PAM handle, which can only
be NULL if the caller ignored an error return from pam_start().

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.9 KB
Line 
1/*-
2 * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
3 * Copyright (c) 2004-2011 Dag-Erling Smørgrav
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by ThinkSec AS and
7 * Network Associates Laboratories, the Security Research Division of
8 * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035
9 * ("CBOSS"), as part of the DARPA CHATS research program.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote
20 *    products derived from this software without specific prior written
21 *    permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * $Id: pam_appl.h 913 2017-01-21 15:11:12Z des $
36 */
37
38#ifndef SECURITY_PAM_APPL_H_INCLUDED
39#define SECURITY_PAM_APPL_H_INCLUDED
40
41#include <security/pam_types.h>
42#include <security/pam_constants.h>
43#include <security/openpam_attr.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49/*
50 * XSSO 4.2.1, 6
51 */
52
53int
54pam_acct_mgmt(pam_handle_t *_pamh,
55        int _flags)
56        OPENPAM_NONNULL((1));
57
58int
59pam_authenticate(pam_handle_t *_pamh,
60        int _flags)
61        OPENPAM_NONNULL((1));
62
63int
64pam_chauthtok(pam_handle_t *_pamh,
65        int _flags)
66        OPENPAM_NONNULL((1));
67
68int
69pam_close_session(pam_handle_t *_pamh,
70        int _flags)
71        OPENPAM_NONNULL((1));
72
73int
74pam_end(pam_handle_t *_pamh,
75        int _status)
76        OPENPAM_NONNULL((1));
77
78int
79pam_get_data(const pam_handle_t *_pamh,
80        const char *_module_data_name,
81        const void **_data)
82        OPENPAM_NONNULL((1,2,3));
83
84int
85pam_get_item(const pam_handle_t *_pamh,
86        int _item_type,
87        const void **_item)
88        OPENPAM_NONNULL((1,3));
89
90int
91pam_get_user(pam_handle_t *_pamh,
92        const char **_user,
93        const char *_prompt)
94        OPENPAM_NONNULL((1,2));
95
96const char *
97pam_getenv(pam_handle_t *_pamh,
98        const char *_name)
99        OPENPAM_NONNULL((1,2));
100
101char **
102pam_getenvlist(pam_handle_t *_pamh)
103        OPENPAM_NONNULL((1));
104
105int
106pam_open_session(pam_handle_t *_pamh,
107        int _flags)
108        OPENPAM_NONNULL((1));
109
110int
111pam_putenv(pam_handle_t *_pamh,
112        const char *_namevalue)
113        OPENPAM_NONNULL((1,2));
114
115int
116pam_set_data(pam_handle_t *_pamh,
117        const char *_module_data_name,
118        void *_data,
119        void (*_cleanup)(pam_handle_t *_pamh,
120                void *_data,
121                int _pam_end_status))
122        OPENPAM_NONNULL((1,2));
123
124int
125pam_set_item(pam_handle_t *_pamh,
126        int _item_type,
127        const void *_item)
128        OPENPAM_NONNULL((1));
129
130int
131pam_setcred(pam_handle_t *_pamh,
132        int _flags)
133        OPENPAM_NONNULL((1));
134
135int
136pam_start(const char *_service,
137        const char *_user,
138        const struct pam_conv *_pam_conv,
139        pam_handle_t **_pamh)
140        OPENPAM_NONNULL((4));
141
142const char *
143pam_strerror(const pam_handle_t *_pamh,
144        int _error_number);
145
146/*
147 * Single Sign-On extensions
148 */
149#if 0
150int
151pam_authenticate_secondary(pam_handle_t *_pamh,
152        char *_target_username,
153        char *_target_module_type,
154        char *_target_authn_domain,
155        char *_target_supp_data,
156        char *_target_module_authtok,
157        int _flags);
158
159int
160pam_get_mapped_authtok(pam_handle_t *_pamh,
161        const char *_target_module_username,
162        const char *_target_module_type,
163        const char *_target_authn_domain,
164        size_t *_target_authtok_len,
165        unsigned char **_target_module_authtok);
166
167int
168pam_get_mapped_username(pam_handle_t *_pamh,
169        const char *_src_username,
170        const char *_src_module_type,
171        const char *_src_authn_domain,
172        const char *_target_module_type,
173        const char *_target_authn_domain,
174        char **_target_module_username);
175
176int
177pam_set_mapped_authtok(pam_handle_t *_pamh,
178        const char *_target_module_username,
179        size_t _target_authtok_len,
180        unsigned char *_target_module_authtok,
181        const char *_target_module_type,
182        const char *_target_authn_domain);
183
184int
185pam_set_mapped_username(pam_handle_t *_pamh,
186        char *_src_username,
187        char *_src_module_type,
188        char *_src_authn_domain,
189        char *_target_module_username,
190        char *_target_module_type,
191        char *_target_authn_domain);
192#endif /* 0 */
193
194#ifdef __cplusplus
195}
196#endif
197
198#endif /* !SECURITY_PAM_APPL_H_INCLUDED */
Note: See TracBrowser for help on using the repository browser.