diff options
author | peter <peter@FreeBSD.org> | 1995-12-30 19:02:48 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1995-12-30 19:02:48 +0000 |
commit | ab124e78b0271ddb904b761b31e5c9a0cf24e070 (patch) | |
tree | 0cf1447720c45721ed3d214a4eaaa6834bda155d /usr.bin/login | |
parent | 15748830d0fcd29294a1969a1012655e74908c1e (diff) | |
download | FreeBSD-src-ab124e78b0271ddb904b761b31e5c9a0cf24e070.zip FreeBSD-src-ab124e78b0271ddb904b761b31e5c9a0cf24e070.tar.gz |
recording cvs-1.6 file death
Diffstat (limited to 'usr.bin/login')
-rw-r--r-- | usr.bin/login/login_skey.c | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/usr.bin/login/login_skey.c b/usr.bin/login/login_skey.c deleted file mode 100644 index b94bd28..0000000 --- a/usr.bin/login/login_skey.c +++ /dev/null @@ -1,105 +0,0 @@ - /* Portions taken from the skey distribution on Oct 21 1993 */ -#ifdef SKEY -#include <sys/types.h> -#include <netinet/in.h> -#include <string.h> -#include <netdb.h> -#include <arpa/inet.h> -#include <stdio.h> -#include <termios.h> -#include <pwd.h> -#include <syslog.h> - -#include <skey.h> - -/* skey_getpass - read regular or s/key password */ - -char *skey_getpass(prompt, pwd, pwok) -char *prompt; -struct passwd *pwd; -int pwok; -{ - static char buf[128]; - struct skey skey; - char *cp; - void rip(); - struct termios saved_ttymode; - struct termios noecho_ttymode; - char *username = pwd ? pwd->pw_name : "nope"; - int sflag; - - /* Attempt an s/key challenge. */ - - if ((sflag = skeychallenge(&skey, username, buf)) == 0) { - printf("%s\n", buf); - } - if (!pwok) { - printf("(s/key required)\n"); - } - fputs(prompt, stdout); - fflush(stdout); - - /* Save current input modes and turn echo off. */ - - tcgetattr(0, &saved_ttymode); - tcgetattr(0, &noecho_ttymode); - noecho_ttymode.c_lflag &= ~ECHO; - tcsetattr(0, TCSANOW, &noecho_ttymode); - - /* Read password. */ - - buf[0] = 0; - fgets(buf, sizeof(buf), stdin); - rip(buf); - - /* Restore previous input modes. */ - - tcsetattr(0, TCSANOW, &saved_ttymode); - - /* Give S/Key users a chance to do it with echo on. */ - - if (sflag == 0 && feof(stdin) == 0 && buf[0] == 0) { - fputs(" (turning echo on)\n", stdout); - fputs(prompt, stdout); - fflush(stdout); - fgets(buf, sizeof(buf), stdin); - rip(buf); - } else { - putchar('\n'); - } - return (buf); -} - -/* skey_crypt - return encrypted UNIX passwd if s/key or regular password ok */ - -char *skey_crypt(pp, salt, pwd, pwok) -char *pp; -char *salt; -struct passwd *pwd; -int pwok; -{ - struct skey skey; - char *p; - char *crypt(); - - /* Try s/key authentication even when the UNIX password is permitted. */ - - if (pwd != 0 && skeylookup(&skey, pwd->pw_name) == 0 - && skeyverify(&skey, pp) == 0) { - /* s/key authentication succeeded */ - if (skey.n < 5) - printf("Warning! Change s/key password soon\n"); - return (pwd->pw_passwd); - } - - /* When s/key authentication does not work, always invoke crypt(). */ - - p = crypt(pp, salt); - if (pwok && pwd != 0 && strcmp(p, pwd->pw_passwd) == 0) - return (pwd->pw_passwd); - - /* The user does not exist or entered bad input. */ - - return (":"); -} -#endif SKEY |