In Connections.c, the code to handle user-specified
ports is slightly broken...
portSet = false;
for (mystrpos = 0; mystrpos <
StrLength(scratchPstring); mystrpos++) {
if (scratchPstring[mystrpos + 1] ==
':') {
scratchPstring[mystrpos + 1] =
' ';
portSet = true;
}
}
The problem is that the standard colon-delimited ports
(a scheme derived from URL syntax) work, but
space-delimited ports (derived from unix command-line
syntax) sometimes break, although only in the case
where the user has altered the state of the SSH
checkbox. To fix this, you could do:
portSet = false;
for (mystrpos = 0; mystrpos <
StrLength(scratchPstring); mystrpos++) {
if (scratchPstring[mystrpos + 1] == ':'
||
scratchPstring[mystrpos + 1] == ' ') {
scratchPstring[mystrpos + 1] =
' ';
portSet = true;
}
}
But you really don't want to do that either, because
flagging a port change (and thus overriding the SSH
checkbox) just because the user accidentally prepended
or appended a space to the text isn't quite what you
want either (and prefs.c already handles that case).
What you want is probably:
portSet = false;
while (mystrpos < StrLength(scratchPstring) &&
scratchPstring[mystrpos + 1] == ' ')
mystrpos++;
for (mystrpos = 0; mystrpos <
StrLength(scratchPstring); mystrpos++) {
if (scratchPstring[mystrpos + 1] ==
':') {
scratchPstring[mystrpos + 1] =
' ';
portSet = true;
} else if (scratchPstring[mystrpos + 1]
== ' ') {
while (mystrpos <
StrLength(scratchPstring)
&& scratchPstring[mystrpos +
1] == ' ')
mystrpos++;
if (mystrpos <
StrLength(scratchPstring))
portSet = true;
}
}
Logged In: YES
user_id=253224
sorry, sourceforge screwed up the indenting, try to figure
out the braces instead...
Logged In: YES
user_id=158181
I used a slightly different method, but the result should be
the same, i.e the port number will always be correctly
checked, even when the favorite name contains spaces.