blob: 4e16f2d85981c6133c7fec7ce876e647cfa5df38 [file] [log] [blame]
Damien Millere4340be2000-09-16 13:29:08 +11001/*
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 Millereba71ba2000-04-29 23:57:08 +100024#ifndef SSHCONNECT_H
25#define SSHCONNECT_H
Ben Lindstrom226cfa02001-01-22 05:34:40 +000026/*
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 */
35int
36ssh_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
50void
51ssh_login(int host_key_valid, RSA * host_key, const char *host,
52 struct sockaddr * hostaddr, uid_t original_real_uid);
53
Damien Millereba71ba2000-04-29 23:57:08 +100054
55void
56check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
57 const char *user_hostfile, const char *system_hostfile);
58
59void ssh_kex(char *host, struct sockaddr *hostaddr);
60void
Ben Lindstrombf555ba2001-01-18 02:04:35 +000061ssh_userauth(const char * local_user, const char * server_user, char *host,
Damien Millereba71ba2000-04-29 23:57:08 +100062 int host_key_valid, RSA *own_host_key);
63
64void ssh_kex2(char *host, struct sockaddr *hostaddr);
65void ssh_userauth2(const char *server_user, char *host);
66
67#endif