]> andersk Git - openssh.git/blobdiff - clientloop.c
- djm@cvs.openbsd.org 2006/03/19 07:41:30
[openssh.git] / clientloop.c
index 9611a5e3e73a56c4699d77b43358606fa26f1843..6d58a5afbc8ac25ce9e2076ec7499bb7ba302377 100644 (file)
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.140 2005/07/04 00:58:43 djm Exp $");
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#include <sys/ioctl.h>
+
+#include <ctype.h>
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+#include <signal.h>
+#include <termios.h>
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -77,6 +89,7 @@ RCSID("$OpenBSD: clientloop.c,v 1.140 2005/07/04 00:58:43 djm Exp $");
 #include "log.h"
 #include "readconf.h"
 #include "clientloop.h"
+#include "sshconnect.h"
 #include "authfd.h"
 #include "atomicio.h"
 #include "sshpty.h"
@@ -113,7 +126,7 @@ extern char *host;
 static volatile sig_atomic_t received_window_change_signal = 0;
 static volatile sig_atomic_t received_signal = 0;
 
-/* Flag indicating whether the user\'s terminal is in non-blocking mode. */
+/* Flag indicating whether the user's terminal is in non-blocking mode. */
 static int in_non_blocking_mode = 0;
 
 /* Common data for the client loop code. */
@@ -266,7 +279,7 @@ client_x11_get_proto(const char *display, const char *xauth_path,
                        }
                }
                snprintf(cmd, sizeof(cmd),
-                   "%s %s%s list %s 2>" _PATH_DEVNULL,
+                   "%s %s%s list %s 2>" _PATH_DEVNULL,
                    xauth_path,
                    generated ? "-f " : "" ,
                    generated ? xauthfile : "",
@@ -642,7 +655,7 @@ client_extra_session2_setup(int id, void *arg)
        if ((c = channel_lookup(id)) == NULL)
                fatal("%s: no channel for id %d", __func__, id);
 
-       display = getenv("DISPLAY");    
+       display = getenv("DISPLAY");
        if (cctx->want_x_fwd && options.forward_x11 && display != NULL) {
                char *proto, *data;
                /* Get reasonable local authentication information. */
@@ -914,6 +927,15 @@ process_cmdline(void)
                logit("      -Lport:host:hostport    Request local forward");
                logit("      -Rport:host:hostport    Request remote forward");
                logit("      -KRhostport             Cancel remote forward");
+               if (!options.permit_local_command)
+                       goto out;
+               logit("      !args                   Execute local command");
+               goto out;
+       }
+
+       if (*s == '!' && options.permit_local_command) {
+               s++;
+               ssh_local_cmd(s);
                goto out;
        }
 
@@ -1376,10 +1398,10 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
                session_ident = ssh2_chan_id;
                if (escape_char != SSH_ESCAPECHAR_NONE)
                        channel_register_filter(session_ident,
-                           simple_escape_filter);
+                           simple_escape_filter, NULL);
                if (session_ident != -1)
                        channel_register_cleanup(session_ident,
-                           client_channel_closed);
+                           client_channel_closed, 0);
        } else {
                /* Check if we should immediately send eof on stdin. */
                client_check_initial_eof_on_stdin();
@@ -1678,7 +1700,7 @@ client_request_x11(const char *request_type, int rchan)
 
        if (!options.forward_x11) {
                error("Warning: ssh server tried X11 forwarding.");
-               error("Warning: this is probably a break in attempt by a malicious server.");
+               error("Warning: this is probably a break-in attempt by a malicious server.");
                return NULL;
        }
        originator = packet_get_string(NULL);
@@ -1711,7 +1733,7 @@ client_request_agent(const char *request_type, int rchan)
 
        if (!options.forward_agent) {
                error("Warning: ssh server tried agent forwarding.");
-               error("Warning: this is probably a break in attempt by a malicious server.");
+               error("Warning: this is probably a break-in attempt by a malicious server.");
                return NULL;
        }
        sock =  ssh_get_authentication_socket();
@@ -1880,7 +1902,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
                        /* Split */
                        name = xstrdup(env[i]);
                        if ((val = strchr(name, '=')) == NULL) {
-                               free(name);
+                               xfree(name);
                                continue;
                        }
                        *val++ = '\0';
@@ -1894,7 +1916,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
                        }
                        if (!matched) {
                                debug3("Ignored env %s", name);
-                               free(name);
+                               xfree(name);
                                continue;
                        }
 
@@ -1903,7 +1925,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
                        packet_put_cstring(name);
                        packet_put_cstring(val);
                        packet_send();
-                       free(name);
+                       xfree(name);
                }
        }
 
This page took 0.054871 seconds and 4 git commands to generate.