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. /* command that was sent by the client, if authorized_keys command= or
  39. dropbear -c was used */
  40. char *original_command;
  41. /* pty details */
  42. int master; /* the master terminal fd*/
  43. int slave;
  44. char * tty;
  45. char * term;
  46. /* exit details */
  47. struct exitinfo exit;
  48. /* These are only set temporarily before forking */
  49. /* Used to set $SSH_CONNECTION in the child session. */
  50. char *connection_string;
  51. /* Used to set $SSH_CLIENT in the child session. */
  52. char *client_string;
  53. #if DROPBEAR_X11FWD
  54. struct Listener * x11listener;
  55. int x11port;
  56. char * x11authprot;
  57. char * x11authcookie;
  58. unsigned int x11screennum;
  59. unsigned char x11singleconn;
  60. #endif
  61. #if DROPBEAR_SVR_AGENTFWD
  62. struct Listener * agentlistener;
  63. char * agentfile;
  64. char * agentdir;
  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. #if DROPBEAR_CLI_NETCAT
  76. void cli_send_netcat_request(void);
  77. #endif
  78. void svr_chansessinitialise(void);
  79. void svr_chansess_checksignal(void);
  80. extern const struct ChanType svrchansess;
  81. struct SigMap {
  82. int signal;
  83. char* name;
  84. };
  85. extern const struct SigMap signames[];
  86. #endif /* DROPBEAR_CHANSESSION_H_ */