aboutsummaryrefslogtreecommitdiffstats
path: root/gpxe/src/net/tcp/ftp.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-03 16:06:41 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-03 16:06:41 -0800
commitaddaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa (patch)
tree2ffea726dc494e87ecc9f506bc6a2bc9242730e3 /gpxe/src/net/tcp/ftp.c
parent5c0f48e49f8d7d084810ecf0b98a76aaebb44835 (diff)
parente7a5f95432132c8fc8f8ede39fda1d368002ddd8 (diff)
downloadsyslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.tar.gz
syslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.tar.xz
syslinux.git-addaeaeb3949d576c4e0eb5cfc133b7c3bcfa8fa.zip
Merge branch 'master' into i915res
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,