Home | History | Annotate | Line # | Download | only in ftpd
extern.h revision 1.20
      1 /*	$NetBSD: extern.h,v 1.20 1999/12/07 05:30:54 lukem Exp $	*/
      2 
      3 /*
      4  * Copyright (C) 1997 and 1998 WIDE Project.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. Neither the name of the project nor the names of its contributors
     16  *    may be used to endorse or promote products derived from this software
     17  *    without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
     23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  * SUCH DAMAGE.
     30  */
     31 
     32 /*-
     33  * Copyright (c) 1992, 1993
     34  *	The Regents of the University of California.  All rights reserved.
     35  *
     36  * Redistribution and use in source and binary forms, with or without
     37  * modification, are permitted provided that the following conditions
     38  * are met:
     39  * 1. Redistributions of source code must retain the above copyright
     40  *    notice, this list of conditions and the following disclaimer.
     41  * 2. Redistributions in binary form must reproduce the above copyright
     42  *    notice, this list of conditions and the following disclaimer in the
     43  *    documentation and/or other materials provided with the distribution.
     44  * 3. All advertising materials mentioning features or use of this software
     45  *    must display the following acknowledgement:
     46  *	This product includes software developed by the University of
     47  *	California, Berkeley and its contributors.
     48  * 4. Neither the name of the University nor the names of its contributors
     49  *    may be used to endorse or promote products derived from this software
     50  *    without specific prior written permission.
     51  *
     52  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     53  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     54  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     55  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     56  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     57  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     58  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     59  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     60  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     61  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     62  * SUCH DAMAGE.
     63  *
     64  *	@(#)extern.h	8.2 (Berkeley) 4/4/94
     65  */
     66 
     67 void	blkfree __P((char **));
     68 char   *conffilename __P((const char *));
     69 char  **copyblk __P((char **));
     70 void	cwd __P((const char *));
     71 void	delete __P((const char *));
     72 char  **do_conversion __P((const char *));
     73 void	dologout __P((int));
     74 void	fatal __P((const char *));
     75 int	ftpd_pclose __P((FILE *));
     76 FILE   *ftpd_popen __P((char *[], const char *, int));
     77 char   *getline __P((char *, int, FILE *));
     78 void	logcmd __P((const char *, off_t, const char *, const char *,
     79 	    const struct timeval *, const char *));
     80 void	logwtmp __P((const char *, const char *, const char *));
     81 void	lreply __P((int, const char *, ...));
     82 void	makedir __P((const char *));
     83 void	parse_conf __P((char *));
     84 void	pass __P((const char *));
     85 void	passive __P((void));
     86 void	long_passive __P((char *, int));
     87 void	perror_reply __P((int, const char *));
     88 void	pwd __P((void));
     89 void	removedir __P((const char *));
     90 void	renamecmd __P((const char *, const char *));
     91 char   *renamefrom __P((char *));
     92 void	reply __P((int, const char *, ...));
     93 void	retrieve __P((char *[], const char *));
     94 void	send_file_list __P((const char *));
     95 void	show_chdir_messages __P((int));
     96 void	statcmd __P((void));
     97 void	statfilecmd __P((const char *));
     98 void	store __P((const char *, const char *, int));
     99 void	user __P((const char *));
    100 char   *xstrdup __P((const char *));
    101 void	yyerror __P((char *));
    102 
    103 typedef long long qdfmt_t;
    104 typedef unsigned long long qufmt_t;
    105 
    106 #define CLASS_CHROOT	"chroot"
    107 #define CLASS_GUEST	"guest"
    108 #define CLASS_REAL	"real"
    109 
    110 struct ftpconv {
    111 	struct ftpconv	*next;
    112 	char		*suffix;	/* Suffix of requested name */
    113 	char		*types;		/* Valid file types */
    114 	char		*disable;	/* File to disable conversions */
    115 	char		*command;	/* Command to do the conversion */
    116 };
    117 
    118 struct ftpclass {
    119 	int		 checkportcmd;	/* Check PORT commands are valid */
    120 	char		*classname;	/* Current class */
    121 	struct ftpconv	*conversions;	/* List of conversions */
    122 	char		*display;	/* Files to display upon chdir */
    123 	unsigned int	 maxtimeout;	/* Maximum permitted timeout */
    124 	int		 modify;	/* Allow dele, mkd, rmd, umask, chmod */
    125 	char		*notify;	/* Files to notify about upon chdir */
    126 	int		 passive;	/* Allow pasv */
    127 	unsigned int	 timeout;	/* Default timeout */
    128 	mode_t		 umask;		/* Umask to use */
    129 };
    130 
    131 #include <netinet/in.h>
    132 
    133 union sockunion {
    134 	struct sockinet {
    135 		u_char si_len;
    136 		u_char si_family;
    137 		u_short si_port;
    138 	} su_si;
    139 	struct sockaddr_in  su_sin;
    140 	struct sockaddr_in6 su_sin6;
    141 };
    142 #define su_len		su_si.si_len
    143 #define su_family	su_si.si_family
    144 #define su_port		su_si.si_port
    145 
    146 extern  int yyparse __P((void));
    147 
    148 extern	char		cbuf[];
    149 extern	struct ftpclass	curclass;
    150 extern	union sockunion data_dest;
    151 extern	int		debug;
    152 extern	int		form;
    153 extern	int		guest;
    154 extern	int		hasyyerrored;
    155 extern	union sockunion his_addr;
    156 extern	char		hostname[];
    157 #ifdef KERBEROS5
    158 extern	krb5_context	kcontext;
    159 #endif
    160 extern	int		logged_in;
    161 extern	int		logging;
    162 extern	int		pdata;
    163 extern	char		proctitle[];
    164 extern	struct passwd  *pw;
    165 extern	char		remotehost[];
    166 extern	off_t		restart_point;
    167 extern	char		tmpline[];
    168 extern	sig_atomic_t	transflag;
    169 extern	int		type;
    170 extern	int		usedefault;
    171 extern	const char	version[];
    172 
    173 extern	off_t		total_data_in, total_data_out, total_data;
    174 extern	off_t		total_files_in, total_files_out, total_files;
    175 extern	off_t		total_bytes_in, total_bytes_out, total_bytes;
    176 extern	off_t		total_xfers_in, total_xfers_out, total_xfers;
    177 
    178 
    179 #define PLURAL(s)	((s) == 1 ? "" : "s")
    180 #define	INTERNAL_LS	"/bin/ls"
    181