From f0dcb8b2c0d68cfb69977cdfdc356725461a28fd Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Tue, 16 Dec 2014 16:34:10 -0500 Subject: [PATCH] pass '-p ' on the virtual commandline --- dropbear/options.h | 2 +- jni/interface.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dropbear/options.h b/dropbear/options.h index bbcdaa9..6259413 100644 --- a/dropbear/options.h +++ b/dropbear/options.h @@ -11,7 +11,7 @@ /* IMPORTANT: Many options will require "make clean" after changes */ #ifndef DROPBEAR_DEFPORT -#define DROPBEAR_DEFPORT "22" +#define DROPBEAR_DEFPORT "2222" #endif #ifndef DROPBEAR_DEFADDRESS diff --git a/jni/interface.c b/jni/interface.c index dac3409..8879c8f 100644 --- a/jni/interface.c +++ b/jni/interface.c @@ -72,7 +72,8 @@ Java_org_galexander_sshd_SimpleSSHDService_start_1sshd(JNIEnv *env_, pid = fork(); if (pid == 0) { - char *argv[2] = { "sshd", NULL }; + char *argv[10] = { "sshd", NULL }; + int argc = 1; char *logfn; int logfd; @@ -84,6 +85,12 @@ Java_org_galexander_sshd_SimpleSSHDService_start_1sshd(JNIEnv *env_, /* replace stderr, so the output is preserved... */ dup2(logfd, 2); } + if (port) { + argv[argc++] = "-p"; + argv[argc] = malloc(20); + sprintf(argv[argc], "%d", (int)port); + argc++; + } dropbear_main(1, argv); } else { (*env)->SetStaticIntField(env, cl_simplesshdservice,