diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-02-10 15:59:46 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-10 15:59:46 -0800 |
commit | e8d0e6fb18aae44474e864d8040d5ed44ff6acab (patch) | |
tree | 547115848f342060950112d85b83706ef12fd800 /gpxe/src/net/tcp/ftp.c | |
parent | 5396e250a679c368b3dd353c730358d6c54960c8 (diff) | |
parent | 2dafb8402ed666b37f96f6e1579a99b8a8c85452 (diff) | |
download | syslinux-e8d0e6fb18aae44474e864d8040d5ed44ff6acab.tar.gz |
Merge branch 'fsc' into pathbased
Resolved Conflicts:
core/fs/ext2/ext2.c
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'gpxe/src/net/tcp/ftp.c')
-rw-r--r-- | gpxe/src/net/tcp/ftp.c | 30 |
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, |