}
+#------------------------------------------------
+update_passwords() {
+
+ empty_line
+ draw_line
+ info "Setting all user passwords ..."
+
+ local password_file="password-hashes.txt"
+ if [[ ! -f "${password_file}" ]] ; then
+ error "Password Hash file '${RED}${password_file}${NORMAL}' not found."
+ exit 8
+ fi
+
+ local -a uids=()
+ local -A password_hashes=()
+ local line=
+ local uid=
+ local password_hash=
+ local password_hash_shorten=
+ local len_pwh=
+ local len_pwhs=
+ local oifs="${IFS}"
+ IFS="
+"
+ debug "Reading password hash file '${CYAN}${password_file}${NORMAL}' ..."
+ for line in $( cat "${password_file}" ) ; do
+ if echo "${line}" | grep -q -P '^\s*(#|$)' ; then
+ continue
+ fi
+ uid=$( echo "${line}" | awk '{print $1}' )
+ password_hash=$( echo "${line}" | awk '{print $2}' )
+ if [[ -z "${uid}" || -z "${password_hash}" ]] ; then
+ warn "Invalid line '${YELLOW}${line}${NORMAL}' found in '${CYAN}${password_file}${NORMAL}'."
+ continue
+ fi
+ uids+=( "${uid}" )
+ password_hashes[${uid}]="${password_hash}"
+ done
+
+ if [[ "${VERBOSE}" == "y" ]] ; then
+ echo
+ echo -e "${CYAN}Password hashes:${NORMAL}"
+ local max_len_uid=1
+ for uid in "${!password_hashes[@]}" ; do
+ local len_uid=$( printf "${uid}" | wc -c )
+ if [[ "${len_uid}" -gt "${max_len_uid}" ]] ; then
+ max_len_uid="${len_uid}"
+ fi
+ done
+ max_len_uid=$(( max_len_uid + 1 ))
+ for uid in "${uids[@]}" ; do
+ password_hash=$( echo "${password_hashes[${uid}]}" )
+ len_pwh=$( printf "${password_hash}" | wc -c )
+ password_hash_shorten=$( echo "${password_hash}" | cut -c 1-50 )
+ len_pwhs=$( printf "${password_hash_shorten}" | wc -c )
+ if [[ "${len_pwh}" -gt "${len_pwhs}" ]] ; then
+ password_hash_shorten="${password_hash_shorten}..."
+ fi
+ printf "%-*s %s\n" "${max_len_uid}" "${uid}:" "${password_hash_shorten}"
+ done
+ fi
+
+}
+
#------------------------------------------------
update_mailhost() {
trap cleanup_tmp_file INT TERM EXIT ABRT
- update_passwd_fbrehm
- update_all_mailhosts
+ # update_passwd_fbrehm
+ update_passwords
+ # update_all_mailhosts
}