chansession.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Dropbear - a SSH2 server
  3. *
  4. * Copyright (c) 2002,2003 Matt Johnston
  5. * All rights reserved.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. * SOFTWARE. */
  24. #ifndef DROPBEAR_CHANSESSION_H_
  25. #define DROPBEAR_CHANSESSION_H_
  26. #include "loginrec.h"
  27. #include "channel.h"
  28. #include "listener.h"
  29. struct exitinfo {
  30. int exitpid; /* -1 if not exited */
  31. int exitstatus;
  32. int exitsignal;
  33. int exitcore;
  34. };
  35. struct ChanSess {
  36. char * cmd; /* command to exec */
  37. pid_t pid; /* child process pid */
  38. /* pty details */
  39. int master; /* the master terminal fd*/
  40. int slave;
  41. char * tty;
  42. char * term;
  43. /* exit details */
  44. struct exitinfo exit;
  45. /* These are only set temporarily before forking */
  46. /* Used to set $SSH_CONNECTION in the child session. */
  47. char *connection_string;
  48. /* Used to set $SSH_CLIENT in the child session. */
  49. char *client_string;
  50. #ifndef DISABLE_X11FWD
  51. struct Listener * x11listener;
  52. int x11port;
  53. char * x11authprot;
  54. char * x11authcookie;
  55. unsigned int x11screennum;
  56. unsigned char x11singleconn;
  57. #endif
  58. #ifdef ENABLE_SVR_AGENTFWD
  59. struct Listener * agentlistener;
  60. char * agentfile;
  61. char * agentdir;
  62. #endif
  63. #ifdef ENABLE_SVR_PUBKEY_OPTIONS
  64. char *original_command;
  65. #endif
  66. };
  67. struct ChildPid {
  68. pid_t pid;
  69. struct ChanSess * chansess;
  70. };
  71. void addnewvar(const char* param, const char* var);
  72. void cli_send_chansess_request(void);
  73. void cli_tty_cleanup(void);
  74. void cli_chansess_winchange(void);
  75. #ifdef ENABLE_CLI_NETCAT
  76. void cli_send_netcat_request(void);
  77. #endif
  78. void svr_chansessinitialise(void);
  79. extern const struct ChanType svrchansess;
  80. struct SigMap {
  81. int signal;
  82. char* name;
  83. };
  84. extern const struct SigMap signames[];
  85. #endif /* DROPBEAR_CHANSESSION_H_ */