1- /* $OpenBSD: auth.h,v 1.91  2017/05/30 14:29:59 markus  Exp $ */ 
1+ /* $OpenBSD: auth.h,v 1.92  2017/06/24 06:34:38 djm  Exp $ */ 
22
33/* 
44 * Copyright (c) 2000 Markus Friedl.  All rights reserved. 
4444
4545struct  ssh ;
4646struct  sshkey ;
47+ struct  sshbuf ;
4748
4849typedef  struct  Authctxt  Authctxt ;
4950typedef  struct  Authmethod  Authmethod ;
@@ -62,28 +63,41 @@ struct Authctxt {
6263	char 		* service ;
6364	struct  passwd 	* pw ;		/* set if 'valid' */ 
6465	char 		* style ;
66+ 
67+ 	/* Method lists for multiple authentication */ 
68+ 	char 		* * auth_methods ;	/* modified from server config */ 
69+ 	u_int 		 num_auth_methods ;
70+ 
71+ 	/* Authentication method-specific data */ 
72+ 	void 		* methoddata ;
6573	void 		* kbdintctxt ;
66- 	char 		* info ;		/* Extra info for next auth_log */ 
6774#ifdef  BSD_AUTH 
6875	auth_session_t 	* as ;
6976#endif 
70- 	char 		* * auth_methods ;	/* modified from server config */ 
71- 	u_int 		 num_auth_methods ;
7277#ifdef  KRB5 
7378	krb5_context 	 krb5_ctx ;
7479	krb5_ccache 	 krb5_fwd_ccache ;
7580	krb5_principal 	 krb5_user ;
7681	char 		* krb5_ticket_file ;
7782	char 		* krb5_ccname ;
7883#endif 
79- 	Buffer 		* loginmsg ;
80- 	void 		* methoddata ;
84+ 	struct  sshbuf 	* loginmsg ;
85+ 
86+ 	/* Authentication keys already used; these will be refused henceforth */ 
87+ 	struct  sshkey 	* * prev_keys ;
88+ 	u_int 		 nprev_keys ;
89+ 
90+ 	/* Last used key and ancilliary information from active auth method */ 
91+ 	struct  sshkey 	* auth_method_key ;
92+ 	char 		* auth_method_info ;
93+ 
94+ 	/* Information exposed to session */ 
95+ 	struct  sshbuf 	* session_info ;	/* Auth info for environment */ 
8196#ifdef  WINDOWS 
8297	void 		* auth_token ;
8398#endif 
84- 	struct  sshkey 	* * prev_userkeys ;
85- 	u_int 		 nprev_userkeys ;
8699};
100+ 
87101/* 
88102 * Every authentication method has to handle authentication requests for 
89103 * non-existing users, or for users that are not allowed to login. In this 
@@ -122,10 +136,18 @@ int      auth_password(Authctxt *, const char *);
122136int 	 hostbased_key_allowed (struct  passwd  * , const  char  * , char  * ,
123137	    struct  sshkey  * );
124138int 	 user_key_allowed (struct  passwd  * , struct  sshkey  * , int );
125- void 	 pubkey_auth_info (Authctxt  * , const  struct  sshkey  * , const  char  * , ...)
126- 	    __attribute__((__format__  (printf , 3 , 4 )));
127- void 	 auth2_record_userkey (Authctxt  * , struct  sshkey  * );
128- int 	 auth2_userkey_already_used (Authctxt  * , struct  sshkey  * );
139+ int 	 auth2_key_already_used (Authctxt  * , const  struct  sshkey  * );
140+ 
141+ /* 
142+  * Handling auth method-specific information for logging and prevention 
143+  * of key reuse during multiple authentication. 
144+  */ 
145+ void 	 auth2_authctxt_reset_info (Authctxt  * );
146+ void 	 auth2_record_key (Authctxt  * , int , const  struct  sshkey  * );
147+ void 	 auth2_record_info (Authctxt  * authctxt , const  char  * , ...)
148+ 	    __attribute__((__format__  (printf , 2 , 3 )))
149+ 	    __attribute__((__nonnull__  (2 )));
150+ void 	 auth2_update_session_info (Authctxt  * , const  char  * , const  char  * );
129151
130152struct  stat ;
131153int 	 auth_secure_path (const  char  * , struct  stat  * , const  char  * , uid_t ,
@@ -152,9 +174,6 @@ void disable_forwarding(void);
152174
153175void 	do_authentication2 (Authctxt  * );
154176
155- void 	auth_info (Authctxt  * authctxt , const  char  * , ...)
156- 	    __attribute__((__format__  (printf , 2 , 3 )))
157- 	    __attribute__((__nonnull__  (2 )));
158177void 	auth_log (Authctxt  * , int , int , const  char  * , const  char  * );
159178void 	auth_maxtries_exceeded (Authctxt  * ) __attribute__((noreturn ));
160179void 	userauth_finish (struct  ssh  * , int , const  char  * , const  char  * );
0 commit comments