155682Smarkm/* 255682Smarkm * Copyright (c) 1985, 1989, 1993, 1994 355682Smarkm * The Regents of the University of California. All rights reserved. 455682Smarkm * 555682Smarkm * Redistribution and use in source and binary forms, with or without 655682Smarkm * modification, are permitted provided that the following conditions 755682Smarkm * are met: 855682Smarkm * 1. Redistributions of source code must retain the above copyright 955682Smarkm * notice, this list of conditions and the following disclaimer. 1055682Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1155682Smarkm * notice, this list of conditions and the following disclaimer in the 1255682Smarkm * documentation and/or other materials provided with the distribution. 1355682Smarkm * 3. All advertising materials mentioning features or use of this software 1455682Smarkm * must display the following acknowledgement: 1555682Smarkm * This product includes software developed by the University of 1655682Smarkm * California, Berkeley and its contributors. 1755682Smarkm * 4. Neither the name of the University nor the names of its contributors 1855682Smarkm * may be used to endorse or promote products derived from this software 1955682Smarkm * without specific prior written permission. 2055682Smarkm * 2155682Smarkm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2255682Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2355682Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2455682Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2555682Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2655682Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2755682Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2855682Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2955682Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3055682Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3155682Smarkm * SUCH DAMAGE. 3255682Smarkm */ 3355682Smarkm 3455682Smarkm#include "ftp_locl.h" 3555682Smarkm 3655682Smarkm/* 3755682Smarkm * User FTP -- Command Tables. 3855682Smarkm */ 3955682Smarkm 4055682Smarkmchar accounthelp[] = "send account command to remote server"; 4155682Smarkmchar appendhelp[] = "append to a file"; 4255682Smarkmchar asciihelp[] = "set ascii transfer type"; 4355682Smarkmchar beephelp[] = "beep when command completed"; 4455682Smarkmchar binaryhelp[] = "set binary transfer type"; 4555682Smarkmchar casehelp[] = "toggle mget upper/lower case id mapping"; 4655682Smarkmchar cdhelp[] = "change remote working directory"; 4755682Smarkmchar cduphelp[] = "change remote working directory to parent directory"; 4855682Smarkmchar chmodhelp[] = "change file permissions of remote file"; 4955682Smarkmchar connecthelp[] = "connect to remote tftp"; 5055682Smarkmchar crhelp[] = "toggle carriage return stripping on ascii gets"; 5155682Smarkmchar deletehelp[] = "delete remote file"; 5255682Smarkmchar debughelp[] = "toggle/set debugging mode"; 5355682Smarkmchar dirhelp[] = "list contents of remote directory"; 5455682Smarkmchar disconhelp[] = "terminate ftp session"; 5555682Smarkmchar domachelp[] = "execute macro"; 5655682Smarkmchar formhelp[] = "set file transfer format"; 5755682Smarkmchar globhelp[] = "toggle metacharacter expansion of local file names"; 5855682Smarkmchar hashhelp[] = "toggle printing `#' for each buffer transferred"; 5955682Smarkmchar helphelp[] = "print local help information"; 6055682Smarkmchar idlehelp[] = "get (set) idle timer on remote side"; 6155682Smarkmchar lcdhelp[] = "change local working directory"; 6255682Smarkmchar lshelp[] = "list contents of remote directory"; 6355682Smarkmchar macdefhelp[] = "define a macro"; 6455682Smarkmchar mdeletehelp[] = "delete multiple files"; 6555682Smarkmchar mdirhelp[] = "list contents of multiple remote directories"; 6655682Smarkmchar mgethelp[] = "get multiple files"; 6755682Smarkmchar mkdirhelp[] = "make directory on the remote machine"; 6855682Smarkmchar mlshelp[] = "list contents of multiple remote directories"; 6955682Smarkmchar modtimehelp[] = "show last modification time of remote file"; 7055682Smarkmchar modehelp[] = "set file transfer mode"; 7155682Smarkmchar mputhelp[] = "send multiple files"; 7255682Smarkmchar newerhelp[] = "get file if remote file is newer than local file "; 7355682Smarkmchar nlisthelp[] = "nlist contents of remote directory"; 7455682Smarkmchar nmaphelp[] = "set templates for default file name mapping"; 7555682Smarkmchar ntranshelp[] = "set translation table for default file name mapping"; 7655682Smarkmchar porthelp[] = "toggle use of PORT cmd for each data connection"; 7755682Smarkmchar prompthelp[] = "force interactive prompting on multiple commands"; 7855682Smarkmchar proxyhelp[] = "issue command on alternate connection"; 7955682Smarkmchar pwdhelp[] = "print working directory on remote machine"; 8055682Smarkmchar quithelp[] = "terminate ftp session and exit"; 8155682Smarkmchar quotehelp[] = "send arbitrary ftp command"; 8255682Smarkmchar receivehelp[] = "receive file"; 8355682Smarkmchar regethelp[] = "get file restarting at end of local file"; 8455682Smarkmchar remotehelp[] = "get help from remote server"; 8555682Smarkmchar renamehelp[] = "rename file"; 8655682Smarkmchar restarthelp[]= "restart file transfer at bytecount"; 8755682Smarkmchar rmdirhelp[] = "remove directory on the remote machine"; 8855682Smarkmchar rmtstatushelp[]="show status of remote machine"; 8955682Smarkmchar runiquehelp[] = "toggle store unique for local files"; 9055682Smarkmchar resethelp[] = "clear queued command replies"; 9155682Smarkmchar sendhelp[] = "send one file"; 9255682Smarkmchar passivehelp[] = "enter passive transfer mode"; 9355682Smarkmchar sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information"; 9455682Smarkmchar shellhelp[] = "escape to the shell"; 9555682Smarkmchar sizecmdhelp[] = "show size of remote file"; 9655682Smarkmchar statushelp[] = "show current status"; 9755682Smarkmchar structhelp[] = "set file transfer structure"; 9855682Smarkmchar suniquehelp[] = "toggle store unique on remote machine"; 9955682Smarkmchar systemhelp[] = "show remote system type"; 10055682Smarkmchar tenexhelp[] = "set tenex file transfer type"; 10155682Smarkmchar tracehelp[] = "toggle packet tracing"; 10255682Smarkmchar typehelp[] = "set file transfer type"; 10355682Smarkmchar umaskhelp[] = "get (set) umask on remote side"; 10455682Smarkmchar userhelp[] = "send new user information"; 10555682Smarkmchar verbosehelp[] = "toggle verbose mode"; 10655682Smarkm 10755682Smarkmchar prothelp[] = "set protection level"; 108178825Sdfrchar prothelp_c[] = "set command protection level"; 109233294Sstas#if defined(KRB5) 11055682Smarkmchar klisthelp[] = "show remote tickets"; 111178825Sdfr#endif 112233294Sstas#if defined(KRB5) 11355682Smarkmchar afsloghelp[] = "obtain remote AFS tokens"; 11455682Smarkm#endif 11555682Smarkm 11655682Smarkmstruct cmd cmdtab[] = { 11755682Smarkm { "!", shellhelp, 0, 0, 0, shell }, 11855682Smarkm { "$", domachelp, 1, 0, 0, domacro }, 11955682Smarkm { "account", accounthelp, 0, 1, 1, account}, 12055682Smarkm { "append", appendhelp, 1, 1, 1, put }, 12155682Smarkm { "ascii", asciihelp, 0, 1, 1, setascii }, 12255682Smarkm { "bell", beephelp, 0, 0, 0, setbell }, 12355682Smarkm { "binary", binaryhelp, 0, 1, 1, setbinary }, 12455682Smarkm { "bye", quithelp, 0, 0, 0, quit }, 12555682Smarkm { "case", casehelp, 0, 0, 1, setcase }, 12655682Smarkm { "cd", cdhelp, 0, 1, 1, cd }, 12755682Smarkm { "cdup", cduphelp, 0, 1, 1, cdup }, 12855682Smarkm { "chmod", chmodhelp, 0, 1, 1, do_chmod }, 12955682Smarkm { "close", disconhelp, 0, 1, 1, disconnect }, 13055682Smarkm { "cr", crhelp, 0, 0, 0, setcr }, 13155682Smarkm { "delete", deletehelp, 0, 1, 1, delete }, 13255682Smarkm { "debug", debughelp, 0, 0, 0, setdebug }, 13355682Smarkm { "dir", dirhelp, 1, 1, 1, ls }, 13455682Smarkm { "disconnect", disconhelp, 0, 1, 1, disconnect }, 13555682Smarkm { "form", formhelp, 0, 1, 1, setform }, 13655682Smarkm { "get", receivehelp, 1, 1, 1, get }, 13755682Smarkm { "glob", globhelp, 0, 0, 0, setglob }, 13855682Smarkm { "hash", hashhelp, 0, 0, 0, sethash }, 13955682Smarkm { "help", helphelp, 0, 0, 1, help }, 14055682Smarkm { "idle", idlehelp, 0, 1, 1, ftp_idle }, 14155682Smarkm { "image", binaryhelp, 0, 1, 1, setbinary }, 14255682Smarkm { "lcd", lcdhelp, 0, 0, 0, lcd }, 14355682Smarkm { "ls", lshelp, 1, 1, 1, ls }, 14455682Smarkm { "macdef", macdefhelp, 0, 0, 0, macdef }, 14555682Smarkm { "mdelete", mdeletehelp, 1, 1, 1, mdelete }, 14655682Smarkm { "mdir", mdirhelp, 1, 1, 1, mls }, 14755682Smarkm { "mget", mgethelp, 1, 1, 1, mget }, 14855682Smarkm { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 14955682Smarkm { "mls", mlshelp, 1, 1, 1, mls }, 15055682Smarkm { "mode", modehelp, 0, 1, 1, setftmode }, 15155682Smarkm { "modtime", modtimehelp, 0, 1, 1, modtime }, 15255682Smarkm { "mput", mputhelp, 1, 1, 1, mput }, 15355682Smarkm { "newer", newerhelp, 1, 1, 1, newer }, 15455682Smarkm { "nmap", nmaphelp, 0, 0, 1, setnmap }, 15555682Smarkm { "nlist", nlisthelp, 1, 1, 1, ls }, 15655682Smarkm { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 15755682Smarkm { "open", connecthelp, 0, 0, 1, setpeer }, 15855682Smarkm { "passive", passivehelp, 0, 0, 0, setpassive }, 15955682Smarkm { "prompt", prompthelp, 0, 0, 0, setprompt }, 16055682Smarkm { "proxy", proxyhelp, 0, 0, 1, doproxy }, 16155682Smarkm { "sendport", porthelp, 0, 0, 0, setport }, 16255682Smarkm { "put", sendhelp, 1, 1, 1, put }, 16355682Smarkm { "pwd", pwdhelp, 0, 1, 1, pwd }, 16455682Smarkm { "quit", quithelp, 0, 0, 0, quit }, 16555682Smarkm { "quote", quotehelp, 1, 1, 1, quote }, 16655682Smarkm { "recv", receivehelp, 1, 1, 1, get }, 16755682Smarkm { "reget", regethelp, 1, 1, 1, reget }, 16855682Smarkm { "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus }, 16955682Smarkm { "rhelp", remotehelp, 0, 1, 1, rmthelp }, 17055682Smarkm { "rename", renamehelp, 0, 1, 1, renamefile }, 17155682Smarkm { "reset", resethelp, 0, 1, 1, reset }, 17255682Smarkm { "restart", restarthelp, 1, 1, 1, restart }, 17355682Smarkm { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 17455682Smarkm { "runique", runiquehelp, 0, 0, 1, setrunique }, 17555682Smarkm { "send", sendhelp, 1, 1, 1, put }, 17655682Smarkm { "site", sitehelp, 0, 1, 1, site }, 17755682Smarkm { "size", sizecmdhelp, 1, 1, 1, sizecmd }, 17855682Smarkm { "status", statushelp, 0, 0, 1, status }, 17955682Smarkm { "struct", structhelp, 0, 1, 1, setstruct }, 18055682Smarkm { "system", systemhelp, 0, 1, 1, syst }, 18155682Smarkm { "sunique", suniquehelp, 0, 0, 1, setsunique }, 18255682Smarkm { "tenex", tenexhelp, 0, 1, 1, settenex }, 18355682Smarkm { "trace", tracehelp, 0, 0, 0, settrace }, 18455682Smarkm { "type", typehelp, 0, 1, 1, settype }, 18555682Smarkm { "user", userhelp, 0, 1, 1, user }, 18655682Smarkm { "umask", umaskhelp, 0, 1, 1, do_umask }, 18755682Smarkm { "verbose", verbosehelp, 0, 0, 0, setverbose }, 18855682Smarkm { "?", helphelp, 0, 0, 1, help }, 18955682Smarkm 190178825Sdfr { "protect", prothelp, 0, 1, 0, sec_prot }, 191178825Sdfr /* what MIT uses */ 192178825Sdfr { "cprotect", prothelp_c, 0, 1, 1, sec_prot_command }, 193233294Sstas#if defined(KRB5) 19455682Smarkm { "klist", klisthelp, 0, 1, 0, klist }, 195178825Sdfr#endif 196233294Sstas#if defined(KRB5) 19755682Smarkm { "afslog", afsloghelp, 0, 1, 0, afslog }, 19855682Smarkm#endif 199233294Sstas 20055682Smarkm { 0 }, 20155682Smarkm}; 20255682Smarkm 20355682Smarkmint NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1; 204