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