1996-09-22 21:56:57 +00:00
|
|
|
/* Author: Wietse Venema, Eindhoven University of Technology.
|
|
|
|
*/
|
1994-08-21 19:09:58 +00:00
|
|
|
|
1997-11-21 07:38:43 +00:00
|
|
|
#ifndef lint
|
|
|
|
static const char rcsid[] =
|
1999-08-28 00:22:10 +00:00
|
|
|
"$FreeBSD$";
|
1997-11-21 07:38:43 +00:00
|
|
|
#endif /* not lint */
|
|
|
|
|
1994-08-21 19:09:58 +00:00
|
|
|
#include <stdio.h>
|
1997-02-20 23:11:22 +00:00
|
|
|
#include <string.h>
|
1994-08-21 19:09:58 +00:00
|
|
|
#include <pwd.h>
|
|
|
|
|
|
|
|
#include <skey.h>
|
|
|
|
|
|
|
|
/* skey_challenge - additional password prompt stuff */
|
|
|
|
|
1996-10-18 17:09:26 +00:00
|
|
|
char *skey_challenge(name, pwd, pwok)
|
1994-08-21 19:09:58 +00:00
|
|
|
char *name;
|
|
|
|
struct passwd *pwd;
|
1996-10-18 17:09:26 +00:00
|
|
|
int pwok;
|
1994-08-21 19:09:58 +00:00
|
|
|
{
|
|
|
|
static char buf[128];
|
|
|
|
struct skey skey;
|
|
|
|
|
|
|
|
/* Display s/key challenge where appropriate. */
|
|
|
|
|
1997-12-24 19:13:23 +00:00
|
|
|
*buf = '\0';
|
1996-10-18 17:09:26 +00:00
|
|
|
if (pwd == NULL || skeychallenge(&skey, pwd->pw_name, buf))
|
1997-12-24 19:13:23 +00:00
|
|
|
snprintf(buf, sizeof(buf), "Password required for %s.", name);
|
1996-10-18 17:09:26 +00:00
|
|
|
else if (!pwok)
|
|
|
|
strcat(buf, " (s/key required)");
|
1994-08-21 19:09:58 +00:00
|
|
|
return (buf);
|
|
|
|
}
|