From 0a7ca6c7baf13265e86b98a40bfd00714d67c84e Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Thu, 21 Jun 2001 03:17:42 +0000 Subject: [PATCH] - markus@cvs.openbsd.org 2001/06/19 15:40:45 [session.c] allocate and free at the same level. --- ChangeLog | 5 ++++- session.c | 21 ++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf242a6f0..f2dc8c5aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,9 @@ - markus@cvs.openbsd.org 2001/06/19 14:09:45 [session.c sshd.8] disable x11-fwd if use_login is enabled; from lukem@wasabisystems.com + - markus@cvs.openbsd.org 2001/06/19 15:40:45 + [session.c] + allocate and free at the same level. 20010615 - (stevesk) don't set SA_RESTART and set SIGCHLD to SIG_DFL @@ -5670,4 +5673,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1294 2001/06/21 03:14:49 mouring Exp $ +$Id: ChangeLog,v 1.1295 2001/06/21 03:17:42 mouring Exp $ diff --git a/session.c b/session.c index 187f38edd..fbdc419eb 100644 --- a/session.c +++ b/session.c @@ -33,7 +33,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.91 2001/06/19 14:09:45 markus Exp $"); +RCSID("$OpenBSD: session.c,v 1.92 2001/06/19 15:40:45 markus Exp $"); #include "ssh.h" #include "ssh1.h" @@ -150,7 +150,7 @@ extern int startup_pipe; extern void destroy_sensitive_data(void); /* original command from peer. */ -char *original_command = NULL; +const char *original_command = NULL; /* data */ #define MAX_SESSIONS 10 @@ -309,12 +309,12 @@ do_authenticated1(Authctxt *authctxt) if (type == SSH_CMSG_EXEC_CMD) { command = packet_get_string(&dlen); debug("Exec command '%.500s'", command); - packet_integrity_check(plen, 4 + dlen, type); + do_exec(s, command); + xfree(command); } else { - command = NULL; - packet_integrity_check(plen, 0, type); + do_exec(s, NULL); } - do_exec(s, command); + packet_done(); session_close(s); return; @@ -608,13 +608,7 @@ do_exec(Session *s, const char *command) else do_exec_no_pty(s, command); - if (command != NULL) - xfree(command); - - if (original_command != NULL) { - xfree(original_command); - original_command = NULL; - } + original_command = NULL; } @@ -1698,6 +1692,7 @@ session_exec_req(Session *s) char *command = packet_get_string(&len); packet_done(); do_exec(s, command); + xfree(command); return 1; }