Initial import from FreeBSD RELENG_4:
[dragonfly.git] / libexec / ftpd / skey-stuff.c
1 /* Author: Wietse Venema, Eindhoven University of Technology. 
2  */
3
4 #ifndef lint
5 static const char rcsid[] =
6   "$FreeBSD: src/libexec/ftpd/skey-stuff.c,v 1.12 1999/08/28 00:09:32 peter Exp $";
7 #endif /* not lint */
8
9 #include <stdio.h>
10 #include <string.h>
11 #include <pwd.h>
12
13 #include <skey.h>
14
15 /* skey_challenge - additional password prompt stuff */
16
17 char   *skey_challenge(name, pwd, pwok)
18 char   *name;
19 struct passwd *pwd;
20 int    pwok;
21 {
22     static char buf[128];
23     struct skey skey;
24
25     /* Display s/key challenge where appropriate. */
26
27     *buf = '\0';
28     if (pwd == NULL || skeychallenge(&skey, pwd->pw_name, buf))
29         snprintf(buf, sizeof(buf), "Password required for %s.", name);
30     else if (!pwok)
31         strcat(buf, " (s/key required)");
32     return (buf);
33 }