summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/package.sh27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/package.sh b/lib/package.sh
index 938d67c..833bbc7 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -272,7 +272,14 @@ _ob_set_source_parameter()
_obssp_name="${1}"
_obssp_value="${2}"
- # FIXME: Name transformation and validation?
+ # Convert field name to uppercase and validate.
+ _obssp_name="$(echo "${_obssp_name}" | tr 'a-z-' 'A-Z_')"
+ case "${_obssp_name:- }" in
+ *[!A-Z0-9_]*)
+ _ob_return 125
+ return ${?}
+ ;;
+ esac
_OB_SOURCE_PARAMETERS="${_OB_SOURCE_PARAMETERS} ${_obssp_name}"
@@ -290,7 +297,23 @@ _ob_set_binary_parameter()
_obsbp_name="${2}"
_obsbp_value="${3}"
- # FIXME: Name transformation and validation?
+ if ! ob_validate_binary_package_name "${_obsbp_package}"; then
+ _ob_return 125
+ return ${?}
+ fi
+
+ # Convert package name to its uppercase "clean" form.
+ _obsbp_package="$(echo "${_obsbp_package}" | tr 'a-z' 'A-Z' | \
+ tr -dC 'A-Z0-9')"
+
+ # Convert field name to uppercase and validate.
+ _obsbp_name="$(echo "${_obsbp_name}" | tr 'a-z-' 'A-Z_')"
+ case "${_obsbp_name:- }" in
+ *[!A-Z0-9_]*)
+ _ob_return 125
+ return ${?}
+ ;;
+ esac
_OB_BINARY_PARAMETERS="${_OB_BINARY_PARAMETERS} ${_obsbp_name}"