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