summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-06-19 15:40:46 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-06-19 15:40:46 +0000
commit99355b6718dbc6efcb7ff8afd728c4001cd9485e (patch)
treebe54d025550a53be8e8832d22fbe89a098ec3699 /usr.bin
parent376228af743fb142266c7f3ab84708cf7d76c67a (diff)
allocate and free at the same level.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/session.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index 76d7cb324b6..2d97cbcb129 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/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"
@@ -112,7 +112,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
@@ -266,12 +266,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;
@@ -514,13 +514,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;
}
@@ -1320,6 +1314,7 @@ session_exec_req(Session *s)
char *command = packet_get_string(&len);
packet_done();
do_exec(s, command);
+ xfree(command);
return 1;
}