The unified diff between revisions [950c261f..] and [d6973967..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "svr-chansession.c"
# from [5d5ab8c49d0c673e5f2cffa59bddaf926cd514e7]
# to [dab4b6dd7a8d03c86f357d5e9511b9a9985f055e]
#
============================================================
--- svr-chansession.c 5d5ab8c49d0c673e5f2cffa59bddaf926cd514e7
+++ svr-chansession.c dab4b6dd7a8d03c86f357d5e9511b9a9985f055e
@@ -63,6 +63,7 @@ static void serial_connect(struct Channe
static void get_termmodes(struct ChanSess *chansess);
static void serial_connect(struct Channel *channel);
+static int sessionbreak(struct ChanSess *chansess);
/* required to clear environment */
extern char** environ;
@@ -317,9 +318,13 @@ static void chansessionrequest(struct Ch
dropbear_assert(chansess != NULL);
TRACE(("type is %s", type))
+#if 0
+ hack
if (strcmp(type, "window-change") == 0) {
ret = sessionwinchange(chansess);
- } else if (strcmp(type, "shell") == 0) {
+ } else
+#endif
+ if (strcmp(type, "shell") == 0) {
ret = sessioncommand(channel, chansess, 0, 0);
} else if (strcmp(type, "pty-req") == 0) {
ret = sessionpty(chansess);
@@ -337,6 +342,8 @@ static void chansessionrequest(struct Ch
#endif
} else if (strcmp(type, "signal") == 0) {
ret = sessionsignal(chansess);
+ } else if (strcmp(type, "break") == 0) {
+ ret = sessionbreak(chansess);
} else {
/* etc, todo "env", "subsystem" */
}
@@ -355,7 +362,31 @@ out:
TRACE(("leave chansessionrequest"))
}
+static int sessionbreak(struct ChanSess *chansess) {
+ int v;
+ char* argv[3];
+ TRACE(("break!!!!"))
+
+ v = fork();
+ if (v < 0) {
+ dropbear_exit("failed for for break");
+ } else if (v == 0) {
+ /* child */
+ argv[0] = "mfctl";
+ argv[1] = "b";
+ argv[2] = NULL;
+
+ execv("/etc/mfctl", argv);
+ dropbear_log(LOG_INFO, "break failed, eh?");
+
+ } else {
+ /* parent - do nothing */
+ }
+
+ return DROPBEAR_SUCCESS;
+}
+
/* Send a signal to a session's process as requested by the client*/
static int sessionsignal(struct ChanSess *chansess) {
@@ -514,6 +545,9 @@ static int sessionpty(struct ChanSess *
unsigned char namebuf[65];
TRACE(("enter sessionpty"))
+ /* Axis hack */
+ TRACE(("this does nothing"))
+#if 0
chansess->term = buf_getstring(ses.payload, &termlen);
if (termlen > MAX_TERM_LEN) {
/* TODO send disconnect ? */
@@ -544,6 +578,7 @@ static int sessionpty(struct ChanSess *
get_termmodes(chansess);
TRACE(("leave sessionpty"))
+#endif
return DROPBEAR_SUCCESS;
}
@@ -764,7 +799,9 @@ static int ptycommand(struct Channel *ch
/* redirect stdin/stdout/stderr */
close(chansess->master);
+ /* hack
pty_make_controlling_tty(&chansess->slave, chansess->tty);
+ */
if ((dup2(chansess->slave, STDIN_FILENO) < 0) ||
(dup2(chansess->slave, STDERR_FILENO) < 0) ||