Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sshconnect.h
1 /* $OpenBSD: sshconnect.h,v 1.46 2020/12/22 00:15:23 djm Exp $ */
2 
3 /*
4  * Copyright (c) 2000 Markus Friedl. 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  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 typedef struct Sensitive Sensitive;
28 struct Sensitive {
29  struct sshkey **keys;
30  int nkeys;
31 };
32 
33 struct ssh_conn_info {
34  char *conn_hash_hex;
35  char *shorthost;
36  char *uidstr;
37  char *keyalias;
38  char *thishost;
39  char *host_arg;
40  char *portstr;
41  char *remhost;
42  char *remuser;
43  char *homedir;
44  char *locuser;
45 };
46 
47 struct addrinfo;
48 struct ssh;
49 struct hostkeys;
50 struct ssh_conn_info;
51 
52 /* default argument for client percent expansions */
53 #define DEFAULT_CLIENT_PERCENT_EXPAND_ARGS(conn_info) \
54  "C", conn_info->conn_hash_hex, \
55  "L", conn_info->shorthost, \
56  "i", conn_info->uidstr, \
57  "k", conn_info->keyalias, \
58  "l", conn_info->thishost, \
59  "n", conn_info->host_arg, \
60  "p", conn_info->portstr, \
61  "d", conn_info->homedir, \
62  "h", conn_info->remhost, \
63  "r", conn_info->remuser, \
64  "u", conn_info->locuser
65 
66 int ssh_connect(struct ssh *, const char *, const char *,
67  struct addrinfo *, struct sockaddr_storage *, u_short,
68  int, int *, int);
69 void ssh_kill_proxy_command(void);
70 
71 void ssh_login(struct ssh *, Sensitive *, const char *,
72  struct sockaddr *, u_short, struct passwd *, int,
73  const struct ssh_conn_info *);
74 
75 int verify_host_key(char *, struct sockaddr *, struct sshkey *,
76  const struct ssh_conn_info *);
77 
78 void get_hostfile_hostname_ipaddr(char *, struct sockaddr *, u_short,
79  char **, char **);
80 
81 void ssh_kex2(struct ssh *ssh, char *, struct sockaddr *, u_short,
82  const struct ssh_conn_info *);
83 
84 void ssh_userauth2(struct ssh *ssh, const char *, const char *,
85  char *, Sensitive *);
86 
87 int ssh_local_cmd(const char *);
88 
89 void maybe_add_key_to_agent(const char *, struct sshkey *,
90  const char *, const char *);
91 
92 void load_hostkeys_command(struct hostkeys *, const char *,
93  const char *, const struct ssh_conn_info *,
94  const struct sshkey *, const char *);