diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 69 |
1 files changed, 33 insertions, 36 deletions
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "includes.h" | 35 | #include "includes.h" |
36 | RCSID("$OpenBSD: session.c,v 1.93 2001/06/21 21:08:25 markus Exp $"); | 36 | RCSID("$OpenBSD: session.c,v 1.94 2001/06/23 15:12:20 itojun Exp $"); |
37 | 37 | ||
38 | #include "ssh.h" | 38 | #include "ssh.h" |
39 | #include "ssh1.h" | 39 | #include "ssh1.h" |
@@ -120,25 +120,22 @@ struct Session { | |||
120 | /* func */ | 120 | /* func */ |
121 | 121 | ||
122 | Session *session_new(void); | 122 | Session *session_new(void); |
123 | void session_set_fds(Session *s, int fdin, int fdout, int fderr); | 123 | void session_set_fds(Session *, int, int, int); |
124 | void session_pty_cleanup(void *session); | 124 | static void session_pty_cleanup(void *); |
125 | int session_pty_req(Session *s); | 125 | void session_proctitle(Session *); |
126 | void session_proctitle(Session *s); | 126 | int session_setup_x11fwd(Session *); |
127 | int session_setup_x11fwd(Session *s); | 127 | void do_exec_pty(Session *, const char *); |
128 | void session_close(Session *s); | 128 | void do_exec_no_pty(Session *, const char *); |
129 | void do_exec_pty(Session *s, const char *command); | 129 | void do_exec(Session *, const char *); |
130 | void do_exec_no_pty(Session *s, const char *command); | 130 | void do_login(Session *, const char *); |
131 | void do_exec(Session *s, const char *command); | 131 | void do_child(Session *, const char *); |
132 | void do_login(Session *s, const char *command); | ||
133 | #ifdef LOGIN_NEEDS_UTMPX | ||
134 | void do_pre_login(Session *s); | ||
135 | #endif | ||
136 | void do_child(Session *s, const char *command); | ||
137 | void do_motd(void); | 132 | void do_motd(void); |
138 | int check_quietlogin(Session *s, const char *command); | ||
139 | 133 | ||
140 | void do_authenticated1(Authctxt *authctxt); | 134 | static void do_authenticated1(Authctxt *); |
141 | void do_authenticated2(Authctxt *authctxt); | 135 | static void do_authenticated2(Authctxt *); |
136 | |||
137 | static void session_close(Session *); | ||
138 | static int session_pty_req(Session *); | ||
142 | 139 | ||
143 | /* import */ | 140 | /* import */ |
144 | extern ServerOptions options; | 141 | extern ServerOptions options; |
@@ -209,7 +206,7 @@ do_authenticated(Authctxt *authctxt) | |||
209 | * terminals are allocated, X11, TCP/IP, and authentication agent forwardings | 206 | * terminals are allocated, X11, TCP/IP, and authentication agent forwardings |
210 | * are requested, etc. | 207 | * are requested, etc. |
211 | */ | 208 | */ |
212 | void | 209 | static void |
213 | do_authenticated1(Authctxt *authctxt) | 210 | do_authenticated1(Authctxt *authctxt) |
214 | { | 211 | { |
215 | Session *s; | 212 | Session *s; |
@@ -738,7 +735,7 @@ check_quietlogin(Session *s, const char *command) | |||
738 | * Sets the value of the given variable in the environment. If the variable | 735 | * Sets the value of the given variable in the environment. If the variable |
739 | * already exists, its value is overriden. | 736 | * already exists, its value is overriden. |
740 | */ | 737 | */ |
741 | void | 738 | static void |
742 | child_set_env(char ***envp, u_int *envsizep, const char *name, | 739 | child_set_env(char ***envp, u_int *envsizep, const char *name, |
743 | const char *value) | 740 | const char *value) |
744 | { | 741 | { |
@@ -779,7 +776,7 @@ child_set_env(char ***envp, u_int *envsizep, const char *name, | |||
779 | * Otherwise, it must consist of empty lines, comments (line starts with '#') | 776 | * Otherwise, it must consist of empty lines, comments (line starts with '#') |
780 | * and assignments of the form name=value. No other forms are allowed. | 777 | * and assignments of the form name=value. No other forms are allowed. |
781 | */ | 778 | */ |
782 | void | 779 | static void |
783 | read_environment_file(char ***env, u_int *envsize, | 780 | read_environment_file(char ***env, u_int *envsize, |
784 | const char *filename) | 781 | const char *filename) |
785 | { | 782 | { |
@@ -1488,7 +1485,7 @@ session_new(void) | |||
1488 | return NULL; | 1485 | return NULL; |
1489 | } | 1486 | } |
1490 | 1487 | ||
1491 | void | 1488 | static void |
1492 | session_dump(void) | 1489 | session_dump(void) |
1493 | { | 1490 | { |
1494 | int i; | 1491 | int i; |
@@ -1520,7 +1517,7 @@ session_open(int chanid) | |||
1520 | return 1; | 1517 | return 1; |
1521 | } | 1518 | } |
1522 | 1519 | ||
1523 | Session * | 1520 | static Session * |
1524 | session_by_channel(int id) | 1521 | session_by_channel(int id) |
1525 | { | 1522 | { |
1526 | int i; | 1523 | int i; |
@@ -1536,7 +1533,7 @@ session_by_channel(int id) | |||
1536 | return NULL; | 1533 | return NULL; |
1537 | } | 1534 | } |
1538 | 1535 | ||
1539 | Session * | 1536 | static Session * |
1540 | session_by_pid(pid_t pid) | 1537 | session_by_pid(pid_t pid) |
1541 | { | 1538 | { |
1542 | int i; | 1539 | int i; |
@@ -1551,7 +1548,7 @@ session_by_pid(pid_t pid) | |||
1551 | return NULL; | 1548 | return NULL; |
1552 | } | 1549 | } |
1553 | 1550 | ||
1554 | int | 1551 | static int |
1555 | session_window_change_req(Session *s) | 1552 | session_window_change_req(Session *s) |
1556 | { | 1553 | { |
1557 | s->col = packet_get_int(); | 1554 | s->col = packet_get_int(); |
@@ -1563,7 +1560,7 @@ session_window_change_req(Session *s) | |||
1563 | return 1; | 1560 | return 1; |
1564 | } | 1561 | } |
1565 | 1562 | ||
1566 | int | 1563 | static int |
1567 | session_pty_req(Session *s) | 1564 | session_pty_req(Session *s) |
1568 | { | 1565 | { |
1569 | u_int len; | 1566 | u_int len; |
@@ -1628,7 +1625,7 @@ session_pty_req(Session *s) | |||
1628 | return 1; | 1625 | return 1; |
1629 | } | 1626 | } |
1630 | 1627 | ||
1631 | int | 1628 | static int |
1632 | session_subsystem_req(Session *s) | 1629 | session_subsystem_req(Session *s) |
1633 | { | 1630 | { |
1634 | u_int len; | 1631 | u_int len; |
@@ -1655,7 +1652,7 @@ session_subsystem_req(Session *s) | |||
1655 | return success; | 1652 | return success; |
1656 | } | 1653 | } |
1657 | 1654 | ||
1658 | int | 1655 | static int |
1659 | session_x11_req(Session *s) | 1656 | session_x11_req(Session *s) |
1660 | { | 1657 | { |
1661 | int success; | 1658 | int success; |
@@ -1676,7 +1673,7 @@ session_x11_req(Session *s) | |||
1676 | return success; | 1673 | return success; |
1677 | } | 1674 | } |
1678 | 1675 | ||
1679 | int | 1676 | static int |
1680 | session_shell_req(Session *s) | 1677 | session_shell_req(Session *s) |
1681 | { | 1678 | { |
1682 | packet_done(); | 1679 | packet_done(); |
@@ -1684,7 +1681,7 @@ session_shell_req(Session *s) | |||
1684 | return 1; | 1681 | return 1; |
1685 | } | 1682 | } |
1686 | 1683 | ||
1687 | int | 1684 | static int |
1688 | session_exec_req(Session *s) | 1685 | session_exec_req(Session *s) |
1689 | { | 1686 | { |
1690 | u_int len; | 1687 | u_int len; |
@@ -1695,7 +1692,7 @@ session_exec_req(Session *s) | |||
1695 | return 1; | 1692 | return 1; |
1696 | } | 1693 | } |
1697 | 1694 | ||
1698 | int | 1695 | static int |
1699 | session_auth_agent_req(Session *s) | 1696 | session_auth_agent_req(Session *s) |
1700 | { | 1697 | { |
1701 | static int called = 0; | 1698 | static int called = 0; |
@@ -1788,7 +1785,7 @@ session_set_fds(Session *s, int fdin, int fdout, int fderr) | |||
1788 | * Function to perform pty cleanup. Also called if we get aborted abnormally | 1785 | * Function to perform pty cleanup. Also called if we get aborted abnormally |
1789 | * (e.g., due to a dropped connection). | 1786 | * (e.g., due to a dropped connection). |
1790 | */ | 1787 | */ |
1791 | void | 1788 | static void |
1792 | session_pty_cleanup(void *session) | 1789 | session_pty_cleanup(void *session) |
1793 | { | 1790 | { |
1794 | Session *s = session; | 1791 | Session *s = session; |
@@ -1818,7 +1815,7 @@ session_pty_cleanup(void *session) | |||
1818 | error("close(s->ptymaster): %s", strerror(errno)); | 1815 | error("close(s->ptymaster): %s", strerror(errno)); |
1819 | } | 1816 | } |
1820 | 1817 | ||
1821 | void | 1818 | static void |
1822 | session_exit_message(Session *s, int status) | 1819 | session_exit_message(Session *s, int status) |
1823 | { | 1820 | { |
1824 | Channel *c; | 1821 | Channel *c; |
@@ -1867,7 +1864,7 @@ session_exit_message(Session *s, int status) | |||
1867 | s->chanid = -1; | 1864 | s->chanid = -1; |
1868 | } | 1865 | } |
1869 | 1866 | ||
1870 | void | 1867 | static void |
1871 | session_close(Session *s) | 1868 | session_close(Session *s) |
1872 | { | 1869 | { |
1873 | debug("session_close: session %d pid %d", s->self, s->pid); | 1870 | debug("session_close: session %d pid %d", s->self, s->pid); |
@@ -1928,7 +1925,7 @@ session_close_by_channel(int id, void *arg) | |||
1928 | } | 1925 | } |
1929 | } | 1926 | } |
1930 | 1927 | ||
1931 | char * | 1928 | static char * |
1932 | session_tty_list(void) | 1929 | session_tty_list(void) |
1933 | { | 1930 | { |
1934 | static char buf[1024]; | 1931 | static char buf[1024]; |
@@ -1991,7 +1988,7 @@ session_setup_x11fwd(Session *s) | |||
1991 | return 1; | 1988 | return 1; |
1992 | } | 1989 | } |
1993 | 1990 | ||
1994 | void | 1991 | static void |
1995 | do_authenticated2(Authctxt *authctxt) | 1992 | do_authenticated2(Authctxt *authctxt) |
1996 | { | 1993 | { |
1997 | server_loop2(); | 1994 | server_loop2(); |