cURL / Mailing Lists / curl-users / Single Mail

curl-users

Problem with special chars in ftp passwords

From: Eric VERGNAUD <eric.vergnaud_at_jlynx.com>
Date: Wed, 13 Oct 2004 22:24:43 +0200

Hi,

When I try to connect on windows using an url like the following:

ftp://user:pass?word@ftp.mydomain.com

Curl fails with a "could not resolve host name" error.

Strangely enough, it works on MacOS X (but I can't trace it, because libcurl
is compiled with gcc, when I'm using CodeWarrior.

Please note the '?' character in the password. In url.c, there is the
following test:

 if ( 2 > sscanf(data->change.url,"%64[^\n:]:\\%[^\n/?]%[^\n]",
        conn->protostr,
        conn->namebuffer,
        conn->path)

In the case of the above url, this call splits the url wrongly:

 conn->protostr is "ftp"
 conn->hostname is "user:pass"
 conn->path is "word_at_ftp.mydomain.com"

Very frankly, I'm not a world champion as far as sscanf is concerned, so I
could do with some advice:

 - is it legal to use '?' in ftp passwords ?
 - shouldn't the above test be skipped when protocol is ftp or ftps ?

Im dying for an answer.

-------------------------------
Eric VERGNAUD - JLynx Software
Cutting-edge technologies and
services for software companies
web: http://www.jlynx.com
-------------------------------
Received on 2004-10-13