From dd0be3d9b38eb45cbcf352f0e885403fa6ceab25 Mon Sep 17 00:00:00 2001 From: Mitchell Berger Date: Fri, 8 Jun 2001 04:17:45 +0000 Subject: * pathnames.h: _PATH_FTPUSERS renamed to _PATH_FTPUSERS_DEFAULT * ftpd.c: Added '-U filename' option to allow specification of an ftpusers file other than the default. * ftpd.M: Documented the new -U option. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13303 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/gssftp/ftpd/ChangeLog | 9 +++++++++ src/appl/gssftp/ftpd/ftpd.M | 7 +++++++ src/appl/gssftp/ftpd/ftpd.c | 21 +++++++++++++++++---- src/appl/gssftp/ftpd/pathnames.h | 2 +- 4 files changed, 34 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/appl/gssftp/ftpd/ChangeLog b/src/appl/gssftp/ftpd/ChangeLog index 9f74c68e2a..3a6280c580 100644 --- a/src/appl/gssftp/ftpd/ChangeLog +++ b/src/appl/gssftp/ftpd/ChangeLog @@ -1,3 +1,12 @@ +2001-06-08 Mitchell Berger + + * pathnames.h: _PATH_FTPUSERS renamed to _PATH_FTPUSERS_DEFAULT. + + * ftpd.c: Added '-U filename' option to allow specification of + an ftpusers file other than the default. + + * ftpd.M: Documented the new -U option. + 2001-06-06 Ezra Peisach * ftpcmd.y: Include "ftpd_var.h" and remove prototype for reply() diff --git a/src/appl/gssftp/ftpd/ftpd.M b/src/appl/gssftp/ftpd/ftpd.M index 725eeee1d9..9ed8cb45e2 100644 --- a/src/appl/gssftp/ftpd/ftpd.M +++ b/src/appl/gssftp/ftpd/ftpd.M @@ -42,6 +42,7 @@ Internet File Transfer Protocol server [\fB\-a \fP|\fB -A\fP] [\fB\-c\fP] [\fB\-C\fP] [\fB\-d\fP] [\fB\-l\fP] [\fB\-t\fP \fItimeout\fP] [\fB\-T\fP \fImaxtimeout\fP] [\fB\-p\fP \fIport\fP] [\fB\-u\fP \fIumask\fP] +[\fB\-U\fP \fIftpusers-file\fP] [\fB\-r\fP \fIrealm-file\fP] [\fB\-s\fP \fIsrvtab\fP] [\fB\-w\fP[\fBip\fP|\fImaxhostlen\fP[\fB,\fP[\fBno\fP]\fBstriplocal\fP]]] .SH DESCRIPTION @@ -107,6 +108,12 @@ Normally the ftp server is invoked by \fB\-u\fP \fIumask\fP Sets the umask for the ftpd process. The default value is normally 027. .TP +\fB\-U\fP \fIftpusers-file\fP +Sets the full path and name of the +.I ftpusers +file to use. The default value is normally +.IR /etc/ftpusers . +.TP \fB\-r\fP \fIrealm-file\fP Sets the name of the .I krb.conf diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index a81556093a..f5bbd52487 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -117,6 +117,7 @@ extern char *sys_errlist[]; #endif extern char *mktemp (); +char *ftpusers; #include @@ -283,6 +284,7 @@ main(argc, argv, envp) { int addrlen, on = 1, tos, port = -1; char *cp; + ftpusers = _PATH_FTPUSERS_DEFAULT; #ifdef KRB5_KRB4_COMPAT keyfile = KEYFILE; @@ -397,6 +399,17 @@ main(argc, argv, envp) goto nextopt; } + case 'U': + if (*++cp != '\0') + ftpusers = cp; + else if (argc > 1) { + argc--, argv++; + ftpusers = *argv; + } + else + fprintf(stderr, "ftpd: -U expects argument\n"); + goto nextopt; + case 'w': { char *optarg; @@ -690,11 +703,11 @@ int askpasswd; /* had user command, ask for passwd */ * Sets global passwd pointer pw if named account exists and is acceptable; * sets askpasswd if a PASS command is expected. If logged in previously, * need to reset state. If name is "ftp" or "anonymous", the name is not in - * _PATH_FTPUSERS, and ftp account exists, set guest and pw, then just return. + * ftpusers, and ftp account exists, set guest and pw, then just return. * If account doesn't exist, ask for passwd anyway. Otherwise, check user * requesting login privileges. Disallow anyone who does not have a standard * shell as returned by getusershell(). Disallow anyone mentioned in the file - * _PATH_FTPUSERS to allow people such as root and uucp to be avoided, except + * ftpusers to allow people such as root and uucp to be avoided, except * for users whose names are followed by whitespace and then the keyword * "restrict." Restricted users are allowed to login, but a chroot() is * done to their home directory. @@ -845,7 +858,7 @@ user(name) } /* - * Check if a user is in the file _PATH_FTPUSERS. + * Check if a user is in the file ftpusers. * Return 1 if they are (a disallowed user), -1 if their username * is followed by "restrict." (a restricted user). Otherwise return 0. */ @@ -857,7 +870,7 @@ checkuser(name) register char *p; char line[FTP_BUFSIZ]; - if ((fd = fopen(_PATH_FTPUSERS, "r")) != NULL) { + if ((fd = fopen(ftpusers, "r")) != NULL) { while (fgets(line, sizeof(line), fd) != NULL) { if ((p = strchr(line, '\n')) != NULL) { *p = '\0'; diff --git a/src/appl/gssftp/ftpd/pathnames.h b/src/appl/gssftp/ftpd/pathnames.h index 8669e466ab..41398bc5f5 100644 --- a/src/appl/gssftp/ftpd/pathnames.h +++ b/src/appl/gssftp/ftpd/pathnames.h @@ -33,4 +33,4 @@ * @(#)pathnames.h 5.2 (Berkeley) 6/1/90 */ -#define _PATH_FTPUSERS "/etc/ftpusers" +#define _PATH_FTPUSERS_DEFAULT "/etc/ftpusers" -- cgit