aboutsummaryrefslogtreecommitdiffstats
path: root/gpxe/src/net/tcp/ftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gpxe/src/net/tcp/ftp.c')
-rw-r--r--gpxe/src/net/tcp/ftp.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/gpxe/src/net/tcp/ftp.c b/gpxe/src/net/tcp/ftp.c
index 445e32bb..920e537a 100644
--- a/gpxe/src/net/tcp/ftp.c
+++ b/gpxe/src/net/tcp/ftp.c
@@ -131,11 +131,33 @@ static const char * ftp_uri_path ( struct ftp_request *ftp ) {
return ftp->uri->path;
}
+/**
+ * Retrieve FTP user
+ *
+ * @v ftp FTP request
+ * @ret user FTP user
+ */
+static const char * ftp_user ( struct ftp_request *ftp ) {
+ static char *ftp_default_user = "anonymous";
+ return ftp->uri->user ? ftp->uri->user : ftp_default_user;
+}
+
+/**
+ * Retrieve FTP password
+ *
+ * @v ftp FTP request
+ * @ret password FTP password
+ */
+static const char * ftp_password ( struct ftp_request *ftp ) {
+ static char *ftp_default_password = "etherboot@etherboot.org";
+ return ftp->uri->password ? ftp->uri->password : ftp_default_password;
+}
+
/** FTP control channel strings */
static struct ftp_control_string ftp_strings[] = {
[FTP_CONNECT] = { NULL, NULL },
- [FTP_USER] = { "USER anonymous", NULL },
- [FTP_PASS] = { "PASS etherboot@etherboot.org", NULL },
+ [FTP_USER] = { "USER ", ftp_user },
+ [FTP_PASS] = { "PASS ", ftp_password },
[FTP_TYPE] = { "TYPE I", NULL },
[FTP_PASV] = { "PASV", NULL },
[FTP_RETR] = { "RETR ", ftp_uri_path },
@@ -335,7 +357,7 @@ static int ftp_control_deliver_raw ( struct xfer_interface *control,
/** FTP control channel operations */
static struct xfer_interface_operations ftp_control_operations = {
.close = ftp_control_close,
- .vredirect = xfer_vopen,
+ .vredirect = xfer_vreopen,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
@@ -402,7 +424,7 @@ static int ftp_data_deliver_iob ( struct xfer_interface *data,
/** FTP data channel operations */
static struct xfer_interface_operations ftp_data_operations = {
.close = ftp_data_closed,
- .vredirect = xfer_vopen,
+ .vredirect = xfer_vreopen,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = ftp_data_deliver_iob,