xref: /titanic_44/usr/src/cmd/ssh/include/auth-pam.h (revision bdb005b59455f11dc7f68cad9b1ec5b07de11e5d)
1 /*
2  * Copyright (c) 2000 Damien Miller.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24 /*
25  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
26  */
27 
28 /* $Id: auth-pam.h,v 1.16 2002/07/23 00:44:07 stevesk Exp $ */
29 
30 #ifndef	_AUTH_PAM_H
31 #define	_AUTH_PAM_H
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #include "includes.h"
38 #ifdef USE_PAM
39 
40 char * derive_pam_svc_name(Authmethod *method);
41 void new_start_pam(Authctxt *authctxt, struct pam_conv *conv);
42 int auth_pam_password(Authctxt *authctxt, const char *password);
43 int do_pam_non_initial_userauth(Authctxt *authctxt);
44 int finish_userauth_do_pam(Authctxt *authctxt);
45 void finish_pam(Authctxt *authctxt);
46 char **fetch_pam_environment(Authctxt *authctxt);
47 void free_pam_environment(char **env);
48 void message_cat(char **p, const char *a);
49 void print_pam_messages(void);
50 
51 #define AUTHPAM_DONE(ac) (ac != NULL && \
52 			ac->pam != NULL && \
53 			ac->pam->h != NULL && \
54 			ac->pam->state == PAM_S_DONE)
55 
56 #define AUTHPAM_RETVAL(ac, rv) ((ac != NULL && ac->pam != NULL) ? \
57 	ac->pam->last_pam_retval : rv)
58 
59 #define AUTHPAM_ERROR(ac, rv) ((ac != NULL && ac->pam != NULL && \
60 				ac->pam->last_pam_retval != PAM_SUCCESS) ? \
61 			ac->pam->last_pam_retval : rv)
62 
63 #endif	/* USE_PAM */
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif /* _AUTH_PAM_H */
70