- char *u;
-
-#ifdef HAVE_ENHANCED_PASSWD
- set_auth_parameters(argc, argv);
- check_auth_parameters();
-#endif /* HAVE_DEC_ENHANCED */
-
- u = user_name();
- encrypted_user_passwd = get_encrypted_passwd(u);
- encrypted_root_passwd = get_encrypted_passwd(ROOT);
- if (u) free (u);
-
- if (encrypted_user_passwd)
- return True;
- else
- return False;
-}
-
+ int i, j;
+ for (i = 0; i < countof(methods); i++)
+ {
+ int ok_p = (methods[i].initted_p &&
+ methods[i].valid_p (typed_passwd, verbose_p));
+
+ check_for_leaks (methods[i].name);
+
+ if (ok_p)
+ {
+ /* If we successfully authenticated by method N, but attempting
+ to authenticate by method N-1 failed, mention that (since if
+ an earlier authentication method fails and a later one succeeds,
+ something screwy is probably going on.)
+ */
+ if (verbose_p && i > 0)
+ {
+ for (j = 0; j < i; j++)
+ if (methods[j].initted_p)
+ fprintf (stderr,
+ "%s: authentication via %s passwords failed.\n",
+ blurb(), methods[j].name);
+ fprintf (stderr,
+ "%s: authentication via %s passwords succeeded.\n",
+ blurb(), methods[i].name);
+ }
+
+ return True; /* Successfully authenticated! */
+ }
+ }