Resync patch with contrib.
[dragonfly.git] / libexec / ftpd / skey-stuff.c
blob699238c4dc89b57ff8881fb68760af261e67821e
1 /* Author: Wietse Venema, Eindhoven University of Technology.
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 $
5 */
7 #include <stdio.h>
8 #include <string.h>
9 #include <pwd.h>
11 #include <skey.h>
13 /* skey_challenge - additional password prompt stuff */
15 char *skey_challenge(name, pwd, pwok)
16 char *name;
17 struct passwd *pwd;
18 int pwok;
20 static char buf[128];
21 struct skey skey;
23 /* Display s/key challenge where appropriate. */
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);