#!/bin/sh

set -e

MECHS="SCRAM-SHA-512 SCRAM-SHA-384 SCRAM-SHA-256 SCRAM-SHA-224 SCRAM-SHA-1 GS2-KRB5 GS2-IAKERB GSS-SPNEGO GSSAPI DIGEST-MD5 EXTERNAL OTP NTLM CRAM-MD5 PLAIN LOGIN ANONYMOUS"

for mech in $MECHS; do
    echo "Checking mechanism $mech"
    output=$(/usr/sbin/saslpluginviewer -m $mech 2>&1) || {
        echo "Mechanism $mech not available"
        echo "${output}"
        exit 1
    }
done
