PDP10, PDP11, VAX, MUX: Fix allowed line attach syntax to accept UDP in any order among attach arguments

This commit is contained in:
Mark Pizzolato 2015-05-23 17:08:51 -07:00
parent 29fe0e6c8d
commit fa407e678b
2 changed files with 34 additions and 32 deletions

View file

@ -3818,7 +3818,7 @@ if (!peer[0]) {
sim_printf ("Peer must be specified before attach\n"); sim_printf ("Peer must be specified before attach\n");
return SCPE_ARG; return SCPE_ARG;
} }
sprintf (attach_string, "Line=%d,%s,Connect=%s,%s", dmc, cptr, peer); sprintf (attach_string, "Line=%d,Connect=%s,%s", dmc, peer, cptr);
ans = tmxr_open_master (mp, attach_string); /* open master socket */ ans = tmxr_open_master (mp, attach_string); /* open master socket */
if (ans != SCPE_OK) if (ans != SCPE_OK)
return ans; return ans;

View file

@ -2287,37 +2287,6 @@ while (*tptr) {
if (0 == MATCH_CMD (gbuf, "CONNECT")) { if (0 == MATCH_CMD (gbuf, "CONNECT")) {
if ((NULL == cptr) || ('\0' == *cptr)) if ((NULL == cptr) || ('\0' == *cptr))
return SCPE_ARG; return SCPE_ARG;
serport = sim_open_serial (cptr, NULL, &r);
if (serport != INVALID_HANDLE) {
sim_close_serial (serport);
if (strchr (cptr, ';') && mp->modem_control)
return SCPE_ARG;
}
else {
memset (hostport, '\0', sizeof(hostport));
strncpy (hostport, cptr, sizeof(hostport)-1);
if ((cptr = strchr (hostport, ';')))
*(cptr++) = '\0';
if (cptr) {
get_glyph (cptr, cptr, 0); /* upcase this string */
if (0 == MATCH_CMD (cptr, "NOTELNET"))
notelnet = TRUE;
else
if (0 == MATCH_CMD (cptr, "TELNET"))
if (datagram)
return SCPE_ARG;
else
notelnet = FALSE;
else
return SCPE_ARG;
}
sock = sim_connect_sock_ex (NULL, hostport, "localhost", NULL, (datagram ? SIM_SOCK_OPT_DATAGRAM : 0) | (packet ? SIM_SOCK_OPT_NODELAY : 0));
if (sock != INVALID_SOCKET)
sim_close_sock (sock);
else
return SCPE_ARG;
cptr = hostport;
}
strcpy (destination, cptr); strcpy (destination, cptr);
continue; continue;
} }
@ -2356,6 +2325,39 @@ while (*tptr) {
return SCPE_ARG; return SCPE_ARG;
} }
} }
if (destination[0]) {
/* Validate destination */
serport = sim_open_serial (destination, NULL, &r);
if (serport != INVALID_HANDLE) {
sim_close_serial (serport);
if (strchr (destination, ';') && mp->modem_control)
return SCPE_ARG;
}
else {
memset (hostport, '\0', sizeof(hostport));
strncpy (hostport, destination, sizeof(hostport)-1);
if ((cptr = strchr (hostport, ';')))
*(cptr++) = '\0';
if (cptr) {
get_glyph (cptr, cptr, 0); /* upcase this string */
if (0 == MATCH_CMD (cptr, "NOTELNET"))
notelnet = TRUE;
else
if (0 == MATCH_CMD (cptr, "TELNET"))
if (datagram)
return SCPE_ARG;
else
notelnet = FALSE;
else
return SCPE_ARG;
}
sock = sim_connect_sock_ex (NULL, hostport, "localhost", NULL, (datagram ? SIM_SOCK_OPT_DATAGRAM : 0) | (packet ? SIM_SOCK_OPT_NODELAY : 0));
if (sock != INVALID_SOCKET)
sim_close_sock (sock);
else
return SCPE_ARG;
}
}
if (line == -1) { if (line == -1) {
if (modem_control != mp->modem_control) if (modem_control != mp->modem_control)
return SCPE_ARG; return SCPE_ARG;