summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-06-21 03:17:42 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-06-21 03:17:42 +0000
commit0a7ca6c7baf13265e86b98a40bfd00714d67c84e (patch)
tree1f98997b30135a0e2900c404e481850d08c7fd83 /session.c
parent699776e9ec1378c1e962146a15436e888e9594b0 (diff)
- markus@cvs.openbsd.org 2001/06/19 15:40:45
[session.c] allocate and free at the same level.
Diffstat (limited to 'session.c')
-rw-r--r--session.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/session.c b/session.c
index 187f38edd..fbdc419eb 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.91 2001/06/19 14:09:45 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.92 2001/06/19 15:40:45 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -150,7 +150,7 @@ extern int startup_pipe;
150extern void destroy_sensitive_data(void); 150extern void destroy_sensitive_data(void);
151 151
152/* original command from peer. */ 152/* original command from peer. */
153char *original_command = NULL; 153const char *original_command = NULL;
154 154
155/* data */ 155/* data */
156#define MAX_SESSIONS 10 156#define MAX_SESSIONS 10
@@ -309,12 +309,12 @@ do_authenticated1(Authctxt *authctxt)
309 if (type == SSH_CMSG_EXEC_CMD) { 309 if (type == SSH_CMSG_EXEC_CMD) {
310 command = packet_get_string(&dlen); 310 command = packet_get_string(&dlen);
311 debug("Exec command '%.500s'", command); 311 debug("Exec command '%.500s'", command);
312 packet_integrity_check(plen, 4 + dlen, type); 312 do_exec(s, command);
313 xfree(command);
313 } else { 314 } else {
314 command = NULL; 315 do_exec(s, NULL);
315 packet_integrity_check(plen, 0, type);
316 } 316 }
317 do_exec(s, command); 317 packet_done();
318 session_close(s); 318 session_close(s);
319 return; 319 return;
320 320
@@ -608,13 +608,7 @@ do_exec(Session *s, const char *command)
608 else 608 else
609 do_exec_no_pty(s, command); 609 do_exec_no_pty(s, command);
610 610
611 if (command != NULL) 611 original_command = NULL;
612 xfree(command);
613
614 if (original_command != NULL) {
615 xfree(original_command);
616 original_command = NULL;
617 }
618} 612}
619 613
620 614
@@ -1698,6 +1692,7 @@ session_exec_req(Session *s)
1698 char *command = packet_get_string(&len); 1692 char *command = packet_get_string(&len);
1699 packet_done(); 1693 packet_done();
1700 do_exec(s, command); 1694 do_exec(s, command);
1695 xfree(command);
1701 return 1; 1696 return 1;
1702} 1697}
1703 1698