Page 1 of 1

curl: no password sent for ftp sites

Posted: Sat Dec 25, 2010 7:28 pm
by basinilya
Flashgot starts curl with the following params:

Code: Select all

/usr/bin/curl -C - -L -O ftp://user@foo.org/file
No password, although I entered one in firefox.

here's output:

Code: Select all

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (67) Access denied: 530

Re: curl: no password sent for ftp sites

Posted: Sat Dec 25, 2010 8:04 pm
by Giorgio Maone
Not sure whether this can be fixed. Will look into that.

Re: curl: no password sent for ftp sites

Posted: Sat Dec 25, 2010 10:03 pm
by basinilya
Is it because the plugin doesn't know the ftp password?

Re: curl: no password sent for ftp sites

Posted: Sat Dec 25, 2010 10:05 pm
by Giorgio Maone
basinilya wrote:Is it because the plugin doesn't know the ftp password?
Yes, more or less.

Re: curl: no password sent for ftp sites

Posted: Sun Dec 26, 2010 11:26 am
by basinilya
flashgotService.patch

Code: Select all

--- /home/il/Downloads/flashgot/components/flashgotService.js	2010-12-16 16:17:52.000000000 +0300
+++ components/flashgotService.js	2010-12-26 14:21:15.000000000 +0300
@@ -677,10 +677,25 @@
       try {
         uri = IOS.newURI(l.href, null, null);
         if (l.userPass && l.userPass.indexOf(":") > -1) continue;
+        if (uri.scheme == "ftp") {
+          if (uri.username) {
+            var WindowWatcherService = CC["@mozilla.org/embedcomp/window-watcher;1"].getService(CI.nsIWindowWatcher);
+            let _aprompter = WindowWatcherService.getNewAuthPrompter(null).QueryInterface(CI.nsIAuthPrompt);
+            var ftpport = (uri.port < 0 || uri.port == 21 ? "" : ":" + uri.port);
+            var realm = uri.scheme + "://" + uri.username + "@" + uri.host + ftpport;
+
+            if (_aprompter.promptPassword("password", "password for " + realm, realm, _aprompter.SAVE_PASSWORD_NEVER, upwd)) {
+              l.href = uri.scheme + "://" + uri.username + ":" + upwd.value + "@" + 
+                       uri.host + ftpport + uri.spec.substring(uri.prePath.length);
+              this.log("Authentication data for " + uri + " added.");
+            }
+          }
+        } else {
         httpAuthManager.getAuthIdentity(uri.scheme, uri.host, uri.port < 0 ? (uri.scheme == "https" ? 443 : 80) : uri.port, null, null, uri.path, udom, uname, upwd);
         this.log("Authentication data for " + uri + " added.");
         l.href = uri.scheme + "://" + uname.value + ":" + upwd.value + "@" + 
                  uri.host + (uri.port < 0 ? "" : (":" + uri.port)) + uri.spec.substring(uri.prePath.length);
+        }
       } catch(e) {}
     }
   },
If password is stored, the password prompt won't appear, but will return the password. If not stored, the prompt will appear, you input and press OK,

Re: curl: no password sent for ftp sites

Posted: Sun Dec 26, 2010 11:44 am
by Giorgio Maone
Thank you for the patch :)

Re: curl: no password sent for ftp sites

Posted: Sun Dec 26, 2010 4:53 pm
by Giorgio Maone

Re: curl: no password sent for ftp sites

Posted: Sun Dec 26, 2010 5:15 pm
by basinilya
silently fails, no terminal window

Code: Select all

*** FlashGot 1.2.8rc2 started at Sun, 26 Dec 2010 17:16:15 GMT ***
Recent post info found: [xpconnect wrapped (nsISupports, nsIHttpChannel, nsIUploadChannel, nsIChannel)], http://static.rutracker.org/favicon.ico VS ftp://user@ftp.foo.ru/jasp/jasperserver-pro-3.5.1-linux-installer.bin, false, false
Adding authentication info
Delayed Runner error: ReferenceError: password is not defined, ([object Array])@file:///home/il/.mozilla/firefox/69l263hw.default/extensions/%7B19503e42-ca3c-4c27-b1e2-9cdb2170ee34%7D/components/flashgotService.js:694
([object Array],0,[object Object])@file:///home/il/.mozilla/firefox/69l263hw.default/extensions/%7B19503e42-ca3c-4c27-b1e2-9cdb2170ee34%7D/components/flashgotService.js:612
([object Object])@file:///home/il/.mozilla/firefox/69l263hw.default/extensions/%7B19503e42-ca3c-4c27-b1e2-9cdb2170ee34%7D/components/flashgotService.js:603
()@chrome://flashgot/content/RedirectContext.js:78
()@chrome://flashgot/content/RedirectContext.js:54
()@file:///home/il/.mozilla/firefox/69l263hw.default/extensions/%7B19503e42-ca3c-4c27-b1e2-9cdb2170ee34%7D/components/flashgotService.js:601
([object XPCWrappedNative_NoHelper])@file:///home/il/.mozilla/firefox/69l263hw.default/extensions/%7B19503e42-ca3c-4c27-b1e2-9cdb2170ee34%7D/components/flashgotService.js:754

Code: Select all

            prompter.promptPassword("Password", realm + " " + password, realm, prompter.SAVE_PASSWORD_NEVER, upwd))

replace password with "password"

Re: curl: no password sent for ftp sites

Posted: Sun Dec 26, 2010 5:39 pm
by Giorgio Maone
Fixed in latest development build, please check, thanks.

Re: curl: no password sent for ftp sites

Posted: Sun Dec 26, 2010 6:15 pm
by basinilya
working

Re: curl: no password sent for ftp sites

Posted: Tue Dec 28, 2010 5:58 pm
by basinilya
wait! Now username is undefined.
wrong case:
uri.userName
uri.username

Re: curl: no password sent for ftp sites

Posted: Wed Dec 29, 2010 1:11 am
by Giorgio Maone

Re: curl: no password sent for ftp sites

Posted: Wed Dec 29, 2010 5:36 pm
by basinilya
working