aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoel Janssen <roel@gnu.org>2017-03-21 12:14:05 +0100
committerRoel Janssen <roel@gnu.org>2017-03-21 12:14:05 +0100
commit193420a80319ed72db511b2d3d3cec62fc941d17 (patch)
tree955beceeed1531863d704832e632600ffb0dd91c
parent3b4efb1f459d0cb21bd47d583cdec3ad38e64dcb (diff)
downloadguix-193420a80319ed72db511b2d3d3cec62fc941d17.tar
guix-193420a80319ed72db511b2d3d3cec62fc941d17.tar.gz
ftp-client: Allow custom username and password for FTP servers.
* guix/ftp-client.scm (ftp-open): Add username and password arguments.
-rw-r--r--guix/ftp-client.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/ftp-client.scm b/guix/ftp-client.scm
index 0a179282ed..054a00ad7f 100644
--- a/guix/ftp-client.scm
+++ b/guix/ftp-client.scm
@@ -121,7 +121,10 @@ seconds to wait for the connection to succeed."
(raise-error errno)))))
(connect s sockaddr)))
-(define* (ftp-open host #:optional (port "ftp") #:key timeout)
+(define* (ftp-open host #:optional (port "ftp")
+ #:key timeout
+ (username "anonymous")
+ (password "guix@example.com"))
"Open an FTP connection to HOST on PORT (a service-identifying string,
or a TCP port number), and return it.
@@ -156,7 +159,7 @@ TIMEOUT, an ETIMEDOUT error is raised."
(if (eqv? code 220)
(begin
;;(%ftp-command "OPTS UTF8 ON" 200 s)
- (%ftp-login "anonymous" "guix@example.com" s)
+ (%ftp-login username password s)
(%make-ftp-connection s ai))
(begin
(close s)