diff options
author | Matt Wilson <msw@redhat.com> | 1999-10-27 21:09:11 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-10-27 21:09:11 +0000 |
commit | f882a9ecbce5dd9c09c969cf3d9ce22782077802 (patch) | |
tree | 408bdcfd1d8f349e79db69a6073c4c83a774f286 | |
parent | 9507255b1006acd827671c018ec7bef4330e6c0f (diff) | |
download | anaconda-f882a9ecbce5dd9c09c969cf3d9ce22782077802.tar.gz anaconda-f882a9ecbce5dd9c09c969cf3d9ce22782077802.tar.xz anaconda-f882a9ecbce5dd9c09c969cf3d9ce22782077802.zip |
1) check for bad hostnames and give an error message
2) remove trailing /'s from URLs
-rw-r--r-- | loader/urls.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/loader/urls.c b/loader/urls.c index 88b98e96e..24b739b80 100644 --- a/loader/urls.c +++ b/loader/urls.c @@ -107,6 +107,7 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol, char * reflowedText = NULL; int width, height; newtGrid entryGrid, buttons, grid; + char * chptr; if (ui->address) { site = ui->address; @@ -207,7 +208,14 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol, _("You must enter a directory.")); continue; } + + if (!addrToIp(site)) { + newtWinMessage(_("Unknown Host"), _("Ok"), + _("%s is not a valid hostname."), site); + continue; + } } + break; } while (1); @@ -224,6 +232,12 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol, if (ui->prefix) free(ui->prefix); ui->prefix = strdup(dir); + /* Get rid of trailing /'s */ + chptr = ui->prefix + strlen(ui->prefix) - 1; + while (chptr > ui->prefix && *chptr == '/') chptr--; + chptr++; + *chptr = '\0'; + if (ui->urlprefix) free(ui->urlprefix); ui->urlprefix = malloc(sizeof(char) * (strlen(ui->address) + strlen(ui->prefix) + 10)); |