tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);
if (tmp && strlen (tmp)) {
- char *tok;
+ char *tok, *tok2, *p;
while ((tok = strsep((char**)&tmp, ",")) != NULL) {
if (strlen(tok)) {
add_openvpn_arg (args, "--remote");
add_openvpn_arg (args, tok);
+ tmp2 = strdup(tok);
+ while ((tok2 = strsep((char **)&tmp2, " ")) != NULL) {
+ gboolean port = FALSE;
+ if (strlen(tok2)) {
+ for (p=tok2, port=TRUE; *p; p++) {
+ if (!isdigit(*p)) {
+ port = FALSE;
+ break;
+ }
+ }
+ if (port)
+ add_openvpn_arg (args, tok2);
+ else if ((strncmp("udp", tok2, 3) == 0 || strncmp("tcp", tok2, 3) == 0))
+ add_openvpn_arg (args, tok2);
+ }
+ }
+ free((void *)tmp2);
}
}
}