[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH] Actually use the ftp login&password parse code (#505424)



Martin Sivak wrote:

---
 loader2/urlinstall.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

Looks ok,
my git am complained about trailing whitespace
(see below), and I have one tiny style nitpick (see below).

Radek

diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c
index 0e0df02..1c07224 100644
--- a/loader2/urlinstall.c
+++ b/loader2/urlinstall.c
@@ -340,6 +340,7 @@ int getFileFromUrl(char * url, char * dest,
enum urlprotocol_t proto = !strncmp(url, "ftp://";, 6) ? URL_METHOD_FTP : URL_METHOD_HTTP;
     char * host = NULL, * file = NULL, * chptr = NULL;
+    char * user = NULL, * password = NULL;
     int fd, rc;
     struct networkDeviceConfig netCfg;
     char * ehdrs = NULL;
@@ -355,8 +356,8 @@ int getFileFromUrl(char * url, char * dest,
tip = &(netCfg.dev.ip);
     inet_ntop(tip->sa_family, IP_ADDR(tip), ret, IP_STRLEN(tip));
- getHostandPath((proto == URL_METHOD_FTP ? url + 6 : url + 7), - &host, &file, ret); + getHostPathandLogin((proto == URL_METHOD_FTP ? url + 6 : url + 7),
trailing whitespace
+                   &host, &file, &user, &password, ret);
logMessage(INFO, "file location: %s://%s/%s", (proto == URL_METHOD_FTP ? "ftp" : "http"), host, file);
@@ -373,6 +374,11 @@ int getFileFromUrl(char * url, char * dest,
         ui.prefix = strdup(host);
     }
+ if (user && strlen(user)){
I'd put space before '{'
+        ui.login = strdup(user);
+        if (password && strlen(password)) ui.password = strdup(password);
+    }
+
     if (proto == URL_METHOD_HTTP) {
         ehdrs = (char *) malloc(24+strlen(VERSION));
         sprintf(ehdrs, "User-Agent: anaconda/%s\r\n", VERSION);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]