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