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:
parent
447ffa0b8f
commit
f0dcb8b2c0
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user