xref: /titanic_44/usr/src/cmd/ssh/include/auth-pam.h (revision bdb005b59455f11dc7f68cad9b1ec5b07de11e5d)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (c) 2000 Damien Miller.  All rights reserved.
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
57c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
67c478bd9Sstevel@tonic-gate  * are met:
77c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
87c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
97c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
107c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
117c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
147c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
157c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
167c478bd9Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
177c478bd9Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
187c478bd9Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
197c478bd9Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
207c478bd9Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
217c478bd9Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
227c478bd9Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate /*
25*bdb005b5SDarren J Moffat  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
28*bdb005b5SDarren J Moffat /* $Id: auth-pam.h,v 1.16 2002/07/23 00:44:07 stevesk Exp $ */
29*bdb005b5SDarren J Moffat 
30*bdb005b5SDarren J Moffat #ifndef	_AUTH_PAM_H
31*bdb005b5SDarren J Moffat #define	_AUTH_PAM_H
32*bdb005b5SDarren J Moffat 
33*bdb005b5SDarren J Moffat #ifdef __cplusplus
34*bdb005b5SDarren J Moffat extern "C" {
35*bdb005b5SDarren J Moffat #endif
36*bdb005b5SDarren J Moffat 
377c478bd9Sstevel@tonic-gate #include "includes.h"
387c478bd9Sstevel@tonic-gate #ifdef USE_PAM
397c478bd9Sstevel@tonic-gate 
40*bdb005b5SDarren J Moffat char * derive_pam_svc_name(Authmethod *method);
417c478bd9Sstevel@tonic-gate void new_start_pam(Authctxt *authctxt, struct pam_conv *conv);
427c478bd9Sstevel@tonic-gate int auth_pam_password(Authctxt *authctxt, const char *password);
437c478bd9Sstevel@tonic-gate int do_pam_non_initial_userauth(Authctxt *authctxt);
447c478bd9Sstevel@tonic-gate int finish_userauth_do_pam(Authctxt *authctxt);
457c478bd9Sstevel@tonic-gate void finish_pam(Authctxt *authctxt);
467c478bd9Sstevel@tonic-gate char **fetch_pam_environment(Authctxt *authctxt);
477c478bd9Sstevel@tonic-gate void free_pam_environment(char **env);
487c478bd9Sstevel@tonic-gate void message_cat(char **p, const char *a);
497c478bd9Sstevel@tonic-gate void print_pam_messages(void);
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define AUTHPAM_DONE(ac) (ac != NULL && \
527c478bd9Sstevel@tonic-gate 			ac->pam != NULL && \
537c478bd9Sstevel@tonic-gate 			ac->pam->h != NULL && \
547c478bd9Sstevel@tonic-gate 			ac->pam->state == PAM_S_DONE)
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define AUTHPAM_RETVAL(ac, rv) ((ac != NULL && ac->pam != NULL) ? \
577c478bd9Sstevel@tonic-gate 	ac->pam->last_pam_retval : rv)
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #define AUTHPAM_ERROR(ac, rv) ((ac != NULL && ac->pam != NULL && \
607c478bd9Sstevel@tonic-gate 				ac->pam->last_pam_retval != PAM_SUCCESS) ? \
617c478bd9Sstevel@tonic-gate 			ac->pam->last_pam_retval : rv)
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate #endif	/* USE_PAM */
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #ifdef __cplusplus
667c478bd9Sstevel@tonic-gate }
677c478bd9Sstevel@tonic-gate #endif
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #endif /* _AUTH_PAM_H */
70