set r = PAM_SYSTEM_ERR and let later code check the flags
before deciding whether the error may be ignored.
Also count the number of successes, and if nothing is explicitly
successful then treat it as a failure. This replaces the previous
check for chain == NULL.
Reviewed by christos, mrg