1
0
mirror of http://galexander.org/git/simplesshd.git synced 2025-01-03 19:50:55 +00:00

pass '-p <portno>' on the virtual commandline

This commit is contained in:
Greg Alexander 2014-12-16 16:34:10 -05:00
parent 447ffa0b8f
commit f0dcb8b2c0
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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,