summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/clientloop.c b/clientloop.c
index 6a35c8e3e..5621768b5 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.141 2005/07/16 01:35:24 djm Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.149 2005/12/30 15:56:37 reyk Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -77,6 +77,7 @@ RCSID("$OpenBSD: clientloop.c,v 1.141 2005/07/16 01:35:24 djm Exp $");
77#include "log.h" 77#include "log.h"
78#include "readconf.h" 78#include "readconf.h"
79#include "clientloop.h" 79#include "clientloop.h"
80#include "sshconnect.h"
80#include "authfd.h" 81#include "authfd.h"
81#include "atomicio.h" 82#include "atomicio.h"
82#include "sshpty.h" 83#include "sshpty.h"
@@ -113,7 +114,7 @@ extern char *host;
113static volatile sig_atomic_t received_window_change_signal = 0; 114static volatile sig_atomic_t received_window_change_signal = 0;
114static volatile sig_atomic_t received_signal = 0; 115static volatile sig_atomic_t received_signal = 0;
115 116
116/* Flag indicating whether the user\'s terminal is in non-blocking mode. */ 117/* Flag indicating whether the user's terminal is in non-blocking mode. */
117static int in_non_blocking_mode = 0; 118static int in_non_blocking_mode = 0;
118 119
119/* Common data for the client loop code. */ 120/* Common data for the client loop code. */
@@ -266,7 +267,7 @@ client_x11_get_proto(const char *display, const char *xauth_path,
266 } 267 }
267 } 268 }
268 snprintf(cmd, sizeof(cmd), 269 snprintf(cmd, sizeof(cmd),
269 "%s %s%s list %s . 2>" _PATH_DEVNULL, 270 "%s %s%s list %s 2>" _PATH_DEVNULL,
270 xauth_path, 271 xauth_path,
271 generated ? "-f " : "" , 272 generated ? "-f " : "" ,
272 generated ? xauthfile : "", 273 generated ? xauthfile : "",
@@ -919,6 +920,15 @@ process_cmdline(void)
919 logit(" -Lport:host:hostport Request local forward"); 920 logit(" -Lport:host:hostport Request local forward");
920 logit(" -Rport:host:hostport Request remote forward"); 921 logit(" -Rport:host:hostport Request remote forward");
921 logit(" -KRhostport Cancel remote forward"); 922 logit(" -KRhostport Cancel remote forward");
923 if (!options.permit_local_command)
924 goto out;
925 logit(" !args Execute local command");
926 goto out;
927 }
928
929 if (*s == '!' && options.permit_local_command) {
930 s++;
931 ssh_local_cmd(s);
922 goto out; 932 goto out;
923 } 933 }
924 934
@@ -1381,10 +1391,10 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1381 session_ident = ssh2_chan_id; 1391 session_ident = ssh2_chan_id;
1382 if (escape_char != SSH_ESCAPECHAR_NONE) 1392 if (escape_char != SSH_ESCAPECHAR_NONE)
1383 channel_register_filter(session_ident, 1393 channel_register_filter(session_ident,
1384 simple_escape_filter); 1394 simple_escape_filter, NULL);
1385 if (session_ident != -1) 1395 if (session_ident != -1)
1386 channel_register_cleanup(session_ident, 1396 channel_register_cleanup(session_ident,
1387 client_channel_closed); 1397 client_channel_closed, 0);
1388 } else { 1398 } else {
1389 /* Check if we should immediately send eof on stdin. */ 1399 /* Check if we should immediately send eof on stdin. */
1390 client_check_initial_eof_on_stdin(); 1400 client_check_initial_eof_on_stdin();
@@ -1685,7 +1695,7 @@ client_request_x11(const char *request_type, int rchan)
1685 1695
1686 if (!options.forward_x11) { 1696 if (!options.forward_x11) {
1687 error("Warning: ssh server tried X11 forwarding."); 1697 error("Warning: ssh server tried X11 forwarding.");
1688 error("Warning: this is probably a break in attempt by a malicious server."); 1698 error("Warning: this is probably a break-in attempt by a malicious server.");
1689 return NULL; 1699 return NULL;
1690 } 1700 }
1691 originator = packet_get_string(NULL); 1701 originator = packet_get_string(NULL);
@@ -1718,7 +1728,7 @@ client_request_agent(const char *request_type, int rchan)
1718 1728
1719 if (!options.forward_agent) { 1729 if (!options.forward_agent) {
1720 error("Warning: ssh server tried agent forwarding."); 1730 error("Warning: ssh server tried agent forwarding.");
1721 error("Warning: this is probably a break in attempt by a malicious server."); 1731 error("Warning: this is probably a break-in attempt by a malicious server.");
1722 return NULL; 1732 return NULL;
1723 } 1733 }
1724 sock = ssh_get_authentication_socket(); 1734 sock = ssh_get_authentication_socket();
@@ -1887,7 +1897,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
1887 /* Split */ 1897 /* Split */
1888 name = xstrdup(env[i]); 1898 name = xstrdup(env[i]);
1889 if ((val = strchr(name, '=')) == NULL) { 1899 if ((val = strchr(name, '=')) == NULL) {
1890 free(name); 1900 xfree(name);
1891 continue; 1901 continue;
1892 } 1902 }
1893 *val++ = '\0'; 1903 *val++ = '\0';
@@ -1901,7 +1911,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
1901 } 1911 }
1902 if (!matched) { 1912 if (!matched) {
1903 debug3("Ignored env %s", name); 1913 debug3("Ignored env %s", name);
1904 free(name); 1914 xfree(name);
1905 continue; 1915 continue;
1906 } 1916 }
1907 1917
@@ -1910,7 +1920,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
1910 packet_put_cstring(name); 1920 packet_put_cstring(name);
1911 packet_put_cstring(val); 1921 packet_put_cstring(val);
1912 packet_send(); 1922 packet_send();
1913 free(name); 1923 xfree(name);
1914 } 1924 }
1915 } 1925 }
1916 1926