Hey,
Password protected directories doesn't work with the FSP code.
get_uri_string(uri, URI_PASSWORD) simply doesn't work.
I don't know how to use branches, so I'm including the patch here:
diff --git a/src/protocol/fsp/fsp.c b/src/protocol/fsp/fsp.c
index c66848a..e8eac96 100644
--- a/src/protocol/fsp/fsp.c
+++ b/src/protocol/fsp/fsp.c
@@ -180,10 +180,19 @@ do_fsp(struct connection *conn)
        struct stat sb;
        struct uri *uri = conn->uri;
        unsigned char *host = get_uri_string(uri, URI_HOST);
-       unsigned char *password = get_uri_string(uri, URI_PASSWORD);
        unsigned char *data = get_uri_string(uri, URI_DATA);
        unsigned short port = (unsigned short)get_uri_port(uri);
-       FSP_SESSION *ses = fsp_open_session(host, port, password);
+       FSP_SESSION *ses;
+
+       if (uri->password) {
+               unsigned char tmp = uri->password[uri->passwordlen];
+
+               uri->password[uri->passwordlen] = '\0';
+               ses = fsp_open_session(host, port, uri->password);
+               uri->password[uri->passwordlen] = tmp;
+       } else {
+               ses = fsp_open_session(host, port, NULL);
+       }
 
        if (!ses)
                fsp_error("Session initialization failed.");

Use it with fake user, eg: fsp://user:[EMAIL PROTECTED]
In directory listings, IMHO, this password should be added to base href,
otherwise it must be added by hand for every followed link.
The same case is for smb2(not applied yet).

-- 
Witek
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to