| 1 |
/* |
| 2 |
* Copyright (c) 1998-2001, Robert O'Callahan |
| 3 |
* (C) 2004- TeraTerm Project |
| 4 |
* All rights reserved. |
| 5 |
* |
| 6 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
* modification, are permitted provided that the following conditions |
| 8 |
* are met: |
| 9 |
* |
| 10 |
* 1. Redistributions of source code must retain the above copyright |
| 11 |
* notice, this list of conditions and the following disclaimer. |
| 12 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
* notice, this list of conditions and the following disclaimer in the |
| 14 |
* documentation and/or other materials provided with the distribution. |
| 15 |
* 3. The name of the author may not be used to endorse or promote products |
| 16 |
* derived from this software without specific prior written permission. |
| 17 |
* |
| 18 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
| 19 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 21 |
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 23 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 |
*/ |
| 29 |
|
| 30 |
/* |
| 31 |
This code is copyright (C) 1998-1999 Robert O'Callahan. |
| 32 |
See LICENSE.TXT for the license. |
| 33 |
*/ |
| 34 |
|
| 35 |
#ifndef __AUTH_H |
| 36 |
#define __AUTH_H |
| 37 |
|
| 38 |
#include <stdio.h> |
| 39 |
|
| 40 |
typedef struct { |
| 41 |
SSHAuthMethod method; |
| 42 |
char *password; |
| 43 |
char *rhosts_client_user; |
| 44 |
Key *key_pair; |
| 45 |
} AUTHCred; |
| 46 |
|
| 47 |
typedef enum { GENERIC_AUTH_MODE, TIS_AUTH_MODE } AuthMode; |
| 48 |
|
| 49 |
typedef struct { |
| 50 |
char *user; |
| 51 |
AUTHCred cur_cred; |
| 52 |
SSHAuthMethod failed_method; |
| 53 |
int flags; |
| 54 |
int supported_types; |
| 55 |
HWND auth_dialog; |
| 56 |
|
| 57 |
AuthMode mode; |
| 58 |
char *TIS_prompt; |
| 59 |
int echo; |
| 60 |
} AUTHState; |
| 61 |
|
| 62 |
void AUTH_init(PTInstVar pvar); |
| 63 |
char *AUTH_get_user_name(PTInstVar pvar); |
| 64 |
int AUTH_set_supported_auth_types(PTInstVar pvar, int types); |
| 65 |
void AUTH_set_generic_mode(PTInstVar pvar); |
| 66 |
void AUTH_set_TIS_mode(PTInstVar pvar, char *prompt, int len, int echo); |
| 67 |
void AUTH_advance_to_next_cred(PTInstVar pvar); |
| 68 |
void AUTH_do_cred_dialog(PTInstVar pvar); |
| 69 |
void AUTH_do_default_cred_dialog(PTInstVar pvar); |
| 70 |
void AUTH_destroy_cur_cred(PTInstVar pvar); |
| 71 |
void AUTH_get_auth_info(PTInstVar pvar, char *dest, int len); |
| 72 |
void AUTH_notify_disconnecting(PTInstVar pvar); |
| 73 |
void AUTH_notify_end_error(PTInstVar pvar); |
| 74 |
void AUTH_notify_closing_on_exit(PTInstVar pvar); |
| 75 |
void AUTH_end(PTInstVar pvar); |
| 76 |
void destroy_malloced_string(char **str); |
| 77 |
void init_password_control(PTInstVar pvar, HWND dlg, int item, BOOL *UseControlChar); |
| 78 |
|
| 79 |
#define AUTH_get_cur_cred(pvar) (&(pvar)->auth_state.cur_cred) |
| 80 |
|
| 81 |
#endif |