#!/bin/sh

po_domain="alterator-ahttpd"
alterator_api_version=1

l10n_dir=/etc/alterator/l10n

. alterator-sh-functions

on_message() {
  case "$in_action" in
    list)
	if [ "$in__objects" = "avail_locale" ];then
		    [ ! -d "$l10n_dir" ] ||
			find "$l10n_dir" -type f|
			    sort|
			    while read f; do
				local name="${f##*/}"
				name="${name##??-}"
				write_enum_item "$name" "$(cat "$f")"
			    done
	fi
	;;
    write)
            printf "%s\0%s" "$in_login" "$in_password" | /usr/sbin/alterator-chkpwd;
	    [ $? -eq '0' ] || write_error "`_ "Authentication failed"`";
	;;
  esac
}

message_loop
