about summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-05-10 21:26:43 +0000
committerLudovic Courtès <ludo@gnu.org>2010-05-10 21:26:43 +0000
commitd8c33c182008e67363d8f225b42b830ba782bede (patch)
tree70f849b6b55f0e430b057e985a28dfd1078651a9 /maintainers
parent659e48bbb03803d3771338981e94675de2f78a36 (diff)
gnupdate: Handle FTP logins with password.
* maintainers/scripts/gnu/gnupdate.scm (%ftp-login): New procedure.
  (ftp-open): Use it.

svn path=/nixpkgs/trunk/; revision=21714
Diffstat (limited to 'maintainers')
-rw-r--r--maintainers/scripts/gnu/gnupdate.scm11
1 files changed, 9 insertions, 2 deletions
diff --git a/maintainers/scripts/gnu/gnupdate.scm b/maintainers/scripts/gnu/gnupdate.scm
index 88917e71ad6bc..1401f5b94e360 100644
--- a/maintainers/scripts/gnu/gnupdate.scm
+++ b/maintainers/scripts/gnu/gnupdate.scm
@@ -307,6 +307,14 @@
         message
         (throw 'ftp-error port command code message))))
 
+(define (%ftp-login user pass port)
+  (display (string-append "USER " user (string #\newline)) port)
+  (let-values (((code message) (%ftp-listen port)))
+    (case code
+      ((230)  #t)
+      ((331) (%ftp-command (string-append "PASS " pass) 230 port))
+      (else  (throw 'ftp-error port command code message)))))
+
 (define (ftp-open host)
   (catch 'getaddrinfo-error
     (lambda ()
@@ -319,8 +327,7 @@
           (if (eqv? code 220)
               (begin
                 ;(%ftp-command "OPTS UTF8 ON" 200 s)
-                ;; FIXME: When `USER' returns 331, we should do a `PASS email'.
-                (%ftp-command "USER anonymous" 230 s)
+                (%ftp-login "anonymous" "ludo@example.com" s)
                 (%make-ftp-connection s ai))
               (begin
                 (format (current-error-port) "FTP to `~a' failed: ~A: ~A~%"