xref: /openbsd/include/bsd_auth.h (revision 15afe4d6)
1*15afe4d6Sfcambus /*	$OpenBSD: bsd_auth.h,v 1.11 2017/03/09 10:13:03 fcambus Exp $	*/
2d0b779f3Sniklas 
3e802aa69Smillert /*-
4e802aa69Smillert  * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
5e802aa69Smillert  *
6e802aa69Smillert  * Redistribution and use in source and binary forms, with or without
7e802aa69Smillert  * modification, are permitted provided that the following conditions
8e802aa69Smillert  * are met:
9e802aa69Smillert  * 1. Redistributions of source code must retain the above copyright
10e802aa69Smillert  *    notice, this list of conditions and the following disclaimer.
11e802aa69Smillert  * 2. Redistributions in binary form must reproduce the above copyright
12e802aa69Smillert  *    notice, this list of conditions and the following disclaimer in the
13e802aa69Smillert  *    documentation and/or other materials provided with the distribution.
14e802aa69Smillert  * 3. All advertising materials mentioning features or use of this software
15e802aa69Smillert  *    must display the following acknowledgement:
16e802aa69Smillert  *	This product includes software developed by Berkeley Software Design,
17e802aa69Smillert  *	Inc.
18e802aa69Smillert  * 4. The name of Berkeley Software Design, Inc.  may not be used to endorse
19e802aa69Smillert  *    or promote products derived from this software without specific prior
20e802aa69Smillert  *    written permission.
21e802aa69Smillert  *
22e802aa69Smillert  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
23e802aa69Smillert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24e802aa69Smillert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25e802aa69Smillert  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
26e802aa69Smillert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27e802aa69Smillert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28e802aa69Smillert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29e802aa69Smillert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30e802aa69Smillert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31e802aa69Smillert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32e802aa69Smillert  * SUCH DAMAGE.
33e802aa69Smillert  *
34e802aa69Smillert  *	BSDI $From: bsd_auth.h,v 2.3 1999/09/08 22:13:08 prb Exp $
35e802aa69Smillert  */
36e802aa69Smillert 
3789ebbd5dSmillert #ifndef _BSD_AUTH_H_
3889ebbd5dSmillert #define _BSD_AUTH_H_
3989ebbd5dSmillert 
40c916d948Smillert #include <machine/_types.h>		/* for __va_list */
41c916d948Smillert 
42e802aa69Smillert typedef struct auth_session_t auth_session_t;
43e802aa69Smillert 
44e802aa69Smillert typedef enum {
45e802aa69Smillert 	AUTHV_ALL,
46e802aa69Smillert 	AUTHV_CHALLENGE,
47e802aa69Smillert 	AUTHV_CLASS,
48e802aa69Smillert 	AUTHV_NAME,
49e802aa69Smillert 	AUTHV_SERVICE,
50e802aa69Smillert 	AUTHV_STYLE,
51e802aa69Smillert 	AUTHV_INTERACTIVE
52e802aa69Smillert } auth_item_t;
53e802aa69Smillert 
5489ebbd5dSmillert #include <sys/cdefs.h>
5589ebbd5dSmillert __BEGIN_DECLS
56a019fb86Smillert struct passwd;
57a019fb86Smillert struct login_cap;
58e802aa69Smillert 
59c72b5b24Smillert char	*auth_getitem(auth_session_t *, auth_item_t);
60c72b5b24Smillert int	 auth_setitem(auth_session_t *, auth_item_t, char *);
61e802aa69Smillert 
62c72b5b24Smillert auth_session_t *auth_open(void);
6378992478Sespie auth_session_t *auth_verify(auth_session_t *, char *, char *, ...)
64ece79e10Sguenther 		    __attribute__((__sentinel__));
6578992478Sespie 
66c72b5b24Smillert auth_session_t *auth_userchallenge(char *, char *, char *, char **);
67c72b5b24Smillert auth_session_t *auth_usercheck(char *, char *, char *, char *);
68e802aa69Smillert 
69c72b5b24Smillert int	 auth_userresponse(auth_session_t *, char *, int);
70c72b5b24Smillert int	 auth_userokay(char *, char *, char *, char *);
71a019fb86Smillert int	 auth_approval(auth_session_t *, struct login_cap *, char *, char *);
72e802aa69Smillert 
73c72b5b24Smillert int	 auth_close(auth_session_t *);
74c72b5b24Smillert void	 auth_clean(auth_session_t *);
75e802aa69Smillert 
76c72b5b24Smillert char	*auth_getvalue(auth_session_t *, char *);
77c72b5b24Smillert int	 auth_getstate(auth_session_t *);
78c72b5b24Smillert char	*auth_challenge(auth_session_t *);
79c72b5b24Smillert void	 auth_setenv(auth_session_t *);
80c72b5b24Smillert void	 auth_clrenv(auth_session_t *);
81e802aa69Smillert 
82c72b5b24Smillert void	 auth_setstate(auth_session_t *, int);
8378992478Sespie int	 auth_call(auth_session_t *, char *, ...)
84ece79e10Sguenther 	    __attribute__((__sentinel__));
85e802aa69Smillert 
86c72b5b24Smillert int	 auth_setdata(auth_session_t *, void *, size_t);
87c72b5b24Smillert int	 auth_setoption(auth_session_t *, char *, char *);
88*15afe4d6Sfcambus int	 auth_setpwd(auth_session_t *, struct passwd *);
89c916d948Smillert void	 auth_set_va_list(auth_session_t *, __va_list);
90e802aa69Smillert 
91c72b5b24Smillert struct passwd *auth_getpwd(auth_session_t *);
92e802aa69Smillert 
93c72b5b24Smillert quad_t	 auth_check_expire(auth_session_t *);
94c72b5b24Smillert quad_t	 auth_check_change(auth_session_t *);
95e802aa69Smillert 
96c72b5b24Smillert void	 auth_clroptions(auth_session_t *);
97c72b5b24Smillert void	 auth_clroption(auth_session_t *, char *);
98e802aa69Smillert 
99c72b5b24Smillert char	*auth_mkvalue(char *);
100a019fb86Smillert void	 auth_checknologin(struct login_cap *);
101c72b5b24Smillert int	 auth_cat(char *);
10289ebbd5dSmillert 
10389ebbd5dSmillert __END_DECLS
10489ebbd5dSmillert 
10589ebbd5dSmillert #endif /* _BSD_AUTH_H_ */
106