mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-17 19:18:06 -05:00
Attempt to filter out duplicate port forwardings in the GUI.
[originally from svn r8624]
This commit is contained in:
parent
c90f047476
commit
ace6564954
24
config.c
24
config.c
@ -1016,19 +1016,25 @@ 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 - cfg->portfwd) + strlen(str) + 2 <=
|
if (!*p) {
|
||||||
sizeof(cfg->portfwd)) {
|
if ((p - cfg->portfwd) + strlen(str) + 2 <=
|
||||||
strcpy(p, str);
|
sizeof(cfg->portfwd)) {
|
||||||
p[strlen(str) + 1] = '\0';
|
strcpy(p, str);
|
||||||
dlg_listbox_add(pfd->listbox, dlg, str);
|
p[strlen(str) + 1] = '\0';
|
||||||
dlg_editbox_set(pfd->sourcebox, dlg, "");
|
dlg_listbox_add(pfd->listbox, dlg, str);
|
||||||
dlg_editbox_set(pfd->destbox, dlg, "");
|
dlg_editbox_set(pfd->sourcebox, dlg, "");
|
||||||
} else {
|
dlg_editbox_set(pfd->destbox, dlg, "");
|
||||||
dlg_error_msg(dlg, "Too many forwardings");
|
} else {
|
||||||
|
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user