xref: /titanic_50/usr/src/cmd/ssh/include/auth.h (revision f44ef4668fa223436280848405e8aeef639dfe38)
17c478bd9Sstevel@tonic-gate /*	$OpenBSD: auth.h,v 1.41 2002/09/26 11:38:43 markus Exp $	*/
27c478bd9Sstevel@tonic-gate 
37c478bd9Sstevel@tonic-gate #ifndef	_AUTH_H
47c478bd9Sstevel@tonic-gate #define	_AUTH_H
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
77c478bd9Sstevel@tonic-gate 
87c478bd9Sstevel@tonic-gate #ifdef __cplusplus
97c478bd9Sstevel@tonic-gate extern "C" {
107c478bd9Sstevel@tonic-gate #endif
117c478bd9Sstevel@tonic-gate 
127c478bd9Sstevel@tonic-gate 
137c478bd9Sstevel@tonic-gate /*
147c478bd9Sstevel@tonic-gate  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
157c478bd9Sstevel@tonic-gate  *
167c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
177c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
187c478bd9Sstevel@tonic-gate  * are met:
197c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
207c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
217c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
227c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
237c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
247c478bd9Sstevel@tonic-gate  *
257c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
267c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
277c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
287c478bd9Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
297c478bd9Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
307c478bd9Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
317c478bd9Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
327c478bd9Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
337c478bd9Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
347c478bd9Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
357c478bd9Sstevel@tonic-gate  *
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate /*
38*f44ef466Sjp161948  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
397c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #include "key.h"
437c478bd9Sstevel@tonic-gate #include "hostfile.h"
447c478bd9Sstevel@tonic-gate #include <openssl/rsa.h>
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifdef USE_PAM
477c478bd9Sstevel@tonic-gate #include <security/pam_appl.h>
487c478bd9Sstevel@tonic-gate #endif /* USE_PAM */
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #ifdef HAVE_LOGIN_CAP
517c478bd9Sstevel@tonic-gate #include <login_cap.h>
527c478bd9Sstevel@tonic-gate #endif
537c478bd9Sstevel@tonic-gate #ifdef BSD_AUTH
547c478bd9Sstevel@tonic-gate #include <bsd_auth.h>
557c478bd9Sstevel@tonic-gate #endif
567c478bd9Sstevel@tonic-gate #ifdef KRB5
577c478bd9Sstevel@tonic-gate #include <krb5.h>
587c478bd9Sstevel@tonic-gate #endif
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate typedef struct Authctxt Authctxt;
617c478bd9Sstevel@tonic-gate typedef struct Authmethod Authmethod;
627c478bd9Sstevel@tonic-gate typedef struct KbdintDevice KbdintDevice;
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #ifdef USE_PAM
657c478bd9Sstevel@tonic-gate typedef struct pam_stuff pam_stuff;
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate struct pam_stuff {
687c478bd9Sstevel@tonic-gate 	Authctxt	*authctxt;
697c478bd9Sstevel@tonic-gate 	pam_handle_t	*h;
707c478bd9Sstevel@tonic-gate 	int		state;
717c478bd9Sstevel@tonic-gate 	int		last_pam_retval;
727c478bd9Sstevel@tonic-gate };
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /* See auth-pam.h and auth-pam.c */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate #define PAM_S_DONE_ACCT_MGMT		0x01 /* acct_mgmt done */
777c478bd9Sstevel@tonic-gate #define PAM_S_DONE_SETCRED		0x02 /* setcred done */
787c478bd9Sstevel@tonic-gate #define PAM_S_DONE_OPEN_SESSION		0x04 /* open_session done */
797c478bd9Sstevel@tonic-gate #define PAM_S_DONE			0x07 /* all done */
807c478bd9Sstevel@tonic-gate #endif /* USE_PAM */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate struct Authctxt {
837c478bd9Sstevel@tonic-gate 	int		 success;
847c478bd9Sstevel@tonic-gate 	int		 valid;
857c478bd9Sstevel@tonic-gate 	int		 attempt;	/* all userauth attempt count */
867c478bd9Sstevel@tonic-gate 	int		 init_attempt;	/* passwd/kbd-int attempt count */
877c478bd9Sstevel@tonic-gate 	int		 failures;
887c478bd9Sstevel@tonic-gate 	int		 init_failures;
897c478bd9Sstevel@tonic-gate 	int		 unwind_dispatch_loop;
907c478bd9Sstevel@tonic-gate 	int		 v1_auth_type;
917c478bd9Sstevel@tonic-gate 	char		*v1_auth_name;
927c478bd9Sstevel@tonic-gate 	Authmethod	*method;
937c478bd9Sstevel@tonic-gate 	char		*user;
947c478bd9Sstevel@tonic-gate 	char		*service;
957c478bd9Sstevel@tonic-gate 	struct passwd	*pw;
967c478bd9Sstevel@tonic-gate 	char		*style;
977c478bd9Sstevel@tonic-gate 	void		*kbdintctxt;	/* XXX Switch to method_data;
987c478bd9Sstevel@tonic-gate 					   v1 still needs this*/
997c478bd9Sstevel@tonic-gate #ifdef USE_PAM
1007c478bd9Sstevel@tonic-gate 	pam_stuff	*pam;
101*f44ef466Sjp161948 	char		*cuser; /* client side user, needed for setting
102*f44ef466Sjp161948 				   PAM_AUSER for hostbased authentication
103*f44ef466Sjp161948 				   using roles */
1047c478bd9Sstevel@tonic-gate 	u_long		 last_login_time; /* need to get the time of
1057c478bd9Sstevel@tonic-gate 					     last login before calling
1067c478bd9Sstevel@tonic-gate 					     pam_open_session() */
1077c478bd9Sstevel@tonic-gate 	char		 last_login_host[MAXHOSTNAMELEN];
1087c478bd9Sstevel@tonic-gate 	int		 pam_retval;	/* pam_stuff is cleaned before
1097c478bd9Sstevel@tonic-gate 					   BSM login failure auditing */
1107c478bd9Sstevel@tonic-gate #endif /* USE_PAM */
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate 	/* SUNW - What follows remains to reduce diffs with OpenSSH but
1137c478bd9Sstevel@tonic-gate 	 *	  is not used in Solaris.  The Solaris SSH internal
1147c478bd9Sstevel@tonic-gate 	 *	  architecture requires that this stuff move into the
1157c478bd9Sstevel@tonic-gate 	 *	  Authmethod method_data.
1167c478bd9Sstevel@tonic-gate 	 */
1177c478bd9Sstevel@tonic-gate #ifndef	SUNW_SSH
1187c478bd9Sstevel@tonic-gate #ifdef BSD_AUTH
1197c478bd9Sstevel@tonic-gate 	auth_session_t	*as;
1207c478bd9Sstevel@tonic-gate #endif
1217c478bd9Sstevel@tonic-gate #ifdef KRB4
1227c478bd9Sstevel@tonic-gate 	char		*krb4_ticket_file;
1237c478bd9Sstevel@tonic-gate #endif
1247c478bd9Sstevel@tonic-gate #ifdef KRB5
1257c478bd9Sstevel@tonic-gate 	krb5_context	 krb5_ctx;
1267c478bd9Sstevel@tonic-gate 	krb5_auth_context krb5_auth_ctx;
1277c478bd9Sstevel@tonic-gate 	krb5_ccache	 krb5_fwd_ccache;
1287c478bd9Sstevel@tonic-gate 	krb5_principal	 krb5_user;
1297c478bd9Sstevel@tonic-gate 	char		*krb5_ticket_file;
1307c478bd9Sstevel@tonic-gate #endif
1317c478bd9Sstevel@tonic-gate 	void *methoddata;
1327c478bd9Sstevel@tonic-gate #endif /* SUNW_SSH */
1337c478bd9Sstevel@tonic-gate };
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate struct Authmethod {
1367c478bd9Sstevel@tonic-gate 	char	*name;
1377c478bd9Sstevel@tonic-gate 	int	*enabled;
1387c478bd9Sstevel@tonic-gate 	/*
1397c478bd9Sstevel@tonic-gate 	 * Userauth method state tracking fields updated in
1407c478bd9Sstevel@tonic-gate 	 * input_userauth_request() and auth-pam.c.
1417c478bd9Sstevel@tonic-gate 	 *
1427c478bd9Sstevel@tonic-gate 	 * The "void (*userauth)(Authctxt *authctxt)" function
1437c478bd9Sstevel@tonic-gate 	 * communicates the userauth result (success, failure,
1447c478bd9Sstevel@tonic-gate 	 * "postponed," abandoned) through the 'authenticated',
1457c478bd9Sstevel@tonic-gate 	 * 'postponed' and 'abandoned' fields.  Partial success is
1467c478bd9Sstevel@tonic-gate 	 * indicated by requiring other userauths to be used by setting
1477c478bd9Sstevel@tonic-gate 	 * their 'required' or 'sufficient' fields.
1487c478bd9Sstevel@tonic-gate 	 *
1497c478bd9Sstevel@tonic-gate 	 * Individual methods should only ever set 'not_again' if it
1507c478bd9Sstevel@tonic-gate 	 * makes no sense to complete the same userauth more than once,
1517c478bd9Sstevel@tonic-gate 	 * and they should set any methods' sufficient or required flags
1527c478bd9Sstevel@tonic-gate 	 * in order to force partial authentication and require that
1537c478bd9Sstevel@tonic-gate 	 * more userauths be tried.  The (void *) 'method_data' and
1547c478bd9Sstevel@tonic-gate 	 * 'hist_method_data' pointers can be used by methods such as
1557c478bd9Sstevel@tonic-gate 	 * pubkey which may make sense to run more than once during
1567c478bd9Sstevel@tonic-gate 	 * userauth or which may require multiple round tripes (e.g.,
1577c478bd9Sstevel@tonic-gate 	 * keyboard-interactive) and which need to keep some state;
1587c478bd9Sstevel@tonic-gate 	 * 'hist_method_data' is there specifically for pubkey userauth
1597c478bd9Sstevel@tonic-gate 	 * where multiple successful attempts should all use different
1607c478bd9Sstevel@tonic-gate 	 * keys.
1617c478bd9Sstevel@tonic-gate 	 *
1627c478bd9Sstevel@tonic-gate 	 * The "attempts," "abandons," "successes" and "failures" fields
1637c478bd9Sstevel@tonic-gate 	 * count the number of times a method has been attempted,
1647c478bd9Sstevel@tonic-gate 	 * abandoned, and has succeeded or failed.  Note that pubkey
1657c478bd9Sstevel@tonic-gate 	 * userauth does not double-count sig-less probes that are
1667c478bd9Sstevel@tonic-gate 	 * followed by a pubkey request for the same pubkey anw with a
1677c478bd9Sstevel@tonic-gate 	 * signature.
1687c478bd9Sstevel@tonic-gate 	 */
1697c478bd9Sstevel@tonic-gate 	void		(*userauth)(Authctxt *authctxt);
1707c478bd9Sstevel@tonic-gate 	void		(*abandon)(Authctxt *, Authmethod *);
1717c478bd9Sstevel@tonic-gate 	void		*method_data;
1727c478bd9Sstevel@tonic-gate 	void		*hist_method_data;
1737c478bd9Sstevel@tonic-gate 	unsigned int	 is_initial;
1747c478bd9Sstevel@tonic-gate 	unsigned int	 attempts:8;
1757c478bd9Sstevel@tonic-gate 	unsigned int	 abandons:8;
1767c478bd9Sstevel@tonic-gate 	unsigned int	 successes:8;
1777c478bd9Sstevel@tonic-gate 	unsigned int	 failures:8;
1787c478bd9Sstevel@tonic-gate 	/*
1797c478bd9Sstevel@tonic-gate 	 * Post-attempt state booleans (authenticated, abandoned, etc...)
1807c478bd9Sstevel@tonic-gate 	 */
1817c478bd9Sstevel@tonic-gate 	unsigned int	 authenticated:1;
1827c478bd9Sstevel@tonic-gate 	unsigned int	 not_again:1;
1837c478bd9Sstevel@tonic-gate 	unsigned int	 sufficient:1;
1847c478bd9Sstevel@tonic-gate 	unsigned int	 required:1;
1857c478bd9Sstevel@tonic-gate 	unsigned int	 postponed:1;
1867c478bd9Sstevel@tonic-gate 	unsigned int	 abandoned:1;
1877c478bd9Sstevel@tonic-gate 	/*
1887c478bd9Sstevel@tonic-gate 	 * NOTE: multi-round-trip userauth methods can either
1897c478bd9Sstevel@tonic-gate 	 *       recursively call dispatch_run and detect abandonment
1907c478bd9Sstevel@tonic-gate 	 *       within their message handlers (as PAM kbd-int does) or
1917c478bd9Sstevel@tonic-gate 	 *       set the postponed flag and let input_userauth_request()
1927c478bd9Sstevel@tonic-gate 	 *       detect abandonment (i.e., initiation of some userauth
1937c478bd9Sstevel@tonic-gate 	 *       method before completion of a started, multi-round-trip
1947c478bd9Sstevel@tonic-gate 	 *       userauth method).
1957c478bd9Sstevel@tonic-gate 	 *
1967c478bd9Sstevel@tonic-gate 	 */
1977c478bd9Sstevel@tonic-gate };
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate /*
2007c478bd9Sstevel@tonic-gate  * Keyboard interactive device:
2017c478bd9Sstevel@tonic-gate  * init_ctx	returns: non NULL upon success
2027c478bd9Sstevel@tonic-gate  * query	returns: 0 - success, otherwise failure
2037c478bd9Sstevel@tonic-gate  * respond	returns: 0 - success, 1 - need further interaction,
2047c478bd9Sstevel@tonic-gate  *		otherwise - failure
2057c478bd9Sstevel@tonic-gate  */
2067c478bd9Sstevel@tonic-gate struct KbdintDevice
2077c478bd9Sstevel@tonic-gate {
2087c478bd9Sstevel@tonic-gate 	const char *name;
2097c478bd9Sstevel@tonic-gate 	void*	(*init_ctx)(Authctxt*);
2107c478bd9Sstevel@tonic-gate 	int	(*query)(void *ctx, char **name, char **infotxt,
2117c478bd9Sstevel@tonic-gate 		    u_int *numprompts, char ***prompts, u_int **echo_on);
2127c478bd9Sstevel@tonic-gate 	int	(*respond)(void *ctx, u_int numresp, char **responses);
2137c478bd9Sstevel@tonic-gate 	void	(*free_ctx)(void *ctx);
2147c478bd9Sstevel@tonic-gate };
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate int      auth_rhosts(struct passwd *, const char *);
2177c478bd9Sstevel@tonic-gate int
2187c478bd9Sstevel@tonic-gate auth_rhosts2(struct passwd *, const char *, const char *, const char *);
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate int	 auth_rhosts_rsa(struct passwd *, char *, Key *);
2217c478bd9Sstevel@tonic-gate int      auth_password(Authctxt *, const char *);
2227c478bd9Sstevel@tonic-gate int      auth_rsa(struct passwd *, BIGNUM *);
2237c478bd9Sstevel@tonic-gate int      auth_rsa_challenge_dialog(Key *);
2247c478bd9Sstevel@tonic-gate BIGNUM	*auth_rsa_generate_challenge(Key *);
2257c478bd9Sstevel@tonic-gate int	 auth_rsa_verify_response(Key *, BIGNUM *, u_char[]);
2267c478bd9Sstevel@tonic-gate int	 auth_rsa_key_allowed(struct passwd *, BIGNUM *, Key **);
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate int	 auth_rhosts_rsa_key_allowed(struct passwd *, char *, char *, Key *);
2297c478bd9Sstevel@tonic-gate int	 hostbased_key_allowed(struct passwd *, const char *, char *, Key *);
2307c478bd9Sstevel@tonic-gate int	 user_key_allowed(struct passwd *, Key *);
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate #ifdef KRB4
2337c478bd9Sstevel@tonic-gate #include <krb.h>
2347c478bd9Sstevel@tonic-gate int     auth_krb4(Authctxt *, KTEXT, char **, KTEXT);
2357c478bd9Sstevel@tonic-gate int	auth_krb4_password(Authctxt *, const char *);
2367c478bd9Sstevel@tonic-gate void    krb4_cleanup_proc(void *);
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate #ifdef AFS
2397c478bd9Sstevel@tonic-gate #include <kafs.h>
2407c478bd9Sstevel@tonic-gate int     auth_krb4_tgt(Authctxt *, const char *);
2417c478bd9Sstevel@tonic-gate int     auth_afs_token(Authctxt *, const char *);
2427c478bd9Sstevel@tonic-gate #endif /* AFS */
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate #endif /* KRB4 */
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate #ifdef KRB5
2477c478bd9Sstevel@tonic-gate int	auth_krb5(Authctxt *authctxt, krb5_data *auth, char **client, krb5_data *);
2487c478bd9Sstevel@tonic-gate int	auth_krb5_tgt(Authctxt *authctxt, krb5_data *tgt);
2497c478bd9Sstevel@tonic-gate int	auth_krb5_password(Authctxt *authctxt, const char *password);
2507c478bd9Sstevel@tonic-gate void	krb5_cleanup_proc(void *authctxt);
2517c478bd9Sstevel@tonic-gate #endif /* KRB5 */
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate #include "auth-pam.h"
2547c478bd9Sstevel@tonic-gate #include "auth2-pam.h"
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate Authctxt *do_authentication(void);
2577c478bd9Sstevel@tonic-gate Authctxt *do_authentication2(void);
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate #ifdef HAVE_BSM
2607c478bd9Sstevel@tonic-gate void	audit_failed_login_cleanup(void *);
2617c478bd9Sstevel@tonic-gate #endif /* HAVE_BSM */
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate int	userauth_check_partial_failure(Authctxt *authctxt);
2647c478bd9Sstevel@tonic-gate void	userauth_force_kbdint(void);
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate Authctxt *authctxt_new(void);
2677c478bd9Sstevel@tonic-gate void	auth_log(Authctxt *, int, char *, char *);
2687c478bd9Sstevel@tonic-gate void	userauth_finish(Authctxt *, char *);
2697c478bd9Sstevel@tonic-gate void	userauth_user_svc_change(Authctxt *authctxt,
2707c478bd9Sstevel@tonic-gate 				 char *user,
2717c478bd9Sstevel@tonic-gate 				 char *service);
2727c478bd9Sstevel@tonic-gate int	auth_root_allowed(char *);
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate char	*auth2_read_banner(void);
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate void	privsep_challenge_enable(void);
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate void	auth2_challenge(Authctxt *, char *);
2797c478bd9Sstevel@tonic-gate void	auth2_challenge_abandon(Authctxt *);
2807c478bd9Sstevel@tonic-gate int	bsdauth_query(void *, char **, char **, u_int *, char ***, u_int **);
2817c478bd9Sstevel@tonic-gate int	bsdauth_respond(void *, u_int, char **);
2827c478bd9Sstevel@tonic-gate int	skey_query(void *, char **, char **, u_int *, char ***, u_int **);
2837c478bd9Sstevel@tonic-gate int	skey_respond(void *, u_int, char **);
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate struct passwd * getpwnamallow(const char *user);
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate char	*get_challenge(Authctxt *);
2887c478bd9Sstevel@tonic-gate int	verify_response(Authctxt *, const char *);
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate struct passwd * auth_get_user(void);
2917c478bd9Sstevel@tonic-gate 
2927c478bd9Sstevel@tonic-gate char	*authorized_keys_file(struct passwd *);
2937c478bd9Sstevel@tonic-gate char	*authorized_keys_file2(struct passwd *);
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate int
2967c478bd9Sstevel@tonic-gate secure_filename(FILE *, const char *, struct passwd *, char *, size_t);
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate HostStatus
2997c478bd9Sstevel@tonic-gate check_key_in_hostfiles(struct passwd *, Key *, const char *,
3007c478bd9Sstevel@tonic-gate     const char *, const char *);
3017c478bd9Sstevel@tonic-gate 
3027c478bd9Sstevel@tonic-gate /* hostkey handling */
3037c478bd9Sstevel@tonic-gate #ifndef lint
3047c478bd9Sstevel@tonic-gate Key	*get_hostkey_by_index(int);
3057c478bd9Sstevel@tonic-gate Key	*get_hostkey_by_type(int);
3067c478bd9Sstevel@tonic-gate int	 get_hostkey_index(Key *);
3077c478bd9Sstevel@tonic-gate #endif /* lint */
3087c478bd9Sstevel@tonic-gate int	 ssh1_session_key(BIGNUM *);
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate /* debug messages during authentication */
3117c478bd9Sstevel@tonic-gate void	 auth_debug_add(const char *fmt,...) __attribute__((format(printf, 1, 2)));
3127c478bd9Sstevel@tonic-gate void	 auth_debug_send(void);
3137c478bd9Sstevel@tonic-gate void	 auth_debug_reset(void);
3147c478bd9Sstevel@tonic-gate 
3157c478bd9Sstevel@tonic-gate #define AUTH_FAIL_MAX 6
3167c478bd9Sstevel@tonic-gate #define AUTH_FAIL_LOG (AUTH_FAIL_MAX/2)
3177c478bd9Sstevel@tonic-gate #define AUTH_FAIL_MSG "Too many authentication failures for %.100s"
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate #define SKEY_PROMPT "\nS/Key Password: "
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate #ifdef __cplusplus
3227c478bd9Sstevel@tonic-gate }
3237c478bd9Sstevel@tonic-gate #endif
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate #endif /* _AUTH_H */
326