|
Lines 1792-1798
static void
Link Here
|
| 1792 |
session_exit_message(Session *s, int status) |
1792 |
session_exit_message(Session *s, int status) |
| 1793 |
{ |
1793 |
{ |
| 1794 |
Channel *c; |
1794 |
Channel *c; |
| 1795 |
u_int i; |
|
|
| 1796 |
|
1795 |
|
| 1797 |
if ((c = channel_lookup(s->chanid)) == NULL) |
1796 |
if ((c = channel_lookup(s->chanid)) == NULL) |
| 1798 |
fatal("session_exit_message: session %d: no channel %d", |
1797 |
fatal("session_exit_message: session %d: no channel %d", |
|
Lines 1818-1824
session_exit_message(Session *s, int sta
Link Here
|
| 1818 |
|
1817 |
|
| 1819 |
/* disconnect channel */ |
1818 |
/* disconnect channel */ |
| 1820 |
debug("session_exit_message: release channel %d", s->chanid); |
1819 |
debug("session_exit_message: release channel %d", s->chanid); |
| 1821 |
channel_cancel_cleanup(s->chanid); |
1820 |
s->pid = 0; |
|
|
1821 |
|
| 1822 |
/* |
| 1823 |
* Adjust cleanup callback attachment to send close messages when |
| 1824 |
* the channel gets EOF. The session will be then be closed |
| 1825 |
* by session_close_by_channel when the childs close their fds. |
| 1826 |
*/ |
| 1827 |
channel_register_cleanup(c->self, session_close_by_channel, 1); |
| 1828 |
|
| 1822 |
/* |
1829 |
/* |
| 1823 |
* emulate a write failure with 'chan_write_failed', nobody will be |
1830 |
* emulate a write failure with 'chan_write_failed', nobody will be |
| 1824 |
* interested in data we write. |
1831 |
* interested in data we write. |
|
Lines 1827-1841
session_exit_message(Session *s, int sta
Link Here
|
| 1827 |
*/ |
1834 |
*/ |
| 1828 |
if (c->ostate != CHAN_OUTPUT_CLOSED) |
1835 |
if (c->ostate != CHAN_OUTPUT_CLOSED) |
| 1829 |
chan_write_failed(c); |
1836 |
chan_write_failed(c); |
| 1830 |
s->chanid = -1; |
|
|
| 1831 |
|
| 1832 |
/* Close any X11 listeners associated with this session */ |
| 1833 |
if (s->x11_chanids != NULL) { |
| 1834 |
for (i = 0; s->x11_chanids[i] != -1; i++) { |
| 1835 |
session_close_x11(s->x11_chanids[i]); |
| 1836 |
s->x11_chanids[i] = -1; |
| 1837 |
} |
| 1838 |
} |
| 1839 |
} |
1837 |
} |
| 1840 |
|
1838 |
|
| 1841 |
void |
1839 |
void |
|
Lines 1879-1885
session_close_by_pid(pid_t pid, int stat
Link Here
|
| 1879 |
} |
1877 |
} |
| 1880 |
if (s->chanid != -1) |
1878 |
if (s->chanid != -1) |
| 1881 |
session_exit_message(s, status); |
1879 |
session_exit_message(s, status); |
| 1882 |
session_close(s); |
1880 |
if (s->ttyfd != -1) |
|
|
1881 |
session_pty_cleanup(s); |
| 1883 |
} |
1882 |
} |
| 1884 |
|
1883 |
|
| 1885 |
/* |
1884 |
/* |
|
Lines 1890-1895
void
Link Here
|
| 1890 |
session_close_by_channel(int id, void *arg) |
1889 |
session_close_by_channel(int id, void *arg) |
| 1891 |
{ |
1890 |
{ |
| 1892 |
Session *s = session_by_channel(id); |
1891 |
Session *s = session_by_channel(id); |
|
|
1892 |
u_int i; |
| 1893 |
|
1893 |
|
| 1894 |
if (s == NULL) { |
1894 |
if (s == NULL) { |
| 1895 |
debug("session_close_by_channel: no session for id %d", id); |
1895 |
debug("session_close_by_channel: no session for id %d", id); |
|
Lines 1909-1914
session_close_by_channel(int id, void *a
Link Here
|
| 1909 |
} |
1909 |
} |
| 1910 |
/* detach by removing callback */ |
1910 |
/* detach by removing callback */ |
| 1911 |
channel_cancel_cleanup(s->chanid); |
1911 |
channel_cancel_cleanup(s->chanid); |
|
|
1912 |
|
| 1913 |
/* Close any X11 listeners associated with this session */ |
| 1914 |
if (s->x11_chanids != NULL) { |
| 1915 |
for (i = 0; s->x11_chanids[i] != -1; i++) { |
| 1916 |
session_close_x11(s->x11_chanids[i]); |
| 1917 |
s->x11_chanids[i] = -1; |
| 1918 |
} |
| 1919 |
} |
| 1920 |
|
| 1912 |
s->chanid = -1; |
1921 |
s->chanid = -1; |
| 1913 |
session_close(s); |
1922 |
session_close(s); |
| 1914 |
} |
1923 |
} |
|
Lines 1994-2000
session_setup_x11fwd(Session *s)
Link Here
|
| 1994 |
} |
2003 |
} |
| 1995 |
for (i = 0; s->x11_chanids[i] != -1; i++) { |
2004 |
for (i = 0; s->x11_chanids[i] != -1; i++) { |
| 1996 |
channel_register_cleanup(s->x11_chanids[i], |
2005 |
channel_register_cleanup(s->x11_chanids[i], |
| 1997 |
session_close_single_x11); |
2006 |
session_close_single_x11, 0); |
| 1998 |
} |
2007 |
} |
| 1999 |
|
2008 |
|
| 2000 |
/* Set up a suitable value for the DISPLAY variable. */ |
2009 |
/* Set up a suitable value for the DISPLAY variable. */ |