Remove /* within block comment.
[dragonfly/netmp.git] / lib / libskey / skey_getpass.c
blobc3f5432d02ff60ddb02d92eac6bad5bb24ca8a0d
1 #include <unistd.h>
2 #include <stdio.h>
3 #include <skey.h>
5 /* skey_getpass - read regular or s/key password */
7 char *skey_getpass(prompt, pwd, pwok)
8 const char *prompt;
9 struct passwd *pwd;
10 int pwok;
12 static char buf[128];
13 struct skey skey;
14 char *pass;
15 int sflag;
17 /* Attempt an s/key challenge. */
18 sflag = (pwd == NULL || skeyinfo(&skey, pwd->pw_name, buf));
19 if (!sflag) {
20 printf("%s\n", buf);
21 if (!pwok)
22 printf("(s/key required)\n");
25 pass = getpass(prompt);
27 /* Give S/Key users a chance to do it with echo on. */
28 if (!sflag && !feof(stdin) && *pass == '\0') {
29 fputs(" (turning echo on)\n", stdout);
30 fputs(prompt, stdout);
31 fflush(stdout);
32 fgets(buf, sizeof(buf), stdin);
33 rip(buf);
34 return (buf);
35 } else
36 return (pass);