1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00
freebsd/libexec/ftpd/skey-stuff.c
Warner Losh e760ef2c35 Various sprintf -> snprintf fixes.
Minor style fix (strcpy(foo,"") -> *foo = '\0')
Obtained from:	OpenBSD(?)
1997-12-24 19:13:23 +00:00

34 lines
741 B
C

/* 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);
}