sshconnect.h 3.0 KB

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