]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.util
wireless-ap: Check that secret has the correct length and no invalid characters
[people/ms/network.git] / src / functions / functions.util
index b7674238333e828c703d7f572450827f84405557..7379a9887de812acf0eb812ef2cb2b0b7d0091e4 100644 (file)
@@ -248,6 +248,19 @@ file_get_age() {
        return ${EXIT_ERROR}
 }
 
+file_to_log() {
+       local level="${1}"
+       assert isset level
+
+       local file="${2}"
+       assert file_exists "${file}"
+
+       local line
+       while read line; do
+               log "${level}" "${line}"
+       done < "${file}"
+}
+
 make_directory() {
        local path="${1}"
 
@@ -732,6 +745,19 @@ contains_spaces() {
        return ${EXIT_FALSE}
 }
 
+contains_non_ascii_characters() {
+       local value="$@"
+
+       # Strip away all ASCII characters
+       local non_ascii="${value//[[:ascii:]]/}"
+
+       if isset non_ascii; then
+               return ${EXIT_TRUE}
+       fi
+
+       return ${EXIT_FALSE}
+}
+
 string_match() {
        local match=${1}
        local string=${2}