Damien Miller | e4340be | 2000-09-16 13:29:08 +1100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 14 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 15 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 16 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 18 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 19 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 20 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | */ |
Damien Miller | eba71ba | 2000-04-29 23:57:08 +1000 | [diff] [blame] | 24 | #ifndef SSHCONNECT_H |
| 25 | #define SSHCONNECT_H |
Ben Lindstrom | 226cfa0 | 2001-01-22 05:34:40 +0000 | [diff] [blame] | 26 | /* |
| 27 | * Opens a TCP/IP connection to the remote server on the given host. If port |
| 28 | * is 0, the default port will be used. If anonymous is zero, a privileged |
| 29 | * port will be allocated to make the connection. This requires super-user |
| 30 | * privileges if anonymous is false. Connection_attempts specifies the |
| 31 | * maximum number of tries, one per second. This returns true on success, |
| 32 | * and zero on failure. If the connection is successful, this calls |
| 33 | * packet_set_connection for the connection. |
| 34 | */ |
| 35 | int |
| 36 | ssh_connect(const char *host, struct sockaddr_storage * hostaddr, |
| 37 | u_short port, int connection_attempts, |
| 38 | int anonymous, uid_t original_real_uid, |
| 39 | const char *proxy_command); |
| 40 | |
| 41 | /* |
| 42 | * Starts a dialog with the server, and authenticates the current user on the |
| 43 | * server. This does not need any extra privileges. The basic connection to |
| 44 | * the server must already have been established before this is called. If |
| 45 | * login fails, this function prints an error and never returns. This |
| 46 | * initializes the random state, and leaves it initialized (it will also have |
| 47 | * references from the packet module). |
| 48 | */ |
| 49 | |
| 50 | void |
| 51 | ssh_login(int host_key_valid, RSA * host_key, const char *host, |
| 52 | struct sockaddr * hostaddr, uid_t original_real_uid); |
| 53 | |
Damien Miller | eba71ba | 2000-04-29 23:57:08 +1000 | [diff] [blame] | 54 | |
| 55 | void |
| 56 | check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, |
| 57 | const char *user_hostfile, const char *system_hostfile); |
| 58 | |
| 59 | void ssh_kex(char *host, struct sockaddr *hostaddr); |
| 60 | void |
Ben Lindstrom | bf555ba | 2001-01-18 02:04:35 +0000 | [diff] [blame] | 61 | ssh_userauth(const char * local_user, const char * server_user, char *host, |
Damien Miller | eba71ba | 2000-04-29 23:57:08 +1000 | [diff] [blame] | 62 | int host_key_valid, RSA *own_host_key); |
| 63 | |
| 64 | void ssh_kex2(char *host, struct sockaddr *hostaddr); |
| 65 | void ssh_userauth2(const char *server_user, char *host); |
| 66 | |
| 67 | #endif |