xref: /onnv-gate/usr/src/cmd/ssh/include/auth-pam.h (revision 12317:89504ac80dd0)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * Copyright (c) 2000 Damien Miller.  All rights reserved.
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
50Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
60Sstevel@tonic-gate  * are met:
70Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
80Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
90Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
100Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
110Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
140Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
150Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
160Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
170Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
180Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
190Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
200Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
210Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
220Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate /*
25*12317SDarren.Moffat@oracle.com  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
260Sstevel@tonic-gate  */
270Sstevel@tonic-gate 
28*12317SDarren.Moffat@oracle.com /* $Id: auth-pam.h,v 1.16 2002/07/23 00:44:07 stevesk Exp $ */
29*12317SDarren.Moffat@oracle.com 
30*12317SDarren.Moffat@oracle.com #ifndef	_AUTH_PAM_H
31*12317SDarren.Moffat@oracle.com #define	_AUTH_PAM_H
32*12317SDarren.Moffat@oracle.com 
33*12317SDarren.Moffat@oracle.com #ifdef __cplusplus
34*12317SDarren.Moffat@oracle.com extern "C" {
35*12317SDarren.Moffat@oracle.com #endif
36*12317SDarren.Moffat@oracle.com 
370Sstevel@tonic-gate #include "includes.h"
380Sstevel@tonic-gate #ifdef USE_PAM
390Sstevel@tonic-gate 
40*12317SDarren.Moffat@oracle.com char * derive_pam_svc_name(Authmethod *method);
410Sstevel@tonic-gate void new_start_pam(Authctxt *authctxt, struct pam_conv *conv);
420Sstevel@tonic-gate int auth_pam_password(Authctxt *authctxt, const char *password);
430Sstevel@tonic-gate int do_pam_non_initial_userauth(Authctxt *authctxt);
440Sstevel@tonic-gate int finish_userauth_do_pam(Authctxt *authctxt);
450Sstevel@tonic-gate void finish_pam(Authctxt *authctxt);
460Sstevel@tonic-gate char **fetch_pam_environment(Authctxt *authctxt);
470Sstevel@tonic-gate void free_pam_environment(char **env);
480Sstevel@tonic-gate void message_cat(char **p, const char *a);
490Sstevel@tonic-gate void print_pam_messages(void);
500Sstevel@tonic-gate 
510Sstevel@tonic-gate #define AUTHPAM_DONE(ac) (ac != NULL && \
520Sstevel@tonic-gate 			ac->pam != NULL && \
530Sstevel@tonic-gate 			ac->pam->h != NULL && \
540Sstevel@tonic-gate 			ac->pam->state == PAM_S_DONE)
550Sstevel@tonic-gate 
560Sstevel@tonic-gate #define AUTHPAM_RETVAL(ac, rv) ((ac != NULL && ac->pam != NULL) ? \
570Sstevel@tonic-gate 	ac->pam->last_pam_retval : rv)
580Sstevel@tonic-gate 
590Sstevel@tonic-gate #define AUTHPAM_ERROR(ac, rv) ((ac != NULL && ac->pam != NULL && \
600Sstevel@tonic-gate 				ac->pam->last_pam_retval != PAM_SUCCESS) ? \
610Sstevel@tonic-gate 			ac->pam->last_pam_retval : rv)
620Sstevel@tonic-gate 
630Sstevel@tonic-gate #endif	/* USE_PAM */
640Sstevel@tonic-gate 
650Sstevel@tonic-gate #ifdef __cplusplus
660Sstevel@tonic-gate }
670Sstevel@tonic-gate #endif
680Sstevel@tonic-gate 
690Sstevel@tonic-gate #endif /* _AUTH_PAM_H */
70