1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-18 19:48:05 -05:00

Attempt to filter out duplicate port forwardings in the GUI.

[originally from svn r8624]
This commit is contained in:
Jacob Nevins 2009-08-18 23:51:49 +00:00
parent c90f047476
commit ace6564954

View File

@ -1016,10 +1016,15 @@ static void portfwd_handler(union control *ctrl, void *dlg,
*p = '\0'; *p = '\0';
p = cfg->portfwd; p = cfg->portfwd;
while (*p) { while (*p) {
if (strcmp(p,str) == 0) {
dlg_error_msg(dlg, "Specified forwarding already exists");
break;
}
while (*p) while (*p)
p++; p++;
p++; p++;
} }
if (!*p) {
if ((p - cfg->portfwd) + strlen(str) + 2 <= if ((p - cfg->portfwd) + strlen(str) + 2 <=
sizeof(cfg->portfwd)) { sizeof(cfg->portfwd)) {
strcpy(p, str); strcpy(p, str);
@ -1030,6 +1035,7 @@ static void portfwd_handler(union control *ctrl, void *dlg,
} else { } else {
dlg_error_msg(dlg, "Too many forwardings"); dlg_error_msg(dlg, "Too many forwardings");
} }
}
} else if (ctrl == pfd->rembutton) { } else if (ctrl == pfd->rembutton) {
int i = dlg_listbox_index(pfd->listbox, dlg); int i = dlg_listbox_index(pfd->listbox, dlg);
if (i < 0) if (i < 0)