diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2003-07-10 15:03:20 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2003-07-10 15:03:20 +0000 |
commit | 8d1f212d9e23f054952e3528ae9386fa9e318637 (patch) | |
tree | 6b404251830ecea6c15f50af9ddd855c777f50d6 /distrib/miniroot/install.sub | |
parent | b17603bcf3304bface40bd04611454f0620b94f3 (diff) |
Try to ensure that ftp gets install sets from the same directory it
looked in to get the list of available sets.
The list of available sets is obtained by connecting to the ftp server
interactively and issuing the commands
user <user> <pass>
cd <dir>
ls
where <dir> is treated as a relative path unless the user enters an
initial '/'. But the files are obtained by issuing the command
ftp ftp://<user>:<pass>@<host>/<dir>
and here <dir> is treated as an absolute path.
When using non-anonymous ftp this difference in the treatment of <dir>
could result in
a) Unhelpful error messages and unsuccessfull transfers.
b) Different sets than intended being installed.
c) Incorrect lists of available sets being displayed.
Now, the non-anonymous ftp transfer command with relative paths (i.e.
no leading '/' or '~') will look like
ftp ftp://<user>:<pass>@<host>/~/<dir>
Problem reported by (amoung others) Sebastian Stark, Nick Holland,
Steven Boothe, Sam Smith, Sergey Smitienko, Stephen Marley, Brad Ely.
ok millert@.
Diffstat (limited to 'distrib/miniroot/install.sub')
-rw-r--r-- | distrib/miniroot/install.sub | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 1573f6fa94e..bdfb0b0e0f1 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.313 2003/07/10 14:12:54 krw Exp $ +# $OpenBSD: install.sub,v 1.314 2003/07/10 15:03:19 krw Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2003 Todd Miller, Theo de Raadt, Ken Westerback @@ -874,7 +874,7 @@ ftp_error () { # Note: _ftp_server_ip, _ftp_server_dir, _ftp_server_login, # _ftp_server_password, and _ftp_active must be global. install_url() { - local _url_type=$1 _file_list _url_base _oifs _prompt + local _url_type=$1 _file_list _url_base _oifs _prompt _home donetconfig @@ -978,9 +978,10 @@ install_url() { # Build up the base url since it is so nasty... _url_base=$_url_type:// if [[ $_url_type == ftp && $_ftp_server_login != anonymous ]]; then + [[ $_ftp_server_dir == /* || $_ftp_server_dir == ~* ]] || _home="~/" _url_base=$_url_base$(encode_for_url "$_ftp_server_login"):$(encode_for_url "$_ftp_server_password")@ fi - eval _url_base=$_url_base\$_${_url_type}_server_ip/\$_${_url_type}_server_dir + eval _url_base=$_url_base\$_${_url_type}_server_ip/$_home\$_${_url_type}_server_dir # Get list of files from the server. if [[ $_url_type == ftp && -z $ftp_proxy ]] ; then |