1*069ac184SEd Maste /* $OpenBSD: sshconnect.h,v 1.47 2023/10/12 02:18:18 djm Exp $ */ 2ca3176e7SBrian Feldman 3b66f2d16SKris Kennaway /* 4b66f2d16SKris Kennaway * Copyright (c) 2000 Markus Friedl. All rights reserved. 5b66f2d16SKris Kennaway * 6b66f2d16SKris Kennaway * Redistribution and use in source and binary forms, with or without 7b66f2d16SKris Kennaway * modification, are permitted provided that the following conditions 8b66f2d16SKris Kennaway * are met: 9b66f2d16SKris Kennaway * 1. Redistributions of source code must retain the above copyright 10b66f2d16SKris Kennaway * notice, this list of conditions and the following disclaimer. 11b66f2d16SKris Kennaway * 2. Redistributions in binary form must reproduce the above copyright 12b66f2d16SKris Kennaway * notice, this list of conditions and the following disclaimer in the 13b66f2d16SKris Kennaway * documentation and/or other materials provided with the distribution. 14b66f2d16SKris Kennaway * 15b66f2d16SKris Kennaway * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16b66f2d16SKris Kennaway * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17b66f2d16SKris Kennaway * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18b66f2d16SKris Kennaway * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19b66f2d16SKris Kennaway * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20b66f2d16SKris Kennaway * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21b66f2d16SKris Kennaway * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22b66f2d16SKris Kennaway * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23b66f2d16SKris Kennaway * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24b66f2d16SKris Kennaway * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25b66f2d16SKris Kennaway */ 26a04a10f8SKris Kennaway 2780628bacSDag-Erling Smørgrav typedef struct Sensitive Sensitive; 2880628bacSDag-Erling Smørgrav struct Sensitive { 294f52dfbbSDag-Erling Smørgrav struct sshkey **keys; 3080628bacSDag-Erling Smørgrav int nkeys; 3180628bacSDag-Erling Smørgrav }; 3280628bacSDag-Erling Smørgrav 3319261079SEd Maste struct ssh_conn_info { 3419261079SEd Maste char *conn_hash_hex; 3519261079SEd Maste char *shorthost; 3619261079SEd Maste char *uidstr; 3719261079SEd Maste char *keyalias; 3819261079SEd Maste char *thishost; 3919261079SEd Maste char *host_arg; 4019261079SEd Maste char *portstr; 4119261079SEd Maste char *remhost; 4219261079SEd Maste char *remuser; 4319261079SEd Maste char *homedir; 4419261079SEd Maste char *locuser; 45*069ac184SEd Maste char *jmphost; 4619261079SEd Maste }; 4719261079SEd Maste 48f7167e0eSDag-Erling Smørgrav struct addrinfo; 494f52dfbbSDag-Erling Smørgrav struct ssh; 5019261079SEd Maste struct hostkeys; 5119261079SEd Maste struct ssh_conn_info; 524f52dfbbSDag-Erling Smørgrav 5319261079SEd Maste /* default argument for client percent expansions */ 5419261079SEd Maste #define DEFAULT_CLIENT_PERCENT_EXPAND_ARGS(conn_info) \ 5519261079SEd Maste "C", conn_info->conn_hash_hex, \ 5619261079SEd Maste "L", conn_info->shorthost, \ 5719261079SEd Maste "i", conn_info->uidstr, \ 5819261079SEd Maste "k", conn_info->keyalias, \ 5919261079SEd Maste "l", conn_info->thishost, \ 6019261079SEd Maste "n", conn_info->host_arg, \ 6119261079SEd Maste "p", conn_info->portstr, \ 6219261079SEd Maste "d", conn_info->homedir, \ 6319261079SEd Maste "h", conn_info->remhost, \ 6419261079SEd Maste "r", conn_info->remuser, \ 65*069ac184SEd Maste "u", conn_info->locuser, \ 66*069ac184SEd Maste "j", conn_info->jmphost 6719261079SEd Maste 6819261079SEd Maste int ssh_connect(struct ssh *, const char *, const char *, 6919261079SEd Maste struct addrinfo *, struct sockaddr_storage *, u_short, 7019261079SEd Maste int, int *, int); 714a421b63SDag-Erling Smørgrav void ssh_kill_proxy_command(void); 72ca3176e7SBrian Feldman 7319261079SEd Maste void ssh_login(struct ssh *, Sensitive *, const char *, 7419261079SEd Maste struct sockaddr *, u_short, struct passwd *, int, 7519261079SEd Maste const struct ssh_conn_info *); 76ca3176e7SBrian Feldman 7719261079SEd Maste int verify_host_key(char *, struct sockaddr *, struct sshkey *, 7819261079SEd Maste const struct ssh_conn_info *); 79a04a10f8SKris Kennaway 804a421b63SDag-Erling Smørgrav void get_hostfile_hostname_ipaddr(char *, struct sockaddr *, u_short, 814a421b63SDag-Erling Smørgrav char **, char **); 824a421b63SDag-Erling Smørgrav 8319261079SEd Maste void ssh_kex2(struct ssh *ssh, char *, struct sockaddr *, u_short, 8419261079SEd Maste const struct ssh_conn_info *); 85ca3176e7SBrian Feldman 8619261079SEd Maste void ssh_userauth2(struct ssh *ssh, const char *, const char *, 8719261079SEd Maste char *, Sensitive *); 88a04a10f8SKris Kennaway 89b74df5b2SDag-Erling Smørgrav int ssh_local_cmd(const char *); 9080628bacSDag-Erling Smørgrav 9119261079SEd Maste void maybe_add_key_to_agent(const char *, struct sshkey *, 9219261079SEd Maste const char *, const char *); 9319261079SEd Maste 9419261079SEd Maste void load_hostkeys_command(struct hostkeys *, const char *, 9519261079SEd Maste const char *, const struct ssh_conn_info *, 9619261079SEd Maste const struct sshkey *, const char *); 97