Fixed bug with sending suboptions so telnet works.
This commit is contained in:
parent
223310bfa8
commit
2304321c79
@ -13,7 +13,7 @@ void print_help(char *name)
|
|||||||
fprintf(stderr, " 's' = modem input\n");
|
fprintf(stderr, " 's' = modem input\n");
|
||||||
fprintf(stderr, " 'S' = modem output\n");
|
fprintf(stderr, " 'S' = modem output\n");
|
||||||
fprintf(stderr, " 'i' = IP input\n");
|
fprintf(stderr, " 'i' = IP input\n");
|
||||||
fprintf(stderr, " 'I' = IP input\n");
|
fprintf(stderr, " 'I' = IP output\n");
|
||||||
fprintf(stderr, " -l 0 (NONE), 1 (FATAL) - 7 (DEBUG_X) (defaults to 0)\n");
|
fprintf(stderr, " -l 0 (NONE), 1 (FATAL) - 7 (DEBUG_X) (defaults to 0)\n");
|
||||||
fprintf(stderr, " -L log file (defaults to stderr)\n");
|
fprintf(stderr, " -L log file (defaults to stderr)\n");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -15,7 +15,6 @@ int line_init_config(modem_config *cfg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int line_write(modem_config *cfg, char *data, int len)
|
int line_write(modem_config *cfg, char *data, int len)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
@ -24,6 +23,7 @@ int line_write(modem_config *cfg, char *data, int len)
|
|||||||
char text[1024];
|
char text[1024];
|
||||||
int text_len = 0;
|
int text_len = 0;
|
||||||
|
|
||||||
|
|
||||||
if (cfg->line_data.is_telnet && cfg->line_data.nvt_data.binary_xmit) {
|
if (cfg->line_data.is_telnet && cfg->line_data.nvt_data.binary_xmit) {
|
||||||
retval = 0;
|
retval = 0;
|
||||||
while (i < len) {
|
while (i < len) {
|
||||||
@ -55,7 +55,6 @@ int line_write(modem_config *cfg, char *data, int len)
|
|||||||
return ip_write(cfg->line_data.fd, data, len);
|
return ip_write(cfg->line_data.fd, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int line_listen(modem_config *cfg)
|
int line_listen(modem_config *cfg)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -66,11 +65,11 @@ int line_off_hook(modem_config *cfg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int line_connect(modem_config *cfg)
|
int line_connect(modem_config *cfg)
|
||||||
{
|
{
|
||||||
char *addy = cfg->dialno;
|
char *addy = cfg->dialno;
|
||||||
|
|
||||||
|
|
||||||
LOG(LOG_INFO, "Connecting");
|
LOG(LOG_INFO, "Connecting");
|
||||||
addy = pb_search(addy);
|
addy = pb_search(addy);
|
||||||
cfg->line_data.fd = ip_connect(addy);
|
cfg->line_data.fd = ip_connect(addy);
|
||||||
@ -86,7 +85,6 @@ int line_connect(modem_config *cfg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int line_disconnect(modem_config *cfg)
|
int line_disconnect(modem_config *cfg)
|
||||||
{
|
{
|
||||||
LOG(LOG_INFO, "Disconnecting");
|
LOG(LOG_INFO, "Disconnecting");
|
||||||
|
@ -386,8 +386,8 @@ int mdm_parse_cmd(modem_config *cfg)
|
|||||||
strncpy(cfg->dialno, cfg->last_dialno, strlen(cfg->last_dialno));
|
strncpy(cfg->dialno, cfg->last_dialno, strlen(cfg->last_dialno));
|
||||||
cfg->dial_type = cfg->dial_type;
|
cfg->dial_type = cfg->dial_type;
|
||||||
cfg->memory_dial = TRUE;
|
cfg->memory_dial = TRUE;
|
||||||
mdm_write(cfg, cfg->crlf, 2);
|
mdm_write_parity(cfg, cfg->crlf, 2);
|
||||||
mdm_write(cfg, cfg->dialno, strlen(cfg->dialno));
|
mdm_write_parity(cfg, cfg->dialno, strlen(cfg->dialno));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cfg->dialno[0] = 0;
|
cfg->dialno[0] = 0;
|
||||||
@ -474,7 +474,7 @@ int mdm_parse_cmd(modem_config *cfg)
|
|||||||
break;
|
break;
|
||||||
case AT_CMD_FLAG_QUERY | 'S':
|
case AT_CMD_FLAG_QUERY | 'S':
|
||||||
sprintf(tmp, "%s%3.3d", cfg->crlf, cfg->s[num]);
|
sprintf(tmp, "%s%3.3d", cfg->crlf, cfg->s[num]);
|
||||||
mdm_write(cfg, tmp, strlen(tmp));
|
mdm_write_parity(cfg, tmp, strlen(tmp));
|
||||||
break;
|
break;
|
||||||
case 'T': // defaut to tone dialing
|
case 'T': // defaut to tone dialing
|
||||||
//cfg->default_dial_type=MDM_DT_TONE;
|
//cfg->default_dial_type=MDM_DT_TONE;
|
||||||
@ -573,7 +573,7 @@ int mdm_handle_char(modem_config *cfg, char ch)
|
|||||||
if (cfg->cmd_started == TRUE) {
|
if (cfg->cmd_started == TRUE) {
|
||||||
if (ch == (char) (cfg->s[5])) {
|
if (ch == (char) (cfg->s[5])) {
|
||||||
if (cfg->cur_line_idx == 0 && cfg->echo == TRUE) {
|
if (cfg->cur_line_idx == 0 && cfg->echo == TRUE) {
|
||||||
mdm_write_char(cfg, 'T');
|
mdm_write_parity(cfg, "T", 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cfg->cur_line_idx--;
|
cfg->cur_line_idx--;
|
||||||
|
15
src/nvt.c
15
src/nvt.c
@ -71,13 +71,13 @@ int parse_nvt_subcommand(int fd, nvt_vars *vars, char *data, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc > 5 && (NVT_SB_SEND == data[4])) {
|
if (rc > 5 && (NVT_SB_SEND == data[3])) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case NVT_OPT_TERMINAL_TYPE:
|
case NVT_OPT_TERMINAL_TYPE:
|
||||||
case NVT_OPT_X_DISPLAY_LOCATION: // should not have to have these
|
|
||||||
case NVT_OPT_ENVIRON: // but telnet seems to expect.
|
|
||||||
case NVT_OPT_NEW_ENVIRON: // them.
|
|
||||||
case NVT_OPT_TERMINAL_SPEED:
|
case NVT_OPT_TERMINAL_SPEED:
|
||||||
|
case NVT_OPT_X_DISPLAY_LOCATION: // should not have to have these
|
||||||
|
case NVT_OPT_ENVIRON: // but telnet seems to expect.
|
||||||
|
case NVT_OPT_NEW_ENVIRON: // them.
|
||||||
response[response_len++] = NVT_SB_IS;
|
response[response_len++] = NVT_SB_IS;
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case NVT_OPT_TERMINAL_TYPE:
|
case NVT_OPT_TERMINAL_TYPE:
|
||||||
@ -148,14 +148,15 @@ int parse_nvt_command(int fd, nvt_vars *vars, char action, int opt)
|
|||||||
|
|
||||||
case NVT_OPT_NAWS:
|
case NVT_OPT_NAWS:
|
||||||
case NVT_OPT_TERMINAL_TYPE:
|
case NVT_OPT_TERMINAL_TYPE:
|
||||||
|
case NVT_OPT_TERMINAL_SPEED:
|
||||||
case NVT_OPT_SUPPRESS_GO_AHEAD:
|
case NVT_OPT_SUPPRESS_GO_AHEAD:
|
||||||
case NVT_OPT_ECHO:
|
case NVT_OPT_ECHO:
|
||||||
case NVT_OPT_X_DISPLAY_LOCATION: // should not have to have these
|
case NVT_OPT_X_DISPLAY_LOCATION: // should not have to have these
|
||||||
case NVT_OPT_ENVIRON: // but telnet seems to expect.
|
case NVT_OPT_ENVIRON: // but telnet seems to expect.
|
||||||
case NVT_OPT_NEW_ENVIRON: // them.
|
case NVT_OPT_NEW_ENVIRON: // them.
|
||||||
case NVT_OPT_TERMINAL_SPEED:
|
|
||||||
resp[1] = get_nvt_cmd_response(action, TRUE);
|
resp[1] = get_nvt_cmd_response(action, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
resp[1] = get_nvt_cmd_response(action, FALSE);
|
resp[1] = get_nvt_cmd_response(action, FALSE);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user