|
@@ -131,11 +131,33 @@ static const char * ftp_uri_path ( struct ftp_request *ftp ) {
|
131
|
131
|
return ftp->uri->path;
|
132
|
132
|
}
|
133
|
133
|
|
|
134
|
+/**
|
|
135
|
+ * Retrieve FTP user
|
|
136
|
+ *
|
|
137
|
+ * @v ftp FTP request
|
|
138
|
+ * @ret user FTP user
|
|
139
|
+ */
|
|
140
|
+static const char * ftp_user ( struct ftp_request *ftp ) {
|
|
141
|
+ static char *ftp_default_user = "anonymous";
|
|
142
|
+ return ftp->uri->user ? ftp->uri->user : ftp_default_user;
|
|
143
|
+}
|
|
144
|
+
|
|
145
|
+/**
|
|
146
|
+ * Retrieve FTP password
|
|
147
|
+ *
|
|
148
|
+ * @v ftp FTP request
|
|
149
|
+ * @ret password FTP password
|
|
150
|
+ */
|
|
151
|
+static const char * ftp_password ( struct ftp_request *ftp ) {
|
|
152
|
+ static char *ftp_default_password = "etherboot@etherboot.org";
|
|
153
|
+ return ftp->uri->password ? ftp->uri->password : ftp_default_password;
|
|
154
|
+}
|
|
155
|
+
|
134
|
156
|
/** FTP control channel strings */
|
135
|
157
|
static struct ftp_control_string ftp_strings[] = {
|
136
|
158
|
[FTP_CONNECT] = { NULL, NULL },
|
137
|
|
- [FTP_USER] = { "USER anonymous", NULL },
|
138
|
|
- [FTP_PASS] = { "PASS etherboot@etherboot.org", NULL },
|
|
159
|
+ [FTP_USER] = { "USER ", ftp_user },
|
|
160
|
+ [FTP_PASS] = { "PASS ", ftp_password },
|
139
|
161
|
[FTP_TYPE] = { "TYPE I", NULL },
|
140
|
162
|
[FTP_PASV] = { "PASV", NULL },
|
141
|
163
|
[FTP_RETR] = { "RETR ", ftp_uri_path },
|