From 2c2a50fde64d3abee0f09d7d96fadfd5434c8315 Mon Sep 17 00:00:00 2001 From: Devin Teske Date: Sat, 22 Jun 2013 02:57:52 +0000 Subject: [PATCH] Take advantage of the fact that f_getvar evaluates the $var_to_get parameter within braces, allowing all manner of parameter expansions (properly quoted or escaped, of course). --- usr.sbin/bsdconfig/share/media/ftp.subr | 5 ++--- usr.sbin/bsdconfig/share/media/httpproxy.subr | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/usr.sbin/bsdconfig/share/media/ftp.subr b/usr.sbin/bsdconfig/share/media/ftp.subr index 62a13e64870a..3c2cba9bc07c 100644 --- a/usr.sbin/bsdconfig/share/media/ftp.subr +++ b/usr.sbin/bsdconfig/share/media/ftp.subr @@ -853,11 +853,10 @@ f_media_get_ftp() userpass="$userpass${userpass:+@}" fi - local ftp_dir mode rx - f_getvar $VAR_FTP_DIR ftp_dir + local dir mode rx + f_getvar $VAR_FTP_DIR\#/ dir f_getvar $VAR_FTP_STATE mode - local dir="${ftp_dir#/}" local port="${ftp_port:+:$ftp_port}" case "$host" in *:*) host="[$host]"; esac diff --git a/usr.sbin/bsdconfig/share/media/httpproxy.subr b/usr.sbin/bsdconfig/share/media/httpproxy.subr index 3483c64f46cd..d2b2cfc90a46 100644 --- a/usr.sbin/bsdconfig/share/media/httpproxy.subr +++ b/usr.sbin/bsdconfig/share/media/httpproxy.subr @@ -292,7 +292,7 @@ f_media_init_http_proxy() ;; *) local fdir fp - f_getvar $VAR_FTP_PATH fp + f_getvar $VAR_FTP_PATH%/ fp for fdir in $FTP_DIRS; do setvar $VAR_HTTP_PROXY_PATH "$fp/$fdir/$rel" if f_http_proxy_check_access; then @@ -380,9 +380,9 @@ f_media_get_http_proxy() fi local proxy_path mode - f_getvar $VAR_HTTP_PROXY_PATH proxy_path + f_getvar $VAR_HTTP_PROXY_PATH%/ proxy_path f_getvar $VAR_HTTP_FTP_MODE mode - local url="${proxy_path%/}/$file$mode" rx + local url="$proxy_path/$file$mode" rx f_dprintf "sending http request for: %s" "$url" printf "GET %s HTTP/1.0\r\n\r\n" "$url" | nc -n "$host" "$proxy_port" |