ftpd.c (17453) | ftpd.c (17478) |
---|---|
1/* 2 * Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $Id: ftpd.c,v 1.20 1996/08/06 08:43:43 phk Exp $ | 33 * $Id$ |
34 */ 35 | 34 */ 35 |
36#if 0 |
|
36#ifndef lint 37static char copyright[] = 38"@(#) Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994\n\ 39 The Regents of the University of California. All rights reserved.\n"; 40#endif /* not lint */ | 37#ifndef lint 38static char copyright[] = 39"@(#) Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994\n\ 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ |
42#endif |
|
41 | 43 |
44#if 0 |
|
42#ifndef lint 43static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; 44#endif /* not lint */ | 45#ifndef lint 46static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; 47#endif /* not lint */ |
48#endif |
|
45 46/* 47 * FTP server. 48 */ 49#include <sys/param.h> 50#include <sys/stat.h> 51#include <sys/ioctl.h> 52#include <sys/socket.h> --- 86 unchanged lines hidden (view full) --- 139char tmpline[7]; 140char hostname[MAXHOSTNAMELEN]; 141char remotehost[MAXHOSTNAMELEN]; 142char *ident = NULL; 143 144static char ttyline[20]; 145char *tty = ttyline; /* for klogin */ 146 | 49 50/* 51 * FTP server. 52 */ 53#include <sys/param.h> 54#include <sys/stat.h> 55#include <sys/ioctl.h> 56#include <sys/socket.h> --- 86 unchanged lines hidden (view full) --- 143char tmpline[7]; 144char hostname[MAXHOSTNAMELEN]; 145char remotehost[MAXHOSTNAMELEN]; 146char *ident = NULL; 147 148static char ttyline[20]; 149char *tty = ttyline; /* for klogin */ 150 |
151#ifdef KERBEROS 152int klogin __P((struct passwd *, char *, char *, char *)); 153#endif 154 |
|
147#if defined(KERBEROS) 148int notickets = 1; | 155#if defined(KERBEROS) 156int notickets = 1; |
157int noticketsdontcomplain = 1; |
|
149char *krbtkfile_env = NULL; 150#endif 151 152/* 153 * Timeout intervals for retrying connections 154 * to hosts that don't accept PORT cmds. This 155 * is a kludge, but given the problems with TCP... 156 */ --- 400 unchanged lines hidden (view full) --- 557 "Guest login ok, send your email address as password."); 558 } else 559 reply(530, "User %s unknown.", name); 560 if (!askpasswd && logging) 561 syslog(LOG_NOTICE, 562 "ANONYMOUS FTP LOGIN REFUSED FROM %s", remotehost); 563 return; 564 } | 158char *krbtkfile_env = NULL; 159#endif 160 161/* 162 * Timeout intervals for retrying connections 163 * to hosts that don't accept PORT cmds. This 164 * is a kludge, but given the problems with TCP... 165 */ --- 400 unchanged lines hidden (view full) --- 566 "Guest login ok, send your email address as password."); 567 } else 568 reply(530, "User %s unknown.", name); 569 if (!askpasswd && logging) 570 syslog(LOG_NOTICE, 571 "ANONYMOUS FTP LOGIN REFUSED FROM %s", remotehost); 572 return; 573 } |
565 if (pw = sgetpwnam(name)) { | 574 if ((pw = sgetpwnam(name))) { |
566 if ((shell = pw->pw_shell) == NULL || *shell == 0) 567 shell = _PATH_BSHELL; 568 while ((cp = getusershell()) != NULL) 569 if (strcmp(cp, shell) == 0) 570 break; 571 endusershell(); 572 573 if (cp == NULL || checkuser(_PATH_FTPUSERS, name)) { --- 874 unchanged lines hidden (view full) --- 1448 1449/* ARGSUSED */ 1450void 1451yyerror(s) 1452 char *s; 1453{ 1454 char *cp; 1455 | 575 if ((shell = pw->pw_shell) == NULL || *shell == 0) 576 shell = _PATH_BSHELL; 577 while ((cp = getusershell()) != NULL) 578 if (strcmp(cp, shell) == 0) 579 break; 580 endusershell(); 581 582 if (cp == NULL || checkuser(_PATH_FTPUSERS, name)) { --- 874 unchanged lines hidden (view full) --- 1457 1458/* ARGSUSED */ 1459void 1460yyerror(s) 1461 char *s; 1462{ 1463 char *cp; 1464 |
1456 if (cp = strchr(cbuf,'\n')) | 1465 if ((cp = strchr(cbuf,'\n'))) |
1457 *cp = '\0'; 1458 reply(500, "'%s': command not understood.", cbuf); 1459} 1460 1461void 1462delete(name) 1463 char *name; 1464{ --- 313 unchanged lines hidden (view full) --- 1778 dirlist = onefile; 1779 simple = 1; 1780 } 1781 1782 if (setjmp(urgcatch)) { 1783 transflag = 0; 1784 goto out; 1785 } | 1466 *cp = '\0'; 1467 reply(500, "'%s': command not understood.", cbuf); 1468} 1469 1470void 1471delete(name) 1472 char *name; 1473{ --- 313 unchanged lines hidden (view full) --- 1787 dirlist = onefile; 1788 simple = 1; 1789 } 1790 1791 if (setjmp(urgcatch)) { 1792 transflag = 0; 1793 goto out; 1794 } |
1786 while (dirname = *dirlist++) { | 1795 while ((dirname = *dirlist++)) { |
1787 if (stat(dirname, &st) < 0) { 1788 /* 1789 * If user typed "ls -l", etc, and the client 1790 * used NLST, do what the user meant. 1791 */ 1792 if (dirname[0] == '-' && *dirlist == NULL && 1793 transflag == 0) { 1794 retrieve("/bin/ls %s", dirname); --- 154 unchanged lines hidden --- | 1796 if (stat(dirname, &st) < 0) { 1797 /* 1798 * If user typed "ls -l", etc, and the client 1799 * used NLST, do what the user meant. 1800 */ 1801 if (dirname[0] == '-' && *dirlist == NULL && 1802 transflag == 0) { 1803 retrieve("/bin/ls %s", dirname); --- 154 unchanged lines hidden --- |