summaryrefslogtreecommitdiffstats
path: root/libexec/ftpd/skey-stuff.c
blob: 30faa9e29e7741066d177e9694d87bac5357c658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Author: Wietse Venema, Eindhoven University of Technology. 
 */

#ifndef lint
static const char rcsid[] =
	"$Id: skey-stuff.c,v 1.10 1997/11/21 07:38:43 charnier Exp $";
#endif /* not lint */

#include <stdio.h>
#include <string.h>
#include <pwd.h>

#include <skey.h>

/* skey_challenge - additional password prompt stuff */

char   *skey_challenge(name, pwd, pwok)
char   *name;
struct passwd *pwd;
int    pwok;
{
    static char buf[128];
    struct skey skey;

    /* Display s/key challenge where appropriate. */

    *buf = '\0';
    if (pwd == NULL || skeychallenge(&skey, pwd->pw_name, buf))
	snprintf(buf, sizeof(buf), "Password required for %s.", name);
    else if (!pwok)
	strcat(buf, " (s/key required)");
    return (buf);
}
OpenPOWER on IntegriCloud