diff options
author | guido <guido@FreeBSD.org> | 1994-08-21 19:09:23 +0000 |
---|---|---|
committer | guido <guido@FreeBSD.org> | 1994-08-21 19:09:23 +0000 |
commit | a368a750a1b9175d41004b8ae490144c96a3a474 (patch) | |
tree | f68469874ce9bc08cb0be998a59fa462d3692e65 /libexec/ftpd | |
parent | 68a462f3d5a11989395d5d422412580fa77a2a8c (diff) | |
download | FreeBSD-src-a368a750a1b9175d41004b8ae490144c96a3a474.zip FreeBSD-src-a368a750a1b9175d41004b8ae490144c96a3a474.tar.gz |
Put skey support in ftpd.
Reviewed by:
Submitted by: guido
Diffstat (limited to 'libexec/ftpd')
-rw-r--r-- | libexec/ftpd/Makefile | 7 | ||||
-rw-r--r-- | libexec/ftpd/ftpd.c | 21 |
2 files changed, 25 insertions, 3 deletions
diff --git a/libexec/ftpd/Makefile b/libexec/ftpd/Makefile index 22c826f..d65a4b9 100644 --- a/libexec/ftpd/Makefile +++ b/libexec/ftpd/Makefile @@ -1,9 +1,10 @@ # @(#)Makefile 8.2 (Berkeley) 4/4/94 PROG= ftpd -CFLAGS+=-DSETPROCTITLE -SRCS= ftpd.c ftpcmd.c logwtmp.c popen.c -LDADD= -lcrypt +CFLAGS+=-DSETPROCTITLE -DSKEY +SRCS= ftpd.c ftpcmd.c logwtmp.c popen.c skey-stuff.c +LDADD= -lcrypt -lskey +DPADD= ${LIBSKEY} MAN8= ftpd.8 CLEANFILES+=ftpcmd.c y.tab.h diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 6e23bd7..5d6fab5 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -141,6 +141,12 @@ char *LastArgv = NULL; /* end of argv */ char proctitle[LINE_MAX]; /* initial part of title */ #endif /* SETPROCTITLE */ +#ifdef SKEY +int pwok = 0; +char *skey_challenge(); +char *skey_crypt(); +#endif + #define LOGCMD(cmd, file) \ if (logging > 1) \ syslog(LOG_INFO,"%s %s%s", cmd, \ @@ -198,6 +204,9 @@ main(argc, argv, envp) int addrlen, ch, on = 1, tos; char *cp, line[LINE_MAX]; FILE *fd; +#ifdef SKEY + char addr_string[20]; /* XXX */ +#endif /* * LOG_NDELAY sets up the logging connection immediately, @@ -209,6 +218,10 @@ main(argc, argv, envp) syslog(LOG_ERR, "getpeername (%s): %m",argv[0]); exit(1); } +#ifdef SKEY + strcpy(addr_string, inet_ntoa(his_addr.sin_addr)); + pwok = authfile(addr_string); +#endif addrlen = sizeof(ctrl_addr); if (getsockname(0, (struct sockaddr *)&ctrl_addr, &addrlen) < 0) { syslog(LOG_ERR, "getsockname (%s): %m",argv[0]); @@ -456,7 +469,11 @@ user(name) } if (logging) strncpy(curname, name, sizeof(curname)-1); +#ifdef SKEY + reply(331, "%s", skey_challenge(name, pw, pwok)); +#else reply(331, "Password required for %s.", name); +#endif askpasswd = 1; /* * Delay before reading passwd after first failed @@ -526,7 +543,11 @@ pass(passwd) salt = "xx"; else salt = pw->pw_passwd; +#ifdef SKEY + xpasswd = skey_crypt(passwd, salt, pw, pwok); +#else xpasswd = crypt(passwd, salt); +#endif /* The strcmp does not catch null passwords! */ if (pw == NULL || *pw->pw_passwd == '\0' || strcmp(xpasswd, pw->pw_passwd)) { |