xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp_var.h (revision 92163adad0f33b8ee626f71225670465b4718da2)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50b6880ccSsp149894  * Common Development and Distribution License (the "License").
60b6880ccSsp149894  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
220b6880ccSsp149894  *	Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  *	Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	All Rights Reserved	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  *	University Copyright- Copyright (c) 1982, 1986, 1988
317c478bd9Sstevel@tonic-gate  *	The Regents of the University of California
327c478bd9Sstevel@tonic-gate  *	All Rights Reserved
337c478bd9Sstevel@tonic-gate  *
347c478bd9Sstevel@tonic-gate  *	University Acknowledgment- Portions of this document are derived from
357c478bd9Sstevel@tonic-gate  *	software developed by the University of California, Berkeley, and its
367c478bd9Sstevel@tonic-gate  *	contributors.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifndef	_FTP_VAR_H
407c478bd9Sstevel@tonic-gate #define	_FTP_VAR_H
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
437c478bd9Sstevel@tonic-gate extern "C" {
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #include <sys/param.h>
477c478bd9Sstevel@tonic-gate #include <sys/types.h>
487c478bd9Sstevel@tonic-gate #include <sys/socket.h>
497c478bd9Sstevel@tonic-gate #include <sys/ioctl.h>
507c478bd9Sstevel@tonic-gate #include <sys/stat.h>
517c478bd9Sstevel@tonic-gate #include <sys/wait.h>
527c478bd9Sstevel@tonic-gate #include <sys/resource.h>
537c478bd9Sstevel@tonic-gate #include <sys/ttold.h>
547c478bd9Sstevel@tonic-gate #include <sys/stropts.h>
557c478bd9Sstevel@tonic-gate #include <sys/time.h>
567c478bd9Sstevel@tonic-gate #include <netinet/in.h>
577c478bd9Sstevel@tonic-gate #include <netinet/tcp.h>
587c478bd9Sstevel@tonic-gate #include <arpa/ftp.h>
597c478bd9Sstevel@tonic-gate #include <arpa/telnet.h>
607c478bd9Sstevel@tonic-gate #include <arpa/inet.h>
617c478bd9Sstevel@tonic-gate #include <setjmp.h>
627c478bd9Sstevel@tonic-gate #include <libintl.h>
637c478bd9Sstevel@tonic-gate #include <string.h>
647c478bd9Sstevel@tonic-gate #include <fcntl.h>
657c478bd9Sstevel@tonic-gate #include <stdlib.h>
667c478bd9Sstevel@tonic-gate #include <stdio.h>
677c478bd9Sstevel@tonic-gate #include <widec.h>
687c478bd9Sstevel@tonic-gate #include <signal.h>
697c478bd9Sstevel@tonic-gate #include <netdb.h>
707c478bd9Sstevel@tonic-gate #include <pwd.h>
717c478bd9Sstevel@tonic-gate #include <locale.h>
727c478bd9Sstevel@tonic-gate #include <limits.h>
737c478bd9Sstevel@tonic-gate #include <fnmatch.h>
747c478bd9Sstevel@tonic-gate #include <dirent.h>
757c478bd9Sstevel@tonic-gate #include <termios.h>
767c478bd9Sstevel@tonic-gate #include <stdarg.h>
777c478bd9Sstevel@tonic-gate #include <unistd.h>
787c478bd9Sstevel@tonic-gate #include <malloc.h>
797c478bd9Sstevel@tonic-gate #include <strings.h>
807c478bd9Sstevel@tonic-gate #include <errno.h>
817c478bd9Sstevel@tonic-gate #include <ctype.h>
827c478bd9Sstevel@tonic-gate #include <gssapi/gssapi.h>
837c478bd9Sstevel@tonic-gate #include <gssapi/gssapi_ext.h>
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #define	signal(s, f)	sigset(s, f)
867c478bd9Sstevel@tonic-gate #define	setjmp(e)	sigsetjmp(e, 1)
877c478bd9Sstevel@tonic-gate #define	longjmp(e, v)	siglongjmp(e, v)
887c478bd9Sstevel@tonic-gate #define	jmp_buf		sigjmp_buf
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate  * FTP global variables.
927c478bd9Sstevel@tonic-gate  */
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #define	DEFAULTFTPFILE	"/etc/default/ftp"
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  * Options and other state info.
987c478bd9Sstevel@tonic-gate  */
99*92163adaSToomas Soome extern int	trace;		/* trace packets exchanged */
100*92163adaSToomas Soome extern int	hash;		/* print # for each buffer transferred */
101*92163adaSToomas Soome extern int	sendport;	/* use PORT cmd for each data connection */
102*92163adaSToomas Soome extern int	verbose;	/* print messages coming back from server */
103*92163adaSToomas Soome extern int	connected;	/* connected to server */
104*92163adaSToomas Soome extern int	fromatty;	/* input is from a terminal */
105*92163adaSToomas Soome extern int	interactive;	/* interactively prompt on m* cmds */
106*92163adaSToomas Soome extern int	debug;		/* debugging level */
107*92163adaSToomas Soome extern int	bell;		/* ring bell on cmd completion */
108*92163adaSToomas Soome extern int	doglob;		/* glob local file names */
109*92163adaSToomas Soome extern int	autologin;	/* establish user account on connection */
110*92163adaSToomas Soome extern int	proxy;		/* proxy server connection active */
111*92163adaSToomas Soome extern int	proxflag;	/* proxy connection exists */
112*92163adaSToomas Soome extern int	sunique;	/* store files on server with unique name */
113*92163adaSToomas Soome extern int	runique;	/* store local files with unique name */
114*92163adaSToomas Soome extern int	mcase;		/* map upper to lower case for mget names */
115*92163adaSToomas Soome extern int	ntflag;		/* use ntin ntout tables for name translation */
116*92163adaSToomas Soome extern int	mapflag;	/* use mapin mapout templates on file names */
117*92163adaSToomas Soome extern int	code;		/* return/reply code for ftp command */
118*92163adaSToomas Soome extern int	crflag;		/* if 1, strip car. rets. on ascii gets */
119*92163adaSToomas Soome extern char	pasv[64];	/* passive port for proxy data connection */
120*92163adaSToomas Soome extern char	*altarg;	/* argv[1] with no shell-like preprocessing  */
121*92163adaSToomas Soome extern char	ntin[17];	/* input translation table */
122*92163adaSToomas Soome extern char	ntout[17];	/* output translation table */
123*92163adaSToomas Soome extern char	mapin[MAXPATHLEN]; /* input map template */
124*92163adaSToomas Soome extern char	mapout[MAXPATHLEN]; /* output map template */
125*92163adaSToomas Soome extern char	typename[32];	/* name of file transfer type */
126*92163adaSToomas Soome extern int	type;		/* file transfer type */
127*92163adaSToomas Soome extern char	structname[32];	/* name of file transfer structure */
128*92163adaSToomas Soome extern int	stru;		/* file transfer structure */
129*92163adaSToomas Soome extern char	formname[32];	/* name of file transfer format */
130*92163adaSToomas Soome extern int	form;		/* file transfer format */
131*92163adaSToomas Soome extern char	modename[32];	/* name of file transfer mode */
132*92163adaSToomas Soome extern int	mode;		/* file transfer mode */
133*92163adaSToomas Soome extern char	bytename[32];	/* local byte size in ascii */
134*92163adaSToomas Soome extern int	bytesize;	/* local byte size in binary */
135*92163adaSToomas Soome extern int	passivemode;	/* passive transfer mode toggle */
136*92163adaSToomas Soome extern off_t	restart_point;	/* transfer restart offset */
137*92163adaSToomas Soome extern int	tcpwindowsize;	/* TCP window size for the data connection */
1387c478bd9Sstevel@tonic-gate 
139*92163adaSToomas Soome extern boolean_t	ls_invokes_NLST;	/* behaviour of 'ls' */
140*92163adaSToomas Soome extern char		*hostname;		/* name of host connected to */
141*92163adaSToomas Soome extern char		*home;
142*92163adaSToomas Soome extern char		*globerr;
1437c478bd9Sstevel@tonic-gate 
144*92163adaSToomas Soome extern struct	sockaddr_in6 myctladdr;		/* for channel bindings */
145*92163adaSToomas Soome extern struct	sockaddr_in6 remctladdr;	/* for channel bindings */
1467c478bd9Sstevel@tonic-gate 
147*92163adaSToomas Soome extern int	clevel;		/* command channel protection level */
148*92163adaSToomas Soome extern int	dlevel;		/* data channel protection level */
1497c478bd9Sstevel@tonic-gate 
150*92163adaSToomas Soome extern int	autoauth;	/* do authentication on connect */
151*92163adaSToomas Soome extern int	auth_type;	/* authentication type */
152*92163adaSToomas Soome extern int	auth_error;	/* one error code for all auth types */
153*92163adaSToomas Soome extern int	autoencrypt;	/* do encryption on connect */
154*92163adaSToomas Soome extern int	fflag;		/* forward credentials */
155*92163adaSToomas Soome extern boolean_t goteof;
1567c478bd9Sstevel@tonic-gate 
157*92163adaSToomas Soome extern int	skipsyst;	/* enable automatic sending of SYST command */
1580b6880ccSsp149894 
159*92163adaSToomas Soome extern uchar_t	*ucbuf;		/* clear text buffer */
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate #define	MECH_SZ		40
1627c478bd9Sstevel@tonic-gate #define	FTP_DEF_MECH	"kerberos_v5"
163*92163adaSToomas Soome extern char	mechstr[MECH_SZ];	/* mechanism type */
1647c478bd9Sstevel@tonic-gate 
165*92163adaSToomas Soome extern gss_OID	mechoid;	/* corresponding mechanism oid type */
166*92163adaSToomas Soome extern gss_ctx_id_t gcontext;	/* gss security context */
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate #define	FTPBUFSIZ	BUFSIZ*16
1697c478bd9Sstevel@tonic-gate #define	HASHSIZ		BUFSIZ*8
1707c478bd9Sstevel@tonic-gate 
171*92163adaSToomas Soome extern char *buf;		/* buffer for binary sends and gets */
1727c478bd9Sstevel@tonic-gate 
173*92163adaSToomas Soome extern jmp_buf toplevel;	/* non-local goto stuff for cmd scanner */
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate /*
1767c478bd9Sstevel@tonic-gate  * BUFSIZE includes
1777c478bd9Sstevel@tonic-gate  *	- (MAXPATHLEN)*2 to  accomodate 2 paths (remote and local file names).
1787c478bd9Sstevel@tonic-gate  *	- MAXCMDLEN to accomodate the longest command listed in cmdtab[]
1797c478bd9Sstevel@tonic-gate  *	  (defined in cmdtab.c) as this is stuffed into the buffer along
1807c478bd9Sstevel@tonic-gate  *	  with the remote and local file names.
1817c478bd9Sstevel@tonic-gate  *	- The 4 bytes are for the 2 blank separators, a carriage-return
1827c478bd9Sstevel@tonic-gate  *	  and a NULL terminator.
1837c478bd9Sstevel@tonic-gate  *
1847c478bd9Sstevel@tonic-gate  * NOTE : The arguments may not be always pathnames (they can be commands
1857c478bd9Sstevel@tonic-gate  *	  too). But, here we have considered the worst case of two pathnames.
1867c478bd9Sstevel@tonic-gate  */
1877c478bd9Sstevel@tonic-gate #define	MAXCMDLEN	10	/* The length of longest command in cmdtab[] */
1887c478bd9Sstevel@tonic-gate #define	BUFSIZE	((MAXPATHLEN)*2+MAXCMDLEN+4)
1897c478bd9Sstevel@tonic-gate 
190*92163adaSToomas Soome extern char	line[BUFSIZE];	/* input line buffer */
191*92163adaSToomas Soome extern char	*stringbase;	/* current scan point in line buffer */
192*92163adaSToomas Soome extern char	argbuf[BUFSIZE]; /* argument storage buffer */
193*92163adaSToomas Soome extern char	*argbase;	/* current storage point in arg buffer */
194*92163adaSToomas Soome extern int	margc;		/* count of arguments on input line */
195*92163adaSToomas Soome extern char	**margv;	/* args parsed from input line */
196*92163adaSToomas Soome extern int	cpend;		/* flag: if != 0, then pending server reply */
197*92163adaSToomas Soome extern int	mflag;		/* flag: if != 0, then active multi command */
198*92163adaSToomas Soome extern FILE	*tmp_nlst;	/* tmp file; holds NLST results for mget, etc */
1997c478bd9Sstevel@tonic-gate 
200*92163adaSToomas Soome extern char	*reply_parse;	/* for parsing replies to the ADAT command */
201*92163adaSToomas Soome extern char	reply_buf[FTPBUFSIZ];
202*92163adaSToomas Soome extern char	*reply_ptr;
2037c478bd9Sstevel@tonic-gate 
204*92163adaSToomas Soome extern int	options;	/* used during socket creation */
2057c478bd9Sstevel@tonic-gate 
206*92163adaSToomas Soome extern int	timeout;	/* connection timeout */
207*92163adaSToomas Soome extern int	timeoutms;	/* connection timeout in msec */
208*92163adaSToomas Soome extern jmp_buf	timeralarm;	/* to recover from global timeout */
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate /*
2127c478bd9Sstevel@tonic-gate  * Format of command table.
2137c478bd9Sstevel@tonic-gate  */
2147c478bd9Sstevel@tonic-gate struct cmd {
2157c478bd9Sstevel@tonic-gate 	char	*c_name;	/* name of command */
2167c478bd9Sstevel@tonic-gate 	char	*c_help;	/* help string */
2177c478bd9Sstevel@tonic-gate 	char	c_bell;		/* give bell when command completes */
2187c478bd9Sstevel@tonic-gate 	char	c_conn;		/* must be connected to use command */
2197c478bd9Sstevel@tonic-gate 	char	c_proxy;	/* proxy server may execute */
2207c478bd9Sstevel@tonic-gate 	void	(*c_handler)(int argc, char *argv[]); /* function to call */
2217c478bd9Sstevel@tonic-gate };
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate struct macel {
2247c478bd9Sstevel@tonic-gate 	char mac_name[9];	/* macro name */
2257c478bd9Sstevel@tonic-gate 	char *mac_start;	/* start of macro in macbuf */
2267c478bd9Sstevel@tonic-gate 	char *mac_end;		/* end of macro in macbuf */
2277c478bd9Sstevel@tonic-gate };
2287c478bd9Sstevel@tonic-gate 
229*92163adaSToomas Soome extern int macnum;			/* number of defined macros */
230*92163adaSToomas Soome extern struct macel macros[16];
231*92163adaSToomas Soome extern char macbuf[4096];
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate extern void macdef(int argc, char *argv[]);
2347c478bd9Sstevel@tonic-gate extern void doproxy(int argc, char *argv[]);
2357c478bd9Sstevel@tonic-gate extern void setpeer(int argc, char *argv[]);
2367c478bd9Sstevel@tonic-gate extern void rmthelp(int argc, char *argv[]);
2377c478bd9Sstevel@tonic-gate extern void settype(int argc, char *argv[]);
2387c478bd9Sstevel@tonic-gate extern void setbinary(int argc, char *argv[]);
2397c478bd9Sstevel@tonic-gate extern void setascii(int argc, char *argv[]);
2407c478bd9Sstevel@tonic-gate extern void settenex(int argc, char *argv[]);
2417c478bd9Sstevel@tonic-gate extern void setebcdic(int argc, char *argv[]);
2427c478bd9Sstevel@tonic-gate extern void setmode(int argc, char *argv[]);
2437c478bd9Sstevel@tonic-gate extern void setform(int argc, char *argv[]);
2447c478bd9Sstevel@tonic-gate extern void setstruct(int argc, char *argv[]);
2457c478bd9Sstevel@tonic-gate extern void put(int argc, char *argv[]);
2467c478bd9Sstevel@tonic-gate extern void mput(int argc, char *argv[]);
2477c478bd9Sstevel@tonic-gate extern void get(int argc, char *argv[]);
2487c478bd9Sstevel@tonic-gate extern void mget(int argc, char *argv[]);
2497c478bd9Sstevel@tonic-gate extern void status(int argc, char *argv[]);
2507c478bd9Sstevel@tonic-gate extern void setbell(int argc, char *argv[]);
2517c478bd9Sstevel@tonic-gate extern void settrace(int argc, char *argv[]);
2527c478bd9Sstevel@tonic-gate extern void sethash(int argc, char *argv[]);
2537c478bd9Sstevel@tonic-gate extern void setverbose(int argc, char *argv[]);
2547c478bd9Sstevel@tonic-gate extern void setport(int argc, char *argv[]);
2557c478bd9Sstevel@tonic-gate extern void setprompt(int argc, char *argv[]);
2567c478bd9Sstevel@tonic-gate extern void setglob(int argc, char *argv[]);
2577c478bd9Sstevel@tonic-gate extern void setdebug(int argc, char *argv[]);
2587c478bd9Sstevel@tonic-gate extern void cd(int argc, char *argv[]);
2597c478bd9Sstevel@tonic-gate extern void lcd(int argc, char *argv[]);
2607c478bd9Sstevel@tonic-gate extern void delete(int argc, char *argv[]);
2617c478bd9Sstevel@tonic-gate extern void mdelete(int argc, char *argv[]);
2627c478bd9Sstevel@tonic-gate extern void renamefile(int argc, char *argv[]);
2637c478bd9Sstevel@tonic-gate extern void ls(int argc, char *argv[]);
2647c478bd9Sstevel@tonic-gate extern void mls(int argc, char *argv[]);
2657c478bd9Sstevel@tonic-gate extern void shell(int argc, char *argv[]);
2667c478bd9Sstevel@tonic-gate extern void user(int argc, char *argv[]);
2677c478bd9Sstevel@tonic-gate extern void pwd(int argc, char *argv[]);
2687c478bd9Sstevel@tonic-gate extern void makedir(int argc, char *argv[]);
2697c478bd9Sstevel@tonic-gate extern void removedir(int argc, char *argv[]);
2707c478bd9Sstevel@tonic-gate extern void quote(int argc, char *argv[]);
2717c478bd9Sstevel@tonic-gate extern void rmthelp(int argc, char *argv[]);
2727c478bd9Sstevel@tonic-gate extern void quit(int argc, char *argv[]);
2737c478bd9Sstevel@tonic-gate extern void disconnect(int argc, char *argv[]);
2747c478bd9Sstevel@tonic-gate extern void account(int argc, char *argv[]);
2757c478bd9Sstevel@tonic-gate extern void setcase(int argc, char *argv[]);
2767c478bd9Sstevel@tonic-gate extern void setcr(int argc, char *argv[]);
2777c478bd9Sstevel@tonic-gate extern void setntrans(int argc, char *argv[]);
2787c478bd9Sstevel@tonic-gate extern void setnmap(int argc, char *argv[]);
2797c478bd9Sstevel@tonic-gate extern void setsunique(int argc, char *argv[]);
2807c478bd9Sstevel@tonic-gate extern void setrunique(int argc, char *argv[]);
2817c478bd9Sstevel@tonic-gate extern void cdup(int argc, char *argv[]);
2827c478bd9Sstevel@tonic-gate extern void domacro(int argc, char *argv[]);
2837c478bd9Sstevel@tonic-gate extern void help(int argc, char *argv[]);
2847c478bd9Sstevel@tonic-gate extern void reset(int argc, char *argv[]);
2857c478bd9Sstevel@tonic-gate extern void reget(int argc, char *argv[]);
2867c478bd9Sstevel@tonic-gate extern void restart(int argc, char *argv[]);
2877c478bd9Sstevel@tonic-gate extern void setpassive(int argc, char *argv[]);
2887c478bd9Sstevel@tonic-gate extern void settcpwindow(int argc, char *argv[]);
2897c478bd9Sstevel@tonic-gate extern void site(int argc, char *argv[]);
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate extern void ccc(int argc, char *argv[]);
2927c478bd9Sstevel@tonic-gate extern void setclear(int argc, char *argv[]);
2937c478bd9Sstevel@tonic-gate extern void setclevel(int argc, char *argv[]);
2947c478bd9Sstevel@tonic-gate extern void setdlevel(int argc, char *argv[]);
2957c478bd9Sstevel@tonic-gate extern void setsafe(int argc, char *argv[]);
2967c478bd9Sstevel@tonic-gate extern void setmech(int argc, char *argv[]);
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate extern int do_auth(void);
2997c478bd9Sstevel@tonic-gate extern void setpbsz(uint_t size);
3007c478bd9Sstevel@tonic-gate extern char *radix_error(int);
3017c478bd9Sstevel@tonic-gate extern int radix_encode(uchar_t *, uchar_t *, size_t, int *, int);
3027c478bd9Sstevel@tonic-gate extern void user_gss_error(OM_uint32 maj_stat, OM_uint32 min_stat,
3037c478bd9Sstevel@tonic-gate 	char *errstr);
3047c478bd9Sstevel@tonic-gate extern void setprivate(int argc, char *argv[]);
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate extern int secure_flush(int);
3077c478bd9Sstevel@tonic-gate extern int secure_getc(FILE *);
3087c478bd9Sstevel@tonic-gate extern int secure_putc(int, FILE *);
3097c478bd9Sstevel@tonic-gate extern ssize_t secure_read(int, void *, size_t);
3107c478bd9Sstevel@tonic-gate extern ssize_t secure_write(int, const void *, size_t);
3117c478bd9Sstevel@tonic-gate 
3127c478bd9Sstevel@tonic-gate extern void fatal(char *msg);
3137c478bd9Sstevel@tonic-gate extern int getreply(int expecteof);
3147c478bd9Sstevel@tonic-gate extern void call(void (*routine)(int argc, char *argv[]), ...);
3157c478bd9Sstevel@tonic-gate extern void sendrequest(char *cmd, char *local, char *remote, int allowpipe);
3167c478bd9Sstevel@tonic-gate extern void recvrequest(char *cmd, char *local, char *remote, char *mode,
3177c478bd9Sstevel@tonic-gate     int allowpipe);
3187c478bd9Sstevel@tonic-gate extern void makeargv(void);
3197c478bd9Sstevel@tonic-gate extern int login(char *host);
3207c478bd9Sstevel@tonic-gate extern int command(char *fmt, ...);
3217c478bd9Sstevel@tonic-gate extern char **glob(char *v);
3227c478bd9Sstevel@tonic-gate extern void blkfree(char **);
3237c478bd9Sstevel@tonic-gate extern void pswitch(int flag);
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate extern char *hookup(char *host, char *);
3267c478bd9Sstevel@tonic-gate extern char *mygetpass(char *prompt);
3277c478bd9Sstevel@tonic-gate extern void lostpeer(int sig);
3287c478bd9Sstevel@tonic-gate extern int ruserpass(char *host, char **aname, char **apass, char **aacct);
3297c478bd9Sstevel@tonic-gate extern FILE *mypopen(char *cmd, char *mode);
3307c478bd9Sstevel@tonic-gate extern int mypclose(FILE *ptr);
3317c478bd9Sstevel@tonic-gate extern struct cmd *getcmd(char *name);
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate extern void stop_timer(void);
3347c478bd9Sstevel@tonic-gate extern void reset_timer(void);
3357c478bd9Sstevel@tonic-gate extern int getpagesize(void);
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate #define	ENCODELEN(l)	(((4 * (l)) / 3) + 4)
3387c478bd9Sstevel@tonic-gate #define	DECODELEN(l)	(((3 * (l)) / 4) + 4)
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3417c478bd9Sstevel@tonic-gate }
3427c478bd9Sstevel@tonic-gate #endif
3437c478bd9Sstevel@tonic-gate 
3447c478bd9Sstevel@tonic-gate #endif	/* _FTP_VAR_H */
345