mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +00:00
Enable bundling
This commit is contained in:
parent
1f308fb2b4
commit
7fb1bec84a
@ -112,13 +112,14 @@ static void printhelp(const char * progname) {
|
|||||||
|
|
||||||
void svr_getopts(int argc, char ** argv) {
|
void svr_getopts(int argc, char ** argv) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i, j;
|
||||||
char ** next = 0;
|
char ** next = 0;
|
||||||
int nextisport = 0;
|
int nextisport = 0;
|
||||||
char* recv_window_arg = NULL;
|
char* recv_window_arg = NULL;
|
||||||
char* keepalive_arg = NULL;
|
char* keepalive_arg = NULL;
|
||||||
char* idle_timeout_arg = NULL;
|
char* idle_timeout_arg = NULL;
|
||||||
char* keyfile = NULL;
|
char* keyfile = NULL;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
|
||||||
/* see printhelp() for options */
|
/* see printhelp() for options */
|
||||||
@ -168,33 +169,10 @@ void svr_getopts(int argc, char ** argv) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 1; i < (unsigned int)argc; i++) {
|
for (i = 1; i < (unsigned int)argc; i++) {
|
||||||
if (nextisport) {
|
if (argv[i][0] != '-' || argv[i][1] == '\0')
|
||||||
addportandaddress(argv[i]);
|
dropbear_exit("Invalid argument: %s", argv[i]);
|
||||||
nextisport = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (next) {
|
|
||||||
*next = argv[i];
|
|
||||||
if (*next == NULL) {
|
|
||||||
dropbear_exit("Invalid null argument");
|
|
||||||
}
|
|
||||||
next = 0x00;
|
|
||||||
|
|
||||||
if (keyfile) {
|
for (j = 1; (c = argv[i][j]) != '\0' && !next && !nextisport; j++) {
|
||||||
addhostkey(keyfile);
|
|
||||||
keyfile = NULL;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argv[i][0] == '-') {
|
|
||||||
char c = argv[i][1];
|
|
||||||
if (strlen(argv[i]) != 2) {
|
|
||||||
/* We only handle one flag per hyphen */
|
|
||||||
fprintf(stderr, "Warning, trailing '%s' of '%s' is ignored.\n",
|
|
||||||
&argv[i][2], argv[i]);
|
|
||||||
}
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'b':
|
case 'b':
|
||||||
next = &svr_opts.bannerfile;
|
next = &svr_opts.bannerfile;
|
||||||
@ -284,12 +262,39 @@ void svr_getopts(int argc, char ** argv) {
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unknown argument %s\n", argv[i]);
|
fprintf(stderr, "Invalid option -%c\n", c);
|
||||||
printhelp(argv[0]);
|
printhelp(argv[0]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!next && !nextisport)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (c == '\0') {
|
||||||
|
i++;
|
||||||
|
j = 0;
|
||||||
|
if (!argv[i]) {
|
||||||
|
dropbear_exit("Missing argument");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextisport) {
|
||||||
|
addportandaddress(&argv[i][j]);
|
||||||
|
nextisport = 0;
|
||||||
|
} else if (next) {
|
||||||
|
*next = &argv[i][j];
|
||||||
|
if (*next == NULL) {
|
||||||
|
dropbear_exit("Invalid null argument");
|
||||||
|
}
|
||||||
|
next = 0x00;
|
||||||
|
|
||||||
|
if (keyfile) {
|
||||||
|
addhostkey(keyfile);
|
||||||
|
keyfile = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up listening ports */
|
/* Set up listening ports */
|
||||||
|
Loading…
Reference in New Issue
Block a user